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. If
FALSE, 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 named
<*EXTERNAL "RTStack__GetThreadFrame" *> PROCEDURE GetThreadFrame (VAR(*OUT*) f: Frame; start: ADDRESS; len: INTEGER);
fthe 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);
fthe frame of its caller. Returns with f.pc=NIL on failure.
<*EXTERNAL "RTStack__PrevFrame" *> PROCEDURE PreviousFrame (READONLY callee: Frame; VAR(*OUT*)caller: Frame);
callerthe stack frame that called
callee. Returns with pc = NIL if
calleeis 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 frame
f. All callee-saved registers must be restored to the state they were in when frame
fmade 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.