HPlogo System Debug Reference Manual > Chapter 3 System Debug Interface Commands and Intrinsics

HPSETDUMP Intrinsic

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Arms a call to Debug which takes place during abnormal process termination.

Callable from: NM

Syntax



   HPSETDUMP (status, cmdstr);

Parameters


status

32-bit signed integer (optional)

The status returned by the HPSETDUMP intrinsic call. The variable is a record containing two 16-bit fields, with the error number in the high-order 16 bits and the intrinsic subsystem number in the low-order 16-bits.

cmdstr

character array (optional)

A packed array of characters (up to 255 bytes) that contains the DEBUG commands to be executed if the process aborts. The first character in the array is recognized as the command delimiter. The last character in the command string must be immediately followed by the same delimiter.

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.

Condition Codes


This intrinsic does not return meaningful condition code values. Status information is returned in the optional status parameter described above.

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;




HPRESETDUMP Intrinsic


RESETDUMP Intrinsic