Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cleaner, prettier stack traces in GDB for C++ template (mostly boost)-heavy code

Tags:

c++

boost

gdb

I work on a financial application (Linux/C++/gcc) that uses boost and templates extensively. The stack traces generated while debugging via GDB is horrifyingly complex with the internal template-wiring of boost adding a lot of ugly noise to the output. Does anyone know of a way to get a cleaner, prettier and more insightful stack-traces for C++ template-heavy (especially boost-heavy) code?

like image 697
ARV Avatar asked Sep 19 '12 13:09

ARV


1 Answers

The Python support in newer versions of GDB has been used to provide pretty printers for template-heavy structures like the STL.

  • http://sourceware.org/gdb/wiki/PythonGdbTutorial
  • http://sourceware.org/gdb/wiki/STLSupport

I haven't tried any of this myself. Unfortunately, it looks like adding support for Boost and for cleaning up stack traces (as opposed to pretty-printing values) may involve rolling some of your own Python code.

like image 174
Josh Kelley Avatar answered Oct 05 '22 22:10

Josh Kelley