This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
c++/1146: gdb cannot set breakpoints within subclasses of classes
- From: thor at math dot tu-berlin dot de
- To: gdb-gnats at sources dot redhat dot com
- Date: 18 Mar 2003 13:12:15 -0000
- Subject: c++/1146: gdb cannot set breakpoints within subclasses of classes
- Reply-to: thor at math dot tu-berlin dot de
>Number: 1146
>Category: c++
>Synopsis: gdb cannot set breakpoints within subclasses of classes
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 18 13:18:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Thomas Richter
>Release: GNU gdb 5.3
>Organization:
>Environment:
Linux cleopatra 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
>Description:
If a class contains the definition and declaration of a sub-class, then gdb cannot set breakpoints within member
functions of this subclass.
>How-To-Repeat:
Save the following file as "foo.cpp":
/* snip */
#include <cstdio>
class A {
public:
class B {
public:
void hello(void);
} b;
};
void A::B::hello(void)
{
printf("Hello.\n");
}
int main(int argc,char **argv)
{
A a;
a.b.hello();
return 0;
}
/* snip */
and compile with
$ g++ -ggdb foo.cpp
(reproduced with releases 2.95.3 and 3.2 of g++).
Then start gdb as follows:
$ gdb a.out
and try to set a breakpoint in A::B::hello. The result is:
GNU gdb 5.3
Copyright 2002 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 A::B::hello
the class A does not have any method named B
Hint: try 'A::B::hello<TAB> or 'A::B::hello<ESC-?>
(Note leading single quote.)
Hence, gdb tries erraneously to resolve A::B as a member, and not as a subclass.
>Fix:
not known
>Release-Note:
>Audit-Trail:
>Unformatted: