Arms a call to Debug which takes place during abnormal process
termination.
Discussion |
 |
The HPSETDUMP intrinsic enables automatic execution of a set
of Debug commands when a process terminates abnormally (aborts).
This intrinsic affects the current process, child process, and any
generation grandchild processes subsequently created by the calling process.
That is, the Setdump attribute and cmdstr is inherited by any new child process and all generations
thereafter.
Debug executes the commands in cmdstr and sends the output to the standard list file ($STDLIST). Any commands which require input generate an
error message.
If the process that aborts is being run from a job, the process
terminates after executing the command string. If the process is
being run from a session, then after the specified command string
has been executed, Debug stops to accept interactive commands with
I/O performed at the user terminal, contingent upon the following
requirements:
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 (refer to the XARITRAP and XCODETRAP intrinsics).
 |
 |  |
 |
 | NOTE: CM programs usually fail these tests. |
 |
 |  |
 |
Once Debug accepts interactive input, the user is free to
enter any Debug command. The user may choose to resume the process
or have it terminate (see the CONTINUE command in chapter 4).
If the cause of the abort is a stack overflow, the command
list is ignored and a stack trace is sent to $STDLIST, after which the process is terminated with no
interactive debugging allowed.
Refer to the MPE/iX Intrinsics Reference Manual for
additional discussion of this intrinsic.
Example |
 |
Assume that a file called ABORTCMD contains a set of Debug commands to be used when
a process abort occurs.
A process abort in the following procedure opens a list file,
performs a stack trace, executes the commands from the use file,
and closes the list file:
PROCEDURE myproc{}; VAR status : integer; debug_cmds : string[255]; BEGIN debug_cmds := '\list errfile;tr,dual;use abortcmd;list close\'; hpsetdump(status, debug_cmds); IF (status <> 0) THEN error_routine(status, 'HPSETDUMP'); . . <code in this area is protected with the "setdump" facility> . hpresetdump(status); IF (status <> 0) THEN error_routine(status, 'HPRESETDUMP'); END; |