User`s guide

78
Chapter 6: Controlling Program Execution
Stepping Through Your Program
Stepping is a process of executing your program for a fixed number of lines
and then automatically returning control to dbx. dbx provides two
commands for stepping through lines of code: step and next.
For both step and next, dbx counts only those source lines that actually
contain code; for the purposes of stepping, dbx ignores blank lines and lines
consisting solely of comments.
The next and step commands differ in their treatment of procedure calls.
When step encounters a procedure call, it usually “steps into” the procedure
and continues stepping through the procedure (counting each line of
source). On the other hand, whennext encounters a procedure call, it “steps
over” the procedure—executing it without stopping but not counting lines
in the procedure—and continues stepping through the current procedure.
The following code fragment illustrates the difference between step and next:
55 foo( arg1, arg2 )
56 int arg1, arg2;
57 {
58 if ( arg1 < arg2 ) {
... ...
78 return( 0 );
79 }
...
211 x = foo( i, j );
212 y = 2 * x;
In this example, if at line 211 you execute a step command to advance one
line,dbx allows the process to proceed to line 58 (the first code line of the foo
procedure). However, if you execute a next command, dbx executes line
211—calling foo—and advances the process to line 212.