[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

165.0. "Image Traceback" by CASHEW::JBATES () Wed Oct 09 1985 15:26

I need a solution to the following problem. I am trying to collect certain
information that is available within a VMS image. The information I need is
displayed when you execute the SHOW CALL command within DEBUG. I know that I
can get the information to the screen by doing a call to the system service
LIB$SIGNAL and specifying an error code to trigger a traceback. What I want to
be able to do is to interrigate the data structure and extract the information
for use within the program. I don't want to capture the information in a file
or define SYS$OUTPUT or SYS$ERROR to a mailbox. 

Any Ideas? 

Anybody know how LIB$SIGNAL or SHOW CALL does it?


				John
T.RTitleUserPersonal
Name
DateLines
165.1DVINCI::FISHERWed Oct 09 1985 16:418
I don't know the answer for sure, but I would start looking at the format
of the procedure frame pointed at by the frame pointer.  These are all linked
together so you follow back through to the main program.  I just don't know
if the actual name is stored in there.  I suspect maybe not, since the debugger
has to load some information (set module) in order to get the routine names.

Burns

165.2TOOLS::STANWed Oct 09 1985 21:054
You get the PC's by following the chain of call frames back.
And, no, the symbolic names are not stored there.
To get these, you have to read the DEBUG symbol table
information.
165.3CASHEW::JBATESThu Oct 10 1985 14:0013
Re: .1 & .2

The information I need seems to be included by the linker if the /TRACEBACK
qualifier is enabled. I can get it to the screen by calling LIB$SIGNAL(40).
It doesn't matter if it is linked with DEBUG or not. I had previously chained 
back through the call frame and got the PC but couldn't find any pointers to 
the other TRACEBACK information.

Is there an offset from something in the call frame that points to the Module
name, routine name, and source line number? 


				John
165.4KOBAL::GILBERTThu Oct 10 1985 18:0639
No, this information IS NOT stored in the call frame, since that would slow
down most applications, even those that don't need tracebacks (like DIRECTORY,
or SHOW or your favorite compiler).

If traceback information is available (and/or enabled) in your image,
the image activator calls a system routine that remembers how to find
the image file (and hence the traceback information) when it's needed;
I believe it does this by hanging onto the channel number to the image.
It also establishes a condition handler on the stack.

When this condition handler is invoked (by standard means of invoking
a condition handler) for a W, E, or F-level signal, it maps the traceback
facility into memory, and calls it.   The traceback facility reads the
traceback information from the image file to produce the traceback display,
which is written to SYS$OUTPUT.  The traceback information can be used to
re-symbolize some of the PCs that are found when trapsing back through the
stack frames.

The interface to the traceback facility is undocumented, as is the format
of the traceback information, and the debugger information.  The format
of an executable image is only modestly described in the VAX/VMS Internals
and Data Structures manual.  With patience and some guesswork and a copy
of STARLET and LIB (the VMS fiche would help, too), you should be able to
get what you want to work (at least until the next major release of VMS,
since this stuff *has* changed before, and may change again).

If this were easy, or particularly useful, someone would've done it already.
Why are you interested in producing a re-symbolization of the traceback?
The traceback provided by VMS is useful, and a link map can also be a great
help in tracking down any problems in programs that are linked sans Debug.

Also, you could link the program *with* Debug, and use a hack program to
zap the image header so it looks like it's NoDebug.  The information will
still be in the image file (if you need it), but the image won't start up
in the Debugger.

I hope this information helps direct your efforts to worthwhile persuits.

					- Gilbert