Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb 5.3 issues with g++ 3.2 on RedHat 7.3 & Solaris 9.
@ 2002-12-23 14:39 Joshua D. Marantz
  2002-12-23 15:26 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Joshua D. Marantz @ 2002-12-23 14:39 UTC (permalink / raw)
  To: gdb; +Cc: josh

Hello,

We are having trouble debugging C++ code.  Are there a number of
outstanding issues, or could we have a configuration problem?

We have tried a variety of combinations of the following tools:

gdb 5.2.1, gdb 5.3
g++ 3.1.1, 3.2, 3.2.1
g++ compile options "-g", "-g3", "-ggdb", "-gstabs", "-gstabs+", "-gdwarf-2"
SGI STL & STLport 4.5.3
RedHat 7.3 & Solaris 9

Symptoms include:

 - breakpoints in constructors do not work.  gdb says they get set successfully,
   but they do not actually break.  This occurs whether the constructors are
   inline or out-of-line.
 - casting on the command line does not work -- yields a syntax error
 - printing contents of instances of STL classes sometimes crashes
 - frequent gdb crashes (sorry this is so vague...)
 - when compiling with -gstabs+, I can print most structures, but I can't
   call class methods from gdb.
 - when compiling with -gdwarf-2, I can call class methods from gdb, but I can't
   print most structures
 - calling global functions from the debugger takes a long time and uses
   a lot of memory.  calling class methods is fast however.  
 - it is difficult to call template methods from the debugger

All these issues were not present using g++ 2.8.1 and gdb 4.17.  In
that environment most things worked well  Although gdb 4.17 did crash
a little too often, it was much more functional.

We can't go back to those old tools because our C++ & STL usage goes
beyond the capabilities of g++ 2.8.1 & 2.9.*.

I can give testcases for all these things but it's really pretty
basic C++ debugging.

Is this enough information?  Is there a path through these tools that
works -- e.g. config options, versions, etc?

Thanks,
-Josh


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: gdb 5.3 issues with g++ 3.2 on RedHat 7.3 & Solaris 9.
@ 2002-12-23 23:15 Michael Elizabeth Chastain
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Elizabeth Chastain @ 2002-12-23 23:15 UTC (permalink / raw)
  To: josh; +Cc: gdb

Hello Josh,

I notice that you didn't list any binutils versions.  Are you just
using the system binutils?  If so, try building binutils 2.13.1,
and then building gcc with "--with-as" and "--with-ld" flags.

Red Hat Linux 7.3 shipped with binutils-2.11.93.0.2.  I've seen gdb test
failures with binutils versions 2.11.2, 2.12, and 2.12.1 that were fixed
in binutils 2.13 and later.

Constructors have a big gotcha with gcc v3: the source code of
a constructor is compiled into 2 or 3 different versions of object code.
These versions have unique mangled names (they have to, in order for
linking to work), but they have identical source code names, which leads
to a great deal of confusion.  What is likely happening is that gdb
sets the breakpoint in one version of the constructor but then the
program is executing a different version.  (BTW, PR gdb/892 is the
same problem).

Do this: compile this program with "gcc -S" and look at
the generated assembly code:

  // ctor.cc
  class Foo
  {
    public:
      Foo ();
  };

  extern "C" void my_marker_function ();

  Foo::Foo ()
  {
    my_marker_function ();
  }

You will see two assembly language functions with slightly different
names, each with a call to the distinctive "my_marker_function".
There really are two functions there and gdb has trouble with that.

(There are two functions in order to implement virtual base class
initialization properly -- they are the "in-charge" constructor and
"not-in-charge" constructor -- there is a lot of detail behind that
which needs documenting).

As far as versions go, I would go with gdb 5.3, gcc 3.2.1, and binutils
2.13.1.  I would try "-gdwarf-2" first and then "-gstabs+".  Note the "+"
in "-gstabs+"; the plain "-gstabs" does not support C++ very all at all.
Also, "-ggdb" is always an alias for some other format, not a format of
its own, so you can drop it from your testing.

You're already on the best released gdb (5.3) and the best compiler
(gcc 3.2.1) and the two good debug formats (-gdwarf-2 and -gstabs+), and
the binutils change is minor (mostly it improved line number records).
So configuration-wise, you are close to the best configurations already,
such as they are in December 2002.  Bring on the test cases and bug
reports.

Michael C


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-11 17:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-23 14:39 gdb 5.3 issues with g++ 3.2 on RedHat 7.3 & Solaris 9 Joshua D. Marantz
2002-12-23 15:26 ` Daniel Jacobowitz
2002-12-23 15:40   ` qthread support in gdb Sunil Alankar
2003-01-11 16:43   ` gdb 5.3 issues with g++ 3.2 on RedHat 7.3 & Solaris 9 Joshua D. Marantz
2003-01-11 17:02     ` Joshua D. Marantz
2002-12-23 23:15 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox