Bug 11353 - Still problems with namespaces
Summary: Still problems with namespaces
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2003-06-27 16:05 UTC by Wolfgang Bangerth
Modified: 2004-04-01 15:58 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2004-01-01 23:49:17


Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2003-06-27 16:05:24 UTC
First: support for namespaces has become much much better, many thanks
for that!

Second: something is still going wrong, though I don't know whether it's
in gcc or in gdb. Here's a small example:
struct X {
    virtual int f() { return 1; }

namespace A {
  struct X {
      virtual int f() { return 2;}

void stop_gdb() {}

int main () {
  X    x;
  A::X a_x;

Compiled with a recent CSV snapshot of gcc (2003-05-20), then going
into gdb yields this:

tmp/gg> c++ -ggdb x.cc
tmp/gg> gdb a.out
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 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 "i386-redhat-linux-gnu"...
(gdb) b main
Breakpoint 1 at 0x80485c6: file x.cc, line 14.
(gdb) r
Starting program: /homes/csm2/bangerth/tmp/gg/a.out

Breakpoint 1, main () at x.cc:14
14        X    x;
(gdb) n
15        A::X a_x;
16        stop_gdb();
(gdb) p x.f()
$1 = 1
(gdb) p a_x.f()
warning: can't find class named `A::X', as given by C++ RTTI
$2 = 2

Note that the result returned is quite right. It's just the warning that's
confusing me, and in particular that no similar warning is given for ::X.

Maybe someone can make sense out of this.

Comment 1 Daniel Jacobowitz 2003-06-29 22:01:02 UTC
Subject: Re:  New: Still problems with namespaces

On Fri, Jun 27, 2003 at 04:05:26PM -0000, bangerth at dealii dot org wrote:
> (gdb) p a_x.f()
> warning: can't find class named `A::X', as given by C++ RTTI

This is primarily a bug in GDB.

Also, I believe GCC still doesn't emit DW_TAG_namespace; the patch was
reposted recently, I don't know what happened to it?

Comment 2 Andrew Pinski 2003-07-31 16:31:55 UTC
I do not know if this is a bug in gcc or gdb but I can still reproduce it in the mainline of 
both gcc and gdb (both 20030730).
Comment 3 Andrew Pinski 2004-01-01 23:49:16 UTC
I think this is a gdb bug now as GCC produces DW_TAG_namespace.
Comment 4 Andrew Pinski 2004-04-01 15:58:16 UTC
I no longer get a warning on the CVS version of gdb (2004-03-29-cvs) so this is fixed.