DIRECTORY AMModel USING[ Section ], AMTypes USING[ TV ], Rope USING[ ROPE ], WorldVM USING[ Address, World ]; AMEvents: DEFINITIONS = BEGIN World: TYPE = WorldVM.World; EventProc: TYPE = PROC[data: REF ANY, event: Event] RETURNS[outcome: Outcome]; Event: TYPE = REF EventRec; Eventuality: TYPE = { break, call, signal, unknown }; EventRec: TYPE = RECORD[ world: World _ NIL, -- world requesting the debugger session: INT _ 0, -- monotonic, incremented at StopEvents or when world boots process: AMTypes.TV _ NIL, -- process requesting the debugger frame: AMTypes.TV _ NIL, -- local frame requesting the debugger worry: BOOLEAN _ FALSE, -- TRUE => don't try to call client procedures -- detail: SELECT type: Eventuality FROM break => [id: BreakID, clientData: REF ANY], call => [msg: Rope.ROPE], signal => [signal, args: AMTypes.TV ], unknown => [why: Rope.ROPE], -- client bug; psbi and frame are valid. ENDCASE]; Outcome: TYPE = RECORD[ SELECT type: * FROM proceed => [result: AMTypes.TV], quit => NULL, retry => [frame, result: AMTypes.TV], returnFrom => [frame, result: AMTypes.TV], ENDCASE] _ [proceed[NIL]]; GetEvents: PROC[world: World, data: REF ANY, proc: EventProc]; StopEvents: PROC[world: World]; Debugging: --INFORMATIONAL-- SIGNAL; Debugged: --INFORMATIONAL-- SIGNAL; -- "Debugging" is raised in a process when it is about to be suspended for an event -- -- "Debugged" is raised in a process when the EventProc returns -- BootedNotifier: TYPE = PROC[world: WorldVM.World, session: INT, clientData: REF]; RegisterBootedNotifier: PROC[proc: BootedNotifier, world: WorldVM.World _ NIL, clientData: REF _ NIL]; UnRegisterBootedNotifier: PROC[proc: BootedNotifier, world: WorldVM.World _ NIL, clientData: REF _ NIL]; WorldSwapLocalSignals: PROC[BOOL]; CallDebugger: PROC[msg: Rope.ROPE]; -- Breakpoints -- BreakID: TYPE = REF BreakRec; BreakRec: TYPE; BreakAt: PROC[world: World, section: AMModel.Section, clientData: REF ANY] RETURNS[id: BreakID]; BreakAfter: PROC[world: World, section: AMModel.Section, clientData: REF ANY] RETURNS[id: BreakID]; FrameBreak: PROC[gf: AMTypes.TV, pc: CARDINAL, clientData: REF ANY] RETURNS[id: BreakID]; -- OctalBreak(1): Sets breakpoint at specified byte relative to "gf"s codebase -- SetBreak: PROC[world: World, addr: WorldVM.Address, pc: CARDINAL, clientData: REF ANY] RETURNS[id: BreakID]; ClearBreak: PROC[id: BreakID]; NextBreak: PROC[world: World, prev: BreakID] RETURNS[id: BreakID, clientData: REF ANY]; -- Procedure invokation -- Apply: PROC[control, args: AMTypes.TV] RETURNS[result: AMTypes.TV]; BadControlLink: ERROR; -- "control" had wrong type class BadArgType: ERROR; -- type of "arg" # range of type of "control" BadResStack: ERROR; -- result stack size was incorrect. EndSession: ERROR; -- debuggee was booted (or StopEvents was called) instead of returning. Kill: SAFE PROC[world: World]; Screen: SAFE PROC[world: WorldVM.World]; END. ÚCedar Abstract Machine: interactions with client AMEvents.mesa Andrew Birrell September 20, 1983 3:25 pm Paul Rovner July 20, 1983 12:42 am "data" is as passed to "GetEvents". An EventProc is called whenever something interesting happens in the client world. Returning from the event allows the client process to proceed, as specified by outcome.type: quit => raise ABORTED in victim process proceed => depending on the event.type: breakpoints => execute saved byte and continue (result=NIL) explicit call => return from the call (result=NIL) signals => RESUME[result] retry => redo the call that caused specified local frame, with given arguments. returnFrom => return control from specified local frame, with given result. NOTE: These are raised as "informational" signals: clients may catch them, but must not jump out of their catch-phrase. The signaller will resume them. registered "BootedNotifiers" are called at end of a client session. This occurs when StopEvents is called for that world, or when AMEventsImpl notices that the debuggee has been booted. All events for which "session" is <= the given "session" should return (their result will be ignored). At end of session, all outstanding calls of "Apply" for that debuggee are terminated by raising the "EndSession" signal. worldName = NIL causes proc to be called for all booted events clientData = NIL implies wildcard match on clientData ditto for world Iff the last call of this procedure has argument "TRUE", signals in the local world will be sent to the world-swap debugger instead of being reported locally. Cause a local "call" event. If someone is handling local events, this will debug without a world-swap, otherwise it will world-swap. Note that DebuggerSwap.CallDebugger will always cause a world-swap. Multiple breaks at one place are illegal. Sets breakpoint at beginning of the section (statement or procedure). Sets breakpoint at end of the section (procedure only). OctalBreak(2): Sets breakpoint at specified byte. "addr" is typically a codebase. Enumerator for breakpoints. Starts and ends with NIL. Returns the currently set breakpoints in most-recent-first order. If "world" is NIL, returns breakpoint in any world. "control" may have class "procedure", "signal" or "error", corresponding to procedure calls or raising a signal or error. Error's are treated the same as signals. This may raise BadControlLink, BadArgType, BadResStack or EndSession. Currently, calls TemporaryBooting.BootButton[] in client world. ʘJšœ0™0Jšœ ™ Jšœ*™*Jšœ#™#J˜šÏk ˜ Jšœœ ˜Jšœœœ˜Jšœœœ˜Jšœœ˜ —J˜Jšœ œ˜J˜Jš˜J˜Jšœœ˜J˜š Ïn œœœœœœ˜NšœÕ™ÕJšœ'™'šœ'™'Jšœ;™;Jšœ2™2Jšœ™—JšœO™OJšœK™K—J˜—Jšœœœ ˜J˜šœ œ˜J˜J˜—šœ œœ˜JšœœÏc ˜4Jšœ œŸ;˜MJšœœŸ"˜=JšœœŸ&˜?JšœœœŸ1˜Išœœ˜%Jšœ#œœ˜,Jšœœ˜Jšœ!œ˜&JšœœŸ(˜EJšœ˜ J˜——šœ œœ˜šœ ˜Jšœœ˜!Jšœ œ˜Jšœ#œ˜'Jšœ&œ˜*—Jšœ œ˜J˜—Jšž œœœœ˜>J˜Jšž œœ˜J˜Jšœ Ÿœœ˜$šœ Ÿœœ˜#JšŸV˜VJšŸB˜BJšœW™WJšœ@™@J˜—š žœœœ œœ˜QJšœœ™œ—J˜š Ðbnœœ.œœœ˜fJšœ>™>—J˜š  œœ.œœœ˜hšœ5™5Jšœ™—J˜—šžœœœ˜"JšœS™SJšœJ™JJ˜—šž œœ œ˜#JšœY™YJšœU™UJšœ™J˜J˜J˜—JšŸ˜J˜J˜Jšœ)™)J˜Jšœ œœ ˜J˜Jšœ œ˜J˜šžœœ5œœ˜JJšœ˜JšœE™EJ˜—šž œœ5œœ˜MJšœ˜Jšœ7™7J˜—š ž œœ œœœœ˜CJšœ˜JšŸQ˜QJ˜—š žœœ*œœœ˜VJšœ˜JšœR™RJ˜—Jšž œœ˜J˜š ž œœœœœ˜WJšœ2œTœ"™®—J˜J˜J˜JšŸ˜J˜J˜š žœœœœœ˜CJšœê™êJ˜—JšœœŸ!˜8Jšœ œŸ-˜@Jšœ œŸ#˜7Jšœ œŸG˜ZJ˜šžœœœ˜Jšœ?™?—J˜Jšžœœœ˜(J˜Jšœ˜J˜—…— €u