This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Best set of gcc options for debugging


On Thu, Jul 08, 2004 at 03:58:02PM -0500, Aaron W. LaFramboise wrote:
> Recently, I've been having a lot of frustration using gdb with gcc 3.4.1
> (and even more so on 3.5) with stabs.

stabs has a set of problems associated with it that are probably never
going to be solved, just because of the limitations with the stabs format.

I strongly advise you to configure using --with-dwarf2 if your target
supports it at all.  If it supports multiple debug formats and stabs is
merely the default, try one of the -gdwarf2 flags.


> What is the story with -g3?  Does this actually do anything useful?

Well, under DWARF, it makes cpp macros visible to the debugger, so
things like

    (gdb) p _NDEBUG

and

    (gdb) p DECL_WHATSIS (decl)

work.  I forget what else it turns on.


-- 
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
    - Brian W. Kernighan, in a plea for clear, straightforward code


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]