how to track down out-of-bounds error?

In some code which uses UArrays, I'm getting the following error: Fail: Ix{Int}.index: Index (3723) out of range ((0,3722)) Presumably this means I'm trying to access one beyond the end of an array. The problem is trying to figure out where I'm doing this. Unfortunately, I have only been able to see this error on a rather large test repository, where it takes seven minutes for the test to show up. Any suggestions how I might most easily track this bug down? -- David Roundy http://www.abridgegame.org

David Roundy
The problem is trying to figure out where I'm doing this. Unfortunately, I have only been able to see this error on a rather large test repository, where it takes seven minutes for the test to show up.
Hah! *My* program can take hours before it crashes.
Any suggestions how I might most easily track this bug down?
Did you try compiling with -prof -auto-all, and running with +RTS -xc? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

On Wed, May 28, 2003 at 03:57:48PM +0200, Ketil Z. Malde wrote:
Any suggestions how I might most easily track this bug down?
Did you try compiling with -prof -auto-all, and running with +RTS -xc?
Thanks! I didn't try that (or know it existed), and it looks like just what I was looking for. Fortunately, however, I've already found my bug by a combination of inspection and good old Debug.Trace (which just served to show me which file was being read when it crashed). -- David Roundy http://www.abridgegame.org

On Wed, 28 May 2003 09:36:31 -0400
David Roundy
In some code which uses UArrays, I'm getting the following error:
Fail: Ix{Int}.index: Index (3723) out of range ((0,3722))
Presumably this means I'm trying to access one beyond the end of an array. The problem is trying to figure out where I'm doing this. Unfortunately, I have only been able to see this error on a rather large test repository, where it takes seven minutes for the test to show up.
Any suggestions how I might most easily track this bug down? -- David Roundy http://www.abridgegame.org
1) (If you are using GHC) compile for profiling and use the -xc runtime option. This causes GHC to dump a "stack" dump when an exception is thrown. 2) See the various debuggers that are out there. I haven't used Hat (is a pain to compile on Win2k with 64MB) but it seems like your best bet. Buddha may work but it would require you to mark a lot of code trusted likely to avoid running out of memory or taking all day. 3) Classic debugging: throw traces (or use HOOD, HOOD is Debug.Trace on massive steroids) in suspected parts of your code and see what looks wrong. I think HOOD has some kind of support for exceptions so it may dump out some very helpful information. 4) Classic debugging part two: chop out code, make tests, you certainly know the drill.
participants (4)
-
David Roundy
-
David Roundy
-
Derek Elkins
-
ketil@ii.uib.no