From cecbcddd2bd950113523d32af42403bc501d7f62 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 7 Nov 2018 11:53:45 +0000 Subject: [PATCH] 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. --- gdbinit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gdbinit b/gdbinit index e7ff01b..b486f5a 100644 --- a/gdbinit +++ b/gdbinit @@ -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