gcc -g genereert foutopsporingsinformatie voor gebruik door GDB-foutopsporingsprogramma.
| optie | Omschrijving | 
|---|---|
| -g0 | geen foutopsporingsinformatie | 
| -g1 | minimale foutopsporingsinformatie | 
| -g | standaard foutopsporingsinformatie | 
| -g3 | maximale foutopsporingsinformatie | 
$ gcc -glevel [options] [source files] [object files] [-o output file]
Schrijf het bronbestand myfile.c :
// myfile.c
 #include <stdio.h/
  
 void main()
 {
     printf("Program run!!\n");
 }
Bouw myfile.c op terminal en voer gdb uit om te debuggen:
$ gcc -g myfile.c -o myfile
 $ gdb myfile
 (gdb) run
 Starting program: /home/ubuntu/myfile
 Program run!!
 Program exited with code 012.
 (gdb) quit
 $