
Colin Paul Adams wrote:
"Adrian" == Adrian Neumann
writes: Adrian> You can use the ghci debugger >> http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci- Adrian> debugger.html
Adrian> it can set breakpoints on exceptions.
So i tried adding the -fbreak-on-error flag. It made no difference - it still exited:
<interactive>: Error in array index <interactive>: interrupted <interactive>: warning: too many hs_exit()s
IIRC, this is because you are catching exceptions at some higher level where you actually find out that this kind of an exception is not handled and give up. If your application is Gtk2Hs then this library will do the catching you do not like in this case. Try to use -fbreak-on-exception instead of -fbreak-on-error. If you try this you may need to set break-on-exception late enough in the execution (use some breakpoint) so that you are not stopping at places which are ok (are correctly handled in an exception handler). In addition to other solutions mentioned here you can also setup conditional breakpoints in GHCi because GHCi breakpoints can be scripted. This is what I mostly use. Most of my debugging is done by writing GHCi debug scripts. Some ideas how to do it are here: http://permalink.gmane.org/gmane.comp.lang.haskell.glasgow.user/16270 It does not work well for interactive command line applications now, but it will work well for them when GHC 6.10.2 is out (the three most critical patches were merged). This alternative may have steep learning curve for such a simple thing but once mastered it works well. Peter.