[project @ 2002-11-05 09:31:37 by simonmar]
[ghc-hetmet.git] / ghc / rts / Disassembler.c
index 29d40d6..8b526c0 100644 (file)
@@ -5,12 +5,13 @@
  * Copyright (c) 1994-1998.
  *
  * $RCSfile: Disassembler.c,v $
- * $Revision: 1.17 $
- * $Date: 2001/01/03 16:44:30 $
+ * $Revision: 1.25 $
+ * $Date: 2002/07/17 09:21:49 $
  * ---------------------------------------------------------------------------*/
 
-#ifdef GHCI
+#ifdef DEBUG
 
+#include "PosixSource.h"
 #include "Rts.h"
 #include "RtsAPI.h"
 #include "RtsUtils.h"
@@ -23,6 +24,8 @@
 #include "Disassembler.h"
 #include "Interpreter.h"
 
+#include <stdio.h>
+
 /* --------------------------------------------------------------------------
  * Disassembler
  * ------------------------------------------------------------------------*/
@@ -44,6 +47,17 @@ int disInstr ( StgBCO *bco, int pc )
    StgInfoTable** itbls       = (StgInfoTable**)(&itbls_arr->payload[0]);
 
    switch (instrs[pc++]) {
+      case bci_SWIZZLE:
+         fprintf(stderr, "SWIZZLE stkoff %d by %d\n",
+                         instrs[pc], (signed int)instrs[pc+1]);
+         pc += 2; break;
+      case bci_CCALL:
+         fprintf(stderr, "CCALL    marshaller at 0x%x\n", 
+                         literals[instrs[pc]] );
+         pc += 1; break;
+      case bci_STKCHECK: 
+         fprintf(stderr, "STKCHECK %d\n", instrs[pc] );
+         pc += 1; break;
       case bci_ARGCHECK: 
          fprintf(stderr, "ARGCHECK %d\n", instrs[pc] );
          pc += 1; break;
@@ -64,6 +78,7 @@ int disInstr ( StgBCO *bco, int pc )
       case bci_PUSH_AS:
          fprintf(stderr, "PUSH_AS  " ); printPtr( ptrs[instrs[pc]] );
          fprintf(stderr, " 0x%x", literals[instrs[pc+1]] );
+         fprintf(stderr, "\n");
          pc += 2; break;
       case bci_PUSH_UBX:
          fprintf(stderr, "PUSH_UBX ");
@@ -94,8 +109,16 @@ int disInstr ( StgBCO *bco, int pc )
       case bci_PACK:
          fprintf(stderr, "PACK     %d words with itbl ", instrs[pc+1] );
          printPtr( (StgPtr)itbls[instrs[pc]] );
+         fprintf(stderr, "\n");
          pc += 2; break;
 
+      case bci_CASEFAIL: 
+         fprintf(stderr, "CASEFAIL\n" );
+         break;
+      case bci_JMP:
+         fprintf(stderr, "JMP to   %d\n", instrs[pc]);
+         pc += 1; break;
+
       case bci_TESTLT_I:
          fprintf(stderr, "TESTLT_I %d, fail to %d\n", literals[instrs[pc]],
                                                       instrs[pc+1]);
@@ -188,4 +211,4 @@ void disassemble( StgBCO *bco )
    ASSERT(pc == nbcs+1);
 }
 
-#endif /* GHCI */
+#endif /* DEBUG */