Sample Video Frame

Created by Zed A. Shaw Updated 2026-08-31 20:32:57
 

Exercise 4: Using a Debugger

This is a video-focused exercise where I show you how to use the debugger that comes with your computer to debug your programs, detect errors, and even debug processes that are currently running. Please watch the accompanying video to learn more about this topic.

GDB Tricks

Here's a list of simple tricks you can do with GNU Debugger (GDB):

  • gdb --args [PROGRAM]: Normally, gdb takes arguments you give it and assumes they are for itself. Using --args passes them to the program.
  • thread apply all bt: Dump a backtrace for all threads. It's very useful.
  • gdb --batch --ex run --ex bt --ex q --args [PROGRAM] [ARGS]: Run the program so that if it bombs, you get a backtrace.
Previous Lesson Next Lesson

Register for Learn C the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.