Compile GHC with -prof to get a stack trace on panic
Simon Marlow
marlowsd at gmail.com
Thu Dec 15 15:24:50 UTC 2016
I think this has been mentioned before but it's probably not widely known:
if you compile GHC profiled (that is, enable GhcProfiled=YES in your mk/
build.mk), then every panic comes with a stack trace. Here's one I just
saw:
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.1.20161206 for x86_64-unknown-linux):
Ix{Int}.index: Index (65536) out of range ((0,28))
CallStack (from -prof):
HscTypes.bin_fixities (compiler/main/HscTypes.hs:1050:51-56)
HscMain.checkOldIface (compiler/main/HscMain.hs:(586,20)-(587,60))
HscMain.hscIncrementalFrontend (compiler/main/HscMain.hs:(556,1)-(618,81))
HscMain.hscIncrementalCompile (compiler/main/HscMain.hs:(644,1)-(699,32))
GHC.withCleanupSession (compiler/main/GHC.hs:(464,1)-(473,27))
GHC.runGhc (compiler/main/GHC.hs:(439,1)-(444,26))
GHC.defaultErrorHandler (compiler/main/GHC.hs:(379,1)-(411,7))
To get more detail in the stack trace you need to add
GhcStage2HcOpts += -fprof-auto-top
Or -fprof-auto, depending on how much detail you want.
Cheers
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161215/b2f174fc/attachment.html>
More information about the ghc-devs
mailing list