HP 3000 Manuals

STACKDUMP intrinsic [ System Debug Reference Manual ] MPE/iX 5.0 Documentation


System Debug Reference Manual

STACKDUMP intrinsic 

Produces a full stack trace.

Callable from:  NM, CM

Syntax 

     STACKDUMP (filename, idnumber, flags, selec);

Parameters 

filename         Byte array (optional) 

                 An array of characters giving the file name of a new
                 output file to be opened.  The name should be terminated
                 by any nonalphanumeric character except a slash (/) or
                 a period (.).  The same restrictions for the
                 formaldesignator parameter in the FOPEN intrinsic apply
                 to this parameter.

idnumber         16-bit integer (optional) 

                 If the intrinsic fails due to a file system error, the
                 file system specific error number of the failure is
                 returned here.  Any value passed into the intrinsic
                 through this parameter is ignored.

flags            16-bit unsigned integer (optional) 

                 This parameter is provided for compatibility with MPE V.
                 If it is present in the intrinsic call, it is ignored
                 and has no effect.

selec            32-bit integer array by reference (optional) 

                 This parameter is provided for compatibility with MPE V.
                 If it is present in the intrinsic call, it is ignored
                 and has no effect.

Discussion 

The STACKDUMP intrinsic calls Debug to send a stack trace to the standard
list file ($STDLIST) or to a new file named in the filename parameter.
Control then returns to the calling procedure.

Refer to the MPE XL Intrinsics Reference Manual (32650-90028) for
additional discussion of this intrinsic.

Condition Codes 

CCE              Request granted.

CCG              Request denied.  An invalid address for the location of
                 the filename parameter was detected.

CCL              Request denied.  File system error occurred during
                 opening or closing of the file.  The specific file
                 system error number is returned in the idnumber 
                 described above.

Examples 

The following example is a code fragment from a Pascal program.  First,
it prints out the error status and intrinsic name that were passed as
parameters.  Next, it calls the STACKDUMP intrinsic to produce a stack
trace.  Finally, the process is terminated with a call to the TERMINATE
intrinsic.

     PROCEDURE error_routine(status : integer;     { error status }
                             proc   : proc_str);   { Intrinsic name that failed }

        procedure STACKDUMP; intrinsic;
        procedure TERMINATE; intrinsic;

        BEGIN
           writeln(proc, ' returned error status of ', status);

           stackdump;

           terminate;
        END;

The next example prompts the user for a file name and then calls the
STACKDUMP intrinsic to print a stack trace to the specified file.

     PROCEDURE show_stack;

        VAR fname : string[80];

        procedure STACKDUMP; intrinsic;

        BEGIN
           prompt('Print stack trace to which file: ');
           readln(fname);

           fname := fname + ' ';     { Add terminator character }

           stackdump(fname);
        END;



MPE/iX 5.0 Documentation