[Haskell-beginners] Backtrace when a certain location in the code is executed

Bryce Verdier bryceverdier at gmail.com
Thu Aug 16 19:05:50 CEST 2012

I'm aware of :break in ghci, and I've used it for "little" functions 
that I was trying to understand. I'm not sure how well it'll work for a 
large project though.

This is the "debugging" section in ghci when you type ":help":
  -- Commands for debugging:

    :abandon                    at a breakpoint, abandon current computation
    :back                       go back in the history (after :trace)
    :break [<mod>] <l> [<col>]  set a breakpoint at the specified location
    :break <name>               set a breakpoint on the specified function
    :continue                   resume after a breakpoint
    :delete <number>            delete the specified breakpoint
    :delete *                   delete all breakpoints
    :force <expr>               print <expr>, forcing unevaluated parts
    :forward                    go forward in the history (after :back)
    :history [<n>]              after :trace, show the execution history
    :list                       show the source code around current 
    :list identifier            show the source code for <identifier>
    :list [<module>] <line>     show the source code around line number 
    :print [<name> ...]         prints a value without forcing its 
    :sprint [<name> ...]        simplifed version of :print
    :step                       single-step after stopping at a breakpoint
    :step <expr>                single-step into <expr>
    :steplocal                  single-step within the current top-level 
    :stepmodule                 single-step restricted to the current module
    :trace                      trace after stopping at a breakpoint
    :trace <expr>               evaluate <expr> with tracing on (see 

I hope this helps.

On 8/16/12 7:31 AM, Nathan Hüsken wrote:
> Hey,
> I am trying to understand haskell program not written by me.
> During runtime one function is called with parameters which makes the
> function throw an error. I want to know from where the function is called.
> In c++ I would set a breakpoint on the error throwing code, and let gdb
> print the backtrace.
> To I have similar options in haskell?
> What other options do I have?
> Thanks!
> Nathan
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners

More information about the Beginners mailing list