-- BBDisableBreaksImpl.mesa -- Russ Atkinson, November 1, 1982 10:07 pm DIRECTORY BBDisableBreaks USING [], BBZones USING [GetPrefixedZone], ProcessOperations USING [HandleToIndex, ReadPSB]; BBDisableBreaksImpl: CEDAR PROGRAM IMPORTS BBZones, ProcessOperations EXPORTS BBDisableBreaks = BEGIN Index: TYPE = CARDINAL [0..1024); -- shadows PSB.PsbIndex ProcessBitVector: TYPE = PACKED ARRAY Index OF BOOL; z: ZONE _ BBZones.GetPrefixedZone[]; disabled: REF ProcessBitVector _ z.NEW[ProcessBitVector _ ALL[FALSE]]; disabling: BOOL _ TRUE; DisableBreakPoints: PUBLIC PROC [inner: PROC] = { -- calls the inner proc with breakpoints disabled for the current process -- ABORTED or UNWIND will restore the old state me: Index _ Me[]; old: BOOL _ disabled[me]; disabled[me] _ disabling; inner[! ABORTED => {disabled[me] _ old; GO TO abort}; UNWIND => disabled[me] _ old]; disabled[me] _ old; EXITS abort => ERROR ABORTED; }; EnableBreakPoints: PUBLIC PROC [inner: PROC] = { -- calls the inner proc with breakpoints enabled for the current process -- ABORTED or UNWIND will restore the old state me: Index _ Me[]; old: BOOL _ disabled[me]; disabled[me] _ FALSE; inner[! ABORTED => {disabled[me] _ old; GO TO abort}; UNWIND => disabled[me] _ old]; disabled[me] _ old; EXITS abort => ERROR ABORTED; }; Enabled: PUBLIC PROC RETURNS [BOOL] = { -- test to see if the current process has breakpoints for the current process me: Index _ Me[]; RETURN [NOT disabled[me]]; }; Me: PROC RETURNS [Index] = TRUSTED INLINE { RETURN [LOOPHOLE[ProcessOperations.HandleToIndex[ProcessOperations.ReadPSB[]]]]}; END.