Changes between Version 1 and Version 2 of Debugging/Compiler


Ignore:
Timestamp:
Aug 27, 2009 1:00:02 PM (6 years ago)
Author:
simonmar
Comment:

more

Legend:

Unmodified
Added
Removed
Modified
  • Debugging/Compiler

    v1 v2  
    55== Basic strategies == 
    66 
    7 At compile time (see also the [http://www.haskell.org/ghc/docs/latest/html/users_guide/options-debugging.html relevant User Manual section]): 
     7When compiling GHC: 
     8 
     9 * add `-DDEBUG` to your `GhcStage1HcOpts` and/or `GhcStage2HcOpts` in `mk/build.mk`.  This enables assertions and extra debug code. 
     10 
     11When compiling the program (see also the [http://www.haskell.org/ghc/docs/latest/html/users_guide/options-debugging.html relevant User Manual section]): 
    812 
    913 * Use `-v3` or `-v4` to get an idea about what GHC is doing when the problem occurs. 
     
    1418 
    1519 * The flag `-dppr-debug` makes the `-ddump-x` flags print much more verbose output.  Use this if you are getting desperate! 
     20 
     21== Adding debugging code to the compiler == 
     22 
     23 * `Outputable.pprTrace` is a nice way to print trace messages from the compiler 
     24 
     25 * `ASSERT(p)`, `ASSERT2(p,msg)`, `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 [[GhcFile(compiler/HsVersions.h)]]. 
     26 
    1627