C and C++ SoftBench User's Guide

Using SoftBench Debugger
Setting and Using Breakpoints
Chapter 7 189
Setting and Using Breakpoints
A breakpoint is a "hook" placed in your executable program by
SoftBench Debugger to halt execution at a specific line. SoftBench
Debugger indicates a breakpoint by a breakpoint annotation in the
Annotation Margin, to the left of the Editable Source Area. The
breakpoint annotation appears on the same line as the source statement.
See Figure 7-6.
When your program runs or continues, and the condition specified in a
breakpoint occurs, control returns to the debugger and any DDE
command attached to the breakpoint executes. If the attached command
does not execute a "go", then the program pauses and you can query
variables and perform other SoftBench Debugger operations. For
information on attaching commands to breakpoints, see “Executing DDE
Commands at a Breakpoint” on page 195.
Your program pauses before executing the source statement associated
with the breakpoint. For example, suppose you set a breakpoint on an
assignment statement. When your program pauses at the breakpoint,
the assignment has not been executed. If you Print ( ) the value of the
variable, you see its previous value. If you Step, the assignment takes
place and you can Print ( ) the result of the assignment.
While the program stops, you can examine the values of variables and
look at anything else that might help you find defects in your program.
You can even change the PC location within the current function, to
repeat a section of code or to skip over unwanted code.
You can have any number of active breakpoints in your program.
Execution stops when SoftBench Debugger encounters any breakpoint.
SoftBench Debugger automatically creates breakpoints on the first and
last lines of your main() procedure.
To get a complete list of breakpoints, use the "Break: Show" menu
selection.
Debugging a Program Using Breakpoints
“Setting a Breakpoint” on page 190 describes how to pause your program
during execution. This can be useful any time you want to execute part of
your program before pausing to debug a section of code. For example,