Using SoftBench Debugger
Examining and Changing Data in Your Program
For example, suppose you debug the following code fragment:
x=0; y=9;
while (y<1000) { x=sqrt(y); x++; y=x*x;
}
Set a breakpoint on the "x=sqrt(y)" line, and run the program. When the program stops at the breakpoint, the PC arrow is at that line. Enter "x" in the "()" input box (or simply
To print the value of a simple variable or expression:
1.Enter a variable name in the "()" input box. You can
2.Select Print ( ). SoftBench Debugger displays the value of the variable in the Debugger Output Area.
You can also evaluate expressions. For example, if n is a numeric variable in the current querying scope, n/12.0 prints
If you print an expression that contains a function call, the function executes. Be aware that this invokes any side effects in the function.
To print the value of a variable referenced by a pointer:
1.Enter the pointer name in the "()" input box. If the pointer is defined in the procedure referred to by the Current Location, you can use the name of the pointer directly. If not, specify it according to the rules defined in “Specifying Variables” on page 178.
2.Select Print* ( ). SoftBench Debugger displays the value of the variable in the Debugger Output Area.
182 | Chapter 7 |