[EMAIL PROTECTED] (John Hunter) writes:

> 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



Quote it.

Like 'PDQ::Ndim'


Debug info doesn't provide us with symbols for namespaces, so this
isn't a GDB bug.

Also, if you want nice C++ debugging, move to the latest CVS version
of GDB off of sourceware, or at the very least, 5.0.

Should finally let you work with STL containers nicely.

--Dan
C++ maintainer - GDB

Reply via email to