This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Gcc options for improving debugging?
- From: Paul Koning <pkoning at equallogic dot com>
- To: kernel-hacker at bennee dot com
- Cc: gdb at sources dot redhat dot com
- Date: Wed, 19 Jul 2006 09:31:38 -0400
- Subject: Re: Gcc options for improving debugging?
- References: <1153308778.9831.49.camel@okra.transitives.com>
>>>>> "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