GHCi debugger status
Peter Hercek
phercek at gmail.com
Mon Nov 24 08:31:48 EST 2008
Claus Reinke wrote:
> f x y z | x<y = z
> | otherwise = z*y
>
> ---------------------
> $ /cygdrive/d/fptools/ghc/ghc/stage2-inplace/ghc.exe --interactive
> Debug.hs -ignore-dot-ghci
> GHCi, version 6.11.20081122: http://www.haskell.org/ghc/ :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer ... linking ... done.
> Loading package base ... linking ... done.
> Loading package ffi-1.0 ... linking ... done.
> [1 of 1] Compiling Main ( Debug.hs, interpreted )
> Ok, modules loaded: Main.
> *Main> :break f
> Breakpoint 0 activated at Debug.hs:(1,0)-(2,24)
> *Main> f 3 2 1
> Stopped at Debug.hs:(1,0)-(2,24)
> _result :: a = _
> [Debug.hs:(1,0)-(2,24)] *Main> :list
> vv
> 1 f x y z | x<y = z
> 2 | otherwise = z*y
> ^^
> 3
> [Debug.hs:(1,0)-(2,24)] *Main> :step
> Stopped at Debug.hs:1:10-12
> _result :: a = _
> [Debug.hs:1:10-12] *Main> :list
> 1 f x y z | x<y = z
> ^^^
> 2 | otherwise = z*y
> [Debug.hs:1:10-12] *Main>
Looks like a bug to me, At this location the x a y should be
observable and cought in trace history.
It actually looks very similar to bug I reported here:
http://hackage.haskell.org/trac/ghc/ticket/2740
Notice that if you write your function like this (as I mostly do):
f x y z =
if x<y then z else z*y
then x and y are observable when "if x<y then z else z*y" is selected
but not when "x<z" is selected!
I see that you use windows, I did in past to but switches to linus
since there were too much problems on windows with ghc, expecially
libraries. Anyway here are some tips you might like:
* you can avoid /cygdrive prefix in cygwin if you set cygdrive-prefix
to /; see man mount and search for -c option
* you can get nicer selection of expression if you set TERM=linux and
launch ghci as ansicon ghc --interarctive
* you can get ansicon from
http://www.geocities.com/jadoxa/ansicon/index.html
and a patch for it here:
http://www.hck.sk/users/peter/pub/
Peter.
More information about the Glasgow-haskell-users
mailing list