1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1994-2000.
7 * ---------------------------------------------------------------------------*/
9 #include "PosixSource.h"
11 #include "rts/Bytecodes.h" /* for InstrPtr */
20 #include "Disassembler.h"
23 /* --------------------------------------------------------------------------
24 * local function decls
25 * ------------------------------------------------------------------------*/
27 static void printStdObjPayload( StgClosure *obj );
29 static void reset_table ( int size );
30 static void prepare_table ( void );
31 static void insert ( StgWord value, const char *name );
33 #if 0 /* unused but might be useful sometime */
34 static rtsBool lookup_name ( char *name, StgWord *result );
35 static void enZcode ( char *in, char *out );
37 static char unZcode ( char ch );
38 static void printZcoded ( const char *raw );
40 /* --------------------------------------------------------------------------
42 * ------------------------------------------------------------------------*/
44 void printPtr( StgPtr p )
47 raw = lookupGHCName(p);
55 void printObj( StgClosure *obj )
57 debugBelch("Object "); printPtr((StgPtr)obj); debugBelch(" = ");
62 printStdObjHdr( StgClosure *obj, char* tag )
64 debugBelch("%s(",tag);
65 printPtr((StgPtr)obj->header.info);
67 debugBelch(", %s", obj->header.prof.ccs->cc->label);
72 printStdObjPayload( StgClosure *obj )
75 const StgInfoTable* info;
78 for (i = 0; i < info->layout.payload.ptrs; ++i) {
80 printPtr((StgPtr)obj->payload[i]);
82 for (j = 0; j < info->layout.payload.nptrs; ++j) {
83 debugBelch(", %pd#",obj->payload[i+j]);
89 printThunkPayload( StgThunk *obj )
92 const StgInfoTable* info;
95 for (i = 0; i < info->layout.payload.ptrs; ++i) {
97 printPtr((StgPtr)obj->payload[i]);
99 for (j = 0; j < info->layout.payload.nptrs; ++j) {
100 debugBelch(", %pd#",obj->payload[i+j]);
106 printThunkObject( StgThunk *obj, char* tag )
108 printStdObjHdr( (StgClosure *)obj, tag );
109 printThunkPayload( obj );
113 printClosure( StgClosure *obj )
115 obj = UNTAG_CLOSURE(obj);
118 info = get_itbl(obj);
120 switch ( info->type ) {
122 barf("Invalid object");
125 case CONSTR_1_0: case CONSTR_0_1:
126 case CONSTR_1_1: case CONSTR_0_2: case CONSTR_2_0:
128 case CONSTR_NOCAF_STATIC:
131 StgConInfoTable *con_info = get_con_itbl (obj);
133 debugBelch("%s(", GET_CON_DESC(con_info));
134 for (i = 0; i < info->layout.payload.ptrs; ++i) {
135 if (i != 0) debugBelch(", ");
136 printPtr((StgPtr)obj->payload[i]);
138 for (j = 0; j < info->layout.payload.nptrs; ++j) {
139 if (i != 0 || j != 0) debugBelch(", ");
140 debugBelch("%p#", obj->payload[i+j]);
147 case FUN_1_0: case FUN_0_1:
148 case FUN_1_1: case FUN_0_2: case FUN_2_0:
150 debugBelch("FUN/%d(",itbl_to_fun_itbl(info)->f.arity);
151 printPtr((StgPtr)obj->header.info);
153 debugBelch(", %s", obj->header.prof.ccs->cc->label);
155 printStdObjPayload(obj);
160 printPtr((StgPtr)obj->header.info);
161 printStdObjPayload(obj);
165 case THUNK_1_0: case THUNK_0_1:
166 case THUNK_1_1: case THUNK_0_2: case THUNK_2_0:
168 /* ToDo: will this work for THUNK_STATIC too? */
170 printThunkObject((StgThunk *)obj,GET_PROF_DESC(info));
172 printThunkObject((StgThunk *)obj,"THUNK");
177 printStdObjHdr(obj, "THUNK_SELECTOR");
178 debugBelch(", %p)\n", ((StgSelector *)obj)->selectee);
182 disassemble( (StgBCO*)obj );
187 StgAP* ap = (StgAP*)obj;
189 debugBelch("AP("); printPtr((StgPtr)ap->fun);
190 for (i = 0; i < ap->n_args; ++i) {
192 printPtr((P_)ap->payload[i]);
200 StgPAP* pap = (StgPAP*)obj;
202 debugBelch("PAP/%d(",pap->arity);
203 printPtr((StgPtr)pap->fun);
204 for (i = 0; i < pap->n_args; ++i) {
206 printPtr((StgPtr)pap->payload[i]);
214 StgAP_STACK* ap = (StgAP_STACK*)obj;
216 debugBelch("AP_STACK("); printPtr((StgPtr)ap->fun);
217 for (i = 0; i < ap->size; ++i) {
219 printPtr((P_)ap->payload[i]);
227 printPtr((StgPtr)((StgInd*)obj)->indirectee);
233 printPtr((StgPtr)((StgInd*)obj)->indirectee);
238 debugBelch("IND_STATIC(");
239 printPtr((StgPtr)((StgInd*)obj)->indirectee);
244 debugBelch("BLACKHOLE(");
245 printPtr((StgPtr)((StgInd*)obj)->indirectee);
249 /* Cannot happen -- use default case.
259 StgUpdateFrame* u = (StgUpdateFrame*)obj;
260 debugBelch("UPDATE_FRAME(");
261 printPtr((StgPtr)GET_INFO(u));
263 printPtr((StgPtr)u->updatee);
270 StgCatchFrame* u = (StgCatchFrame*)obj;
271 debugBelch("CATCH_FRAME(");
272 printPtr((StgPtr)GET_INFO(u));
274 printPtr((StgPtr)u->handler);
281 StgStopFrame* u = (StgStopFrame*)obj;
282 debugBelch("STOP_FRAME(");
283 printPtr((StgPtr)GET_INFO(u));
291 debugBelch("ARR_WORDS(\"");
292 /* ToDo: we can't safely assume that this is a string!
293 for (i = 0; arrWordsGetChar(obj,i); ++i) {
294 putchar(arrWordsGetChar(obj,i));
296 for (i=0; i<((StgArrWords *)obj)->words; i++)
297 debugBelch("%lu", (lnat)((StgArrWords *)obj)->payload[i]);
302 case MUT_ARR_PTRS_CLEAN:
303 debugBelch("MUT_ARR_PTRS_CLEAN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
306 case MUT_ARR_PTRS_DIRTY:
307 debugBelch("MUT_ARR_PTRS_DIRTY(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
310 case MUT_ARR_PTRS_FROZEN:
311 debugBelch("MUT_ARR_PTRS_FROZEN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
317 StgMVar* mv = (StgMVar*)obj;
318 debugBelch("MVAR(head=%p, tail=%p, value=%p)\n", mv->head, mv->tail, mv->value);
324 StgMutVar* mv = (StgMutVar*)obj;
325 debugBelch("MUT_VAR_CLEAN(var=%p)\n", mv->var);
331 StgMutVar* mv = (StgMutVar*)obj;
332 debugBelch("MUT_VAR_DIRTY(var=%p)\n", mv->var);
338 debugBelch(" key=%p value=%p finalizer=%p",
339 (StgPtr)(((StgWeak*)obj)->key),
340 (StgPtr)(((StgWeak*)obj)->value),
341 (StgPtr)(((StgWeak*)obj)->finalizer));
343 /* ToDo: chase 'link' ? */
348 debugBelch("%lu (%p)",(unsigned long)(((StgTSO*)obj)->id), (StgTSO*)obj);
353 /* Symptomatic of a problem elsewhere, have it fall-through & fail */
355 debugBelch("EVACUATED(");
356 printClosure((StgEvacuated*)obj->evacuee);
362 //barf("printClosure %d",get_itbl(obj)->type);
363 debugBelch("*** printClosure: unknown type %d ****\n",
364 get_itbl(obj)->type );
365 barf("printClosure %d",get_itbl(obj)->type);
371 void printGraph( StgClosure *obj )
378 printStackObj( StgPtr sp )
380 /*debugBelch("Stack[%d] = ", &stgStack[STACK_SIZE] - sp); */
382 StgClosure* c = (StgClosure*)(*sp);
383 printPtr((StgPtr)*sp);
384 if (c == (StgClosure*)&stg_ctoi_R1p_info) {
385 debugBelch("\t\t\tstg_ctoi_ret_R1p_info\n" );
387 if (c == (StgClosure*)&stg_ctoi_R1n_info) {
388 debugBelch("\t\t\tstg_ctoi_ret_R1n_info\n" );
390 if (c == (StgClosure*)&stg_ctoi_F1_info) {
391 debugBelch("\t\t\tstg_ctoi_ret_F1_info\n" );
393 if (c == (StgClosure*)&stg_ctoi_D1_info) {
394 debugBelch("\t\t\tstg_ctoi_ret_D1_info\n" );
396 if (c == (StgClosure*)&stg_ctoi_V_info) {
397 debugBelch("\t\t\tstg_ctoi_ret_V_info\n" );
399 if (get_itbl(c)->type == BCO) {
400 debugBelch("\t\t\t");
401 debugBelch("BCO(...)\n");
404 debugBelch("\t\t\t");
405 printClosure ( (StgClosure*)(*sp));
414 printSmallBitmap( StgPtr spBottom, StgPtr payload, StgWord bitmap, nat size )
420 for(i = 0; i < size; i++, bitmap >>= 1 ) {
421 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-(payload+i)), payload+i);
422 if ((bitmap & 1) == 0) {
423 printPtr((P_)payload[i]);
426 debugBelch("Word# %lu\n", (lnat)payload[i]);
432 printLargeBitmap( StgPtr spBottom, StgPtr payload, StgLargeBitmap* large_bitmap, nat size )
438 for (bmp=0; i < size; bmp++) {
439 StgWord bitmap = large_bitmap->bitmap[bmp];
441 for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) {
442 debugBelch(" stk[%lu] (%p) = ", (lnat)(spBottom-(payload+i)), payload+i);
443 if ((bitmap & 1) == 0) {
444 printPtr((P_)payload[i]);
447 debugBelch("Word# %lu\n", (lnat)payload[i]);
454 printStackChunk( StgPtr sp, StgPtr spBottom )
457 const StgInfoTable *info;
459 ASSERT(sp <= spBottom);
460 for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) {
462 info = get_itbl((StgClosure *)sp);
464 switch (info->type) {
468 printObj((StgClosure*)sp);
472 printObj((StgClosure*)sp);
484 debugBelch("RET_DYN (%p)\n", r);
486 p = (P_)(r->payload);
487 printSmallBitmap(spBottom, sp,
488 RET_DYN_LIVENESS(r->liveness),
489 RET_DYN_BITMAP_SIZE);
490 p += RET_DYN_BITMAP_SIZE + RET_DYN_NONPTR_REGS_SIZE;
492 for (size = RET_DYN_NONPTRS(dyn); size > 0; size--) {
493 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p);
494 debugBelch("Word# %ld\n", (long)*p);
498 for (size = RET_DYN_PTRS(dyn); size > 0; size--) {
499 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p);
507 debugBelch("RET_SMALL (%p)\n", info);
508 bitmap = info->layout.bitmap;
509 printSmallBitmap(spBottom, sp+1,
510 BITMAP_BITS(bitmap), BITMAP_SIZE(bitmap));
516 bco = ((StgBCO *)sp[1]);
518 debugBelch("RET_BCO (%p)\n", sp);
519 printLargeBitmap(spBottom, sp+2,
520 BCO_BITMAP(bco), BCO_BITMAP_SIZE(bco));
529 StgFunInfoTable *fun_info;
533 ret_fun = (StgRetFun *)sp;
534 fun_info = get_fun_itbl(ret_fun->fun);
535 size = ret_fun->size;
536 debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, fun_info->f.fun_type);
537 switch (fun_info->f.fun_type) {
539 printSmallBitmap(spBottom, sp+2,
540 BITMAP_BITS(fun_info->f.b.bitmap),
541 BITMAP_SIZE(fun_info->f.b.bitmap));
544 printLargeBitmap(spBottom, sp+2,
545 GET_FUN_LARGE_BITMAP(fun_info),
546 GET_FUN_LARGE_BITMAP(fun_info)->size);
549 printSmallBitmap(spBottom, sp+2,
550 BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
551 BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]));
558 debugBelch("unknown object %d\n", info->type);
559 barf("printStackChunk");
564 void printTSO( StgTSO *tso )
566 printStackChunk( tso->sp, tso->stack+tso->stack_size);
569 /* --------------------------------------------------------------------------
570 * Address printing code
572 * Uses symbol table in (unstripped executable)
573 * ------------------------------------------------------------------------*/
575 /* --------------------------------------------------------------------------
576 * Simple lookup table
578 * Current implementation is pretty dumb!
579 * ------------------------------------------------------------------------*/
586 static nat table_size;
587 static struct entry* table;
590 static nat max_table_size;
592 static void reset_table( int size )
594 max_table_size = size;
596 table = (struct entry *)stgMallocBytes(size * sizeof(struct entry), "Printer.c:reset_table()");
599 static void prepare_table( void )
601 /* Could sort it... */
604 static void insert( StgWord value, const char *name )
606 if ( table_size >= max_table_size ) {
607 barf( "Symbol table overflow\n" );
609 table[table_size].value = value;
610 table[table_size].name = name;
611 table_size = table_size + 1;
616 static rtsBool lookup_name( char *name, StgWord *result )
619 for( i = 0; i < table_size && strcmp(name,table[i].name) != 0; ++i ) {
621 if (i < table_size) {
622 *result = table[i].value;
630 /* Code from somewhere inside GHC (circa 1994)
632 * "std"++xs -> "Zstd"++xs
633 * char_to_c 'Z' = "ZZ"
634 * char_to_c '&' = "Za"
635 * char_to_c '|' = "Zb"
636 * char_to_c ':' = "Zc"
637 * char_to_c '/' = "Zd"
638 * char_to_c '=' = "Ze"
639 * char_to_c '>' = "Zg"
640 * char_to_c '#' = "Zh"
641 * char_to_c '<' = "Zl"
642 * char_to_c '-' = "Zm"
643 * char_to_c '!' = "Zn"
644 * char_to_c '.' = "Zo"
645 * char_to_c '+' = "Zp"
646 * char_to_c '\'' = "Zq"
647 * char_to_c '*' = "Zt"
648 * char_to_c '_' = "Zu"
649 * char_to_c c = "Z" ++ show (ord c)
651 static char unZcode( char ch )
654 case 'a' : return ('&');
655 case 'b' : return ('|');
656 case 'c' : return (':');
657 case 'd' : return ('/');
658 case 'e' : return ('=');
659 case 'g' : return ('>');
660 case 'h' : return ('#');
661 case 'l' : return ('<');
662 case 'm' : return ('-');
663 case 'n' : return ('!');
664 case 'o' : return ('.');
665 case 'p' : return ('+');
666 case 'q' : return ('\'');
667 case 't' : return ('*');
668 case 'u' : return ('_');
670 case '\0' : return ('Z');
671 default : return (ch);
676 /* Precondition: out big enough to handle output (about twice length of in) */
677 static void enZcode( char *in, char *out )
683 for( i = 0; in[i] != '\0'; ++i ) {
758 const char *lookupGHCName( void *addr )
761 for( i = 0; i < table_size && table[i].value != (StgWord) addr; ++i ) {
763 if (i < table_size) {
764 return table[i].name;
770 static void printZcoded( const char *raw )
774 while ( raw[j] != '\0' ) {
776 debugBelch("%c", unZcode(raw[j+1]));
779 debugBelch("%c", unZcode(raw[j+1]));
785 /* --------------------------------------------------------------------------
786 * Symbol table loading
787 * ------------------------------------------------------------------------*/
789 /* Causing linking trouble on Win32 plats, so I'm
790 disabling this for now.
796 /* Fairly ad-hoc piece of code that seems to filter out a lot of
797 * rubbish like the obj-splitting symbols
800 static rtsBool isReal( flagword flags STG_UNUSED, const char *name )
803 /* ToDo: make this work on BFD */
804 int tp = type & N_TYPE;
805 if (tp == N_TEXT || tp == N_DATA) {
806 return (name[0] == '_' && name[1] != '_');
812 (name[0] == 'g' && name[1] == 'c' && name[2] == 'c') ||
813 (name[0] == 'c' && name[1] == 'c' && name[2] == '.')) {
820 extern void DEBUG_LoadSymbols( char *name )
826 abfd = bfd_openr(name, "default");
828 barf("can't open executable %s to get symbol table", name);
830 if (!bfd_check_format_matches (abfd, bfd_object, &matching)) {
836 asymbol **symbol_table;
837 long number_of_symbols;
838 long num_real_syms = 0;
841 storage_needed = bfd_get_symtab_upper_bound (abfd);
843 if (storage_needed < 0) {
844 barf("can't read symbol table");
847 if (storage_needed == 0) {
848 debugBelch("no storage needed");
851 symbol_table = (asymbol **) stgMallocBytes(storage_needed,"DEBUG_LoadSymbols");
853 number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
855 if (number_of_symbols < 0) {
856 barf("can't canonicalise symbol table");
859 for( i = 0; i != number_of_symbols; ++i ) {
861 bfd_get_symbol_info(abfd,symbol_table[i],&info);
862 /*debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name); */
863 if (isReal(info.type, info.name)) {
868 IF_DEBUG(interpreter,
869 debugBelch("Loaded %ld symbols. Of which %ld are real symbols\n",
870 number_of_symbols, num_real_syms)
873 reset_table( num_real_syms );
875 for( i = 0; i != number_of_symbols; ++i ) {
877 bfd_get_symbol_info(abfd,symbol_table[i],&info);
878 if (isReal(info.type, info.name)) {
879 insert( info.value, info.name );
883 stgFree(symbol_table);
888 #else /* HAVE_BFD_H */
890 extern void DEBUG_LoadSymbols( char *name STG_UNUSED )
895 #endif /* HAVE_BFD_H */
897 void findPtr(P_ p, int); /* keep gcc -Wall happy */
902 findPtrBlocks (StgPtr p, bdescr *bd, StgPtr arr[], int arr_size, int i)
905 for (; bd; bd = bd->link) {
907 for (q = bd->start; q < bd->free; q++) {
908 if (UNTAG_CLOSURE((StgClosure*)*q) == (StgClosure *)p) {
910 for (r = bd->start; r < bd->free; r = end) {
911 // skip over zeroed-out slop
913 if (!LOOKS_LIKE_CLOSURE_PTR(r)) {
914 debugBelch("%p found at %p, no closure at %p\n",
918 end = r + closure_sizeW((StgClosure*)r);
920 debugBelch("%p = ", r);
921 printClosure((StgClosure *)r);
927 debugBelch("%p found at %p, closure?", p, q);
939 findPtr(P_ p, int follow)
943 const int arr_size = 1024;
944 StgPtr arr[arr_size];
948 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
949 bd = generations[g].blocks;
950 i = findPtrBlocks(p,bd,arr,arr_size,i);
951 bd = generations[g].large_objects;
952 i = findPtrBlocks(p,bd,arr,arr_size,i);
953 if (i >= arr_size) return;
955 if (follow && i == 1) {
961 /* prettyPrintClosure() is for printing out a closure using the data constructor
962 names found in the info tables. Closures are printed in a fashion that resembles
963 their Haskell representation. Useful during debugging.
965 Todo: support for more closure types, and support for non pointer fields in the
969 void prettyPrintClosure_ (StgClosure *);
971 void prettyPrintClosure (StgClosure *obj)
973 prettyPrintClosure_ (obj);
977 void prettyPrintClosure_ (StgClosure *obj)
980 StgConInfoTable *con_info;
982 /* collapse any indirections */
984 type = get_itbl(obj)->type;
986 while (type == IND ||
987 type == IND_STATIC ||
990 obj = ((StgInd *)obj)->indirectee;
991 type = get_itbl(obj)->type;
994 /* find the info table for this object */
995 info = get_itbl(obj);
997 /* determine what kind of object we have */
1000 /* full applications of data constructors */
1008 case CONSTR_NOCAF_STATIC:
1013 /* find the con_info for the constructor */
1014 con_info = get_con_itbl (obj);
1016 /* obtain the name of the constructor */
1017 descriptor = GET_CON_DESC(con_info);
1019 debugBelch ("(%s", descriptor);
1021 /* process the payload of the closure */
1022 /* we don't handle non pointers at the moment */
1023 for (i = 0; i < info->layout.payload.ptrs; i++)
1026 prettyPrintClosure_ ((StgClosure *) obj->payload[i]);
1032 /* if it isn't a constructor then just print the closure type */
1035 debugBelch ("<%s>", info_type(obj));
1041 char *what_next_strs[] = {
1043 [ThreadRunGHC] = "ThreadRunGHC",
1044 [ThreadInterpret] = "ThreadInterpret",
1045 [ThreadKilled] = "ThreadKilled",
1046 [ThreadRelocated] = "ThreadRelocated",
1047 [ThreadComplete] = "ThreadComplete"
1051 void printPtr( StgPtr p )
1053 debugBelch("ptr 0x%p (enable -DDEBUG for more info) " , p );
1056 void printObj( StgClosure *obj )
1058 debugBelch("obj 0x%p (enable -DDEBUG for more info) " , obj );
1064 /* -----------------------------------------------------------------------------
1067 NOTE: must be kept in sync with the closure types in includes/ClosureTypes.h
1068 -------------------------------------------------------------------------- */
1070 char *closure_type_names[] = {
1071 [INVALID_OBJECT] = "INVALID_OBJECT",
1072 [CONSTR] = "CONSTR",
1073 [CONSTR_1_0] = "CONSTR_1_0",
1074 [CONSTR_0_1] = "CONSTR_0_1",
1075 [CONSTR_2_0] = "CONSTR_2_0",
1076 [CONSTR_1_1] = "CONSTR_1_1",
1077 [CONSTR_0_2] = "CONSTR_0_2",
1078 [CONSTR_STATIC] = "CONSTR_STATIC",
1079 [CONSTR_NOCAF_STATIC] = "CONSTR_NOCAF_STATIC",
1081 [FUN_1_0] = "FUN_1_0",
1082 [FUN_0_1] = "FUN_0_1",
1083 [FUN_2_0] = "FUN_2_0",
1084 [FUN_1_1] = "FUN_1_1",
1085 [FUN_0_2] = "FUN_0_2",
1086 [FUN_STATIC] = "FUN_STATIC",
1088 [THUNK_1_0] = "THUNK_1_0",
1089 [THUNK_0_1] = "THUNK_0_1",
1090 [THUNK_2_0] = "THUNK_2_0",
1091 [THUNK_1_1] = "THUNK_1_1",
1092 [THUNK_0_2] = "THUNK_0_2",
1093 [THUNK_STATIC] = "THUNK_STATIC",
1094 [THUNK_SELECTOR] = "THUNK_SELECTOR",
1098 [AP_STACK] = "AP_STACK",
1100 [IND_PERM] = "IND_PERM",
1101 [IND_STATIC] = "IND_STATIC",
1102 [RET_BCO] = "RET_BCO",
1103 [RET_SMALL] = "RET_SMALL",
1104 [RET_BIG] = "RET_BIG",
1105 [RET_DYN] = "RET_DYN",
1106 [RET_FUN] = "RET_FUN",
1107 [UPDATE_FRAME] = "UPDATE_FRAME",
1108 [CATCH_FRAME] = "CATCH_FRAME",
1109 [STOP_FRAME] = "STOP_FRAME",
1110 [BLACKHOLE] = "BLACKHOLE",
1111 [BLOCKING_QUEUE] = "BLOCKING_QUEUE",
1112 [MVAR_CLEAN] = "MVAR_CLEAN",
1113 [MVAR_DIRTY] = "MVAR_DIRTY",
1114 [ARR_WORDS] = "ARR_WORDS",
1115 [MUT_ARR_PTRS_CLEAN] = "MUT_ARR_PTRS_CLEAN",
1116 [MUT_ARR_PTRS_DIRTY] = "MUT_ARR_PTRS_DIRTY",
1117 [MUT_ARR_PTRS_FROZEN0] = "MUT_ARR_PTRS_FROZEN0",
1118 [MUT_ARR_PTRS_FROZEN] = "MUT_ARR_PTRS_FROZEN",
1119 [MUT_VAR_CLEAN] = "MUT_VAR_CLEAN",
1120 [MUT_VAR_DIRTY] = "MUT_VAR_DIRTY",
1123 [MUT_PRIM] = "MUT_PRIM",
1125 [TREC_CHUNK] = "TREC_CHUNK",
1126 [ATOMICALLY_FRAME] = "ATOMICALLY_FRAME",
1127 [CATCH_RETRY_FRAME] = "CATCH_RETRY_FRAME",
1128 [CATCH_STM_FRAME] = "CATCH_STM_FRAME",
1129 [WHITEHOLE] = "WHITEHOLE"
1133 info_type(StgClosure *closure){
1134 return closure_type_names[get_itbl(closure)->type];
1138 info_type_by_ip(StgInfoTable *ip){
1139 return closure_type_names[ip->type];
1143 info_hdr_type(StgClosure *closure, char *res){
1144 strcpy(res,closure_type_names[get_itbl(closure)->type]);