DIRECTORY Commander USING[CommandProc, Register], CommanderOps USING[ArgumentVector, Parse], IO, LocalCirio USING[AddSearchDirectory, Connection, GetConnection, GetStackForSelf, ReleaseConnection], RMTWTestSubject USING[ExamineSubjectStack, Subject], Rope USING[ActionType, ROPE], StackCirio USING[GetBannerForDotOofCurrentFrame, ResetStack, Stack, WalkStack, WalkStackToCProcedure]; LocalCirioTest: CEDAR PROGRAM IMPORTS Commander, CommanderOps, IO, LocalCirio, StackCirio, RMTWTestSubject = BEGIN LocalCirioTestDriver: Commander.CommandProc = BEGIN reports: IO.STREAM ¬ cmd.out; args: CommanderOps.ArgumentVector ¬ CommanderOps.Parse[cmd]; connection: LocalCirio.Connection ¬ LocalCirio.GetConnection[["PopUpDriver2", "BreakPointPopUp"], reports]; CleanUp: PROC = BEGIN LocalCirio.ReleaseConnection[connection, reports]; END; BEGIN ENABLE UNWIND => CleanUp[]; LocalCirioTestInner: PROC[key: CARD32] = BEGIN stack: StackCirio.Stack ¬ LocalCirio.GetStackForSelf[connection, reports]; index: CARD ¬ StackCirio.ResetStack[stack, reports]; IO.PutF1[reports, "Cirio Of %g\N", IO.rope[StackCirio.GetBannerForDotOofCurrentFrame[stack, reports]]]; FOR I: INT IN [1..args.argc) DO LocalCirio.AddSearchDirectory[connection, args[I], reports]; ENDLOOP; IF StackCirio.WalkStackToCProcedure[stack, "_LocalCirioTestInner_", "LocalCirioTest", cmd.out] THEN BEGIN actualMovement: INT; newFrameIndex: CARD; [actualMovement, newFrameIndex] ¬ StackCirio.WalkStack[stack, 1, cmd.out]; -- get into position RMTWTestSubject.ExamineSubjectStack[stack, TRUE, reports] END ELSE IO.PutRope[reports, "\N\NFAILED TO FIND EXPECTED TEST SUBJECT FRAME\N\N"]; ERROR CloseDownLocalTest[]; END; RMTWTestSubject.Subject[TRUE, LocalCirioTestInner ! CloseDownLocalTest => CONTINUE]; END; CleanUp[] END; CloseDownLocalTest: ERROR = CODE; LocalCirioTestSubjectDriver: Commander.CommandProc = {RMTWTestSubject.Subject[TRUE, LocalDebuggeeTestFrame]}; LocalDebuggeeTestFrame: PROC[key: CARD32] = BEGIN inner: PROC[key: CARD32] RETURNS[INT32] = {ThisIsUncaught[]; RETURN[-1]}; result: INT ¬ inner[key]; SELECT result FROM -1 => RETURN; ENDCASE => ERROR ABORTED; END; ThisIsUncaught: SIGNAL = CODE; RemoteCirioTestSubjectDriver: Commander.CommandProc = {RMTWTestSubject.Subject[TRUE, CirioDebuggeeTestFrame]}; CirioDebuggeeTestFrame: PROC[key: CARD32] = BEGIN inner: PROC[key: CARD32] RETURNS[INT32] = TRUSTED MACHINE CODE {"XR_CallDebugger"}; result: INT ¬ inner[key]; SELECT result FROM -1 => RETURN; ENDCASE => ERROR ABORTED; END; Commander.Register["TestLocalCirio", LocalCirioTestDriver]; Commander.Register["RemoteCirioTestSubject", RemoteCirioTestSubjectDriver]; Commander.Register["LocalCirioTestSubject", LocalCirioTestSubjectDriver]; END..  LocalCirioTest.mesa Copyright Σ 1992 by Xerox Corporation. All rights reserved. Sturgis, March 23, 1990 4:07 pm PST Spreitze, October 1, 1990 12:01 pm PDT Willie-s, May 15, 1992 2:46 pm PDT Local Test open a block to so that unwind catches can cleanup (note: we need not lock a monitor, since only one thread has access to the connection data.) now, lets close down the test Cirio Test Subject remote cirio test will be looking for a frame with this procedure name Remote Cirio Test note: this module can not be loaded on the D machine because it references Local Cirio stuff. Perhaps we can build a dummy Local Cirio? This code should be copied into a RemoteCirioTest module. RemoteCirioTestDriver: Commander.CommandProc = BEGIN args: CommanderOps.ArgumentVector _ CommanderOps.Parse[cmd]; serverName: Rope.ROPE _ args[1]; portNum: CARDINAL _ IF args.argc <= 2 THEN 4815 ELSE CARDINAL[Convert.CardFromRope[args[2]]]; reports: IO.STREAM _ IO.ROS[]; connection: RemoteCirio.Connection _ RemoteCirio.OpenConnection[serverName, portNum, FileNames.CurrentWorkingDirectory[], reports]; remoteWorldStopped: BOOLEAN _ FALSE; CleanUp: PROC = BEGIN IF remoteWorldStopped THEN RemoteCirio.ResumeRemoteWorld[connection]; remoteWorldStopped _ FALSE; RemoteCirio.CloseConnection[connection, reports]; IO.Close[reports] END; open a block to so that unwind catches can cleanup (note: we need not lock a monitor, since only one thread has access to the connection data.) BEGIN ENABLE UNWIND => CleanUp[]; TestInner: PROC = BEGIN nThreads: CARD _ RemoteCirio.StopRemoteWorld[connection, reports]; remoteWorldStopped _ TRUE; BEGIN interestingThreads: LIST OF CARD _ RemoteCirio.FindThreadsWithProperty[connection, [callingDebugger[]]]; threadFound: BOOLEAN _ FALSE; -- tentative FOR ts: LIST OF CARD _ interestingThreads, ts.rest WHILE ts # NIL DO x: CARD _ ts.first; remoteThreadIndex: CARD _ RemoteCirio.FocusOnThread[connection, x, cmd.out]; stack: StackCirio.Stack _ RemoteCirio.GetStackForCurrentThread[connection, reports]; index: CARD _ StackCirio.ResetThreadStack[stack, reports]; IO.PutF[cmd.out, "searching thread %g\N", IO.rope[RemoteCirio.GetThreadTitleText[connection, x]]]; IF StackCirio.WalkThreadStackToCProcedure[stack, keyName, "LocalCirioTest", cmd.out] THEN {ExamineStack[stack, reports]; threadFound _ TRUE; EXIT}; ENDLOOP; IF NOT threadFound THEN IO.PutF[reports, "\N\NFAILED TO FIND EXPECTED TEST SUBJECT THREAD\N\N"]; END; END; TestInner[]; -- so that unwinds from aborts from breakpoints will be caught END; CleanUp[] END; main code Κν•NewlineDelimiter –(cedarcode) style™šœ™Jšœ Οeœ1™Kšœ˜—Kšœžœ˜šžœž˜Kšœžœ˜ Kšžœžœžœ˜—Kšžœ˜K˜K˜K˜——™K™ˆK™9K˜šŸœ™.Kšž™K™™KKšžœ™—Kšœ ™ Kšžœ™——K™K™K˜K˜™ K˜Kšœ;˜;KšœK˜KKšœI˜IK˜—Kšžœ˜——…— ΄£