[project @ 2000-12-19 14:30:17 by simonmar]
[ghc-hetmet.git] / ghc / rts / Printer.c
index 99c1255..466eba7 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.23 2000/03/31 03:09:36 hwloidl Exp $
+ * $Id: Printer.c,v 1.29 2000/12/11 12:40:24 simonmar Exp $
  *
  * (c) The GHC Team, 1994-2000.
  *
@@ -14,6 +14,8 @@
 
 #include "RtsUtils.h"
 #include "RtsFlags.h"
+#include "MBlock.h"
+#include "Storage.h"
 #include "Bytecodes.h"  /* for InstrPtr */
 #include "Disassembler.h"
 
@@ -43,17 +45,8 @@ static void    printZcoded   ( const char *raw );
  * Printer
  * ------------------------------------------------------------------------*/
 
-
 #ifdef INTERPRETER
-extern void* itblNames[];
-extern int   nItblNames;
-char* lookupHugsItblName ( void* v )
-{
-   int i;
-   for (i = 0; i < nItblNames; i += 2)
-      if (itblNames[i] == v) return itblNames[i+1];
-   return NULL;
-}
+char* lookupHugsItblName ( void* itbl );
 #endif
 
 void printPtr( StgPtr p )
@@ -116,7 +109,7 @@ void printClosure( StgClosure *obj )
             fprintf(stderr,"AP_UPD("); printPtr((StgPtr)ap->fun);
             for (i = 0; i < ap->n_args; ++i) {
                 fprintf(stderr,", ");
-                printPtr(ap->payload[i]);
+                printPtr((P_)ap->payload[i]);
             }
             fprintf(stderr,")\n");
             break;
@@ -161,7 +154,7 @@ void printClosure( StgClosure *obj )
             fprintf(stderr,", ");
             printPtr((StgPtr)caf->value); /* should be null */
             fprintf(stderr,", ");
-            printPtr((StgPtr)caf->link);  /* should be null */
+            printPtr((StgPtr)caf->link);
             fprintf(stderr,")\n"); 
             break;
         }
@@ -205,8 +198,7 @@ void printClosure( StgClosure *obj )
 
     case TSO:
       fprintf(stderr,"TSO("); 
-      fprintf(stderr,"%d (%x)", 
-              stgCast(StgTSO*,obj)->id, stgCast(StgTSO*,obj));
+      fprintf(stderr,"%d (%p)",((StgTSO*)obj)->id, (StgTSO*)obj);
       fprintf(stderr,")\n"); 
       break;
 
@@ -267,6 +259,23 @@ void printClosure( StgClosure *obj )
             break;
         }
 
+#ifdef XMLAMBDA
+/* rows are mutarrays in xmlambda, maybe we should make a new type: ROW */
+    case MUT_ARR_PTRS_FROZEN:
+          {
+            StgWord i;
+            StgMutArrPtrs* p = stgCast(StgMutArrPtrs*,obj);
+
+            fprintf(stderr,"Row<%i>(",p->ptrs);
+            for (i = 0; i < p->ptrs; ++i) {
+                if (i > 0) fprintf(stderr,", ");
+                printPtr((StgPtr)(p->payload[i]));
+            }
+            fprintf(stderr,")\n");
+            break;
+          }
+#endif  
+
     case FUN:
     case FUN_1_0: case FUN_0_1: 
     case FUN_1_1: case FUN_0_2: case FUN_2_0:
@@ -822,8 +831,7 @@ static void printZcoded( const char *raw )
 /* Causing linking trouble on Win32 plats, so I'm
    disabling this for now. 
 */
-/* For now, BFD support is unconditionally disabled -- HWL */
-#if 0 /* HWL */ && defined(HAVE_BFD_H) && !defined(_WIN32)
+#if defined(HAVE_BFD_H) && !defined(_WIN32)
 
 #include <bfd.h>
 
@@ -931,6 +939,8 @@ extern void DEBUG_LoadSymbols( char *name STG_UNUSED )
 
 #include "StoragePriv.h"
 
+void findPtr(P_ p);            /* keep gcc -Wall happy */
+
 void
 findPtr(P_ p)
 {