HP OpenVMS Systemsask the wizard |
The Question is: Is it possible to generate a stack dump (traceback) directly, i.e. outside an error handler ? The Answer is :
If you are asking if it is possible to traverse the call frames,
yes, this is easily possible.
If you are asking about symbolizing the contents of the call
frames, this is more involved.
The easiest approach generally involves dynamically activating
the OpenVMS debugger under program control, and passing in the
necessary commands. See SS$_DEBUG in the debugger manual index
for details.
Here is an example of dynamically activating the debugger to
generate a traceback of calls:
#include <lib$routines.h>
#include <ssdef.h>
#include <string.h>
main()
{
char ascic_debug_commands[128];
char *dbgcmd = "*show calls;go;exit";
strcpy( ascic_debug_commands, dbgcmd );
ascic_debug_commands[0] = (char) strlen( dbgcmd ) - 1;
lib$signal(SS$_DEBUG,1,ascic_debug_commands);
return 1;
}
|