how to track down infinite loop?

Olaf Chitil olaf@cs.york.ac.uk
Wed, 26 Mar 2003 18:24:04 +0000


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