Gcc options for improving debugging?

Paul Koning pkoning@equallogic.com
Wed Jul 19 17:33:00 GMT 2006


>>>>> "Alex" == Alex Bennee <kernel-hacker@bennee.com> writes:

 Alex> Hi, By default we build our software with -O3 which brings in a
 Alex> host of optimisations which make following code in GDB a
 Alex> pain.

Sure enough, exactly as documented.

 Alex> An alternate approach is to compile with -O3 but turn off
 Alex> specific optimisations which make life tricky for gdb. So far I
 Alex> have:

 Alex> * -ggdb3 (obviously) * -fno-omit-frame-pointer (seems to help
 Alex> with finding some variables)

-ggdb3???  That's not an optimization option.

I find that the simplest and best answer is to do most debugging using
a version compiled with -O1.  That gives you inline assembler,
inlining of things that are specifically called out to be inlined,
etc.  But it doesn't do much instruction reordering.

      paul



More information about the Gdb mailing list