HP 3000 Manuals

HOW TO ESTABLISH BREAKPOINTS [ MPE Debug/Stack Dump Reference Manual ] MPE/iX 5.0 Documentation


MPE Debug/Stack Dump Reference Manual

HOW TO ESTABLISH BREAKPOINTS 

In order to determine the breakpoints, look at the map produced during
program preparation by PMAP (Figure 3-2).  This program has only one
unnamed segment listed as SEG' with segment number 0 (see item 3).  If
you had divided your program into segments, the PMAP listing would show
each segment in ascending order by number.  The segment number is only
necessary in a segmented program and then only if you want to set a
breakpoint in a segment other than the currently executing segment.

The offset from the start of the code must, however, always be specified.
This offset is relative to the start of code shown for each program unit
in the PMAP listing.  Refer to item 5 in Figure 3-2 for the start of code
in the main program (location 165) and in the subroutine (location 0).

For example, suppose a program with five segments.  The first entry point
is in segment 0 and you want to set a breakpoint, in segment 4 at
location 200 relative to the start of code in that segment, you enter:

?B 4.200+ 5      where 5 is the start of code, 4 is the segment number
                 and you want to break 200 (octal) locations past the
                 start of code.

Returning to the sample program, suppose you want to break at a labelled
statement, you can refer to the label map in Figure 3-1 for the offset of
each program label from the start of code.

For example, to break at label 10 in the main program, enter:

     ?B 165+ 12 or ?B 177     (note that the offset is octal)

To break at label 30 in the subroutine, enter:

     ?B 74                    (relative to location 0)

More than one breakpoint can be specified in one B command:

     ?B 165+ 12, 165+ 75, 74       (break at labels 10, 20, and 30)

To break at an unlabelled statement, use the location (item 4, Figure
3-1) as the offset from the start of code.  For example, to break at
statement 13 in the main program, enter:

     ?B 165+ 37           (37 is the offset to start of code in MAIN)

REPEATED BREAKPOINTS 

If your program loops through a breakpoint more than once, you may
specify that the breakpoint be set:

 *  only at the nth occurrence (conditional breakpoint)

 *  at every occurrence (permanent breakpoint)

 *  at every nth occurrence, (permanent conditional breakpoint)

For example, to break the third time the program executes the instruction
at location 155:

     ?B 155:3                  (break the 3rd time 155 is executed)

Following this break, the breakpoint is cleared and no breaks will occur
in subsequent executions of location 155.

To break every time the program executes the instruction at 155, enter:

     ?B 155:@  or ?B 155:@ 1      (break each time 155 is executed)

This is a permanent breakpoint, indicated by @, and remains in effect
until the program terminates or the breakpoint is specifically cleared.

To break every third time the instruction is executed, enter:

     ?B 155:@ 3    (break every third time 155 is executed)


NOTE When a breakpoint is set, the program pauses in its execution before the instruction at the specified breakpoint location is executed.
DISPLAYING BREAKPOINTS All existing breakpoints are displayed by the following command: ?B@ In response, the system prints the logical segment number (LCST) and the P register location of each existing breakpoint. (Refer to item 3, Figure 3-3.) If a breakpoint is permanent, the @ symbol is displayed following the LCST and P values. The number of times the program loops through such a breakpoint is also displayed followed by a slash zero if the break is executed every time. For example: ?B 165+25:@ ?B@ LCST=0 , P=212 ,@1/0 If a conditional breakpoint is set, for instance to break every third time the statement at 165+ 25 is executed, this is indicated in the breakpoint display as follows: ?B 165+25:@3 ?B@ LCST=0 ,P=212 ,@3/0 Each time the statement at 212 is executed, the count is increased by one. When the breakpoint is taken, it is reduced to zero once again. If the breakpoint is not permanent, but a count was specified, the breakpoint is cleared after the break is executed on the nth pass through the statement. For instance, if a break on the third pass through location 212 is specified: ?B 165+25:3 At a break following the second execution of location 212, the breakpoint is displayed as: *BREAK* 0.262 ?B@ LCST = ,P=212 ,3/2 When the breakpoint at 212 is taken, the breakpoint is cleared: *BREAK* 0.212 ?B@ ? CLEARING BREAKPOINTS A breakpoint specified for one time only is cleared when execution resumes after the break has occurred. A permanent breakpoint is cleared only when the program terminates or the breakpoint is specifically cleared. For example, if the following breakpoints are set: ?B 165+ 12, 165+ 75, 74, 125 When the break at location 165+ 12 has been taken, that breakpoint is cleared. Similarly with each of the others. If breakpoints are permanent as specified in the following command: ?B 155:@, 175:@5 The breakpoint at each of these locations is cleared only when the program terminates. You may, however, clear any breakpoints that remain with the C command. For example, suppose the breakpoint at 165+ 12 has been taken, before resuming execution of the program, you can clear all the remaining breakpoints by entering: ?C@ If you only want to clear one of the remaining breakpoints, it must be explicitly specified, for instance, as: ?C 165+ 75 Several breakpoints may be cleared as follows: ?C 165+ 75,125 If you attempt to clear a breakpoint that has not been set, the command is ignored. RESUMING EXECUTION When you have displayed or modified at the current breakpoint, you can enter either R or E in order to resume execution. R with no parameters simply resumes execution at the current breakpoint location. (Refer to item 4, Figure 3-3.) You can resume and also set a new breakpoint with the R command. The breakpoint is specified in exactly the same way as in the B command, except that only one breakpoint can be specified with R. (Refer to item 4, Figure 3-3.) Another way to resume execution is by entering the E command with no parameters. Used in this way it produces the same effect as R with no parameters. (Refer to item 6, Figure 3-3.) With parameters E is used to delete values from the top-of-stack, S. This capability is illustrated in section 4 in the discussion of interactive use of :SETDUMP. E@ can be used to terminate a program executing in DEBUG mode. Used in this way, it is similar to pressing the BREAK key during normal program execution and then entering the :ABORT command. (Refer to item 7, Figure 3-3.)


MPE/iX 5.0 Documentation