GCC 3.2.2 Debugging Advice

Tony Wetmore tony.wetmore@solipsys.com
Fri Apr 18 19:44:00 GMT 2003


Help!

I am in need of advice on debugging C++ code built using GCC version
3.2.2.  I have been using GCC for years on Linux and have never really
had any trouble with debugging my C++ code.

However, I have recently begun using GCC on Solaris (x86) and am having
some problems with debugging.  Specifically, I have been having problems
with setting breakpoints on constructor and destructor class methods.
It does not seem to matter whether these methods are declared inline
within the class body or not.

I have been searching all over the web and banging my head against this
for quite some time.  I think I have found various bits of pieces of
this puzzle, but have not really found anything yet to tie it all
together.

For example, I understand that the DWARF-2 debugging format is "better"
for C++ code debugging, but I cannot find the status of its
implementation in GCC and/or GDB on the Solaris-x86 platform.  On
GNU/Linux, everything seems to "just work," but I cannot really figure
out why that is.

I assume that the default debug format under Linux is DWARF-2, but I do
not know how to ascertain that for sure.  Is there any way to tell from
a given object file (or executable/library) what debugging format was
used?  I know that objdump or readelf can be used to examine the
properties of a file, but it seems to just automatically determine which
format was used and dumps the data.

In the end, I am looking for specific advice on successfully debugging
C++ code on Solaris-x86 using GCC 3.2.2, answering such questions as:

  * What debug format should be used (stabs, dwarf-2 or ???) ?

  * What version of GDB should be used ?

  * Must I build GDB with any specific "configure" options ?

  * Should I use GNU binutils or the native assembler and linker?

  * What GCC command-line flags should be used (-fno-inline, etc) ?

  * Any other relevant questions I have not yet considered...

And in cases where the choice is up to me, what are the pros/cons of the
available options?  For example, I understand that there is (or at least
was in the past) a significant functionality/size tradeoff for using
DWARF-2 instead of STABS.

If there is a good site or FAQ that discusses these questions, please
feel free to direct me to it.  I have been unsuccessful thus far in
trying to find one.

If it is helpful, I can put together a very brief test program and run
various combinations of compilers, linkers and debuggers to demonstrate
the exact problems that I am having.

Thank you very much for any help you can offer!

---
Tony Wetmore
Solipsys Corporation
mailto:tony.wetmore@solipsys.com
http://www.solipsys.com
 
 



More information about the Gcc-help mailing list