For unknown traps, print contents of registers and continue execution
authorMichael Meissner <gnu@the-meissners.org>
Sat, 14 Sep 1996 02:36:40 +0000 (02:36 +0000)
committerMichael Meissner <gnu@the-meissners.org>
Sat, 14 Sep 1996 02:36:40 +0000 (02:36 +0000)
sim/d10v/ChangeLog
sim/d10v/simops.c

index 25d1b1bf4482d340b1b0982b12a74ba30c650cad..bd1e1ad8fe12ccf7438277c5fb723710ef3917fd 100644 (file)
@@ -1,3 +1,8 @@
+Fri Sep 13 22:35:19 1996  Michael Meissner  <meissner@tiktok.cygnus.com>
+
+       * simops.c (OP_5F00): Use unknown traps to print all GPRs,
+       accumulators, PC, and F0/F1/C flags.
+
 Thu Sep 12 12:50:11 1996  Mark Alexander  <marka@cygnus.com>
 
        * simops.c (OP_5F00): Fix problems with system calls.
index 5b5d70ff8077bb8ae9d985d90e88f95f4e2b3a08..3a889a189e1c367af1e712d4ba836a38730a2c45 100644 (file)
@@ -2425,8 +2425,38 @@ OP_5F00 ()
   switch (OP[0])
     {
     default:
+#if 0
       (*d10v_callback->printf_filtered) (d10v_callback, "Unknown trap code %d\n", OP[0]);
       State.exception = SIGILL;
+#else
+      /* Use any other traps for batch debugging. */
+      {
+       int i;
+       static int first_time = 1;
+
+       if (first_time)
+         {
+           first_time = 0;
+           (*d10v_callback->printf_filtered) (d10v_callback, "Trap  #     PC ");
+           for (i = 0; i < 16; i++)
+             (*d10v_callback->printf_filtered) (d10v_callback, "  %sr%d", (i > 9) ? "" : " ", i);
+           (*d10v_callback->printf_filtered) (d10v_callback, "         a0         a1 f0 f1 c\n");
+         }
+
+      (*d10v_callback->printf_filtered) (d10v_callback, "Trap %2d 0x%.4x:", (int)OP[0], (int)PC);
+
+      for (i = 0; i < 16; i++)
+       (*d10v_callback->printf_filtered) (d10v_callback, " %.4x", (int) State.regs[i]);
+
+      for (i = 0; i < 2; i++)
+       (*d10v_callback->printf_filtered) (d10v_callback, " %.2x%.8lx",
+                                          ((int)(State.a[OP[i]] >> 32) & 0xff),
+                                          ((unsigned long)State.a[OP[i]]) & 0xffffffff);
+
+      (*d10v_callback->printf_filtered) (d10v_callback, "  %d  %d %d\n",
+                                        State.F0 != 0, State.F1 != 0, State.C != 0);
+      break;
+#endif
 
     case 0:
       /* Trap 0 is used for simulating low-level I/O */
@@ -2588,6 +2618,7 @@ OP_5F00 ()
       /* Trap 3 writes a character */
       putchar (State.regs[2]);
       break;
+      }
     }
 }