HPlogo System Debug Reference Manual > Chapter 6 System Debug Command Specifications M - X

TRAP

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4
E0300 Edition 3 ♥
E0692 Edition 3

Debug only

Arms/disarms/lists various traps that are monitored by Debug.

Syntax



   TRAP [LIST]
   TRAP [trap-name] [option]

Parameters


trap-name

Traps can be classified into several classes. The trap names for each class are presented together. In general, this parameter specifies which trap to arm, disarm, or list. Only enough characters to make the name recognizable are required.

Hardware Traps

These are traps that are documented in the Precision Architecture Control Document (ACD). They are trapped directly by the hardware.

BRANCH

The BRANCH trap is the taken branch trap. Any time a branch instruction is executed the debugger stops.

MPE/iX X-Traps

These traps correspond to the MPE/iX user intrinsics of similar name. (Refer to the MPE/iX Intrinsics Reference Manual for descriptions of the each of these traps.) By arming these traps, the debugger obtains control of the process before the system trap mechanism. You may have the system ignore the trap (pretend it never happened) or process it as if the debugger had not been notified.

To have the trap ignored use the C[ontinue] IGNORE command.

Typing C[ontinue] or C[ontinue] NOIGNORE causes the trap subsystem to process the trap as if Debug has not been notified.

XARITHMETIC

The trap mask indicating the cause of the trap is displayed.

XCODE

The code trap number is displayed.

XLIBRARY

Not implemented.

XSYSTEM

Not implemented.

Refer to the MPE XL Intrinsics Reference Manual (32650-90028) for a description of the format of the various trap masks and codes displayed by Debug when one of the above traps is encountered.

Trace Traps

The currently defined trace events are based on compiler generated breakpoints. These breakpoints are inserted into the code by the compilers only if the symbolic debug compiler option is used. If the debugger arms any of these events, it stops at the indicated event.

BEGIN_PROCEDURE

Stop at the entry to procedure.

END_PROCEDURE

Stop at the exit from procedure.

LABELS

Stop at all labels.

STATEMENTS

Stop at each source statement (requires compiler support).

EXIT_PROGRAM

Stop at the program exit point.

ENTER_PROGRAM

Stop at the program entry point.

TRACE_ALL

All of the trace events.

option

Three options are supported. If none is given, LIST is assumed.

LIST

List the current setting of the trap(s).

ARM

Arm the indicated trap(s).

DISARM

Disarm the indicated trap(s).

Examples



   $nmdebug > trap list
   XLIBRARY         DISABLED
   XARITHMETIC      DISABLED
   XSYSTEM          DISABLED
   XCODE            DISABLED
   BRANCH           DISABLED
   BEGIN_PROCEDURE  DISABLED
   END_PROCEDURE    DISABLED
   LABELS           DISABLED
   STATEMENTS       DISABLED
   ENTER_PROGRAM    DISABLED
   EXIT_PROGRAM     DISABLED

List the status of all the defined traps (initial status is disabled).

   $nmdebug > trap branch arm

Arm the branch taken trap and the arithmetic traps.

   $nmdebug > trap
   XLIBRARY         DISABLED
   XARITHMETIC      DISABLED
   XSYSTEM          DISABLED
   XCODE            DISABLED
   BRANCH           DISABLED
   BEGIN_PROCEDURE  DISABLED
   END_PROCEDURE    ARMED
   LABELS           DISABLED
   STATEMENTS       DISABLED
   ENTER_PROGRAM    DISABLED
   EXIT_PROGRAM     DISABLED

Show the status of the traps.

   $nmdebug > c
   Branch Taken at: 6a8.00005d84 processstudent+$60
    to: 6a8.000056b8 lr_wa_10

   $nmdebug > c
   Branch Taken at: 6a8.00005708 lr_wa_1+$8
    to: 6a8.00005d88 processstudent+$64

   $nmdebug > c
   Branch Taken at: 6a8.00005d94 processstudent+$70
    to: 6a8.00005990 ?_start+$3c

   $nmdebug > c
   Branch Taken at: 6a8.000059ac ?_start+$58
    to: a.fff7b004

   $nmdebug > c
   Branch Taken at: a.fff7b024
    to: 730.00015c6c ?average

The above example shows the use of the branch taken trap. Every time any form of branch instruction is executed, Debug stops just before the branch occurs.

 $nmdebug > trap xari arm
 $nmdebug > trap xari list
 XLIBRARY         ARMED

 $nmdebug > c
 XARI Trap at: 730.00015d38 average+$b0
 trap mask = 00000002

 $nmdebug > wl pc,#13
 GRP $730.15d38
 $nmdebug > dc pc-20,#13
 GRP $730.15d18
 00015d18 average+$90 b6b60802 ADDIO 1,21,22
 00015d1c average+$94 6bd63f81 STW   22,-64(0,30)
 00015d20 average+$98 e81f1f77 B,N   average+$58
 00015d24 average+$9c 20000009 ** Stmt  9
 00015d28 average+$a0 4bc13ee9 LDW   -140(0,30),1
 00015d2c average+$a4 b4390fff ADDIO -1,1,25       /* Trap occurred in
 00015d30 average+$a8 ebff0595 BL    divoI,31      /* <-- this routine.
 00015d34 average+$ac 4bda3f89 LDW   -60(0,30),26
 00015d38 average+$b0 4bdf3ed9 LDW   -148(0,30),31 /* <-- PC is here
 00015d3c average+$b4 6bfd0000 STW   29,0(0,31)
 00015d40 average+$b8 e840c000 BV    0(2)
 00015d44 average+$bc 37de3f31 LDO   -104(30),30

 $nmdebug > dr r29
 R29=$0

 $nmdebug > mr r29 4
 R29=$0 := $4

 $nmdebug > c ignore

The above example starts by arming the XARI trap. The process is allowed to run. During execution, an arithmetic trap was detected. Debug stops to allow the user to inspect the state of the process. After viewing the code, it can be seen that the trap occurred in the divoI millicode routine. By analyzing the trap mask it is determined that the trap was caused by attempting to divide by zero. The millicode divide routine returns the result of its operation in general register 29.

After looking at the source code, the bug in the program was discovered. It was determined that at this point in process execution, the result of the divide should have been "4". The millicode return register is updated with the correct value. The continue command with the IGNORE option is issued to resume the process as if the trap never happened. (If the IGNORE option had been specified, the process would have been terminated by the trap subsystem.)

Limitations, Restrictions


The XLIBRARY and XSYSTEM trace traps are not implemented.




TR[ACE]


UF