Enable gdb pretty printing for libstdc++

gdb 7.0 added support for python pretty printers, libstdc++ provides
python pretty printers but they are not loaded by default on LinuxMint
18. Load them but only for this distro as upstream Debian enables them
by default and loading them multiple times will throw an exception.
This commit is contained in:
Kenneth Benzie 2018-11-07 11:53:45 +00:00
parent f60c762bc2
commit cecbcddd2b

11
gdbinit
View File

@ -1,2 +1,13 @@
set print pretty on
set auto-load safe-path ~/
# Enable C++ std pretty printing in LinuxMint 18.X
# https://sourceware.org/gdb/wiki/STLSupport
python
from platform import linux_distribution
distro = linux_distribution()
if 'LinuxMint' == distro[0] and '18' in distro[1]:
from sys import path
path.insert(0, '/usr/share/gcc-5/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers(None)
end