Skip to content
  • Simon Marlow's avatar
    Enable stack traces with ghci -fexternal-interpreter -prof · 6be09e88
    Simon Marlow authored
    Summary:
    The main goal here is enable stack traces in GHCi.  After this change,
    if you start GHCi like this:
    
      ghci -fexternal-interpreter -prof
    
    (which requires packages to be built for profiling, but not GHC
    itself) then the interpreter manages cost-centre stacks during
    execution and can produce a stack trace on request.  Call locations
    are available for all interpreted code, and any compiled code that was
    built with the `-fprof-auto` familiy of flags.
    
    There are a couple of ways to get a stack trace:
    
    * `error`/`undefined` automatically get one attached
    * `Debug.Trace.traceStack` can be used anywhere, and prints the current
      stack
    
    Because the interpreter is running in a separate process, only the
    interpreted code is running in profiled mode and the compiler itself
    isn't slowed down by profiling.
    
    The GHCi debugger still doesn't work with -fexternal-interpreter,
    although this patch gets it a step closer.  Most of the functionality
    of breakpoi...
    6be09e88