summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2016-10-09 18:17:46 -0400
committerBen Gamari <ben@smart-cactus.org>2016-10-09 18:17:51 -0400
commitbcd34451382e0d1b52ef82cb9d762e9d68bc0887 (patch)
treea6fb65d1c1bb301df04a3f53afb63c4bbdff6006 /rts
parent7b060e12efbfed2f29136fd605f76e8d6ca79f85 (diff)
downloadhaskell-bcd34451382e0d1b52ef82cb9d762e9d68bc0887.tar.gz
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
Diffstat (limited to 'rts')
-rw-r--r--rts/Linker.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index f16fb83996..3eeb46eae1 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1399,6 +1399,11 @@ static SymbolAddr* lookupSymbol_ (SymbolName* 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;