Subject: | |
From: | |
Reply To: | |
Date: | Mon, 22 May 1995 17:35:53 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Dan writes:
> I'm attempting to modify some legacy code in SPL to catch traps and dump
> relevant debugging information in the case the code crashes. This works fine
...
> Is there a way to do code-related traps from SPL? E.g. I would like to trap
> memory protection traps, etc. Or am I simply asking too much of SPL?
Yes, try the undocumented XCODETRAP. It's been around since MPE IV days.
SPL calling sequence:
integer
old'plabel;
...
Procedure xcodetrap (new'plabel, old'plabel);
value new'plabel;
integer new'plabel, old'plabel;
option external;
...
procedure my'codetrap'handler;
begin
...
end;
...
xcodetrap (@my'codetrap'handler, old'plabel);
Unlike control-Y's, I don't remember what parameters (if any) are
passed into the user's trap handler...and therefore don't recall
what odd-ball stack manipulations might be necessary to exit a
user codetrap handler. (Sorry)
Some *old* MPE/V code I just found (thanks to the MAGNET Nugget), shows:
procedure arm'stack'trace(abort); <<stack>>
value abort; integer abort;
begin
integer p=q-2, old;
genmsgu(4,abort);
stack'trace(0);
xcodetrap(0,old);
p := p - 1; <<retry instruction>>
end;
Note: (1) I didn't write the above code; (2) I don't know if it works;
(3) it was probably given to me more than 10 years ago by someone in
HP's compiler lab.
The NM xcodetrap is similar, except both parameters are 32-bit integers
AND I'm not sure it works if you've armed any POSIX signals....but it
used to work fine prior to MPE/iX 5.0
BTW, XCODETRAP was actually documented by HP for a very short time, in
the first-ever MPE XL Trap Handling manual...then they dropped it,
for unknown reasons.
SS
|
|
|