On Wed, 2020-02-26 at 17:23 +0000, Jonathan Wakely wrote: > I compiled this program: > > #include <unordered_map> > > int main() > { > std::unordered_map<int, int> m; > m[3] = 5; > return m[1]; > } > > And with Fedora 31's GDB 8.3.50 I get this behaviour:
I can't reproduce with a simple test either. But in my full system I have something like this: class Obj { typedef uint64_t GroupId; typedef uint64_t ObjectId; typedef std::unordered_map<GroupId, ObjectId> GroupIdToObjectIdMap; GroupIdToObjectIdMap objMap; }; then in GDB I do this: (gdb) ptype $v->objMap type = std::unordered_map<unsigned long, unsigned long> Fine, but then when I do this: (gdb) py v = gdb.parse_and_eval('$v') (gdb) py print str(v.type) Obj::GroupIdToObjectIdMap OK, but then when I do this: (gdb) py print str(v.type.strip_typedefs()) class std::unordered_map<unsigned long, unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, unsigned long> > > Note the "class " prefix here. And: (gdb) py t = gdb.lookup_type(str(v.type.strip_typedefs()) Traceback (most recent call last): File "<string>", line 1, in <module> gdb.error: No type named class std::unordered_map<unsigned long, unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, unsigned long> > >::__node_type. Error while executing Python code. If I use v.type.strip_typedefs().name it works. I haven't been able to reproduce this in a small separate test case. I have no idea what the difference is :( Thanks!!