[commit: ghc] master: eventlog: Log the current stack size when stack overflows (7e57067)

git at git.haskell.org git at git.haskell.org
Mon Nov 19 11:35:05 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7e570676bd0a57f8a77e5577d9f27e2d3159193e/ghc

>---------------------------------------------------------------

commit 7e570676bd0a57f8a77e5577d9f27e2d3159193e
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Mon Nov 19 11:34:13 2018 +0000

    eventlog: Log the current stack size when stack overflows
    
    Reviewers: maoe, bgamari, erikd, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, carter, sjorn3
    
    Differential Revision: https://phabricator.haskell.org/D5287


>---------------------------------------------------------------

7e570676bd0a57f8a77e5577d9f27e2d3159193e
 rts/Schedule.c | 6 +++++-
 rts/Trace.c    | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/rts/Schedule.c b/rts/Schedule.c
index 54ebb43..eb9203f 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -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);
diff --git a/rts/Trace.c b/rts/Trace.c
index 5abd1d9..4475054 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -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]);



More information about the ghc-commits mailing list