Pausing during Execution [ Symbolic Debugger/iX User's Guide ] MPE/iX 5.0 Documentation
Symbolic Debugger/iX User's Guide
Pausing during Execution
When you want to temporarily suspend the execution of the program to
examine some aspect of it, such as a variable's value, set one or more
breakpoints in the program. This must be done before starting the
program, or when it is suspended by an existing breakpoint or an
exception condition.
Breakpoints direct the debugger to stop execution at or immediately
before executing the specified line (or instruction). When you resume
execution, the program will continue until this or another breakpoint is
reached. While the program is suspended, you can enter any debugger
command.
Setting Breakpoints
To set a breakpoint in source mode, enter the line number before which
you want execution to pause. In disassembly mode, enter an address or a
label and offset to specify the location for the breakpoint. If it is
not an executable statement, the debugger sets a breakpoint at the first
executable statement following that line. You can set breakpoints before
step and run commands or after another breakpoint occurs.
The following example sets a breakpoint before line 10:
>b 10
When a breakpoint is set, the debugger displays in the command window the
procedure and line number where the breakpoint is set and the source
statement located at that line. If your terminal supports windowing, the
line is marked in the source window with an asterisk (*). From this
point on, the debugger pauses each time line 10 is encountered.
To pause after a specific number of occurrences of the breakpoint, enter
the b (breakpoint) command followed by a number. In the following
example, a breakpoint is set at line 10. The debugger pauses every other
time line 10 is encountered.
>b 10 \2
To set a breakpoint at the first executable statement in every debuggable
procedure in the program, enter:
>bp
To execute a series of debugger commands before each procedure is
executed, enter the bp (breakpoint procedure) command with a command
list. For example, to track the value of a particular variable, the
following command sets a breakpoint at the beginning of each procedure
and executes three commands (Q, p and c) at each of these breakpoints.
>bp {Q; p someglobal; c}
In this example, the Q (Quiet) command suppresses the debugger messages
that are normally displayed when a breakpoint is encountered. The p
(print) command displays the current value of the global variable
someglobal. The c (continue) command resumes execution of the program.
You can also set all-procedure breakpoints with the bpt and the bpx
commands. The bpt command sets a trace breakpoint at the beginning and
exit of all procedures. The bpx command sets a breakpoint at each
procedure's exit.
For HP COBOL II programs, use the bpg (breakpoint paragraph) and the tpg
(trace paragraph) commands to set all-paragraph breakpoints.
The procedure and paragraph breakpoints are set for all procedures and
paragraphs. You cannot set individual procedure breakpoints in this
manner. The b (breakpoint) command can be used to set individual
procedure or paragraph breakpoints, which will co-exist with any
all-procedure or all-paragraph breakpoint that may be set at the same
location.
Resuming Execution After a Breakpoint
Once the debugger pauses for a breakpoint and you have finished entering
commands at that breakpoint, enter the c (continue) command:
>c
This causes execution to continue until another breakpoint is encountered
or the program terminates.
Listing Breakpoints
To list the breakpoints that are set in the program, enter the lb (list
breakpoints) command as follows:
>lb
When the lb (list breakpoints) command is executed, information about
each breakpoint is displayed. For example, two breakpoints are shown
below. The first number on each breakpoint line is the debugger-assigned
breakpoint number, which you use with other commands (such as db (delete
breakpoint)). The number following count is the number of times the
source statement will be encountered before the program pauses. The
breakpoint state (active or suspended) is listed next, followed by the
line at which the breakpoint is set and the source statement on that
line.
Overall breakpoints state: SUSPENDED
1: count: 1 Active sortall: 12: abc += 1;
2: count: 5 Suspended fixit: 29: def=abc >> 4;
Deleting Breakpoints
To delete a breakpoint, enter the debugger-assigned number of the
breakpoint (see the previous section "Displaying Breakpoints") with the
db (delete breakpoint) command.
For example, to delete the breakpoint whose number is 2, enter:
>db 2
If you do not enter the breakpoint number, the breakpoint at the current
line, if any, is deleted. If there is no breakpoint at the current line,
the debugger displays all of the breakpoints.
To delete all breakpoints, enter:
>db *
To delete all-procedure breakpoints (only those breakpoints set by the bp
(breakpoint procedure), bpt (breakpoint trace), or bpx (breakpoint exit)
commands), enter the following respective commands:
>dp
>Dpt
>Dpx
To delete all-paragraph breakpoints (breakpoints set by the bpg
(breakpoint paragraph) or tpg (trace paragraph) commands), use the dpg
(delete paragraph) command:
>dpg
MPE/iX 5.0 Documentation