ജിഡിബി ഡീബഗ്ഗർ ഉപയോഗിക്കുന്നതിന് gcc -g ഡീബഗ് വിവരങ്ങൾ സൃഷ്ടിക്കുന്നു.
ഓപ്ഷൻ | വിവരണം |
---|---|
-g0 | ഡീബഗ് വിവരങ്ങളൊന്നുമില്ല |
-g1 | ഏറ്റവും കുറഞ്ഞ ഡീബഗ് വിവരങ്ങൾ |
-ജി | സ്ഥിരസ്ഥിതി ഡീബഗ് വിവരങ്ങൾ |
-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
$