  Generating a traceback? (stackdump) 
 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 &lt;lib$routines.h&gt;
#include &lt;ssdef.h&gt;
#include &lt;string.h&gt;
 
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 
