[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Generating a traceback? (stackdump)

» close window

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;
    }
 
 

answer written or last revised on ( 4-FEB-2002 )

» close window