From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX"  3-FEB-1993 21:22:24.37
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: forcing Traceback output

In article <1993Jan27.234409.13431@nntpd.lkg.dec.com>,
jnelson@gauche.zko.dec.com (Jeff E. Nelson) writes:

> In article <86657@ut-emx.uucp>, pso@phobos.as.utexas.edu (P Samuel
> Odoms) writes:
> |>Is there a way to force the traceback handler to get control, at any
> |>time during the execution of an image, to print out the current stack
> |>information?  I should add that I'm hoping there is something
> |>analogous to LIB$SIGNAL(SS$_DEBUG).  I don't want my image to
> |>abort execution, though; it should be able to resume where it left off.
> 
> Yes, this is possible if the following conditions are met:
> 
> 1. The program calls lib$signal with an -informational- message. You'll have
>    to invent your own, since there isn't a default one available. Inventing
>    your own is a good idea anyway, since you can inform your user that what
>    follows is expected, e.g.,
> 
>         %FOOBAR-I-TRACEBACK, forcing a traceback now
> 
> 2. The program's exception handlers (if any) must RESIGNAL this informational
>    message. If any exception handler handles the exception, then
>    traceback will never get a chance to see it.
> 
> 3. The program is compiled with the default switch of /DEBUG=TRACEBACK.
> 
> 4. The program is linked with the default switch of /TRACE.
> 
> 5. The program is not run with /DEBUG. TRACE can't be activated if the debugger
>    is already running.

At our site we use PL/1 (does anybody else in the world? :-} ). I've tried
following Jeff's conditions, but no traceback dump. We have several message
handlers which receive and send messages to/from other processes. It is
important that they keep going, so we have a condition handler like this:

  on finish;

  on anycondition
    begin;
      if oncode() = SS$_OPRABORT
      then
        goto end_pgm;
      else
        do;
          call LOG_ERROR;  /* write error to log file */
          goto main_loop;  /* reset and start again */
        end;
    end;

Currently, our LOG_ERROR routine uses SYS$PUTMSG to write the error to the
log file, and then writes a traceback of call frame PC addresses. To find
the location of the error, we then need to compile the source with machine
language and search for the appropriate PC address.

Is there a way to access the traceback symbol information from within a
program, or at least to execute a traceback dump from a PL/1 program
without exiting the program?

-------------------------------------------------------------------/\/\---
Ken Bosward, Analyst/Programmer, Process & Engineering Section    / / /\
             BHP Information Technology, Wollongong. Australia   / / /  \
Mail      :  P.O. Box 261, Warrawong 2502                       / / / /\ \
Telephone :  +61 42 755219    Fax: +61 42 755215                \ \/ / / /
Internet  :  webosk@itwol.bhp.com.au                             \  / / /
------------------------------------------------------------------\/\/\/--