COP 4600 - Discussion 6

Debugging using gdb

Debugging is extremely important to determine bugs in your program. gdb is a powerful debugger that is used to debug programs with the gcc compiler. Can run your program, stop at predetermined locations (breakpoints), display/set variables, trace program's execution, execute one line at a time, etc.



Debugging using gdb and emacs

gdb can be used within emacs and is well-integrated. First you have to make sure that the program is compiled properly using the -g option as previously mentioned.

To start gdb within emacs, type in:

		M-x gdb         [Alt-x gdb]
		

This will gdb in the same window by splitting it, showing the gdb prompt and the source code at the same time. This provides visual feedback regarding which line gdb is currently running (or stopped at), the breakpoints, etc.

NOTE: Very useful list of emacs commands.


Previous