Debugging with GHCi.

Simon Marlow simonmarhaskell at gmail.com
Tue Apr 4 05:11:55 EDT 2006


Bulat Ziganshin wrote:
> Hello Simon,
> 
> Monday, April 3, 2006, 11:45:35 PM, you wrote:
> 
> 
>>>btw, the basic breakpoint functionality could indeed be provided
>>>as a compiler/IDE transformation, but calling out to GHCi makes
>>>a lot more sense:
> 
> 
>>I think you misunderstand me: I wanted to avoid the recompilation step
>>when adding a breakpoint, that's all.  The interface would be exactly 
> 
> 
> but this can be implemented just by adding call to special function
> after each operation in I/O monad. this function will check whether we
> reached breakpoint and pause program if so. this approach is simpler
> to implement and allow easily extend breakpoints' types (line number,
> condition, line number+condition, variable changed....). this should
> be slower, but i think in most cases this cost should be acceptable

Why just the I/O monad?  What if I want to set a breakpoint in a pure 
function?  Calling a function on entry to every single BCO would be very 
costly.

The interpreter could check before entering a BCO whether there was a 
breakpoint set on that BCO.  That's nearly equivalent to the 
implementation I proposed before (overwriting the BCO with a breakpoint 
object) and might be simpler, I'm not sure.

Cheers,
	Simon


More information about the Cvs-ghc mailing list