Debugging a Program With dbx

Tracing Code

Tracing displays information about the line of code about to be executed or a function about to be called.

Setting a Trace

Set a trace by typing a trace command at the command line. Table 5-1 shows the command syntax for the types of traces that you can set. The information a trace provides depends on the type of event associated with it.

Table 5-1 trace Command Syntax

Command 

trace prints ...

trace step

Every line in the program as it is about to be executed 

trace next -in function

Every line while the program is in the function 

trace at line_number

The line number and the line itself, as that line becomes the next line to be executed 

trace in function

The name of the function that called function; line number, parameters passed in, and return value

trace inmember member_function

The name of the function that called member_function of any class; its line number, parameters passed in, and its return value

trace inclass class

The name of the function that called any member_function in class; its line number, parameters passed in, and return value

trace infunction function

The name of the function that called any member_function in class; its line number, parameters passed in, and return value

trace change variable [-in function]

The new value of variable, if it changes, and the line at which it changed

Controlling the Speed of a Trace

In many programs, code execution is too fast to view the code. The dbxenv trace_speed allows you to control the delay after each trace is printed. The default delay is 0.5 seconds.

To set the interval between execution of each line of code during a trace:


dbxenv trace_speed number