[Converted from Gnats 829] GDB doesn't know about using directives in C++ Release: GNU gdb 2002-11-15-cvs Environment: any How-To-Repeat: Compile this file: namespace A { int x = 1; } using namespace A; int main() { x; return 0; } Then try to print out x: (gdb) b main Breakpoint 1 at 0x80484a0: file using-direct.cc, line 11. (gdb) r Starting program: /cartan/carlton/sync/gdb-backup/namespace/prs/using-direct Breakpoint 1, main () at using-direct.cc:11 11 return 0; (gdb) p x No symbol "x" in current context.
Fix: A good first step would be for GCC to generate the appropriate debugging information...
From: David Carlton <carlton@kealia.com> To: gdb-gnats@sources.redhat.com Cc: Subject: Re: gdb/829: GDB doesn't know about using directives Date: Wed, 17 Mar 2004 12:15:29 -0800 On 15 Nov 2002 21:42:50 -0000, carlton@math.Stanford.EDU said: > A good first step would be for GCC to generate the appropriate > debugging information... I believe GCC does now generate that debugging information. (I think GCC 3.4 will do so, though it's vaguely possible that the fix won't be until 3.5.)
I have verified that this bug has been fixed sometime between GDB 6.8 and 7.1 using GCC 4.1.0 and newer. [I did not check GCC releases > 3.4.6 and < 4.1.0.]