Notice! This document is currently in Archived status.
The content of this document may be incorrect or outdated.

Print this article Edit this article

Get started using the debugger DBX


Dbx can be a very helpful debugger. It works on C, FORTRAN, and Pascal code. In order to use dbx, you must compile your code with the -g flag. This flag causes the compiler to include a symbol table that dbx needs. Type:
	man cc
man f77
man pc
for more details.

The basic list of dbx commands are:

run
Start execution of a program.

stop at line-number
Insert a breakpoint at the given line number. When a running program reaches a breakpoint, execution stops and control returns to the debugger.

stop in function-name
Insert a breakpoint at the first line of the named function. Commonly, the command stop in main is used to stop at the beginning of the program.

cont
Continue execution after a breakpoint.

print expression
Display the value of an expression.

step
Execute a single line in the program. If the current statement calls a function, the function is single-stepped.

next
Execute a single line in the program, but treat function calls as a single line. This command is used to skip over function calls.

list
List the source programs.

where
Print the list of currently active functions.

 

Summary

If you get a core dump:
  1. (Re)compile with -g
  2. Run (and get coredump)
  3. dbx a.out core
  4. "where" tells you on what line (or close to it) you died

For more information, type:

	% man dbx 

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: May 24, 2007 2:28 pm GMT-4 by admin
JumpURL: