[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can't debug anonymous namespaces
From: |
Tron Thomas |
Subject: |
Can't debug anonymous namespaces |
Date: |
Mon, 14 Apr 2003 17:00:35 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Can't debug anonymous namespaces,
Tron Thomas <=