Using SoftBench Debugger

Examining and Changing Data in Your Program

Examining and Changing Data in Your Program

You can use SoftBench Debugger to view or change the values of variables in your program. This feature directly accesses the underlying debugger, and as such is very dependent on DDE features.

DDE accepts commands only when SoftBench Debugger has control (the "Debugger Input" prompt is not greyed out) and your program is not running. If you enter DDE commands when DDE is not accepting them, DDE buffers the commands until it is ready to accept them. You can stop your program with a breakpoint (see “Setting and Using Breakpoints” on page 189) or by selecting Interrupt Program. You can examine variables between steps if you single-step, or dynamically by setting a watchpoint on the variables.

DDE evaluates variables in the scope of the Current Location, as indicated in the "Current Location" line above the Editable Source Area. Usually the Current Location follows the PC Location, so DDE evaluates variables in the environment where your program executes. For example, when you single-step through your source, the Current Location is in the procedure you are stepping through.

If you want to evaluate a variable in the scope of another function on the current call stack, use the and buttons next to the "Stack Frame" label in the Current Location line (or choose "Show: Stack…" and choose a stack frame in the "Stack View" window). This sets the Current Location to the specified function in the call stack.

To evaluate in the scope of a function outside the current call stack (for example, to evaluate a static variable local to a function), enter the function name in the "()" input box and choose "Visit:

Procedure ( )" to set the Current Location to that function.

Finally, you can always specify the variable fully with the appropriate DDE syntax (see “Specifying Variables” on page 178). This syntax overrides the Current Location.

The PC arrow points to the line that will be executed next. If the PC points to an assignment statement, the assignment has not yet been executed. To see the result of an assignment statement, Step past it (or Step Over it if it calls a function).

Chapter 7

181