Search code examples
gdbpretty-print

How to determine the cause of GDB pretty printing issues?


I'm trying to determine why GDB on my system does not provide any pretty printing for C++ standard library types.

Command info pretty-printer yields some bogus output:

global pretty-printers:
  builtin
    mpx_bound128
Python Exception <type 'exceptions.UnicodeEncodeError'> 'ascii' codec can't encode characters in position 48-53: ordinal not in range(128): 
Error occurred in Python: 'ascii' codec can't encode characters in position 48-53: ordinal not in range(128)

And I can't seem to find the offending gdbinit script.


Solution

  • I was able to overcome the issue by altering the default Python encoding in .gdbinit script as follows:

    python
    import sys
    reload(sys)
    sys.setdefaultencoding('utf8')
    end