how can I get a listing of everything that's done in a program

Simon Marlow marlowsd at gmail.com
Wed Oct 21 08:04:30 EDT 2009


On 20/10/2009 14:54, Ralph Crawford wrote:
> Hi.  I'm working with GHC 6.10.4 on Solaris.  I'm new at Haskell and
> have inherited a rather large and complex program to maintain and
> modify.  I'd like to get a listing of everything - every single step -
> that's done in a run of the program.  Something similar to the output of
> the :step command, but I'd like the entire run (which would involve tens
> of thousands of steps).  Is there a way to just do this - have it run
> and print everything it does to the screen?
>
> I've tried doing the following, after starting a "script" to capture all
> of the screen output...
>
> ghci -fglasgow-exts parsequery.hs
> :break 36
> main
>
> which takes me to this prompt...
>
> Loading package mtl-1.1.0.2 ... linking ... done.
> Stopped at lesearch.hs:36:13-39
> _result :: IO SearchState = _
> input :: [String] = _
> st :: SearchState = _
> [lesearch.hs:36:13-39] *Main>
>
> This takes me to the call before the one that I want to output each step
> of so that I can then manually, with hardcopy, read it and get an idea
> of what happened.
>
> So I start a step through the next call.
>
> [lesearch.hs:36:13-39] *Main> :step process_query_loop st input
> Stopped at lesearch.hs:(46,0)-(69,39)
> _result :: IO SearchState = _
> ... [lesearch.hs:(46,0)-(69,39)] *Main>
>
> So far so good.  This is what I want to see - a listing like this for
> every (interpreted of course) line of haskell code that runs, all the
> way to the end.  Since this is a very large program, at this point I
> started pasting this to the terminal - 4 steps at a time...
>
> :step
> :step
> :step
> :step
>
> This gave me the listing I wanted.  But after a certain point, it
> inevitably fails with a core dump, and what I capture from the screen is
> garbled up to that point anyway.  I'm hoping there's a simpler way to do
> this.  Thanks for taking the time to read this.

If you get a core dump, that's obviously a bug.  If you can supply us 
with a small program that illustrates the bug, please submit a bug 
report at

http://hackage.haskell.org/trac/ghc/wiki/ReportABug

As for getting a list of the evaluation steps, we don't have anything 
that does exactly what you want at the moment, but it probably wouldn't 
be hard to implement on top of the existing debugging functionality. 
Feel free to make a feature request, describing exactly what 
functionality you'd like to see:

http://hackage.haskell.org/trac/ghc/newticket?type=feature+request

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list