Scenario Application code Print frame script Analysis GDB session Frame 0 0x7fffffffe240: 0x0000555555554040 0x0000000300000008 0x7fffffffe250: 0x0000000000000000 0x0000000b00000000 0x7fffffffe260: 0x00007fffffffe280 0x000055555555518e
Continue readingCategory: Debugging & Memory
Add prefix for shared libs location (GDB)
GDB is looking for the shared libs at specific paths. It’s possible to add a prefix to those paths. Example
Continue readingConditional breakpoints (C++)
Showcase Debugging $ g++ -g main.cpp $ gdb a.out (gdb) b main.cpp:5 if i == 5 Breakpoint 1 at 0xa24:
Continue readingFlameGraph (Docker)
Setup Get FlameGraph repo % git clone https://github.com/brendangregg/FlameGraph fg Create Docker image Follow the instructions here: C++ develop container (Docker)
Continue readingPretty printer – Own type
Example code Without pretty printer (gdb) b 29 (gdb) r Breakpoint 1, main () at main.cpp:29 29 return 0; (gdb)
Continue readingStack unwinding
Mechanism 1. Frame pointers … the old default way Frame pointers are enabled by default. Strong optimization (“-O2”, “-O3”) will
Continue readingLayout of std::string (libstdc++)
Source code Analysis $ g++ –version g++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0 $ g++ main.cpp -g $ gdb a.out (gdb) b 7
Continue readingLayout of std:set (libstdc++)
Source code Analysis $ g++ –version g++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0 $ g++ main.cpp -g $ gdb a.out (gdb) b 6
Continue readingLayout of std::unordered_set (libstdc++)
Layout The meta element on the stack consumes 7 words (56 Byte on x64, 28 Byte on x86). Each node
Continue readingLayout of std:deque (libstdc++)
Layout The meta element on the stack consumes 10 words (80 Byte on x64, 40 Byte on x86). Each chunk
Continue reading