[Haskell-cafe] How to debug GHC

Simon Marlow simonmar at microsoft.com
Wed Sep 14 09:44:11 EDT 2005


On 10 September 2005 21:15, Frederik Eaton wrote:

> On Fri, Sep 02, 2005 at 04:40:05PM +0400, Bulat Ziganshin wrote:
>> Hello Nils,
>> 
>> Friday, September 02, 2005, 10:47:05 AM, you wrote:
>> 
>>>     Compile your program with -prof -auto-all (make sure you have
>>> the 
>> 
>>> I tried this out under GHC 6.4/Linux and got a segmentation fault
>>> instead of a stack trace. Under GHC 6.2.2 it seemed to work, though.
>> 
>> this error is already fixed in current pre-6.4.1 version
> 
> I'm using a 2005/9/3 version of 6.4.1 and running into situations
> where the "stack trace" has function A calling function B, where when
> I look at the code, A never calls B. Is this normal? Is it some
> side-effect of laziness? It sure makes the traces a lot less useful.

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.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list