Can't debug anonymous namespaces

Tron Thomas <[email protected]> Mon, 14 Apr 2003 17:00:35 -0700
Newsgroups gmane.comp.gdb.bugs.general
Message-ID <[email protected]>
I checked the archives and didn't see this issue reported.  I'd be 
surprised if I was actually the first one to run into this situation.

Build this program with debug information:

#include <iostream>

namespace{

int g_value = 42;
void PrintMessage()
{
    std::cout << "The answer to life the universe and everything is " <<
        g_value << "!\n";
}

} // namespace

int main()
{
    PrintMessage();

    return 0;
}

Debug the program with gdb
At the gdb prompt type:  b PrintMessage
Result:  Function "PrintMessage" not defined
Expected:  Break point should be set at the beginning of the 
PrintMessage procedure

At the gdb prompt type: b 9
Type:  r
gdb breaks at the beginning of the PrintMessage procedure
Type:  print g_value
Result:  Address of symbol "g_value" is unknown
Expected: gdb should report that the value of g_value is 42.

Configuration:
RedHat Linux (Intel) 7.2
gdb version 5.2-2
gcc version 2.96