I doubt this is a bug, more likely my own lack of understanding of how
to use namespaces within gdb, but this seemed to be the closest forum
to ask such a question. If their is a better forum, please advise.
In the code below, I cannot access the value of Ndim while debugging
in main.
Here is the code and the gdb session.
#include <iostream>
#include <cstddef>
namespace PDQ {
void init();
size_t Ndim;
}
void
PDQ::init () {
Ndim = 2;
}
int main() {
using namespace PDQ;
init();
cout << "almost done; Ndim is " << Ndim << endl;
}
GDB session; code is compiled with g++ -g using gcc-2.95.2
Breakpoint 1, main () at namespace_gdb.cpp:17
(gdb) n
(gdb) p Ndim
No symbol "Ndim" in current context.
(gdb) p PDQ::Ndim
No symbol "PDQ" in current context.
(gdb) n
almost done; Ndim is 2
(gdb) show version
GNU gdb 4.18