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.

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
- Debugging with GDB
- Common Runtime Errors
- Exception Handling in C