summaryrefslogtreecommitdiff
path: root/rts/Profiling.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-11-14 15:13:33 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-11-14 15:14:09 +0000
commite37893cbe8c289dc56cecf6dff5c8b64ed8c3485 (patch)
treeee691b3bb6a667e865321f779fa48cc92dc504ba /rts/Profiling.c
parent66962374847686e84692ce319a1427e96ac8440c (diff)
downloadhaskell-e37893cbe8c289dc56cecf6dff5c8b64ed8c3485.tar.gz
+RTS -xc: print a the closure type of the exception too
Diffstat (limited to 'rts/Profiling.c')
-rw-r--r--rts/Profiling.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/rts/Profiling.c b/rts/Profiling.c
index c75a344c7f..38191ff4bd 100644
--- a/rts/Profiling.c
+++ b/rts/Profiling.c
@@ -17,6 +17,7 @@
#include "ProfHeap.h"
#include "Arena.h"
#include "RetainerProfile.h"
+#include "Printer.h"
#include <string.h>
@@ -1001,7 +1002,7 @@ static rtsBool fprintCallStack (CostCentreStack *ccs)
/* For calling from .cmm code, where we can't reliably refer to stderr */
void
-fprintCCS_stderr (CostCentreStack *ccs, StgTSO *tso)
+fprintCCS_stderr (CostCentreStack *ccs, StgClosure *exception, StgTSO *tso)
{
rtsBool is_caf;
StgPtr frame;
@@ -1010,7 +1011,26 @@ fprintCCS_stderr (CostCentreStack *ccs, StgTSO *tso)
nat depth = 0;
const nat MAX_DEPTH = 10; // don't print gigantic chains of stacks
- fprintf(stderr, "*** Exception raised (reporting due to +RTS -xc), stack trace:\n ");
+ {
+ char *desc;
+ StgInfoTable *info;
+ info = get_itbl(exception);
+ switch (info->type) {
+ case CONSTR:
+ case CONSTR_1_0:
+ case CONSTR_0_1:
+ case CONSTR_2_0:
+ case CONSTR_1_1:
+ case CONSTR_0_2:
+ case CONSTR_STATIC:
+ case CONSTR_NOCAF_STATIC:
+ desc = GET_CON_DESC(itbl_to_con_itbl(info));
+ default:
+ desc = closure_type_names[info->type];
+ }
+ fprintf(stderr, "*** Exception (reporting due to +RTS -xc): (%s), stack trace: \n ", desc);
+ }
+
is_caf = fprintCallStack(ccs);
// traverse the stack down to the enclosing update frame to