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:
133 debugBelch("%s(", GET_PROF_DESC(info));
134 debugBelch("%s", obj->header.prof.ccs->cc->label);
136 debugBelch("CONSTR(");
137 printPtr((StgPtr)obj->header.info);
138 debugBelch("(tag=%d)",info->srt_bitmap);
140 for (i = 0; i < info->layout.payload.ptrs; ++i) {
142 printPtr((StgPtr)obj->payload[i]);
144 for (j = 0; j < info->layout.payload.nptrs; ++j) {
145 debugBelch(", %p#", obj->payload[i+j]);
152 case FUN_1_0: case FUN_0_1:
153 case FUN_1_1: case FUN_0_2: case FUN_2_0:
155 debugBelch("FUN/%d(",itbl_to_fun_itbl(info)->f.arity);
156 printPtr((StgPtr)obj->header.info);
158 debugBelch(", %s", obj->header.prof.ccs->cc->label);
160 printStdObjPayload(obj);
164 case THUNK_1_0: case THUNK_0_1:
165 case THUNK_1_1: case THUNK_0_2: case THUNK_2_0:
167 /* ToDo: will this work for THUNK_STATIC too? */
169 printThunkObject((StgThunk *)obj,GET_PROF_DESC(info));
171 printThunkObject((StgThunk *)obj,"THUNK");
176 printStdObjHdr(obj, "THUNK_SELECTOR");
177 debugBelch(", %p)\n", ((StgSelector *)obj)->selectee);
181 disassemble( (StgBCO*)obj );
186 StgAP* ap = (StgAP*)obj;
188 debugBelch("AP("); printPtr((StgPtr)ap->fun);
189 for (i = 0; i < ap->n_args; ++i) {
191 printPtr((P_)ap->payload[i]);
199 StgPAP* pap = (StgPAP*)obj;
201 debugBelch("PAP/%d(",pap->arity);
202 printPtr((StgPtr)pap->fun);
203 for (i = 0; i < pap->n_args; ++i) {
205 printPtr((StgPtr)pap->payload[i]);
213 StgAP_STACK* ap = (StgAP_STACK*)obj;
215 debugBelch("AP_STACK("); printPtr((StgPtr)ap->fun);
216 for (i = 0; i < ap->size; ++i) {
218 printPtr((P_)ap->payload[i]);
226 printPtr((StgPtr)((StgInd*)obj)->indirectee);
231 debugBelch("IND_OLDGEN(");
232 printPtr((StgPtr)((StgInd*)obj)->indirectee);
238 printPtr((StgPtr)((StgInd*)obj)->indirectee);
242 case IND_OLDGEN_PERM:
243 debugBelch("IND_OLDGEN_PERM(");
244 printPtr((StgPtr)((StgInd*)obj)->indirectee);
249 debugBelch("IND_STATIC(");
250 printPtr((StgPtr)((StgInd*)obj)->indirectee);
254 /* Cannot happen -- use default case.
264 StgUpdateFrame* u = (StgUpdateFrame*)obj;
265 debugBelch("UPDATE_FRAME(");
266 printPtr((StgPtr)GET_INFO(u));
268 printPtr((StgPtr)u->updatee);
275 StgCatchFrame* u = (StgCatchFrame*)obj;
276 debugBelch("CATCH_FRAME(");
277 printPtr((StgPtr)GET_INFO(u));
279 printPtr((StgPtr)u->handler);
286 StgStopFrame* u = (StgStopFrame*)obj;
287 debugBelch("STOP_FRAME(");
288 printPtr((StgPtr)GET_INFO(u));
294 debugBelch("CAF_BH");
304 debugBelch("ARR_WORDS(\"");
305 /* ToDo: we can't safely assume that this is a string!
306 for (i = 0; arrWordsGetChar(obj,i); ++i) {
307 putchar(arrWordsGetChar(obj,i));
309 for (i=0; i<((StgArrWords *)obj)->words; i++)
310 debugBelch("%lu", (lnat)((StgArrWords *)obj)->payload[i]);
315 case MUT_ARR_PTRS_CLEAN:
316 debugBelch("MUT_ARR_PTRS_CLEAN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
319 case MUT_ARR_PTRS_DIRTY:
320 debugBelch("MUT_ARR_PTRS_DIRTY(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
323 case MUT_ARR_PTRS_FROZEN:
324 debugBelch("MUT_ARR_PTRS_FROZEN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
330 StgMVar* mv = (StgMVar*)obj;
331 debugBelch("MVAR(head=%p, tail=%p, value=%p)\n", mv->head, mv->tail, mv->value);
337 StgMutVar* mv = (StgMutVar*)obj;
338 debugBelch("MUT_VAR_CLEAN(var=%p)\n", mv->var);
344 StgMutVar* mv = (StgMutVar*)obj;
345 debugBelch("MUT_VAR_DIRTY(var=%p)\n", mv->var);
351 debugBelch(" key=%p value=%p finalizer=%p",
352 (StgPtr)(((StgWeak*)obj)->key),
353 (StgPtr)(((StgWeak*)obj)->value),
354 (StgPtr)(((StgWeak*)obj)->finalizer));
356 /* ToDo: chase 'link' ? */
360 debugBelch("STABLE_NAME(%lu)\n", (lnat)((StgStableName*)obj)->sn);
365 debugBelch("%lu (%p)",(unsigned long)(((StgTSO*)obj)->id), (StgTSO*)obj);
370 /* Symptomatic of a problem elsewhere, have it fall-through & fail */
372 debugBelch("EVACUATED(");
373 printClosure((StgEvacuated*)obj->evacuee);
379 //barf("printClosure %d",get_itbl(obj)->type);
380 debugBelch("*** printClosure: unknown type %d ****\n",
381 get_itbl(obj)->type );
382 barf("printClosure %d",get_itbl(obj)->type);
388 void printGraph( StgClosure *obj )
395 printStackObj( StgPtr sp )
397 /*debugBelch("Stack[%d] = ", &stgStack[STACK_SIZE] - sp); */
399 StgClosure* c = (StgClosure*)(*sp);
400 printPtr((StgPtr)*sp);
401 if (c == (StgClosure*)&stg_ctoi_R1p_info) {
402 debugBelch("\t\t\tstg_ctoi_ret_R1p_info\n" );
404 if (c == (StgClosure*)&stg_ctoi_R1n_info) {
405 debugBelch("\t\t\tstg_ctoi_ret_R1n_info\n" );
407 if (c == (StgClosure*)&stg_ctoi_F1_info) {
408 debugBelch("\t\t\tstg_ctoi_ret_F1_info\n" );
410 if (c == (StgClosure*)&stg_ctoi_D1_info) {
411 debugBelch("\t\t\tstg_ctoi_ret_D1_info\n" );
413 if (c == (StgClosure*)&stg_ctoi_V_info) {
414 debugBelch("\t\t\tstg_ctoi_ret_V_info\n" );
416 if (get_itbl(c)->type == BCO) {
417 debugBelch("\t\t\t");
418 debugBelch("BCO(...)\n");
421 debugBelch("\t\t\t");
422 printClosure ( (StgClosure*)(*sp));
431 printSmallBitmap( StgPtr spBottom, StgPtr payload, StgWord bitmap, nat size )
437 for(i = 0; i < size; i++, bitmap >>= 1 ) {
438 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-(payload+i)), payload+i);
439 if ((bitmap & 1) == 0) {
440 printPtr((P_)payload[i]);
443 debugBelch("Word# %lu\n", (lnat)payload[i]);
449 printLargeBitmap( StgPtr spBottom, StgPtr payload, StgLargeBitmap* large_bitmap, nat size )
455 for (bmp=0; i < size; bmp++) {
456 StgWord bitmap = large_bitmap->bitmap[bmp];
458 for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) {
459 debugBelch(" stk[%lu] (%p) = ", (lnat)(spBottom-(payload+i)), payload+i);
460 if ((bitmap & 1) == 0) {
461 printPtr((P_)payload[i]);
464 debugBelch("Word# %lu\n", (lnat)payload[i]);
471 printStackChunk( StgPtr sp, StgPtr spBottom )
474 const StgInfoTable *info;
476 ASSERT(sp <= spBottom);
477 for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) {
479 info = get_itbl((StgClosure *)sp);
481 switch (info->type) {
485 printObj((StgClosure*)sp);
489 printObj((StgClosure*)sp);
501 debugBelch("RET_DYN (%p)\n", r);
503 p = (P_)(r->payload);
504 printSmallBitmap(spBottom, sp,
505 RET_DYN_LIVENESS(r->liveness),
506 RET_DYN_BITMAP_SIZE);
507 p += RET_DYN_BITMAP_SIZE + RET_DYN_NONPTR_REGS_SIZE;
509 for (size = RET_DYN_NONPTRS(dyn); size > 0; size--) {
510 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p);
511 debugBelch("Word# %ld\n", (long)*p);
515 for (size = RET_DYN_PTRS(dyn); size > 0; size--) {
516 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p);
524 debugBelch("RET_SMALL (%p)\n", info);
525 bitmap = info->layout.bitmap;
526 printSmallBitmap(spBottom, sp+1,
527 BITMAP_BITS(bitmap), BITMAP_SIZE(bitmap));
533 bco = ((StgBCO *)sp[1]);
535 debugBelch("RET_BCO (%p)\n", sp);
536 printLargeBitmap(spBottom, sp+2,
537 BCO_BITMAP(bco), BCO_BITMAP_SIZE(bco));
546 StgFunInfoTable *fun_info;
550 ret_fun = (StgRetFun *)sp;
551 fun_info = get_fun_itbl(ret_fun->fun);
552 size = ret_fun->size;
553 debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, fun_info->f.fun_type);
554 switch (fun_info->f.fun_type) {
556 printSmallBitmap(spBottom, sp+2,
557 BITMAP_BITS(fun_info->f.b.bitmap),
558 BITMAP_SIZE(fun_info->f.b.bitmap));
561 printLargeBitmap(spBottom, sp+2,
562 GET_FUN_LARGE_BITMAP(fun_info),
563 GET_FUN_LARGE_BITMAP(fun_info)->size);
566 printSmallBitmap(spBottom, sp+2,
567 BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
568 BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]));
575 debugBelch("unknown object %d\n", info->type);
576 barf("printStackChunk");
581 void printTSO( StgTSO *tso )
583 printStackChunk( tso->sp, tso->stack+tso->stack_size);
586 /* --------------------------------------------------------------------------
587 * Address printing code
589 * Uses symbol table in (unstripped executable)
590 * ------------------------------------------------------------------------*/
592 /* --------------------------------------------------------------------------
593 * Simple lookup table
595 * Current implementation is pretty dumb!
596 * ------------------------------------------------------------------------*/
603 static nat table_size;
604 static struct entry* table;
607 static nat max_table_size;
609 static void reset_table( int size )
611 max_table_size = size;
613 table = (struct entry *)stgMallocBytes(size * sizeof(struct entry), "Printer.c:reset_table()");
616 static void prepare_table( void )
618 /* Could sort it... */
621 static void insert( StgWord value, const char *name )
623 if ( table_size >= max_table_size ) {
624 barf( "Symbol table overflow\n" );
626 table[table_size].value = value;
627 table[table_size].name = name;
628 table_size = table_size + 1;
633 static rtsBool lookup_name( char *name, StgWord *result )
636 for( i = 0; i < table_size && strcmp(name,table[i].name) != 0; ++i ) {
638 if (i < table_size) {
639 *result = table[i].value;
647 /* Code from somewhere inside GHC (circa 1994)
649 * "std"++xs -> "Zstd"++xs
650 * char_to_c 'Z' = "ZZ"
651 * char_to_c '&' = "Za"
652 * char_to_c '|' = "Zb"
653 * char_to_c ':' = "Zc"
654 * char_to_c '/' = "Zd"
655 * char_to_c '=' = "Ze"
656 * char_to_c '>' = "Zg"
657 * char_to_c '#' = "Zh"
658 * char_to_c '<' = "Zl"
659 * char_to_c '-' = "Zm"
660 * char_to_c '!' = "Zn"
661 * char_to_c '.' = "Zo"
662 * char_to_c '+' = "Zp"
663 * char_to_c '\'' = "Zq"
664 * char_to_c '*' = "Zt"
665 * char_to_c '_' = "Zu"
666 * char_to_c c = "Z" ++ show (ord c)
668 static char unZcode( char ch )
671 case 'a' : return ('&');
672 case 'b' : return ('|');
673 case 'c' : return (':');
674 case 'd' : return ('/');
675 case 'e' : return ('=');
676 case 'g' : return ('>');
677 case 'h' : return ('#');
678 case 'l' : return ('<');
679 case 'm' : return ('-');
680 case 'n' : return ('!');
681 case 'o' : return ('.');
682 case 'p' : return ('+');
683 case 'q' : return ('\'');
684 case 't' : return ('*');
685 case 'u' : return ('_');
687 case '\0' : return ('Z');
688 default : return (ch);
693 /* Precondition: out big enough to handle output (about twice length of in) */
694 static void enZcode( char *in, char *out )
700 for( i = 0; in[i] != '\0'; ++i ) {
775 const char *lookupGHCName( void *addr )
778 for( i = 0; i < table_size && table[i].value != (StgWord) addr; ++i ) {
780 if (i < table_size) {
781 return table[i].name;
787 static void printZcoded( const char *raw )
791 while ( raw[j] != '\0' ) {
793 debugBelch("%c", unZcode(raw[j+1]));
796 debugBelch("%c", unZcode(raw[j+1]));
802 /* --------------------------------------------------------------------------
803 * Symbol table loading
804 * ------------------------------------------------------------------------*/
806 /* Causing linking trouble on Win32 plats, so I'm
807 disabling this for now.
813 /* Fairly ad-hoc piece of code that seems to filter out a lot of
814 * rubbish like the obj-splitting symbols
817 static rtsBool isReal( flagword flags STG_UNUSED, const char *name )
820 /* ToDo: make this work on BFD */
821 int tp = type & N_TYPE;
822 if (tp == N_TEXT || tp == N_DATA) {
823 return (name[0] == '_' && name[1] != '_');
829 (name[0] == 'g' && name[1] == 'c' && name[2] == 'c') ||
830 (name[0] == 'c' && name[1] == 'c' && name[2] == '.')) {
837 extern void DEBUG_LoadSymbols( char *name )
843 abfd = bfd_openr(name, "default");
845 barf("can't open executable %s to get symbol table", name);
847 if (!bfd_check_format_matches (abfd, bfd_object, &matching)) {
853 asymbol **symbol_table;
854 long number_of_symbols;
855 long num_real_syms = 0;
858 storage_needed = bfd_get_symtab_upper_bound (abfd);
860 if (storage_needed < 0) {
861 barf("can't read symbol table");
864 if (storage_needed == 0) {
865 debugBelch("no storage needed");
868 symbol_table = (asymbol **) stgMallocBytes(storage_needed,"DEBUG_LoadSymbols");
870 number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
872 if (number_of_symbols < 0) {
873 barf("can't canonicalise symbol table");
876 for( i = 0; i != number_of_symbols; ++i ) {
878 bfd_get_symbol_info(abfd,symbol_table[i],&info);
879 /*debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name); */
880 if (isReal(info.type, info.name)) {
885 IF_DEBUG(interpreter,
886 debugBelch("Loaded %ld symbols. Of which %ld are real symbols\n",
887 number_of_symbols, num_real_syms)
890 reset_table( num_real_syms );
892 for( i = 0; i != number_of_symbols; ++i ) {
894 bfd_get_symbol_info(abfd,symbol_table[i],&info);
895 if (isReal(info.type, info.name)) {
896 insert( info.value, info.name );
900 stgFree(symbol_table);
905 #else /* HAVE_BFD_H */
907 extern void DEBUG_LoadSymbols( char *name STG_UNUSED )
912 #endif /* HAVE_BFD_H */
914 void findPtr(P_ p, int); /* keep gcc -Wall happy */
919 findPtrBlocks (StgPtr p, bdescr *bd, StgPtr arr[], int arr_size, int i)
922 for (; bd; bd = bd->link) {
924 for (q = bd->start; q < bd->free; q++) {
925 if (UNTAG_CLOSURE((StgClosure*)*q) == (StgClosure *)p) {
928 while (HEAP_ALLOCED((StgPtr)*r) || !LOOKS_LIKE_INFO_PTR(*r) || (P_)*r == NULL) {
931 debugBelch("%p = ", r);
932 printClosure((StgClosure *)r);
944 findPtr(P_ p, int follow)
948 #if defined(__GNUC__)
949 const int arr_size = 1024;
951 #define arr_size 1024
953 StgPtr arr[arr_size];
957 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
958 for (s = 0; s < generations[g].n_steps; s++) {
959 bd = generations[g].steps[s].blocks;
960 i = findPtrBlocks(p,bd,arr,arr_size,i);
961 bd = generations[g].steps[s].large_objects;
962 i = findPtrBlocks(p,bd,arr,arr_size,i);
963 if (i >= arr_size) return;
966 if (follow && i == 1) {
972 /* prettyPrintClosure() is for printing out a closure using the data constructor
973 names found in the info tables. Closures are printed in a fashion that resembles
974 their Haskell representation. Useful during debugging.
976 Todo: support for more closure types, and support for non pointer fields in the
980 void prettyPrintClosure_ (StgClosure *);
982 void prettyPrintClosure (StgClosure *obj)
984 prettyPrintClosure_ (obj);
988 void prettyPrintClosure_ (StgClosure *obj)
991 StgConInfoTable *con_info;
993 /* collapse any indirections */
995 type = get_itbl(obj)->type;
997 while (type == IND ||
998 type == IND_STATIC ||
999 type == IND_OLDGEN ||
1001 type == IND_OLDGEN_PERM)
1003 obj = ((StgInd *)obj)->indirectee;
1004 type = get_itbl(obj)->type;
1007 /* find the info table for this object */
1008 info = get_itbl(obj);
1010 /* determine what kind of object we have */
1013 /* full applications of data constructors */
1021 case CONSTR_NOCAF_STATIC:
1026 /* find the con_info for the constructor */
1027 con_info = get_con_itbl (obj);
1029 /* obtain the name of the constructor */
1030 descriptor = GET_CON_DESC(con_info);
1032 debugBelch ("(%s", descriptor);
1034 /* process the payload of the closure */
1035 /* we don't handle non pointers at the moment */
1036 for (i = 0; i < info->layout.payload.ptrs; i++)
1039 prettyPrintClosure_ ((StgClosure *) obj->payload[i]);
1045 /* if it isn't a constructor then just print the closure type */
1048 debugBelch ("<%s>", info_type(obj));
1054 char *what_next_strs[] = {
1056 [ThreadRunGHC] = "ThreadRunGHC",
1057 [ThreadInterpret] = "ThreadInterpret",
1058 [ThreadKilled] = "ThreadKilled",
1059 [ThreadRelocated] = "ThreadRelocated",
1060 [ThreadComplete] = "ThreadComplete"
1064 void printPtr( StgPtr p )
1066 debugBelch("ptr 0x%p (enable -DDEBUG for more info) " , p );
1069 void printObj( StgClosure *obj )
1071 debugBelch("obj 0x%p (enable -DDEBUG for more info) " , obj );
1077 /* -----------------------------------------------------------------------------
1080 NOTE: must be kept in sync with the closure types in includes/ClosureTypes.h
1081 -------------------------------------------------------------------------- */
1083 char *closure_type_names[] = {
1084 [INVALID_OBJECT] = "INVALID_OBJECT",
1085 [CONSTR] = "CONSTR",
1086 [CONSTR_1_0] = "CONSTR_1_0",
1087 [CONSTR_0_1] = "CONSTR_0_1",
1088 [CONSTR_2_0] = "CONSTR_2_0",
1089 [CONSTR_1_1] = "CONSTR_1_1",
1090 [CONSTR_0_2] = "CONSTR_0_2",
1091 [CONSTR_STATIC] = "CONSTR_STATIC",
1092 [CONSTR_NOCAF_STATIC] = "CONSTR_NOCAF_STATIC",
1094 [FUN_1_0] = "FUN_1_0",
1095 [FUN_0_1] = "FUN_0_1",
1096 [FUN_2_0] = "FUN_2_0",
1097 [FUN_1_1] = "FUN_1_1",
1098 [FUN_0_2] = "FUN_0_2",
1099 [FUN_STATIC] = "FUN_STATIC",
1101 [THUNK_1_0] = "THUNK_1_0",
1102 [THUNK_0_1] = "THUNK_0_1",
1103 [THUNK_2_0] = "THUNK_2_0",
1104 [THUNK_1_1] = "THUNK_1_1",
1105 [THUNK_0_2] = "THUNK_0_2",
1106 [THUNK_STATIC] = "THUNK_STATIC",
1107 [THUNK_SELECTOR] = "THUNK_SELECTOR",
1111 [AP_STACK] = "AP_STACK",
1113 [IND_OLDGEN] = "IND_OLDGEN",
1114 [IND_PERM] = "IND_PERM",
1115 [IND_OLDGEN_PERM] = "IND_OLDGEN_PERM",
1116 [IND_STATIC] = "IND_STATIC",
1117 [RET_BCO] = "RET_BCO",
1118 [RET_SMALL] = "RET_SMALL",
1119 [RET_BIG] = "RET_BIG",
1120 [RET_DYN] = "RET_DYN",
1121 [RET_FUN] = "RET_FUN",
1122 [UPDATE_FRAME] = "UPDATE_FRAME",
1123 [CATCH_FRAME] = "CATCH_FRAME",
1124 [STOP_FRAME] = "STOP_FRAME",
1125 [CAF_BLACKHOLE] = "CAF_BLACKHOLE",
1126 [BLACKHOLE] = "BLACKHOLE",
1127 [MVAR_CLEAN] = "MVAR_CLEAN",
1128 [MVAR_DIRTY] = "MVAR_DIRTY",
1129 [ARR_WORDS] = "ARR_WORDS",
1130 [MUT_ARR_PTRS_CLEAN] = "MUT_ARR_PTRS_CLEAN",
1131 [MUT_ARR_PTRS_DIRTY] = "MUT_ARR_PTRS_DIRTY",
1132 [MUT_ARR_PTRS_FROZEN0] = "MUT_ARR_PTRS_FROZEN0",
1133 [MUT_ARR_PTRS_FROZEN] = "MUT_ARR_PTRS_FROZEN",
1134 [MUT_VAR_CLEAN] = "MUT_VAR_CLEAN",
1135 [MUT_VAR_DIRTY] = "MUT_VAR_DIRTY",
1137 [STABLE_NAME] = "STABLE_NAME",
1139 [TVAR_WATCH_QUEUE] = "TVAR_WATCH_QUEUE",
1140 [INVARIANT_CHECK_QUEUE] = "INVARIANT_CHECK_QUEUE",
1141 [ATOMIC_INVARIANT] = "ATOMIC_INVARIANT",
1143 [TREC_CHUNK] = "TREC_CHUNK",
1144 [TREC_HEADER] = "TREC_HEADER",
1145 [ATOMICALLY_FRAME] = "ATOMICALLY_FRAME",
1146 [CATCH_RETRY_FRAME] = "CATCH_RETRY_FRAME",
1147 [CATCH_STM_FRAME] = "CATCH_STM_FRAME",
1148 [WHITEHOLE] = "WHITEHOLE"
1152 info_type(StgClosure *closure){
1153 return closure_type_names[get_itbl(closure)->type];
1157 info_type_by_ip(StgInfoTable *ip){
1158 return closure_type_names[ip->type];
1162 info_hdr_type(StgClosure *closure, char *res){
1163 strcpy(res,closure_type_names[get_itbl(closure)->type]);