Skip to content

Usage

Pretty PrintingΒΆ

See the Pretty Printing Website for more detailed information.

Pretty printers are provided by the compiler module (i.e. gcc/9.3.0), so you will need to load the GCC module and customize your ~/.gdbinit file:

Create or modify .gdbinit in your home directory so that it contains the following code to look for and load the compiler module's pretty-print driver. It is Python, so indentation matters!

python
import os, sys
gcc_python_dir = os.environ.get('HPC_GCC_PYTHON_DIR')
if gcc_python_dir:
   sys.path.insert(0, gcc_python_dir)
   from libstdcxx.v6.printers import register_libstdcxx_printers
   register_libstdcxx_printers (None)
end

Whenever you load the GDB module, load the appropriate GCC module along with it:

module load gdb/9.2 gcc/9.3.0
Now, when you start GDB, the libstdcxx pretty-printers will be available:
$ gdb -q
(gdb) info pretty-printer 
global pretty-printers:
  builtin
    mpx_bound128
  libstdc++-v6
    __gnu_cxx::_Slist_iterator
    __gnu_cxx::__8::_Slist_iterator
    ...
    ...