GHCi debugger status

Claus Reinke claus.reinke at
Tue Nov 25 08:25:20 EST 2008

> No, it's a real problem.  If we retained all the variables in scope at 
> every breakpoint, GHCi would grow a whole bunch of space leaks.  It's 
> pretty important that adding debugging shouldn't change the space behaviour 
> of the program.  Of course, constant factors are fine, but we're talking 
> asymptotic changes here.
> Now perhaps it would be possible to arrange that the extra variables are 
> only retained if they are needed by a future breakpoint, but that's tricky 
> (conditional stubbing of variables), and :trace effectively enables all 
> breakpoints so you get the space leaks back.

Then how about my suggestion for selectively adding lexical scope to
breakpoints? I'd like to be able to say

    :break <loc/name> {names}

and have GHCi make the necessary changes to keep {names} available
for inspection when it hits that breakpoint. Whatever cost that involves, it 
is unavoidable if we want to be able to inspect parts of the lexical scope 
at the breakpoint, we'd have full control over the cost incurred, and at 
least we wouldn't have to keep modifying our sources to inspect different 
aspects of our code in a debugging session.


More information about the Glasgow-haskell-users mailing list