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);
165 printPtr((StgPtr)obj->header.info);
166 printStdObjPayload(obj);
170 case THUNK_1_0: case THUNK_0_1:
171 case THUNK_1_1: case THUNK_0_2: case THUNK_2_0:
173 /* ToDo: will this work for THUNK_STATIC too? */
175 printThunkObject((StgThunk *)obj,GET_PROF_DESC(info));
177 printThunkObject((StgThunk *)obj,"THUNK");
182 printStdObjHdr(obj, "THUNK_SELECTOR");
183 debugBelch(", %p)\n", ((StgSelector *)obj)->selectee);
187 disassemble( (StgBCO*)obj );
192 StgAP* ap = (StgAP*)obj;
194 debugBelch("AP("); printPtr((StgPtr)ap->fun);
195 for (i = 0; i < ap->n_args; ++i) {
197 printPtr((P_)ap->payload[i]);
205 StgPAP* pap = (StgPAP*)obj;
207 debugBelch("PAP/%d(",pap->arity);
208 printPtr((StgPtr)pap->fun);
209 for (i = 0; i < pap->n_args; ++i) {
211 printPtr((StgPtr)pap->payload[i]);
219 StgAP_STACK* ap = (StgAP_STACK*)obj;
221 debugBelch("AP_STACK("); printPtr((StgPtr)ap->fun);
222 for (i = 0; i < ap->size; ++i) {
224 printPtr((P_)ap->payload[i]);
232 printPtr((StgPtr)((StgInd*)obj)->indirectee);
237 debugBelch("IND_OLDGEN(");
238 printPtr((StgPtr)((StgInd*)obj)->indirectee);
244 printPtr((StgPtr)((StgInd*)obj)->indirectee);
248 case IND_OLDGEN_PERM:
249 debugBelch("IND_OLDGEN_PERM(");
250 printPtr((StgPtr)((StgInd*)obj)->indirectee);
255 debugBelch("IND_STATIC(");
256 printPtr((StgPtr)((StgInd*)obj)->indirectee);
260 /* Cannot happen -- use default case.
270 StgUpdateFrame* u = (StgUpdateFrame*)obj;
271 debugBelch("UPDATE_FRAME(");
272 printPtr((StgPtr)GET_INFO(u));
274 printPtr((StgPtr)u->updatee);
281 StgCatchFrame* u = (StgCatchFrame*)obj;
282 debugBelch("CATCH_FRAME(");
283 printPtr((StgPtr)GET_INFO(u));
285 printPtr((StgPtr)u->handler);
292 StgStopFrame* u = (StgStopFrame*)obj;
293 debugBelch("STOP_FRAME(");
294 printPtr((StgPtr)GET_INFO(u));
300 debugBelch("CAF_BH");
310 debugBelch("ARR_WORDS(\"");
311 /* ToDo: we can't safely assume that this is a string!
312 for (i = 0; arrWordsGetChar(obj,i); ++i) {
313 putchar(arrWordsGetChar(obj,i));
315 for (i=0; i<((StgArrWords *)obj)->words; i++)
316 debugBelch("%lu", (lnat)((StgArrWords *)obj)->payload[i]);
321 case MUT_ARR_PTRS_CLEAN:
322 debugBelch("MUT_ARR_PTRS_CLEAN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
325 case MUT_ARR_PTRS_DIRTY:
326 debugBelch("MUT_ARR_PTRS_DIRTY(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
329 case MUT_ARR_PTRS_FROZEN:
330 debugBelch("MUT_ARR_PTRS_FROZEN(size=%lu)\n", (lnat)((StgMutArrPtrs *)obj)->ptrs);
336 StgMVar* mv = (StgMVar*)obj;
337 debugBelch("MVAR(head=%p, tail=%p, value=%p)\n", mv->head, mv->tail, mv->value);
343 StgMutVar* mv = (StgMutVar*)obj;
344 debugBelch("MUT_VAR_CLEAN(var=%p)\n", mv->var);
350 StgMutVar* mv = (StgMutVar*)obj;
351 debugBelch("MUT_VAR_DIRTY(var=%p)\n", mv->var);
357 debugBelch(" key=%p value=%p finalizer=%p",
358 (StgPtr)(((StgWeak*)obj)->key),
359 (StgPtr)(((StgWeak*)obj)->value),
360 (StgPtr)(((StgWeak*)obj)->finalizer));
362 /* ToDo: chase 'link' ? */
367 debugBelch("%lu (%p)",(unsigned long)(((StgTSO*)obj)->id), (StgTSO*)obj);
372 /* Symptomatic of a problem elsewhere, have it fall-through & fail */
374 debugBelch("EVACUATED(");
375 printClosure((StgEvacuated*)obj->evacuee);
381 //barf("printClosure %d",get_itbl(obj)->type);
382 debugBelch("*** printClosure: unknown type %d ****\n",
383 get_itbl(obj)->type );
384 barf("printClosure %d",get_itbl(obj)->type);
390 void printGraph( StgClosure *obj )
397 printStackObj( StgPtr sp )
399 /*debugBelch("Stack[%d] = ", &stgStack[STACK_SIZE] - sp); */
401 StgClosure* c = (StgClosure*)(*sp);
402 printPtr((StgPtr)*sp);
403 if (c == (StgClosure*)&stg_ctoi_R1p_info) {
404 debugBelch("\t\t\tstg_ctoi_ret_R1p_info\n" );
406 if (c == (StgClosure*)&stg_ctoi_R1n_info) {
407 debugBelch("\t\t\tstg_ctoi_ret_R1n_info\n" );
409 if (c == (StgClosure*)&stg_ctoi_F1_info) {
410 debugBelch("\t\t\tstg_ctoi_ret_F1_info\n" );
412 if (c == (StgClosure*)&stg_ctoi_D1_info) {
413 debugBelch("\t\t\tstg_ctoi_ret_D1_info\n" );
415 if (c == (StgClosure*)&stg_ctoi_V_info) {
416 debugBelch("\t\t\tstg_ctoi_ret_V_info\n" );
418 if (get_itbl(c)->type == BCO) {
419 debugBelch("\t\t\t");
420 debugBelch("BCO(...)\n");
423 debugBelch("\t\t\t");
424 printClosure ( (StgClosure*)(*sp));
433 printSmallBitmap( StgPtr spBottom, StgPtr payload, StgWord bitmap, nat size )
439 for(i = 0; i < size; i++, bitmap >>= 1 ) {
440 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-(payload+i)), payload+i);
441 if ((bitmap & 1) == 0) {
442 printPtr((P_)payload[i]);
445 debugBelch("Word# %lu\n", (lnat)payload[i]);
451 printLargeBitmap( StgPtr spBottom, StgPtr payload, StgLargeBitmap* large_bitmap, nat size )
457 for (bmp=0; i < size; bmp++) {
458 StgWord bitmap = large_bitmap->bitmap[bmp];
460 for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) {
461 debugBelch(" stk[%lu] (%p) = ", (lnat)(spBottom-(payload+i)), payload+i);
462 if ((bitmap & 1) == 0) {
463 printPtr((P_)payload[i]);
466 debugBelch("Word# %lu\n", (lnat)payload[i]);
473 printStackChunk( StgPtr sp, StgPtr spBottom )
476 const StgInfoTable *info;
478 ASSERT(sp <= spBottom);
479 for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) {
481 info = get_itbl((StgClosure *)sp);
483 switch (info->type) {
487 printObj((StgClosure*)sp);
491 printObj((StgClosure*)sp);
503 debugBelch("RET_DYN (%p)\n", r);
505 p = (P_)(r->payload);
506 printSmallBitmap(spBottom, sp,
507 RET_DYN_LIVENESS(r->liveness),
508 RET_DYN_BITMAP_SIZE);
509 p += RET_DYN_BITMAP_SIZE + RET_DYN_NONPTR_REGS_SIZE;
511 for (size = RET_DYN_NONPTRS(dyn); size > 0; size--) {
512 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p);
513 debugBelch("Word# %ld\n", (long)*p);
517 for (size = RET_DYN_PTRS(dyn); size > 0; size--) {
518 debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p);
526 debugBelch("RET_SMALL (%p)\n", info);
527 bitmap = info->layout.bitmap;
528 printSmallBitmap(spBottom, sp+1,
529 BITMAP_BITS(bitmap), BITMAP_SIZE(bitmap));
535 bco = ((StgBCO *)sp[1]);
537 debugBelch("RET_BCO (%p)\n", sp);
538 printLargeBitmap(spBottom, sp+2,
539 BCO_BITMAP(bco), BCO_BITMAP_SIZE(bco));
548 StgFunInfoTable *fun_info;
552 ret_fun = (StgRetFun *)sp;
553 fun_info = get_fun_itbl(ret_fun->fun);
554 size = ret_fun->size;
555 debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, fun_info->f.fun_type);
556 switch (fun_info->f.fun_type) {
558 printSmallBitmap(spBottom, sp+2,
559 BITMAP_BITS(fun_info->f.b.bitmap),
560 BITMAP_SIZE(fun_info->f.b.bitmap));
563 printLargeBitmap(spBottom, sp+2,
564 GET_FUN_LARGE_BITMAP(fun_info),
565 GET_FUN_LARGE_BITMAP(fun_info)->size);
568 printSmallBitmap(spBottom, sp+2,
569 BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
570 BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]));
577 debugBelch("unknown object %d\n", info->type);
578 barf("printStackChunk");
583 void printTSO( StgTSO *tso )
585 printStackChunk( tso->sp, tso->stack+tso->stack_size);
588 /* --------------------------------------------------------------------------
589 * Address printing code
591 * Uses symbol table in (unstripped executable)
592 * ------------------------------------------------------------------------*/
594 /* --------------------------------------------------------------------------
595 * Simple lookup table
597 * Current implementation is pretty dumb!
598 * ------------------------------------------------------------------------*/
605 static nat table_size;
606 static struct entry* table;
609 static nat max_table_size;
611 static void reset_table( int size )
613 max_table_size = size;
615 table = (struct entry *)stgMallocBytes(size * sizeof(struct entry), "Printer.c:reset_table()");
618 static void prepare_table( void )
620 /* Could sort it... */
623 static void insert( StgWord value, const char *name )
625 if ( table_size >= max_table_size ) {
626 barf( "Symbol table overflow\n" );
628 table[table_size].value = value;
629 table[table_size].name = name;
630 table_size = table_size + 1;
635 static rtsBool lookup_name( char *name, StgWord *result )
638 for( i = 0; i < table_size && strcmp(name,table[i].name) != 0; ++i ) {
640 if (i < table_size) {
641 *result = table[i].value;
649 /* Code from somewhere inside GHC (circa 1994)
651 * "std"++xs -> "Zstd"++xs
652 * char_to_c 'Z' = "ZZ"
653 * char_to_c '&' = "Za"
654 * char_to_c '|' = "Zb"
655 * char_to_c ':' = "Zc"
656 * char_to_c '/' = "Zd"
657 * char_to_c '=' = "Ze"
658 * char_to_c '>' = "Zg"
659 * char_to_c '#' = "Zh"
660 * char_to_c '<' = "Zl"
661 * char_to_c '-' = "Zm"
662 * char_to_c '!' = "Zn"
663 * char_to_c '.' = "Zo"
664 * char_to_c '+' = "Zp"
665 * char_to_c '\'' = "Zq"
666 * char_to_c '*' = "Zt"
667 * char_to_c '_' = "Zu"
668 * char_to_c c = "Z" ++ show (ord c)
670 static char unZcode( char ch )
673 case 'a' : return ('&');
674 case 'b' : return ('|');
675 case 'c' : return (':');
676 case 'd' : return ('/');
677 case 'e' : return ('=');
678 case 'g' : return ('>');
679 case 'h' : return ('#');
680 case 'l' : return ('<');
681 case 'm' : return ('-');
682 case 'n' : return ('!');
683 case 'o' : return ('.');
684 case 'p' : return ('+');
685 case 'q' : return ('\'');
686 case 't' : return ('*');
687 case 'u' : return ('_');
689 case '\0' : return ('Z');
690 default : return (ch);
695 /* Precondition: out big enough to handle output (about twice length of in) */
696 static void enZcode( char *in, char *out )
702 for( i = 0; in[i] != '\0'; ++i ) {
777 const char *lookupGHCName( void *addr )
780 for( i = 0; i < table_size && table[i].value != (StgWord) addr; ++i ) {
782 if (i < table_size) {
783 return table[i].name;
789 static void printZcoded( const char *raw )
793 while ( raw[j] != '\0' ) {
795 debugBelch("%c", unZcode(raw[j+1]));
798 debugBelch("%c", unZcode(raw[j+1]));
804 /* --------------------------------------------------------------------------
805 * Symbol table loading
806 * ------------------------------------------------------------------------*/
808 /* Causing linking trouble on Win32 plats, so I'm
809 disabling this for now.
815 /* Fairly ad-hoc piece of code that seems to filter out a lot of
816 * rubbish like the obj-splitting symbols
819 static rtsBool isReal( flagword flags STG_UNUSED, const char *name )
822 /* ToDo: make this work on BFD */
823 int tp = type & N_TYPE;
824 if (tp == N_TEXT || tp == N_DATA) {
825 return (name[0] == '_' && name[1] != '_');
831 (name[0] == 'g' && name[1] == 'c' && name[2] == 'c') ||
832 (name[0] == 'c' && name[1] == 'c' && name[2] == '.')) {
839 extern void DEBUG_LoadSymbols( char *name )
845 abfd = bfd_openr(name, "default");
847 barf("can't open executable %s to get symbol table", name);
849 if (!bfd_check_format_matches (abfd, bfd_object, &matching)) {
855 asymbol **symbol_table;
856 long number_of_symbols;
857 long num_real_syms = 0;
860 storage_needed = bfd_get_symtab_upper_bound (abfd);
862 if (storage_needed < 0) {
863 barf("can't read symbol table");
866 if (storage_needed == 0) {
867 debugBelch("no storage needed");
870 symbol_table = (asymbol **) stgMallocBytes(storage_needed,"DEBUG_LoadSymbols");
872 number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
874 if (number_of_symbols < 0) {
875 barf("can't canonicalise symbol table");
878 for( i = 0; i != number_of_symbols; ++i ) {
880 bfd_get_symbol_info(abfd,symbol_table[i],&info);
881 /*debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name); */
882 if (isReal(info.type, info.name)) {
887 IF_DEBUG(interpreter,
888 debugBelch("Loaded %ld symbols. Of which %ld are real symbols\n",
889 number_of_symbols, num_real_syms)
892 reset_table( num_real_syms );
894 for( i = 0; i != number_of_symbols; ++i ) {
896 bfd_get_symbol_info(abfd,symbol_table[i],&info);
897 if (isReal(info.type, info.name)) {
898 insert( info.value, info.name );
902 stgFree(symbol_table);
907 #else /* HAVE_BFD_H */
909 extern void DEBUG_LoadSymbols( char *name STG_UNUSED )
914 #endif /* HAVE_BFD_H */
916 void findPtr(P_ p, int); /* keep gcc -Wall happy */
921 findPtrBlocks (StgPtr p, bdescr *bd, StgPtr arr[], int arr_size, int i)
924 for (; bd; bd = bd->link) {
926 for (q = bd->start; q < bd->free; q++) {
927 if (UNTAG_CLOSURE((StgClosure*)*q) == (StgClosure *)p) {
930 while (HEAP_ALLOCED((StgPtr)*r) || !LOOKS_LIKE_INFO_PTR(*r) || (P_)*r == NULL) {
933 debugBelch("%p = ", r);
934 printClosure((StgClosure *)r);
946 findPtr(P_ p, int follow)
950 #if defined(__GNUC__)
951 const int arr_size = 1024;
953 #define arr_size 1024
955 StgPtr arr[arr_size];
959 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
960 bd = generations[g].blocks;
961 i = findPtrBlocks(p,bd,arr,arr_size,i);
962 bd = generations[g].large_objects;
963 i = findPtrBlocks(p,bd,arr,arr_size,i);
964 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",
1138 [MUT_PRIM] = "MUT_PRIM",
1140 [TREC_CHUNK] = "TREC_CHUNK",
1141 [ATOMICALLY_FRAME] = "ATOMICALLY_FRAME",
1142 [CATCH_RETRY_FRAME] = "CATCH_RETRY_FRAME",
1143 [CATCH_STM_FRAME] = "CATCH_STM_FRAME",
1144 [WHITEHOLE] = "WHITEHOLE"
1148 info_type(StgClosure *closure){
1149 return closure_type_names[get_itbl(closure)->type];
1153 info_type_by_ip(StgInfoTable *ip){
1154 return closure_type_names[ip->type];
1158 info_hdr_type(StgClosure *closure, char *res){
1159 strcpy(res,closure_type_names[get_itbl(closure)->type]);