Debug may be invoked directly or indirectly: directly from
the CI of a session, or from an intrinsic call within a program;
indirectly through arming a call to Debug in the case of a process abort.
The MPE/iX CI commands are identical to the MPE V commands,
with the exception that the user may specify an optional command
string to be passed to Debug when it is invoked. The following is
a list of the available MPE/iX CI commands and their syntax:
All intrinsics can be called from NM with the exception of STACKDUMP'.
This intrinsic is not supported in native mode
and is found only in the CM intrinsic file. Only those intrinsics available
in MPE V are callable by the CM user. The following table summarizes
which intrinsics are callable from compatibility mode (CM) and native mode (NM):
Callable From
Intrinsic Name
CM/NM
DEBUG
CM/NM
RESETDUMP
CM/NM
SETDUMP
CM/NM
STACKDUMP
CM
STACKDUMP'
NM
HPDEBUG
NM
HPRESETDUMP
NM
HPSETDUMP
Note that no HPSTACKDUMP intrinsic is present. It is intended that the
user call HPDEBUG to produce a custom stackdump when desired.
Direct Calls
If you want to invoke Debug from the CI of the current session, use the
DEBUG command. This command is implemented through intrinsics.
The CI simply calls the DEBUG or HPDEBUG intrinsic. Note
that this command requires privileged mode (PM) capability.
Debug may also be invoked with the HPDEBUG/DEBUG intrinsic calls from
within any program. Native
mode programs enter Debug assuming that the user will be viewing
the native mode environment (program, stack, registers); this is
referred to as NM Debug. Compatibility mode programs enter Debug
assuming that the user will be viewing the compatibility mode environment;
this is called CM Debug.
Process Abort Calls
You may arm a call to Debug which occurs in the event of a
process abort. The call may be armed by:
The SETDUMP command.
The SETDUMP intrinsic.
The HPSETDUMP intrinsic.
Once a SETDUMP command or intrinsic has been issued, all new processes
created are affected. Both the setdump attribute and the DEBUG command
string are inherited by new child processes. This feature may be disarmed by
the following:
The RESETDUMP command.
The RESETDUMP intrinsic.
The HPRESETDUMP intrinsic.
If the Debug process abort call has not been armed through one of the
SETDUMP interfaces, and a process abort occurs, an abbreviated
stack trace is produced. This abbreviated trace shows only the most
recently called procedure in the program file and in each library
being used. This is done for both the CM and NM stacks.
The following is an example of a CM program aborting without invocation
of SETDUMP.
:run cmbomb
**** PROGRAM ERROR #4 :INTEGER DIVIDE BY ZERO
ABORT: CMBOMB.DEMO.TELESUP
**** PROCESS ABORT TRACE ****
NM SYS a.006d7798 dbg_abort_trace+$30
CM SYS % 27.261 SWITCH'TO'NM'+4 SUSER1
CM PROG % 0.1215 TEST_ARITH_TRAP+24 SEG'
PROGRAM TERMINATED IN AN ERROR STATE. (CIERR 976)
:
The following example is the same as above except that the
code was compiled with a native mode compiler.
:run nmbomb
**** Integer divide by zero (TRAPS 30)
ABORT: NMBOMB.DEMO.TELESUP
**** PROCESS ABORT TRACE ****
NM PROG 191.00006b20 test_arith_trap+$28
PROGRAM TERMINATED IN AN ERROR STATE. (CIERR 976)
:
If the SETDUMP command (or intrinsic) is invoked before running
this program, a full dual stack trace and a register dump is produced
when the process aborts. Consider the following example:
Note that in the above example, the user is left in Debug.
At this point, the user is able to enter any Debug command. The
process may even be resumed (see the CONTINUE command in chapter 4).
It is possible to specify what action should be taken when
a process aborts by providing a list of commands for Debug to execute.
In the following example, a simple message is printed if the process
aborts.
:setdump ;debug="wl 'Oh my, our process is aborting !'":run cmbomb
**** PROGRAM ERROR #4 :INTEGER DIVIDE BY ZERO
ABORT: CMBOMB.DEMO.TELESUP
**** PROCESS ABORT STACKDUMP FACILITY ****
Oh my, our process is aborting!
PROGRAM TERMINATED IN AN ERROR STATE. (CIERR 976)
:
Notice that the user was not left in Debug after the command
string was executed. In order to be left in Debug, several criteria
must first be met:
The abort did not occur while in system code, and
The process entered the abort code through a native mode
interrupt. Such aborts are typically caused by arithmetic and
code-related traps (see the XARITRAP and XCODETRAP
intrinsics).
Most CM programs fail these checks and are returned to the
CI without entering Debug.
The SETDUMP functionality is also accessible programmatically with the
SETDUMP and HPSETDUMP intrinsics. Refer to the following
pages for detailed descriptions and examples.
Chapter 3 System Debug Interface Commands and Intrinsics