Debugging GHC with GHCi
Thomas Jakway
tjakway at nyu.edu
Mon Jan 9 01:33:14 UTC 2017
I want to be able to load certain GHC modules in interpreted mode in
ghci so I can set breakpoints in them. I have tests in the testsuite
that are compiled by inplace/bin/ghc-stage2 with -package ghc. I can
load the tests with ghc-stage2 --interactive -package ghc but since ghc
is compiled I can only set breakpoints in the tests themselves. Loading
the relevant files by passing them as absolute paths to :l loads them
but ghci doesn't stop at the breakpoints placed in them (I'm guessing
because ghci doesn't realize that the module I just loaded is meant to
replace the compiled version in -package ghc).
So if I use
inplace/bin/ghc-stage2 --interactive -package ghc mytest.hs
then
:l abs/path/to/AsmCodeGen.hs
and set breakpoints, nothing happens.
Ideally I'd only have to load the module I'm debugging (and it's
dependencies?) but if that isn't possible how would I get ghci to load
all of GHC in interpreted mode (intead of using -package ghc)?
Currently I'm using trace & friends to do printf-style debugging but
it's definitely not ideal.
-Thomas Jakway
More information about the ghc-devs
mailing list