SpyClient.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Maxwell November 29, 1983 11:27 am
see SpyDoc.tioga for instructions on how to use this interface
Russ Atkinson (RRA) March 8, 1985 6:50:43 pm PST
DIRECTORY
AMModel USING [Section],
IO USING [STREAM],
PrincOps USING [PsbNull, PsbIndex],
Rope USING [ROPE];
SpyClient: DEFINITIONS = BEGIN OPEN Rope;
StackType: TYPE = CARDINAL [0..7);
DataType: TYPE = {CPU, process, breakProcess, pagefaults, allocations, wordsAllocated, userDefined};
common procedures
InitializeSpy: PROC [dataType: DataType ← CPU, process: PrincOps.PsbIndex ← PrincOps.PsbNull, spyOnSpyLog: BOOLFALSE] RETURNS [errorMsg: ROPE];
process is only used if dataType = process
spyOnSpyLog is used by DisplayData
errorMsg = NIL indicates success
StandardSpy: PROC = INLINE {IF InitializeSpy[].errorMsg # NIL THEN ERROR};
StartSpy: PROC;
the spy records data whenever # starts exceeds # stops
StopSpy: PROC;
you must StartSpy to enable breaks
DisplayData: PROC [cutoff: CARDINAL ← 3, herald: ROPENIL, stream: IO.STREAMNIL, spyOnSpyLog: BOOLFALSE];
... displays data (automatically stops Spy); cutoff gives cutoff of printing (in percentage points); herald is the client supplied herald (follows Cedar Spy of xxx); a typescript is opened if stream = NIL
break procedures
SetStartBreak: PROC [section: AMModel.Section ← NIL, procedure: ROPENIL, sourceIndex: INT ← 0] RETURNS [ok: BOOL, msg: ROPE];
... sets a breakpoint that will start Spying whenever the breakpoint is encountered. procedure is of form "ModuleIMPL.Proc" & is only used if section = NIL; if sourceIndex # 0, then treat `procedure' as a filename.
SetStopBreak: PROC [section: AMModel.Section ← NIL, procedure: ROPENIL, sourceIndex: INT ← 0] RETURNS [ok: BOOL, msg: ROPE];
... sets a breakpoint that will stop Spying whenever the breakpoint is encountered. procedure is of form "ModuleIMPL.Proc" & is only used if section = NIL (breakpoint is set at the RETURN); if sourceIndex # 0, then treat `procedure' as a filename.
ClearBreaks: PROC;
clears all stop and start breaks
SetUserBreak: PROC [section: AMModel.Section ← NIL, type: StackType ← 0, procedure: ROPENIL, sourceIndex: INT ← 0] RETURNS [ok: BOOL, msg: ROPE];
log a count whenever this break is encountered; type allows the user to distinguish breaks; procedure is of form "ModuleImpl.Proc"; only used if section = NIL; if sourceIndex # 0, then treat `procedure' as a filename
SetTrace: PROC [section: AMModel.Section ← NIL, procedure: ROPENIL, sourceIndex: INT ← 0] RETURNS [ok: BOOL, msg: ROPE];
sets a break such that Spy writes a trace on the spy log whenever this break is encountered; procedure is of form "ModuleImpl.Proc"; only used if section = NIL; if sourceIndex # 0, then treat `procedure' as a filename
ClearUserBreaks: PROC;
clears all stop and start breaks; clears the traces, too.
END. .