[Haskell-cafe] How to debug GHC

Simon Marlow simonmar at microsoft.com
Mon Sep 19 07:20:16 EDT 2005

On 19 September 2005 03:57, Frederik Eaton wrote:

>>> 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
> runghc).

The "tee" problem is probably a result of the fact that GHC puts
stdin/stdout into non-blocking mode.

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

Sure, it's always good to have a record of bug reports even if we don't
get to them right away.


More information about the Haskell-Cafe mailing list