Friday, December 02, 2005

use gdb, makefiles, g++

use gdb for debugging applications:

1. #first put debug info in Makefile files:
LDFLAGS = -g -W1
CFLAGS = -g

2. #run make

3.
gdb appname
#put breakpoints with:
break [FUNC_NAME]
# [FUNC_NAME] is the function name

4. r [ARGS]
#where ARGS are the args needed for the app

5.
#s for steps
#n for next line of code
#c for run to next breakpoint
#detach to leave program running
#kill to stop app

6. to kill an app being debugged:
ps -C appname
kill -9 apppid
#after that close parent app - or type 'exit' in the parent terminal window.

--------------

Here is the KDbg home page.
KDbg = debugger for KDE, based on gdb.

----

gdb tutorials:
Debugging Under Unix: gdb Tutorial
Debugging with gdb


gnu make tutorial:
GNU make

g++ tutorial

No comments: