0Pricing
C Academy · Lesson

Debugging with GDB

Use the GNU Debugger (gdb) to analyze and fix issues in your programs.

1

Debugging with GDB

The GNU Debugger (GDB) is a powerful tool for finding and fixing bugs in C programs.

In this lesson, you will learn:

  • How to compile programs for debugging.
  • How to set breakpoints and inspect variables.
  • How to step through code execution.
Debugging with GDB — illustration 1

2

Compiling a Program for Debugging

To use GDB, compile your program with the -g flag:

gcc -g program.c -o program

This includes debugging information in the executable.

All lessons in this course

  1. Debugging with GDB
  2. Common Runtime Errors
  3. Exception Handling in C
← Back to C Academy