X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FPrinter.c;h=fcc483dce6e934d815b1756c92cde4be7ca230e2;hb=26f4bfc82f2b2359259578e9c54d476fc2de650f;hp=6ab4b7e0684e97a40c25a1d04a576522d7145c5d;hpb=70a2431f90fa932733ce015714ef7848640ed48f;p=ghc-hetmet.git diff --git a/rts/Printer.c b/rts/Printer.c index 6ab4b7e..fcc483d 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -128,21 +128,16 @@ printClosure( StgClosure *obj ) case CONSTR_NOCAF_STATIC: { StgWord i, j; + StgConInfoTable *con_info = get_con_itbl (obj); -#ifdef PROFILING - debugBelch("%s(", GET_PROF_DESC(info)); - debugBelch("%s", obj->header.prof.ccs->cc->label); -#else - debugBelch("CONSTR("); - printPtr((StgPtr)obj->header.info); - debugBelch("(tag=%d)",info->srt_bitmap); -#endif + debugBelch("%s(", GET_CON_DESC(con_info)); for (i = 0; i < info->layout.payload.ptrs; ++i) { - debugBelch(", "); + if (i != 0) debugBelch(", "); printPtr((StgPtr)obj->payload[i]); } for (j = 0; j < info->layout.payload.nptrs; ++j) { - debugBelch(", %p#", obj->payload[i+j]); + if (i != 0 || j != 0) debugBelch(", "); + debugBelch("%p#", obj->payload[i+j]); } debugBelch(")\n"); break; @@ -281,6 +276,15 @@ printClosure( StgClosure *obj ) break; } + case UNDERFLOW_FRAME: + { + StgUnderflowFrame* u = (StgUnderflowFrame*)obj; + debugBelch("UNDERFLOW_FRAME("); + printPtr((StgPtr)u->next_chunk); + debugBelch(")\n"); + break; + } + case STOP_FRAME: { StgStopFrame* u = (StgStopFrame*)obj; @@ -294,11 +298,7 @@ printClosure( StgClosure *obj ) { StgWord i; debugBelch("ARR_WORDS(\""); - /* ToDo: we can't safely assume that this is a string! - for (i = 0; arrWordsGetChar(obj,i); ++i) { - putchar(arrWordsGetChar(obj,i)); - } */ - for (i=0; i<((StgArrWords *)obj)->words; i++) + for (i=0; ipayload[i]); debugBelch("\")\n"); break; @@ -470,13 +470,11 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) case UPDATE_FRAME: case CATCH_FRAME: - printObj((StgClosure*)sp); + case UNDERFLOW_FRAME: + case STOP_FRAME: + printObj((StgClosure*)sp); continue; - case STOP_FRAME: - printObj((StgClosure*)sp); - return; - case RET_DYN: { StgRetDyn* r; @@ -568,7 +566,8 @@ printStackChunk( StgPtr sp, StgPtr spBottom ) void printTSO( StgTSO *tso ) { - printStackChunk( tso->sp, tso->stack+tso->stack_size); + printStackChunk( tso->stackobj->sp, + tso->stackobj->stack+tso->stackobj->stack_size); } /* -------------------------------------------------------------------------- @@ -906,19 +905,31 @@ int searched = 0; static int findPtrBlocks (StgPtr p, bdescr *bd, StgPtr arr[], int arr_size, int i) { - StgPtr q, r; + StgPtr q, r, end; for (; bd; bd = bd->link) { searched++; for (q = bd->start; q < bd->free; q++) { if (UNTAG_CLOSURE((StgClosure*)*q) == (StgClosure *)p) { if (i < arr_size) { - r = q; - while (HEAP_ALLOCED((StgPtr)*r) || !LOOKS_LIKE_INFO_PTR(*r) || (P_)*r == NULL) { - r--; + for (r = bd->start; r < bd->free; r = end) { + // skip over zeroed-out slop + while (*r == 0) r++; + if (!LOOKS_LIKE_CLOSURE_PTR(r)) { + debugBelch("%p found at %p, no closure at %p\n", + p, q, r); + break; + } + end = r + closure_sizeW((StgClosure*)r); + if (q < end) { + debugBelch("%p = ", r); + printClosure((StgClosure *)r); + arr[i++] = r; + break; + } + } + if (r >= bd->free) { + debugBelch("%p found at %p, closure?", p, q); } - debugBelch("%p = ", r); - printClosure((StgClosure *)r); - arr[i++] = r; } else { return i; } @@ -933,11 +944,7 @@ findPtr(P_ p, int follow) { nat g; bdescr *bd; -#if defined(__GNUC__) const int arr_size = 1024; -#else -#define arr_size 1024 -#endif StgPtr arr[arr_size]; int i = 0; searched = 0; @@ -1040,7 +1047,6 @@ char *what_next_strs[] = { [ThreadRunGHC] = "ThreadRunGHC", [ThreadInterpret] = "ThreadInterpret", [ThreadKilled] = "ThreadKilled", - [ThreadRelocated] = "ThreadRelocated", [ThreadComplete] = "ThreadComplete" }; @@ -1103,6 +1109,7 @@ char *closure_type_names[] = { [RET_FUN] = "RET_FUN", [UPDATE_FRAME] = "UPDATE_FRAME", [CATCH_FRAME] = "CATCH_FRAME", + [UNDERFLOW_FRAME] = "UNDERFLOW_FRAME", [STOP_FRAME] = "STOP_FRAME", [BLACKHOLE] = "BLACKHOLE", [BLOCKING_QUEUE] = "BLOCKING_QUEUE", @@ -1119,6 +1126,7 @@ char *closure_type_names[] = { [PRIM] = "PRIM", [MUT_PRIM] = "MUT_PRIM", [TSO] = "TSO", + [STACK] = "STACK", [TREC_CHUNK] = "TREC_CHUNK", [ATOMICALLY_FRAME] = "ATOMICALLY_FRAME", [CATCH_RETRY_FRAME] = "CATCH_RETRY_FRAME",