stack traces when debugging GHC

Austin Seipp austin at well-typed.com
Mon Feb 9 08:44:51 UTC 2015


Looks like you want
https://ghc.haskell.org/trac/ghc/wiki/Debugging/Compiler - the first
section mentions -DDEBUG, but not -fprof-auto. Probably worth adding a
few sentences about what you've found to the top of the page.

Thanks!

On Sun, Feb 8, 2015 at 8:51 PM, Richard Eisenberg <eir at cis.upenn.edu> wrote:
> Hi devs,
>
> I've just made a miraculous discovery and I want to share!
>
> It has happened many times that I create some bizarre error in GHC and have no clue where it comes from. In the past, I've ended up using pprTrace to label all calls of the failing function, sometimes recursively, until I get an idea of what's going on. This is terribly painful. And then, I noticed that the function Debug.Trace.traceStack (just in the `base` package, not part of GHC) will print out a stack trace, when profiling is enabled. So, I tried building a profiled build of GHC, with -DDEBUG and -fprof-auto (just by editing the "prof" section of build.mk).
>
> And then, voila, ASSERTs now print stack traces! And, with a small change in Outputable, I can get pprTrace to print stack traces, too! Hooray!
>
> I'd love to put this on the wiki. Any clue where this might be found?
>
> Richard
>
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>



-- 
Regards,

Austin Seipp, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/


More information about the ghc-devs mailing list