This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
RE: exp/2070: gdb doesn't resolve namespace when print expression
- From: "Yan, Michael" <myan at microstrategy dot com>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 19 Jan 2006 18:38:01 -0000
- Subject: RE: exp/2070: gdb doesn't resolve namespace when print expression
- Reply-to: "Yan, Michael" <myan at microstrategy dot com>
The following reply was made to PR exp/2070; it has been noted by GNATS.
From: "Yan, Michael" <myan@microstrategy.com>
To: "Daniel Jacobowitz" <drow@false.org>
Cc: <gdb-gnats@sources.redhat.com>
Subject: RE: exp/2070: gdb doesn't resolve namespace when print expression
Date: Thu, 19 Jan 2006 13:30:11 -0500
Thanks, Daniel
Even if I have gcc 4.0.3+, I can't print namespaced C++ object. Is it =
right?
BTW, the gdb shiped with HP-UX 11 works. I guess they fix this somehow.
Michael
-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@false.org]
Sent: Thursday, January 19, 2006 12:50 PM
To: Yan, Michael
Cc: gdb-gnats@sources.redhat.com; myan@gmail.com
Subject: Re: exp/2070: gdb doesn't resolve namespace when print
expression
On Thu, Jan 19, 2006 at 12:25:34PM -0500, Yan, Michael wrote:
> g++ (GCC) 3.2.3
I believe that version of G++ does not emit debug information for
namespaces. GDB does the best it can in the absence of useful
information, but there are some severe limitations anyway.
> > (gdb) p *(NBase::Frog *) 0x501010
> > No symbol "NBase" in current context.
With GCC 4.0.3 I get:
(gdb) p *(NBase::Frog *) 0x501010
A syntax error in expression, near `) 0x501010'.
(gdb) p *(Frog *) 0x501010
A syntax error in expression, near `) 0x501010'.
(gdb) p *('NBase::Frog' *) 0x501010
Cannot access memory at address 0x501010
The first syntax error is a bug in GDB; I believe there's an open PR
about it.
The second error is expected when I am stopped in main(), because there
is no Frog in this namespace. When stopped in NBase::Frog::Frog() it's
a bug in GDB (which I believe there's another bug report about also) -
GDB finds NBase::Frog::Frog() instead of NBase::Frog and gets confused.
For now I can only recommend the third form, and hopefully someone will
take another stab at the first two bugs soon.
--=20
Daniel Jacobowitz
CodeSourcery