profile
engineer . tinkerer . father

Andreas Heimberger

  • home
  • github
  • instagram
  • xing
  • linkedin
Built with Hugo

Bachelor Thesis: Darstellung von STL-Datentypen in einem Debugger

My bachelor thesis was about the representation of the C++ Standard Template Library within the debugger Ricodebug. Ricodebug was a students project and used the GNU Debugger (GDB). Within the thesis I showed different methods, to represent the content of the C++ data structure in a human readable way. Furthermore, I investigated Visual Studio 2010 (autoexp.dat), Visual Studio 2013 (.natvis) and Qt (bridge.py, dumper.py, qttypes.py).

The following text output is from the debugger GDB and shows why this work was of interest. Without Pretty-Printer it is not possible to get information about the content within the data structure.

Without Pretty-Printer : Overview about class structure of the object.

(gdb) print vec
$2 = {<std::_Vector_base<int, std::allocator<int> >> = {_M_impl = {
<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No data fields>},
<No data fields>}, _M_start = 0x604050, _M_finish = 0x604064,
_M_end_of_storage = 0x604070}}, <No data fields>}

With Pretty-Printer : Shows values stored within the object.

(gdb) print vec
^done,value="std::vector of length 5, capacity 8 = {10, 5, 1, -5, -10}"

Furthermore, I presented different solutions within the thesis for debugging classes, which were:

  • Code Injection: Adding additional print functions to a code via shared libraries.
  • Front-End interprets data structure
  • Debugger overwrites output-stream: GDB Pretty-Printer

At the end of the thesis I came to the conclusion, that python pretty-printers are the best solution for my thesis, because they would work in every visual front-end which uses GDB and furthermore, an existing solution existed to represented the Standard Template Library.

At the end of my thesis I made a proof of concept. I included python pretty-printers within Ricodebug.

Ressources: