eventlog: Log the current stack size when stack overflows
authorMatthew Pickering <matthewtpickering@gmail.com>
Mon, 19 Nov 2018 11:34:13 +0000 (11:34 +0000)
committerMatthew Pickering <matthewtpickering@gmail.com>
Mon, 19 Nov 2018 11:34:27 +0000 (11:34 +0000)
Reviewers: maoe, bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, carter, sjorn3

Differential Revision: https://phabricator.haskell.org/D5287

rts/Schedule.c
rts/Trace.c

index 54ebb43..eb9203f 100644 (file)
@@ -492,7 +492,11 @@ run_thread:
             traceEventStopThread(cap, t, t->why_blocked + 6, 0);
         }
     } else {
-        traceEventStopThread(cap, t, ret, 0);
+        if (ret == StackOverflow) {
+          traceEventStopThread(cap, t, ret, t->tot_stack_size);
+        } else {
+          traceEventStopThread(cap, t, ret, 0);
+        }
     }
 
     ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
index 5abd1d9..4475054 100644 (file)
@@ -218,6 +218,11 @@ static void traceSchedEvent_stderr (Capability *cap, EventTypeNum tag,
         if (info1 == 6 + BlockedOnBlackHole) {
             debugBelch("cap %d: thread %" FMT_Word " stopped (blocked on black hole owned by thread %lu)\n",
                        cap->no, (W_)tso->id, (long)info2);
+        } else if (info1 == StackOverflow) {
+            debugBelch("cap %d: thead %" FMT_Word
+                       " stopped (stack overflow, size %lu)\n",
+                      cap->no, (W_)tso->id, (long)info2);
+
         } else {
             debugBelch("cap %d: thread %" FMT_Word " stopped (%s)\n",
                        cap->no, (W_)tso->id, thread_stop_reasons[info1]);