gcc -g מייצר מידע איתור באגים שישמש את ניפוי הבאגים של GDB.
| אוֹפְּצִיָה | תיאור |
|---|---|
| -g0 | אין מידע על ניפוי באגים |
| -g1 | מידע על איתור באגים מינימלי |
| -g | מידע על ברירת מחדל לאיתור באגים |
| -g3 | מידע על איתור באגים מרבי |
$ gcc -glevel [options] [source files] [object files] [-o output file]
כתוב קובץ מקור myfile.c :
// myfile.c
#include <stdio.h/
void main()
{
printf("Program run!!\n");
}
בנה myfile.c במסוף והפעל את gdb לאיתור באגים:
$ gcc -g myfile.c -o myfile
$ gdb myfile
(gdb) run
Starting program: /home/ubuntu/myfile
Program run!!
Program exited with code 012.
(gdb) quit
$