This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/57: nested classes incorrectly printed
- To: gdb-gnats at sources dot redhat dot com
- Subject: gdb/57: nested classes incorrectly printed
- From: stu dot whitman at emergent-it dot com
- Date: 4 Jun 2001 21:48:08 -0000
- Reply-To: stu dot whitman at emergent-it dot com
>Number: 57
>Category: gdb
>Synopsis: nested classes incorrectly printed
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 04 14:58:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Stuart Whitman
>Release: i686-pc-linux-gnu 5.0
>Organization:
>Environment:
bash$ uname -a
Linux natrella_linux 2.2.18 #2 Mon Dec 18 10:33:29 EST 2000 i686 unknown
>Description:
In the following example two classes have a nested class with the same
name. Gdb incorrectly prints the contents of the nested class.
>How-To-Repeat:
bash$ cat main.cc
class A {
struct I;
I * d_i;
public:
A ();
};
struct A::I {
int d_v;
};
A::A()
{ d_i = new I(); d_i->d_v = 5; }
class B {
struct I;
I* d_i;
public:
B ();
};
struct B::I {
double d_v;
};
B::B()
{ d_i = new I(); d_i->d_v = 1.0; }
main ()
{
A a;
B b;
}
bash$ gcc --version
2.95.3
bash$ gcc -g main.cc -o main.exe
bash$ /usr/local/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$ /usr/local/bin/gdb main.exe
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 0x80492ae: file main.cc, line 35.
(gdb) run
Starting program: /export/home/stu/storm/src/data/gulf/test/main.exe
Breakpoint 1, main () at main.cc:35
35 A a;
(gdb) n
36 B b;
(gdb) n
37 }
(gdb) print * a.d_i
$1 = {d_v = 5}
(gdb) print * b.d_i
$2 = {d_v = 0}
(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:
int d_v;
I & operator=(A::I const &);
I(A::I const &);
I(void);
} *
(gdb) quit
The program is running. Exit anyway? (y or n) y
bash$ uname -a
Linux natrella_linux 2.2.18 #2 Mon Dec 18 10:33:29 EST 2000 i686 unknown
bash$
>Fix:
NONE
>Release-Note:
>Audit-Trail:
>Unformatted: