User`s guide

Studying a New Program
3
problem areas. If your program crashes, first determine which line causes it
to crash, then set a breakpoint just before that line.
You can use several dbx commands to trace a variable’s value. Here’s a
simple method for tracing a program variable:
1. Use the stop command (see “Setting Breakpoints” on page 59) to set
breakpoints in the program at locations where you want to examine the
state of the program stack or the values stored in program variables.
2. Use the run or rerun command (described in “Running Your Program”
on page 9) to run your program under dbx. The program stops at the
first breakpoint that it encounters during execution.
3. Examine the program variable as described in “Displaying the Value of
a Variable” on page 41. Examine the program stack as described in
“Examining the Stack” on page 46.
4. Use the cont command (see “Continuing Execution After a Breakpoint”
on page 64) to continue execution past a breakpoint. However, you
cannot continue execution past a line that crashes the program.
Studying a New Program
Use dbx to examine the flow of control in a program. When studying the flow
of control within a program, use the dbx commands stop, run/rerun, print,
next, step, and cont. To study a new program:
1. Use the stop command to set breakpoints in the program. When you
execute the program under dbx, it stops execution at the breakpoints.
If you want to review every line in the program, set a breakpoint on the
first executable line. If you don’t want to look at each line, set
breakpoints just before the sections you intend to review.
2. Use the run and rerun commands to run the program under dbx. The
program stops at the first breakpoint.
3. Use the print command to print the value of a program variable at a
breakpoint.
4. Use the step, next, or cont command to continue past a breakpoint and
execute the rest of the program.