This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


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

Re: gdb/57


The following reply was made to PR gdb/57; it has been noted by GNATS.

From: Stuart Whitman <stu.whitman@emergent-it.com>
To: angela@wonderslug.com
Cc: stu.whitman@dlva.emergent-IT.com,
 	gdb-gnats@sources.redhat.com, gdb-prs@sources.redhat.com,
 	"Shirron, Joe" <Joe.Shirron@emergent-IT.com>,
 	"Warme, David" <David.Warme@emergent-IT.com>
Subject: Re: gdb/57
Date: Mon, 15 Oct 2001 15:13:51 -0400

 This is a multi-part message in MIME format.
 --------------8ADF0D0F1E395616FE2B9DC3
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Angela,
 
 When I incorporated the -gdwarf-2 into our software it improved things,
 but still I believe there is a bug. When debugging our software
 sometimes it would display the correct class other times it would not.
 
 I separated the classes into separated .h and .cc files to try to mimick
 our software more closer. When doing this the bug reappeared.
 
 I will attach the separate files.
 
 If you want me to submit another bug report in the bug database, let me
 know.
 Thanks,
 Stu
 
 Here is the output:
 
 bash$ g++ --version
 2.95.3
 bash$ /testbed/gnu/i386-unknown-linux/bin/gdb --version
 GNU gdb 5.0
 Copyright 2000 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i686-pc-linux-gnu".
 bash$ g++ -gdwarf-2 -o main main.cc a.cc b.cc
 bash$ /testbed/gnu/i386-unknown-linux/bin/gdb main
 GNU gdb 5.0
 Copyright 2000 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "i686-pc-linux-gnu"...
 (gdb) break main
 Breakpoint 1 at 0x8049266: file main.cc, line 6.
 (gdb) run
 Starting program: /export/home/stu/tmp/nestclasses/main 
 
 Breakpoint 1, main () at main.cc:6
 6		A a;
 (gdb) n
 7		B b;
 (gdb) n
 8	}
 (gdb) ptype a.d_i
 type = class I {
   public:
     double d_v;
 
     I & operator=(B::I const &);
     I(B::I const &);
     I(void);
 } *
 (gdb) ptype b.d_i
 type = class I {
   public:
     double d_v;
 
     I & operator=(B::I const &);
     I(B::I const &);
     I(void);
 } *
 (gdb) 
 
 Angela Marie Thomas wrote:
 > 
 > >  Description:
 > > In the following example two classes have a nested class with the same
 > > name. Gdb incorrectly prints the contents of the nested class.
 > 
 > Have you tried using dwarf-2 debugging?  My understanding is
 > that dwarf-2 debugging is generally preferred for C++ debugging.
 > In a couple of quick tests, compiling your source with -gdwarf-2
 > produced what look like expected results.  The following is using
 > gcc 2.95.1 and gdb 4.18.  I have had similar results with gcc 2.93,
 > gcc 2.96 and gdb 5.0.
 > 
 > (gdb) b main
 > Breakpoint 1 at 0x200127c: file main.cc, line 33.
 > (gdb) run
 > Starting program: /tmp/main.gdwarf-2
 > Breakpoint 1, main () at main.cc:33
 > 33      A a;
 > (gdb) n
 > 34      B b;
 > (gdb) n
 > 35      }
 > (gdb) ptype a.d_i
 > type = class I {
 >   public:
 >     int d_v;
 > 
 >     I & operator=(A::I const &);
 >     I(A::I const &);
 >     I(void);
 > } *
 > (gdb) ptype b.d_i
 > type = class I {
 >   public:
 >     double d_v;
 > 
 >     I & operator=(B::I const &);
 >     I(B::I const &);
 >     I(void);
 > } *
 > (gdb)
 > 
 > --
 > Angela Marie Thomas
 > angela@wonderslug.com
 
 -- 
 Stuart Whitman		Emergent Information Technologies, Inc.
      703 645 8445	Metro Place
 Fax: 703 641 7172	2600 Park Tower Drive, Suite 800
 			Vienna, VA 22180
 --------------8ADF0D0F1E395616FE2B9DC3
 Content-Type: text/plain; charset=us-ascii;
  name="a.cc"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="a.cc"
 
 #include "a.h"
 
 struct A::I {
 	int d_v;
 };
 
 A::A()
 { d_i = new I(); d_i->d_v = 5; }
 
 
 --------------8ADF0D0F1E395616FE2B9DC3
 Content-Type: text/plain; charset=us-ascii;
  name="a.h"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="a.h"
 
 class A {
 
 	struct I;
 
 	I * d_i;
 public:
 	A ();
 };
 
 
 --------------8ADF0D0F1E395616FE2B9DC3
 Content-Type: text/plain; charset=us-ascii;
  name="b.cc"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="b.cc"
 
 #include "b.h"
 
 struct B::I {
 	double d_v;
 };
 
 B::B()
 { d_i = new I(); d_i->d_v = 1.0; }
 
 
 --------------8ADF0D0F1E395616FE2B9DC3
 Content-Type: text/plain; charset=us-ascii;
  name="b.h"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="b.h"
 
 class B {
 
 	struct I;
 	I* d_i;
 
 public:
 	B ();
 };
 
 --------------8ADF0D0F1E395616FE2B9DC3
 Content-Type: text/plain; charset=us-ascii;
  name="main.cc"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="main.cc"
 
 #include "a.h"
 #include "b.h"
 
 main () 
 {
 	A a;
 	B b;
 }
 
 --------------8ADF0D0F1E395616FE2B9DC3--
 


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