DIRECTORY Breakpoint, BreakpointPrivate, BreakWorldArchitecture, RefTab, Rope, Shepherd, TargetArchitecture; BreakpointImpl: CEDAR PROGRAM IMPORTS Breakpoint, BreakpointPrivate, BreakWorldArchitecture, RefTab, Rope EXPORTS Breakpoint, BreakpointPrivate, BreakWorldArchitecture ~ { BreakAccess: PUBLIC TYPE ~ Breakpoint.BreakAccess ¬ Breakpoint.nullBreakAccess; BreakAccessRep: PUBLIC TYPE ~ Breakpoint.BreakAccessRep; BreakAccessData: PUBLIC TYPE ~ REF BreakAccessDataRep ¬ Breakpoint.nullBreakAccessData; BreakAccessDataRep: PUBLIC TYPE ~ RECORD [ breakTable: RefTab.Ref ¬ NIL ]; Break: PUBLIC TYPE ~ REF BreakRep ¬ Breakpoint.nullBreak; BreakRep: PUBLIC TYPE ~ RECORD [ breakAccess: Breakpoint.BreakAccess, address: BreakWorldArchitecture.Address, patch: Shepherd.Patch, clientData: Breakpoint.ClientData ]; SetBreakpoint: PUBLIC Breakpoint.SetBreakProc ~ { breakWorld: BreakWorldArchitecture.BreakWorld ¬ address.breakWorld; worldAccess: BreakWorldArchitecture.WorldAccess ¬ BreakWorldArchitecture.WorldAccessFromBreakWorld[breakWorld]; targetBreaks: BreakpointPrivate.TargetBreaks ¬ BreakpointPrivate.RetrieveTargetBreaks[worldAccess.name]; breakProcDataSegment: BreakWorldArchitecture.Address ¬ worldAccess.procs.getProcDataSegment[breakWorld, breakProc]; RETURN[targetBreaks.SetBreakpoint[address, clientData, breakProc, breakProcDataSegment, breakData, damages]] }; ClearBreakpoint: PUBLIC Breakpoint.ClearBreakProc ~ { breakWorld: BreakWorldArchitecture.BreakWorld ¬ break.address.breakWorld; worldAccess: BreakWorldArchitecture.WorldAccess ¬ BreakWorldArchitecture.WorldAccessFromBreakWorld[breakWorld]; targetBreaks: BreakpointPrivate.TargetBreaks ¬ BreakpointPrivate.RetrieveTargetBreaks[worldAccess.name]; targetBreaks.ClearBreakpoint[break]; RETURN; }; NewBreakAccess: PUBLIC PROCEDURE [] RETURNS [Breakpoint.BreakAccess] ~{ procs: Breakpoint.BreakAccessProcs ~ NEW[Breakpoint.BreakAccessProcsRep ¬ [ set: Breakpoint.SetBreakpoint, clear: Breakpoint.ClearBreakpoint, enumerate: Breakpoint.EnumerateBreakpoints]]; data: Breakpoint.BreakAccessData ~ NEW[BreakAccessDataRep ¬ [ breakTable: RefTab.Create[]]]; breakAccess: Breakpoint.BreakAccess ~ NEW[Breakpoint.BreakAccessRep ¬ [procs: procs, data: data]]; RETURN [breakAccess]; }; EnumerateBreakpoints: PUBLIC Breakpoint.EnumerateBreakProc ~ { Apply: RefTab.EachPairAction ~ { break: Break ~ NARROW[val]; clientData: Breakpoint.ClientData ~ Breakpoint.ClientDataFromBreak[break: break]; quit ¬ proc[clientData: clientData]; RETURN [quit: quit]; }; breakAccess: Breakpoint.BreakAccess ~ BreakWorldArchitecture.BreakAccessFromBreakWorld[breakWorld: breakWorld]; breakTable: RefTab.Ref ~ BreakTableFromBreakAccess[breakAccess: breakAccess]; IF breakTable = NIL THEN { ERROR Breakpoint.Cant[ code: $NullBreakTable, message: "EnumerateBreakpoints[nullBreakTable]"]; }; quit ¬ breakTable.Pairs[action: Apply]; RETURN [quit: quit]; }; RememberBreak: PUBLIC PROCEDURE [break: Break] ~ { breakAccess: Breakpoint.BreakAccess ~ BreakAccessFromBreak[break: break]; breakTable: RefTab.Ref ~ BreakTableFromBreakAccess[breakAccess: breakAccess]; IF breakTable = NIL THEN { ERROR Breakpoint.Cant[ code: $NullBreakTable, message: "RememberBreak[nullBreakTable]"]; }; IF NOT breakTable.Insert[key: break, val: break] THEN { ERROR Breakpoint.Cant[code: $CantRememberBreak, message: "Can't remember break"]; }; RETURN; }; ForgetBreak: PUBLIC PROCEDURE [break: Break] ~ { breakAccess: Breakpoint.BreakAccess ~ BreakAccessFromBreak[break: break]; breakTable: RefTab.Ref ~ BreakTableFromBreakAccess[breakAccess: breakAccess]; IF breakTable = NIL THEN { ERROR Breakpoint.Cant[ code: $NullBreakTable, message: "ForgetBreak[nullBreakTable]"]; }; IF NOT breakTable.Delete[key: break] THEN { ERROR Breakpoint.Cant[code: $CantForgetBreak, message: "Can't forget break"]; }; RETURN; }; NewBreak: PUBLIC PROCEDURE [ address: BreakWorldArchitecture.Address, patch: Shepherd.Patch, clientData: Breakpoint.ClientData] RETURNS [Breakpoint.Break] ~ { breakWorld: BreakWorldArchitecture.BreakWorld ~ BreakWorldArchitecture.BreakWorldFromBreakWorldAddress[address: address]; breakAccess: Breakpoint.BreakAccess ~ BreakWorldArchitecture.BreakAccessFromBreakWorld[breakWorld: breakWorld]; break: Breakpoint.Break ~ NEW[BreakRep ¬ [ breakAccess: breakAccess, address: address, patch: patch, clientData: clientData]]; RETURN [break]; }; IsNullBreak: PUBLIC PROCEDURE [break: Breakpoint.Break] RETURNS [BOOLEAN] ~ { RETURN [break = Breakpoint.nullBreak]; }; AddressFromBreak: PUBLIC PROCEDURE [break: Breakpoint.Break] RETURNS [BreakWorldArchitecture.Address] ~ { IF break.IsNullBreak[] THEN { ERROR Breakpoint.Cant[code: $NullBreak, message: "AddressFromBreak[nullBreak]"]; }; RETURN [break.address]; }; PatchFromBreak: PUBLIC PROCEDURE [break: Breakpoint.Break] RETURNS [Shepherd.Patch] ~ { IF break.IsNullBreak[] THEN { ERROR Breakpoint.Cant[code: $NullBreak, message: "PatchFromBreak[nullBreak]"]; }; RETURN [break.patch]; }; ClientDataFromBreak: PUBLIC PROCEDURE [break: Breakpoint.Break] RETURNS [Breakpoint.ClientData] ~ { IF break.IsNullBreak[] THEN { ERROR Breakpoint.Cant[code: $NullBreak, message: "ClientDataFromBreak[nullBreak]"]; }; RETURN [break.clientData]; }; BreakAccessFromBreak: PROCEDURE [break: Break] RETURNS [Breakpoint.BreakAccess] ~ { IF Breakpoint.IsNullBreak[break: break] THEN { ERROR Breakpoint.Cant[ code: $NullBreak, message: "BreakAccessFromBreak[nullBreak]"]; }; RETURN [break.breakAccess]; }; BreakTableFromBreakAccess: PROCEDURE [breakAccess: Breakpoint.BreakAccess] RETURNS [RefTab.Ref] ~ { IF breakAccess = Breakpoint.nullBreakAccess THEN { ERROR Breakpoint.Cant[code: $NullBreakAccess, message: "Null breakAccess"]; }; IF breakAccess.data = Breakpoint.nullBreakAccessData THEN { ERROR Breakpoint.Cant[code: $NullBreakAccessData, message: "Null breakAccess.data"]; }; RETURN [breakAccess.data.breakTable]; }; CantSet: PUBLIC ERROR [ code: Breakpoint.ErrorCode, message: Breakpoint.ErrorMessage] ~ CODE; CantClear: PUBLIC ERROR [ code: Breakpoint.ErrorCode, message: Breakpoint.ErrorMessage] ~ CODE; registry: BreakpointPrivate.Registry ¬ NIL; RegisterTargetBreaks: PUBLIC PROC[targetBreaks: BreakpointPrivate.TargetBreaks] ~ { newR: BreakpointPrivate.Registry; i:CARD; IF registry = NIL THEN { registry ¬ NEW[BreakpointPrivate.RegistryBody[1]]; registry[0] ¬ targetBreaks; } ELSE IF (i ¬ RetrieveTargetBreaksInner[targetBreaks.targetName]) # LAST[CARD] THEN { registry[i] ¬ targetBreaks; } ELSE { newR ¬ NEW[BreakpointPrivate.RegistryBody[registry.length+1]]; FOR i IN [0..registry.length) DO newR[i] ¬ registry[i]; ENDLOOP; newR[registry.length] ¬ targetBreaks; registry ¬ newR; }; }; RetrieveTargetBreaksInner: PROC[targetName: Rope.ROPE] RETURNS[registryIndex: CARD] ~ { i: CARD; IF registry = NIL THEN RETURN[LAST[CARD]]; FOR i ¬ 0, i + 1 UNTIL i = registry.length OR Rope.Equal[targetName, registry[i].targetName] DO ENDLOOP; IF i # registry.length THEN RETURN[i] ELSE RETURN[LAST[CARD]]; }; RetrieveTargetBreaks: PUBLIC PROC[targetName: Rope.ROPE] RETURNS[BreakpointPrivate.TargetBreaks] ~ { i: CARD ¬ RetrieveTargetBreaksInner[targetName]; IF i # LAST[CARD] THEN RETURN[registry[i]] ELSE ERROR; }; }. | BreakpointImpl.mesa Copyright Σ 1989, 1990, 1991, 1992 by Xerox Corporation. All rights reserved. Peter B. Kessler, April 19, 1990 10:38 am PDT Laurie Horton, October 16, 1991 1:27 am PDT Katsuyuki Komatsu March 5, 1992 1:32 pm PST Public Types EXPORTed to BreakWorldArchitecture Public Types EXPORTed to Breakpoint Public Procedures EXPORTed to Breakpoint PROCEDURE [ address: BreakWorldArchitecture.Address, clientData: ClientData, breakProc: BreakProc, breakData: BreakData, damages: TargetArchitecture.RegisterClass _ TargetArchitecture.RegisterClass.all] RETURNS [Break]; PROCEDURE [break: Break] RETURNS []; PROCEDURE [breakWorld: BreakWorldArchitecture.BreakWorld, proc: BreakpointProc] RETURNS [quit: BOOLEAN _ FALSE]; PROC [key: Key, val: Val] RETURNS [quit: BOOL _ FALSE] Private Procedures Public Errors exported to Breakpoint. Target-Dependent Procedure dispatch Κ–(cedarcode) style•NewlineDelimiter ™code™Kšœ ΠerœC™NKšœ-™-K™+K™+K™šΟk ˜ Kšœ ˜ Kšœ˜Kšœ˜Kšœ˜Kšœ˜Kšœ ˜ Kšœ˜—K˜—unitšΠlnœžœžœ˜KšžœD˜KKšžœ6˜=Kšœ˜headšœ/™/šœ žœžœ7˜OKšœžœžœ˜8K˜——šœ#™#šœžœžœžœ5˜Wšœžœžœžœ˜*Kšœž˜Kšœ˜—K˜—šœžœžœžœ!˜9šœ žœžœžœ˜ K˜$K˜(K˜K˜!Kšœ˜—K˜——šœ(™(šΟn œžœ˜1šž œ™ Kšœ)™)Kšœ™Kšœ™Kšœ™šœ*™*Kšœ(™(—Kšžœ ™K˜K˜CK˜oK˜hK˜sKšžœf˜lK˜—K˜—š œžœ˜5Kšž œžœ™$K˜K˜IK˜oK˜hKšœ$˜$Kšžœ˜K˜K˜K˜—š œžœž œžœ˜Hšœ%žœ#˜KKšœ˜Kšœ#˜#Kšœ-˜-—šœ#žœ˜=K˜—šœ&žœ˜FKšœ˜—K˜Kšžœ˜K˜K˜—š œžœ"˜>Kšž œHžœžœ™qš œ˜ Kšžœžœžœžœ™6Kšœžœ˜KšœQ˜QK˜K˜$Kšžœ˜K˜—˜&K˜I—KšœM˜MK˜šžœžœžœ˜šžœ˜KšœH˜HK˜——K˜'Kšžœ˜Kšœ˜K˜—š  œžœž œ˜2˜&K˜#—KšœM˜MK˜šžœžœžœ˜šžœ˜KšœA˜AK˜——šžœžœ+žœ˜7KšžœL˜QKšœ˜—Kšžœ˜Kšœ˜K˜—š  œžœž œ˜0K˜IKšœM˜MK˜šžœžœžœ˜šžœ˜Kšœ?˜?K˜——šžœžœžœ˜+KšžœH˜MKšœ˜—Kšžœ˜Kšœ˜K˜—š œžœž œfžœ˜žšœ0˜0KšœI˜I—˜&K˜I—šœžœ ˜*K˜S—K˜Kšžœ ˜Kšœ˜K˜—š   œžœž œžœžœ˜MKšžœ ˜&Kšœ˜K˜—š œžœž œžœ%˜jšžœžœ˜KšžœK˜PK˜—Kšžœ˜Kšœ˜K˜—š œžœž œžœ˜Xšžœžœ˜KšžœI˜NK˜—Kšžœ˜Kšœ˜K˜—š œžœž œžœ˜dšžœžœ˜KšžœN˜SK˜—Kšžœ˜Kšœ˜K˜——šœ™š œž œžœ˜Sšžœ&žœ˜.šžœ˜Kšœ>˜>—K˜—Kšžœ˜K˜K˜—š œž œ'žœ˜cšžœ*žœ˜2KšžœF˜KKšœ˜—šžœ3žœ˜;KšžœO˜TKšœ˜—Kšžœ˜%K˜K˜——™%š œžœžœCžœ˜]K˜—š  œžœžœCžœ˜_K˜——M™#Kšœ'žœ˜+K˜š œžœžœ2˜SKšœ!˜!Kšœžœ˜K˜šžœ žœžœ˜Kšœ žœ$˜2K˜—š œžœžœ<žœžœžœ˜VK˜—šœžœ˜Kšœžœ4˜>šžœžœž˜ K˜Kšžœ˜—K˜%K˜K˜—K˜—K˜K˜š  œžœžœžœžœ˜WKšœžœ˜Kš žœ žœžœžœžœžœ˜*šžœžœžœ0ž˜_Kšžœ˜—šžœž˜Kšžœ˜ —šž˜Kšžœžœžœ˜—K˜K˜—š  œžœžœžœžœ$˜dKšœžœ)˜0šžœžœžœž˜Kšžœ ˜—šž˜Kšžœ˜—K˜—K™L˜——…—*'Β