0

I'm using python to analysis a core dump, and there is a variable named my_map having type std:map<int, MyObj*>. I have got the gdb.Value object:

   py_val = gdb.parse_and_eval('my_map')

and when I tried to iterate it with following code:

   for key in py_val:
     print(key)

I got an error: TypeError: 'gdb.Value' object is not iterable

How to iterate the std::map in gdb using python?

jasonxia
  • 321
  • 1
  • 8
  • If you have pretty printers, you can try `gdb.default_visualizer(py_val).children()`, which returns an iterable. – ssbssa Sep 05 '22 at 18:01

0 Answers0