[project @ 2000-01-14 14:56:40 by simonmar]
[ghc-hetmet.git] / ghc / rts / Printer.c
index 600d0a2..c8059ab 100644 (file)
@@ -1,7 +1,7 @@
 /* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.19 2000/01/13 14:34:04 hwloidl Exp $
+ * $Id: Printer.c,v 1.20 2000/01/14 14:56:40 simonmar Exp $
  *
- * Copyright (c) 1994-1999.
+ * (c) The GHC Team, 1994-2000.
  *
  * Heap printer
  * 
@@ -475,6 +475,95 @@ void printTSO( StgTSO *tso )
     /* printStackChunk( tso->sp, tso->stack+tso->stack_size); */
 }
 
+/* -----------------------------------------------------------------------------
+   Closure types
+   
+   NOTE: must be kept in sync with the closure types in includes/ClosureTypes.h
+   -------------------------------------------------------------------------- */
+
+static char *closure_type_names[] = {
+  "INVALID_OBJECT",            /* 0  */
+  "CONSTR",                    /* 1  */
+  "CONSTR_1_0",                        /* 2  */
+  "CONSTR_0_1",                        /* 3  */
+  "CONSTR_2_0",                        /* 4  */
+  "CONSTR_1_1",                        /* 5  */
+  "CONSTR_0_2",                        /* 6  */
+  "CONSTR_INTLIKE",            /* 7  */
+  "CONSTR_CHARLIKE",           /* 8  */
+  "CONSTR_STATIC",             /* 9  */
+  "CONSTR_NOCAF_STATIC",       /* 10 */
+  "FUN",                       /* 11 */
+  "FUN_1_0",                   /* 12 */
+  "FUN_0_1",                   /* 13 */
+  "FUN_2_0",                   /* 14 */
+  "FUN_1_1",                   /* 15 */
+  "FUN_0_2",                   /* 16 */
+  "FUN_STATIC",                        /* 17 */
+  "THUNK",                     /* 18 */
+  "THUNK_1_0",                 /* 19 */
+  "THUNK_0_1",                 /* 20 */
+  "THUNK_2_0",                 /* 21 */
+  "THUNK_1_1",                 /* 22 */
+  "THUNK_0_2",                 /* 23 */
+  "THUNK_STATIC",              /* 24 */
+  "THUNK_SELECTOR",            /* 25 */
+  "BCO",                       /* 26 */
+  "AP_UPD",                    /* 27 */
+  "PAP",                       /* 28 */
+  "IND",                       /* 29 */
+  "IND_OLDGEN",                        /* 30 */
+  "IND_PERM",                  /* 31 */
+  "IND_OLDGEN_PERM",           /* 32 */
+  "IND_STATIC",                        /* 33 */
+  "CAF_UNENTERED",             /* 34 */
+  "CAF_ENTERED",               /* 35 */
+  "CAF_BLACKHOLE",             /* 36 */
+  "RET_BCO",                   /* 37 */
+  "RET_SMALL",                 /* 38 */
+  "RET_VEC_SMALL",             /* 39 */
+  "RET_BIG",                   /* 40 */
+  "RET_VEC_BIG",               /* 41 */
+  "RET_DYN",                   /* 42 */
+  "UPDATE_FRAME",              /* 43 */
+  "CATCH_FRAME",               /* 44 */
+  "STOP_FRAME",                        /* 45 */
+  "SEQ_FRAME",                 /* 46 */
+  "BLACKHOLE",                 /* 47 */
+  "BLACKHOLE_BQ",              /* 48 */
+  "SE_BLACKHOLE",              /* 49 */
+  "SE_CAF_BLACKHOLE",          /* 50 */
+  "MVAR",                      /* 51 */
+  "ARR_WORDS",                 /* 52 */
+  "MUT_ARR_PTRS",              /* 53 */
+  "MUT_ARR_PTRS_FROZEN",       /* 54 */
+  "MUT_VAR",                   /* 55 */
+  "WEAK",                      /* 56 */
+  "FOREIGN",                   /* 57 */
+  "STABLE_NAME",               /* 58 */
+  "TSO",                       /* 59 */
+  "BLOCKED_FETCH",             /* 60 */
+  "FETCH_ME",                  /* 61 */
+  "EVACUATED",                 /* 62 */
+  "N_CLOSURE_TYPES",           /* 63 */
+  "FETCH_ME_BQ",               /* 64 */
+  "RBH"                        /* 65 */
+};
+
+char *
+info_type(StgClosure *closure){ 
+  return closure_type_names[get_itbl(closure)->type];
+}
+
+char *
+info_type_by_ip(StgInfoTable *ip){ 
+  return closure_type_names[ip->type];
+}
+
+void
+info_hdr_type(StgClosure *closure, char *res){ 
+  strcpy(res,closure_type_names[get_itbl(closure)->type]);
+}
 
 /* --------------------------------------------------------------------------
  * Address printing code
@@ -698,7 +787,7 @@ static void printZcoded( const char *raw )
 /* Causing linking trouble on Win32 plats, so I'm
    disabling this for now. 
 */
-#if defined(HAVE_BFD_H) && !defined(_WIN32) && defined(USE_BSD)
+#if defined(HAVE_BFD_H) && !defined(_WIN32)
 
 #include <bfd.h>
 
@@ -797,7 +886,7 @@ extern void DEBUG_LoadSymbols( char *name )
 
 #else /* HAVE_BFD_H */
 
-extern void DEBUG_LoadSymbols( char *name )
+extern void DEBUG_LoadSymbols( char *name STG_UNUSED )
 {
   /* nothing, yet */
 }