Debugging Basics
Systematic techniques for finding and fixing bugs: compilation flags, assertions, logging, debuggers. Understanding debugging tools is essential for efficient development.
GDB
GNU Debugger (GDB) is the standard debugger for C/C++ on Linux. Allows stepping through code, inspecting variables, setting breakpoints, and analyzing crashes.
Core Dumps
Core dump = snapshot of crashed program's memory. Essential for debugging crashes in production where debugger can't be attached.
Sanitizers
Compiler-based runtime tools that detect bugs: memory errors, undefined behavior, data races, memory leaks. Much faster than Valgrind, part of GCC/Clang.
Valgrind
Dynamic analysis tool suite for memory debugging, leak detection, and profiling. More thorough than sanitizers but much slower (10-50x).
Performance Tools
Tools for finding performance bottlenecks: CPU time, cache misses, branch mispredictions. Measure first, then optimize.
Reading Assembly
Understanding compiler-generated assembly helps verify optimizations, debug performance issues, and understand low-level behavior.