[commit: ghc] ghc-8.0: Do not segfault if no common root can be found (ec05551)

git at git.haskell.org git at git.haskell.org
Mon Oct 10 15:00:38 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/ec05551392aeb39b42d1a529fac32b1f795f29b0/ghc

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

commit ec05551392aeb39b42d1a529fac32b1f795f29b0
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sun Oct 9 18:17:46 2016 -0400

    Do not segfault if no common root can be found
    
    When trying to profile a plugin, ghc mysteriously segfaulted.  Upon
    closer examination the segfault happend due to a `->prevStack` lookup
    on a NULL pointer.
    
    A new CostCentre: Unknown is introduced that is set, if ccsapp and
    ccsfn are of equal depth (e.g. 0), and do not have a common CostCentre
    in their stacks.
    
    Reviewers: bgamari, simonmar, austin, erikd
    
    Reviewed By: simonmar
    
    Subscribers: Phyx, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2551
    
    (cherry picked from commit bcd34451382e0d1b52ef82cb9d762e9d68bc0887)


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

ec05551392aeb39b42d1a529fac32b1f795f29b0
 rts/Linker.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rts/Linker.c b/rts/Linker.c
index ae2830e..9412e5b 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1427,6 +1427,11 @@ static void* lookupSymbol_ (char *lbl)
                 errorBelch("Could not on-demand load symbol '%s'\n", lbl);
                 return NULL;
             }
+#ifdef PROFILING
+            // collect any new cost centres & CCSs
+            // that were defined during runInit
+            initProfiling2();
+#endif
         }
 
         return val;



More information about the ghc-commits mailing list