Forráskód Böngészése

Better report for traps on ARM.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6700 8c9fc860-2736-0410-a75d-ab315db34111
eth.tmartiel 9 éve
szülő
commit
a8ed445049
4 módosított fájl, 25 hozzáadás és 31 törlés
  1. 19 28
      source/ARM.Traps.Mod
  2. 1 1
      source/FoxProfiler.Mod
  3. 2 2
      source/Reflection.Mod
  4. 3 0
      source/Shell.Alias

+ 19 - 28
source/ARM.Traps.Mod

@@ -110,22 +110,6 @@ VAR
 	modes: ARRAY 25 OF CHAR;
 	flags: ARRAY 13 OF CHAR;
 
-
-
-	(* Write flag values. *)
-	PROCEDURE Flags(w: Streams.Writer; s: SET);
-	VAR i: SHORTINT; ch: CHAR;
-	BEGIN
-		FOR i := 0 TO 11 DO
-			ch := flags[i];
-			IF ch # "!" THEN
-				IF i IN s THEN ch := CAP(ch) END;
-				w.Char(ch)
-			END
-		END;
-		w.String(" iopl"); w.Int(ASH(SYSTEM.VAL(LONGINT, s * {12,13}), -12), 1)
-	END Flags;
-
 	(** Display trap state. *)
 	PROCEDURE  Show*(p: Objects.Process; VAR int: Machine.State; VAR exc: Machine.ExceptionState; long: BOOLEAN);
 	VAR id: LONGINT; overflow: BOOLEAN; w: Streams.Writer;
@@ -170,12 +154,16 @@ VAR
 				|NilPointer: w.String(NilPointerDesc)
 				|MemoryError: w.String(MemoryErrorDesc); w.String(" at "); w.Address(exc.pf)
 				|ExceptionRaised: w.String(ExceptionRaisedDesc)
-				|ProcessResurrected: w.String(ProcessResurrectedDesc)
-				|RecursiveExclusive: w.String(RecursiveExclusiveDesc)
-				|AwaitOutsideExclusive: w.String(AwaitOutsideExclusiveDesc)
 			ELSE
-				w.String("HALT statement: ");
-				w.Int(exc.halt, 0)
+				(* To avoid huge sparse case table *)
+				CASE exc.halt OF
+					 ProcessResurrected: w.String(ProcessResurrectedDesc)
+					|RecursiveExclusive: w.String(RecursiveExclusiveDesc)
+					|AwaitOutsideExclusive: w.String(AwaitOutsideExclusiveDesc)
+				ELSE
+					w.String("HALT statement: ");
+					w.Int(exc.halt, 0)
+				END
 			END;
 			IF exc.locks # {} THEN
 				w.String(", Locks: "); w.Set(exc.locks)
@@ -185,15 +173,16 @@ VAR
 				w.Char(0EX);	(* "fixed font" *)
 				w.Ln;
 				(* output values *)
-				Val("R0", int.R[0]); Val("R1", int.R[1]); Val("R2", int.R[2]); Val("R3", int.R[3]);
-				Val("R4", int.R[4]); Val("R5", int.R[5]); Val("R6", int.R[6]); Val("R7", int.R[7]);
-				Val("R8", int.R[8]); Val("R9", int.R[9]); Val("R10", int.R[10]); Val("R11", int.R[11]);
-				Val("FP", int.BP); Val("SP", int.SP); Val("LR", int.LR); Val("PC", int.PC);
-				Val("PSR", int.PSR);
-				Val("TMR", Kernel.GetTicks()); w.Ln
+				Val("R0", int.R[0]); w.Char(' '); Val("R1", int.R[1]); w.Char(' '); Val("R2", int.R[2]); w.Char(' '); Val("R3", int.R[3]); w.Ln;
+				Val("R4", int.R[4]); w.Char(' '); Val("R5", int.R[5]); w.Char(' '); Val("R6", int.R[6]); w.Char(' '); Val("R7", int.R[7]); w.Ln;
+				Val("R8", int.R[8]); w.Char(' '); Val("R9", int.R[9]); w.Char(' '); Val("R10", int.R[10]); Val("R11", int.R[11]); w.Ln;
+				Val("FP", int.BP); w.Char(' '); Val("SP", int.SP); w.Char(' '); Val("LR", int.LR); w.Char(' '); Val("PC", int.PC); w.Ln;
+				Val("PSR", int.PSR); w.Ln;
+				Val("Ticks", Kernel.GetTicks()); Val("Timer", Machine.GetTimer()); w.Ln
 			ELSE
 				w.Ln
 			END;
+			w.Char(' '); w.String("CPU="); w.Int(1, 0); w.Ln;
 			IF exc.halt = UndefinedInstn THEN
 				Val("Instruction", exc.instn)
 			ELSIF exc.halt = MemoryError THEN
@@ -202,7 +191,9 @@ VAR
 					Val("Status", exc.status)
 				END
 			END;
+			w.Ln;
 			w.String("Process:"); Reflection.WriteProcess(w, p); w.Ln;
+			w.String("Stack Traceback:"); w.Ln;
 			Reflection.StackTraceBack(w, int.PC, int.BP, Objects.GetStackBottom(p), long, overflow);
 		END;
 		w.String("---------------------------------"); w.Ln;
@@ -353,7 +344,7 @@ VAR
 		user := TRUE;
 		traceTrap := (exc.locks = {}) & (exc.halt >= MAX(INTEGER)) & (exc.halt <= MAX(INTEGER)+1);
 
-		Show(t, int, exc, exc.halt # MAX(INTEGER)+1);	(* Always show the trap info!*)
+		Show(t, int, exc, (exc.halt # MAX(INTEGER)+1) & (trapState[Machine.ID()] = 0));	(* Always show the trap info!*)
 
 		IF exc.halt = haltUnbreakable THEN
 			Unbreakable(t, int, exc, handled)

+ 1 - 1
source/FoxProfiler.Mod

@@ -87,7 +87,7 @@ TYPE
 	HashEntryInt = RECORD
 		used: BOOLEAN; key, value: LONGINT;
 	END;
-	HashIntArray = ARRAY 2*MaxProcesses OF HashEntryInt
+	HashIntArray = ARRAY 2*MaxProcesses OF HashEntryInt;
 
 
 VAR

+ 2 - 2
source/Reflection.Mod

@@ -40,7 +40,7 @@ VAR
 	*)
 
 	(** Write a variable value.  The v parameter is a variable descriptor obtained with NextVar.  Parameter col is incremented with the (approximate) number of characters written. *)
-	PROCEDURE WriteVar*(w: Streams.Writer; v: Variable; VAR col: LONGINT);
+	PROCEDURE WriteVar*(w: Streams.Writer; VAR v: Variable; VAR col: LONGINT);
 	VAR ch: CHAR;
 	BEGIN
 		IF v.type = 15 THEN
@@ -580,7 +580,7 @@ VAR
 					WriteProc0(w, m, pc, bp, refs, refpos, base); w.Ln;Wait(w); w.Update;
 					IF long & (~overflow OR (count > 0)) THEN	(* show variables *)
 						IF refpos # -1 THEN Variables(w, refs, refpos, base) END;
-						IF (m # NIL) & (base # m.sb) & (count = 0) THEN ModuleState(w, m) END
+						IF FALSE & (m # NIL) & (base # m.sb) & (count = 0) THEN ModuleState(w, m) END
 					END;
 				ELSE
 					w.String( "Unknown external procedure, pc = " );  w.Address( pc );  w.Ln; Wait(w);

+ 3 - 0
source/Shell.Alias

@@ -34,3 +34,6 @@ unmount=FSTools.Unmount
 uptime=UpTime.Show
 showfs=FSTools.Watch
 whoimports=SystemTools.WhoImports
+lsusb=UsbInfo.Show
+ps=SystemTools.ShowProcesses
+halt=SystemTools.PowerDown