Sunday, March 2, 2014

GDB : Compile Source Code Menggunakan -g Flag

Pagi ini sudah berhasil mengcompile source code yg dibuat menggunakan bahasa C dengan flag -g, seperti ini:

gcc -g -o Latihan4d Latihan4d.c

dikasih flag -g biar memudahkan proses debugging menggunakan GDB (GNU Debugger).

Tampilan proses selanjutnya seperti ini:

steven@steven-N43SM:~/GDBProject$ gcc -g -o Latihan4d Latihan4d.c
steven@steven-N43SM:~/GDBProject$ ./Latihan4d
Selamat Pagi Balikpapan
Sarapan Pagi yang Enak
steven@steven-N43SM:~/GDBProject$ gdb Latihan4d
GNU gdb (Ubuntu/Linaro 7.4-2012.02-0ubuntu2) 7.4-2012.02
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/steven/GDBProject/Latihan4d...done.
(gdb) run
Starting program: /home/steven/GDBProject/Latihan4d
Selamat Pagi Balikpapan
Sarapan Pagi yang Enak
[Inferior 1 (process 6634) exited normally]
(gdb)

keterangan debugging menggunakan flag -g bisa dilihat disini:

http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html

No comments:

Post a Comment

please, write your comment about this article