|Version 2 (modified by 8 years ago) (diff),|
Debugging the compiler
When compiling GHC:
mk/build.mk. This enables assertions and extra debug code.
When compiling the program (see also the relevant User Manual section):
-v4to get an idea about what GHC is doing when the problem occurs.
-dcore-lintthe GHC command line when compiling each Haskell module. This makes GHC type-check the intermediate program after every optimisation pass, which often nails a fault.
-ddump-simplto see the optimised Core output. There are a number of other
-ddump-xflags; see the user manual.
- The flag
-ddump-xflags print much more verbose output. Use this if you are getting desperate!
Adding debugging code to the compiler
Outputable.pprTraceis a nice way to print trace messages from the compiler
WARN(p,msg)are assertions and warning enabled only when the compiler is compiled with
-DDEBUG. There are also variants of these that work better in a monad setting; see compiler/HsVersions.h.