[Haskell-cafe] How to debug GHC

Frederik Eaton frederik at a5.repetae.net
Sun Sep 18 22:57:06 EDT 2005

> > It could be a bug - can you reduce the example and report it?
> > 
> > GHC's profiler tries to overlay a lexical call graph on to the dynamic
> > execution of the program.  It does this more or less in the way you
> > described before: every function gets an extra argument describing the
> > call context.  However, there are some tricky areas: notably CAFs.  We
> > don't as yet have a principled description of the mechanism, and I know
> > of various cases where odd results are obtained with the current system.
> > Also, the optimiser has to be careful not to change the shape of the
> > call graph, and I suspect there are cases where it goes wrong.
> I see. Well, I'm afraid I've lost the example, but I'll keep my eyes
> open in case it happens again. It's good to know what the correct
> behavior is supposed to be.

While I was finishing a project for somebody I ran into this problem
again, as well as some other bugs, and made several copies of the code
so that the problems could be reproduced.

In addition to the stack trace problems, I found: (1) a problem where
output freezes when it is being piped through 'tee' and the user
presses ^S and then ^Q and (2) an issue where a "trace" statement is
not being printed correctly by ghc (but is being printed correctly by

However, I don't have time to reduce these to minimal test cases. Do
you want to look at them anyway?



More information about the Haskell-Cafe mailing list