This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa/doc] correct info about best C++ compilers/debug formats
- From: David Carlton <carlton at math dot stanford dot edu>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: gdb-patches at sources dot redhat dot com, Daniel Jacobowitz <drow at mvista dot com>, eliz at gnu dot org
- Date: 03 Feb 2003 11:29:40 -0800
- Subject: Re: [rfa/doc] correct info about best C++ compilers/debug formats
On Mon, 3 Feb 2003 12:56:22 -0600, Michael Elizabeth Chastain <mec@shout.net> said:
> After fixing the doco, we can kill all the setup_xfail_format dwarf-1
> lines. We can either add a test for dwarf-1 to "skip_cplus_tests",
> or we can just let the test suite do its job and report a lot of
> FAILs on dwarf-1. I favor the latter. But I would like to discuss
> this *after* fixing the docs.
Fair enough.
> Now the content:
> @emph{Warning:} @value{GDBN} can only debug C@t{++} code if you use the
> proper compiler and the proper debug format. Currently, @value{GDBN}
> works best when debugging C@t{++} code that is compiled with
> @value{NGCC} 2.95.3 or with @value{NGCC} 3.1 or newer, using the options
> @option{-gdwarf-2} or @option{-gstabs+}. DWARF 2 is preferred over
> stabs; newer versions of @value{NGCC} use DWARF 2 as the default
> whenever possible. Other compilers and/or debug formats are likely to
> work badly or not at all when using @value{GDBN} to debugg C@t{++} code.
> The normal spelling is 'DWARF2' not 'DWARF 2'.
I wondered about this. The standard doesn't give any guidance (it
says "DWARF Version 2", to me DWARF 2 looks much better, and the GCC
option is -gdwarf-2, not -gdwarf2. On the other hand, there are more
web pages that refer to it as DWARF2 than web pages that refer to it
as DWARF 2.
> Also you usually want to say "stabs+", not "stabs".
I guess that makes sense.
> Also a typo on "debugg".
Thanks.
> The part about "newer versions of gcc use DWARF 2 as the default
> whenever possible" is vague and not accurate enough for doco (I
> think).
Well, I wanted to include some sort of sentence that reassured users
that they probably didn't have to specify the debug format explicitly.
Also, if they use a recent version of GCC, they'll probably get
the best working debug format by default: if GCC doesn't default to
DWARF 2, there's probably a good reason for that.
> Some more places need changing:
> To solve such problems, either recompile without optimizations, or use a
> different debug info format, if the compiler supports several such
> formats. For example, @value{NGCC}, the @sc{gnu} C/C@t{++} compiler usually
> supports the @samp{-gstabs} option. @samp{-gstabs} produces debug info
> in a format that is superior to formats such as COFF. You may be able
> to use DWARF2 (@samp{-gdwarf-2}), which is also an effective form for
> debug info. See @ref{Debugging Options,,Options for Debugging Your
> Program or @sc{gnu} CC, gcc.info, Using @sc{gnu} CC}, for more
> information.
> --> Change "-gstabs" to "-gstabs+" here. In particular "-gstabs" is
> miserable with C++ (I have tested it).
> For best results when using @sc{gnu} C@t{++}, use the stabs debugging
> format. You can select that format explicitly with the @code{g++}
> command-line options @samp{-gstabs} or @samp{-gstabs+}. See
> @ref{Debugging Options,,Options for Debugging Your Program or @sc{gnu}
> CC, gcc.info, Using @sc{gnu} CC}, for more information.
> --> Rewrite to say 'DWARF2'.
Thanks, I'll submit a revised patch including these.
David Carlton
carlton@math.stanford.edu