[PATCH 0/2] namespace support

Sami Wagiaalla swagiaal@redhat.com
Fri May 22 14:42:00 GMT 2009


Hi everybody,

I have been working on improving c++ namespace support in gdb.
I have done a fair amount of work and would like to commit it upstream.

This series of patches is a small subset.
The entire work can be viewed in the archer repo:

   git clone git://sourceware.org/git/archer.git
   cd archer
   git branch archer-swagiaal-using-directive 
origin/archer-swagiaal-using-directive

Please bear with me as I work my way through the review process :)

Here is an example of the things I have gotten to work:

namespace imports:

namespace A
{
   int x = 9;
}

int main()
{
   using namespace A;
   x;
}
(gdb) break main
...
(gdb) run
...
(gdb) print x
$1 = 9

namespace aliases:

namespace A
{
   int x = 9;
}

namespace B=A;
int main()
{
   B::x;
}
(gdb) break main
...
(gdb) run
...
(gdb) print B::x
$1 = 9

Imports if individual elements from namespaces:

namespace A
{
   int x = 9;
   int y = 99;
}

using A::x;
int main()
{
   x;
}
(gdb) break main
...
(gdb) run
...
(gdb) print x
$1 = 9
(gdb) print y
No symbol "y" in current context.

Koenig lookup:

namespace A
{
   class C
   {
   };

   int foo(C arg)
   {
     return 11;
   }
}

int main()
{
   A::C theC;
   foo(theC);
}

(gdb) b main
...
(gdb) r
...
(gdb) print foo(theC)
$1 = 11



More information about the Gdb-patches mailing list