how to track down infinite loop?

Hello. I've got an infinite loop (I think) which I recently introduced to my code (the visible symptom is stack space overflow), and am wondering if there is an easier way to figure out where it might be. The problem being that I've made a rather large number of changes (all of which are mutually dependent). In the past, I've used ghc's heap profiling to track this sort of thing down, as I can pretty easily trace from that what functions were called in the infinite loop. The problem I'm now having is that the string describing the call stack is truncated too much, so I can't see who the real culprit is. I know the best thing would be to go over all my changes with a fine-toothed comb, but it would be nice to have an idea where to look. Actually, it's not all that much new code, but I usually find it hard to see a bug that I've written myself... Any ideas for tricks to see where a program is looping indefinitely? I'm sure I can track down this bug pretty easily, but is seems like this is something one really ought to be able to do... -- David Roundy http://civet.berkeley.edu/droundy/

David Roundy wrote:
Any ideas for tricks to see where a program is looping indefinitely? I'm sure I can track down this bug pretty easily, but is seems like this is something one really ought to be able to do...
May I answer your question by advertising the Haskell tracer Hat? http://www.cs.york.ac.uk/fp/hat/ The various trace viewing tools of Hat show you your computation in various ways and thus help you in particular to locate a fault. In your case hat-trail is the right tool. Just start hat-trail with the trace of your looping computation (you may interrupt the computation early to save time and trace space; but note that a traced computation is considerably slower). Then repeatedly press "enter" to see the whole virtual stack. Each stack entry shows a function with its arguments in most evaluated form. I should point out that Hat works for Haskell 98; it supports only few libraries and no ghc language extensions. Real soon we will release a new version supporting more libraries, a few language extensions (multiparameter classes, functional dependencies) and some other improvements. Ciao, Olaf -- OLAF CHITIL, Dept. of Computer Science, The University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767
participants (2)
-
David Roundy
-
Olaf Chitil