UNSAFE INTERFACEThis interface defines the low-level routines used to traverse the runtime stack. Not all platforms support these routines.RTStack ; IMPORT RTMachine;
CONST Has_walker = RTMachine.Has_stack_walker;
Indicates whether this platform has a stack walker. IfHas_walker
isFALSE
, it is a checked runtime error to call any of the routines described below.
TYPE Frame = RTMachine.FrameInfo;
A machine-dependent type that minimally includes fields namedpc
andsp
.
<*EXTERNAL "RTStack__GetThreadFrame" *> PROCEDURE GetThreadFrame (VAR(*OUT*) f: Frame; start: ADDRESS; len: INTEGER);
Return in f
the frame of the thread whose machine state is in bytes
[start .. start+len). Returns with f.pc=NIL on failure.
<*EXTERNAL "RTStack__CurFrame" *> PROCEDURE CurrentFrame (VAR(*OUT*) f: Frame);
Return in f
the frame of its caller. Returns with f.pc=NIL on failure.
<*EXTERNAL "RTStack__PrevFrame" *> PROCEDURE PreviousFrame (READONLY callee: Frame; VAR(*OUT*)caller: Frame);
Return incaller
the stack frame that calledcallee
. Returns with pc = NIL ifcallee
is the first frame on the stack or its predecessor is ill-formed.
<*EXTERNAL "RTStack__Unwind" *> PROCEDURE Unwind (READONLY f: Frame);
Restore the machine state back to the framef
. All callee-saved registers must be restored to the state they were in when framef
made its last call. Note that if the unwind operation encounters a signal handler frame, it must also restore the caller-saved registers.
<*EXTERNAL "RTStack__ProcName" *> PROCEDURE ProcName (READONLY f: Frame): ADDRESS;
Return the null-terminated constant string that names the procedure
corresponding to the stack frame f
. Returns NIL if no name is
known.
END RTStack.