void printStackChunk( StgPtr sp, StgPtr spBottom ) { StgWord bitmap; const StgInfoTable *info; ASSERT(sp <= spBottom); for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) { info = get_itbl((StgClosure *)sp); switch (info->type) { case UPDATE_FRAME: case CATCH_FRAME: case UNDERFLOW_FRAME: case STOP_FRAME: printObj((StgClosure*)sp); continue; case RET_DYN: { StgRetDyn* r; StgPtr p; StgWord dyn; nat size; r = (StgRetDyn *)sp; dyn = r->liveness; debugBelch("RET_DYN (%p)\n", r); p = (P_)(r->payload); printSmallBitmap(spBottom, sp, RET_DYN_LIVENESS(r->liveness), RET_DYN_BITMAP_SIZE); p += RET_DYN_BITMAP_SIZE + RET_DYN_NONPTR_REGS_SIZE; for (size = RET_DYN_NONPTRS(dyn); size > 0; size--) { debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p); debugBelch("Word# %ld\n", (long)*p); p++; } for (size = RET_DYN_PTRS(dyn); size > 0; size--) { debugBelch(" stk[%ld] (%p) = ", (long)(spBottom-p), p); printPtr(p); p++; } continue; } case RET_SMALL: debugBelch("RET_SMALL (%p)\n", info); bitmap = info->layout.bitmap; printSmallBitmap(spBottom, sp+1, BITMAP_BITS(bitmap), BITMAP_SIZE(bitmap)); continue; case RET_BCO: { StgBCO *bco; bco = ((StgBCO *)sp[1]); debugBelch("RET_BCO (%p)\n", sp); printLargeBitmap(spBottom, sp+2, BCO_BITMAP(bco), BCO_BITMAP_SIZE(bco)); continue; } case RET_BIG: barf("todo"); case RET_FUN: { StgFunInfoTable *fun_info; StgRetFun *ret_fun; ret_fun = (StgRetFun *)sp; fun_info = get_fun_itbl(ret_fun->fun); debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, (int)fun_info->f.fun_type); switch (fun_info->f.fun_type) { case ARG_GEN: printSmallBitmap(spBottom, sp+2, BITMAP_BITS(fun_info->f.b.bitmap), BITMAP_SIZE(fun_info->f.b.bitmap)); break; case ARG_GEN_BIG: printLargeBitmap(spBottom, sp+2, GET_FUN_LARGE_BITMAP(fun_info), GET_FUN_LARGE_BITMAP(fun_info)->size); break; default: printSmallBitmap(spBottom, sp+2, BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]), BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type])); break; } continue; } default: debugBelch("unknown object %d\n", (int)info->type); barf("printStackChunk"); } } }
void printStackChunk( StgPtr sp, StgPtr spBottom ) { StgWord bitmap; const StgInfoTable *info; ASSERT(sp <= spBottom); for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) { info = get_itbl((StgClosure *)sp); switch (info->type) { case UPDATE_FRAME: case CATCH_FRAME: case UNDERFLOW_FRAME: case STOP_FRAME: printClosure((StgClosure*)sp); continue; case RET_SMALL: { StgWord c = *sp; if (c == (StgWord)&stg_ctoi_R1p_info) { debugBelch("tstg_ctoi_ret_R1p_info\n" ); } else if (c == (StgWord)&stg_ctoi_R1n_info) { debugBelch("stg_ctoi_ret_R1n_info\n" ); } else if (c == (StgWord)&stg_ctoi_F1_info) { debugBelch("stg_ctoi_ret_F1_info\n" ); } else if (c == (StgWord)&stg_ctoi_D1_info) { debugBelch("stg_ctoi_ret_D1_info\n" ); } else if (c == (StgWord)&stg_ctoi_V_info) { debugBelch("stg_ctoi_ret_V_info\n" ); } else if (c == (StgWord)&stg_ap_v_info) { debugBelch("stg_ap_v_info\n" ); } else if (c == (StgWord)&stg_ap_f_info) { debugBelch("stg_ap_f_info\n" ); } else if (c == (StgWord)&stg_ap_d_info) { debugBelch("stg_ap_d_info\n" ); } else if (c == (StgWord)&stg_ap_l_info) { debugBelch("stg_ap_l_info\n" ); } else if (c == (StgWord)&stg_ap_n_info) { debugBelch("stg_ap_n_info\n" ); } else if (c == (StgWord)&stg_ap_p_info) { debugBelch("stg_ap_p_info\n" ); } else if (c == (StgWord)&stg_ap_pp_info) { debugBelch("stg_ap_pp_info\n" ); } else if (c == (StgWord)&stg_ap_ppp_info) { debugBelch("stg_ap_ppp_info\n" ); } else if (c == (StgWord)&stg_ap_pppp_info) { debugBelch("stg_ap_pppp_info\n" ); } else if (c == (StgWord)&stg_ap_ppppp_info) { debugBelch("stg_ap_ppppp_info\n" ); } else if (c == (StgWord)&stg_ap_pppppp_info) { debugBelch("stg_ap_pppppp_info\n" ); #ifdef PROFILING } else if (c == (StgWord)&stg_restore_cccs_info) { debugBelch("stg_restore_cccs_info\n" ); fprintCCS(stderr, (CostCentreStack*)sp[1]); debugBelch("\n" ); continue; #endif } else { debugBelch("RET_SMALL (%p)\n", info); } bitmap = info->layout.bitmap; printSmallBitmap(spBottom, sp+1, BITMAP_BITS(bitmap), BITMAP_SIZE(bitmap)); continue; } case RET_BCO: { StgBCO *bco; bco = ((StgBCO *)sp[1]); debugBelch("RET_BCO (%p)\n", sp); printLargeBitmap(spBottom, sp+2, BCO_BITMAP(bco), BCO_BITMAP_SIZE(bco)); continue; } case RET_BIG: barf("todo"); case RET_FUN: { const StgFunInfoTable *fun_info; StgRetFun *ret_fun; ret_fun = (StgRetFun *)sp; fun_info = get_fun_itbl(ret_fun->fun); debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, (int)fun_info->f.fun_type); switch (fun_info->f.fun_type) { case ARG_GEN: printSmallBitmap(spBottom, sp+2, BITMAP_BITS(fun_info->f.b.bitmap), BITMAP_SIZE(fun_info->f.b.bitmap)); break; case ARG_GEN_BIG: printLargeBitmap(spBottom, sp+2, GET_FUN_LARGE_BITMAP(fun_info), GET_FUN_LARGE_BITMAP(fun_info)->size); break; default: printSmallBitmap(spBottom, sp+2, BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]), BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type])); break; } continue; } default: debugBelch("unknown object %d\n", (int)info->type); barf("printStackChunk"); } } }
void printStackChunk( StgPtr sp, StgPtr spBottom ) { StgWord bitmap; const StgInfoTable *info; ASSERT(sp <= spBottom); for (; sp < spBottom; sp += stack_frame_sizeW((StgClosure *)sp)) { info = get_itbl((StgClosure *)sp); switch (info->type) { case UPDATE_FRAME: case CATCH_FRAME: case UNDERFLOW_FRAME: case STOP_FRAME: printObj((StgClosure*)sp); continue; case RET_SMALL: debugBelch("RET_SMALL (%p)\n", info); bitmap = info->layout.bitmap; printSmallBitmap(spBottom, sp+1, BITMAP_BITS(bitmap), BITMAP_SIZE(bitmap)); continue; case RET_BCO: { StgBCO *bco; bco = ((StgBCO *)sp[1]); debugBelch("RET_BCO (%p)\n", sp); printLargeBitmap(spBottom, sp+2, BCO_BITMAP(bco), BCO_BITMAP_SIZE(bco)); continue; } case RET_BIG: barf("todo"); case RET_FUN: { StgFunInfoTable *fun_info; StgRetFun *ret_fun; ret_fun = (StgRetFun *)sp; fun_info = get_fun_itbl(ret_fun->fun); debugBelch("RET_FUN (%p) (type=%d)\n", ret_fun->fun, (int)fun_info->f.fun_type); switch (fun_info->f.fun_type) { case ARG_GEN: printSmallBitmap(spBottom, sp+2, BITMAP_BITS(fun_info->f.b.bitmap), BITMAP_SIZE(fun_info->f.b.bitmap)); break; case ARG_GEN_BIG: printLargeBitmap(spBottom, sp+2, GET_FUN_LARGE_BITMAP(fun_info), GET_FUN_LARGE_BITMAP(fun_info)->size); break; default: printSmallBitmap(spBottom, sp+2, BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]), BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type])); break; } continue; } default: debugBelch("unknown object %d\n", (int)info->type); barf("printStackChunk"); } } }