EMZETT.
Login

Debuggers and core dumps

In short: A debugger lets a program run step by step so you can inspect variables. A core dump is an image of the memory of a crashed program for later analysis.

In more detail: With breakpoints the debugger stops the program at a line. Then you can read values, view the call stack and continue line by line. Core dumps enable this even after the crash on another machine.

In Depth

  • Commands (gdb): break file.c:42, run, next, step, print x, backtrace.
  • Conditional breakpoints: Stop only when, for example, i == 1000 holds.
  • Watchpoints: Stop as soon as a variable changes.
  • Core dump: Enable on Linux with ulimit -c unlimited, then gdb program core.
  • Debug symbols: Compile with -g so names and lines are visible.
  • Other languages: IDEs and browser developer tools offer the same functions graphically.

See also: Profiling and flame graphs