I just tried something, and, fortunately, it works now. At the very least, it can print map and vector content as expected. Here is what I did:
Since he complains that he cannot find the printer.py module, I think probably I should tell the python interpreter where this file is located. Therefore, I first added this extra line to my ~ / .gdbinit file: sys.path.append("/home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6")
(After the line sys.path.insert(0, '/home/jerry/myLib/gdb_stl_support/python') )
Then running gdb again, I got the following error:
Traceback (most recent call last): File "<string>", line 5, in <module> File "/home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6/printers.py", line 1247, in register_libstdcxx_printers gdb.printing.register_pretty_printer(obj, libstdcxx_printer) File "/usr/share/gdb/python/gdb/printing.py", line 146, in register_pretty_printer printer.name) RuntimeError: pretty-printer already registered: libstdc++-v6 /home/jerry/.gdbinit:7: Error in sourced command file: Error while executing Python code.
Given the error information, I edited the ~ / .gdbinit file and commented out the register_libstdcxx_printers (None) .
Then, after starting gdb, it works.
But I'm still wondering if directory lookups are recursive in sys.path? I mean, the python interpreter should work as follows: as soon as you add one directory to sys.path , then the subdirectory in this directory will also look for the module file.
Dreamer
source share