[python] Anonymous namespaces prevent some Python pretty-printing
Paul Pluzhnikov
ppluzhnikov@google.com
Fri Nov 7 23:52:00 GMT 2008
Greetings,
Consider:
--- simple-stl3.cc ---
#include <map>
namespace {
struct Foo {
};
}
int main(int argc, char *argv[])
{
std::map<int, Foo> m;
return 0; // break here
}
--- simple-stl3.cc ---
When printing this with Tom's StdMap printer, this results in:
Traceback (most recent call last):
File "<string>", line 13, in _format_children
File "/home/ppluzhnikov/.gdbinit.py", line 160, in children
keytype = tp.template_argument(0)
RuntimeError: syntax error, near `<unnamed>::Foo, std::less<int>, std::'
That's because
cp_demangled_name_to_comp("std::map<int, <unnamed>::Foo, std::less<int>, std::allocator<std::pair<const int, <unnamed>::Foo> > >", ...)
returns NULL, with error set to "syntax error, near ..."
It strikes me that the whole split and rejoin mechanism that
typy_template_argument uses is very fragile.
Not sure what can be done about it though :(
--
Paul Pluzhnikov
More information about the Archer
mailing list