diff --git a/doc/21-debug.md b/doc/21-debug.md index b7ecb4666..90ca0c6cb 100644 --- a/doc/21-debug.md +++ b/doc/21-debug.md @@ -51,10 +51,12 @@ SLES/openSUSE: Install the `boost`, `python` and `icinga2` pretty printers. Absolute paths are required, so please make sure to update the installation paths accordingly (`pwd`). -Boost Pretty Printers: - $ mkdir -p ~/.gdb_printers && cd ~/.gdb_printers - $ git clone https://github.com/ruediger/Boost-Pretty-Printer.git && cd Boost-Pretty-Printer + +Boost Pretty Printers compatible with Python 3: + + $ git clone https://github.com/mateidavid/Boost-Pretty-Printer.git && cd Boost-Pretty-Printer + $ git checkout python-3 $ pwd /home/michi/.gdb_printers/Boost-Pretty-Printer @@ -71,34 +73,38 @@ Icinga 2 Pretty Printers: Now you'll need to modify/setup your `~/.gdbinit` configuration file. You can download the one from Icinga 2 and modify all paths. -Example on Fedora: +Example on Fedora 22: $ wget https://raw.githubusercontent.com/Icinga/icinga2/master/tools/debug/gdb/gdbinit -O ~/.gdbinit $ vim ~/.gdbinit set print pretty on - + python import sys sys.path.insert(0, '/home/michi/.gdb_printers/icinga2') from icingadbg import register_icinga_printers register_icinga_printers() end - + python import sys sys.path.insert(0, '/home/michi/.gdb_printers/python') from libstdcxx.v6.printers import register_libstdcxx_printers - register_libstdcxx_printers(None) + try: + register_libstdcxx_printers(None) + except: + pass end - + python import sys sys.path.insert(0, '/home/michi/.gdb_printers/Boost-Pretty-Printer') - from boost.printers import register_printer_gen - register_printer_gen(None) + import boost_print + boost_print.register_printers() end + If you are getting the following error when running gdb, the `libstdcxx` printers are already preloaded in your environment and you can remove the duplicate import in your `~/.gdbinit` file. diff --git a/tools/debug/gdb/gdbinit b/tools/debug/gdb/gdbinit index 5242513be..a7e6b8720 100644 --- a/tools/debug/gdb/gdbinit +++ b/tools/debug/gdb/gdbinit @@ -11,7 +11,10 @@ python import sys sys.path.insert(0, '/home/gbeutner/gdb_printers/python') from libstdcxx.v6.printers import register_libstdcxx_printers -register_libstdcxx_printers(None) +try: + register_libstdcxx_printers(None) +except: + pass end python