Wednesday, June 27, 2007

GDB - Code Debugger in Linux Enviroment

GDB is a tool for developer to debug the software when in Linux enviroment.

Run your application in debug mode
------------------------------------
1) gdb [application_name]
2) to set a break point
a) b [function_name]
b) b [document_name]:[line_number]
3) Start the application
run
4) Next line when in debug mode
n
5) Continue running when debug mode
c
6) Exit Debug Mode
q

Debugging Core Dump File
---------------------------
1) gdb [application_name] [core_dump_filename]
2) Debug the dump segment
b
3) Look into the dump segment
frame [segment_number]
4) Exit the debug mode
q