Ang gcc -g ay bumubuo ng impormasyon sa pag-debug na gagamitin ng GDB debugger.
opsyon | paglalarawan |
---|---|
-g0 | walang impormasyon sa pag-debug |
-g1 | minimal na impormasyon sa pag-debug |
-g | default na impormasyon sa pag-debug |
-g3 | pinakamataas na impormasyon sa pag-debug |
$ gcc -glevel [options] [source files] [object files] [-o output file]
Sumulat ng source file myfile.c :
// myfile.c
#include <stdio.h>
void main()
{
printf("Program run!!\n");
}
Bumuo ng myfile.c sa terminal at patakbuhin ang gdb para i-debug:
$ gcc -g myfile.c -o myfile
$ gdb myfile
(gdb) run
Starting program: /home/ubuntu/myfile
Program run!!
Program exited with code 012.
(gdb) quit
$
Advertising