This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] Anonymous namespaces prevent some Python pretty-printing
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: archer at sourceware dot org
- Cc: ppluzhnikov at google dot com
- Date: Fri, 7 Nov 2008 15:51:30 -0800 (PST)
- Subject: [python] Anonymous namespaces prevent some Python pretty-printing
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1226101892; bh=BwcQWd9tfAcK9ekKmrmpH8+lrgQ=;h=DomainKey-Signature:To:Cc:Subject:Message-Id:Date:From; b=KcilqgWHNJZ+g/3RE5BRGZN35Ozldz7zBJURz6Nh5IbW+ja26vHcHYCRa9ABeTqrfHmMMkMYXEknCUmPVfMpvA==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=to:cc:subject:message-id:date:from;b=B/4pB+VtzOjkdgOBYkNxpd9/I/VepnEt6jliCVS0RKuqK8u6KBE/yYYvHpiO2WcTF01uzTVZykwXmgzt4GG5Lw==
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