gcc 4.1 Options for Maximum Debugging (also ecos synth).

John Carter john.carter@tait.co.nz
Thu Mar 9 21:43:00 GMT 2006


We have two builds. One that runs on our embedded target and has -Os and 
another that runs on our Linux desktop machines and is just for running 
unit tests and debugging.

Current the desktop build is built -O0, but I suspect that isn't really 
what I want.

-O0 means "no optimization".

In practice is means "be a dumb stupid compiler" and don't...
  * Don't do enough work to make the assembler readable, clutter it with
    lead in / lead out code for each fragment.
  * Don't do enough data flow analysis to give initialized variables
    warnings.
  * Don't do any global analysis to detect bad code.

So what I want is..
  * Assembler that is easy to read and correlates well with the source.
  * In depth data flow / static analysis to give good warnings.
  * Stack and bounds checking to the maximum. (Hey, the desktop PC is about
    a 1000 times faster than the embedded target and has no memory / real
    time constraints.)

My current guess as to the gcc settings I want are...
  -O1  -fno-delayed-branch -fno-guess-branch-probability \
  -fno-cprop-registers -fno-loop-optimize -funit-at-a-time

I tried -fstack-protector but it then seemed to want a bunch of extra 
libraries.

Question 1:
   Which optimization / -f options on gcc 4.1 would you recommend for
   maximum warnings / analysis / debuggability? (Assuming all appropriate
   -W options are switched on already...)

Question 2:
   Has anybody got -fstack-protector working with ECos synthetic platform?


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

>From this principle, all of life and physics may be deduced.



More information about the Gcc-help mailing list