Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
debugging techniques?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel Andor <Daniel.Andor@p...>
Subject: debugging techniques?
Hi all,

I have a program that exits:
- in native code:
Fatal error: exception Invalid_argument("out-of-bound array or string access")
- in byte-code:
Fatal error: exception Invalid_argument("Array.set")

So somewhere I've got some array indices messed up. But where?? This is a 
large computational code, with lots and lots of arrays, and this is the first 
time it's crashed like this. So I don't really know where to start looking, 
and the exceptions don't help me find the error.

Native code: I'd want to use gdb and get a stack trace, but that has eluded 
me. (even -ccopt -g doesn't work)
Byte-code: when I run it in ocamldebug, then as soon as I hit the exception, 
the program stops running, and again I can't get a stack trace.

Is there any way to get Exceptions to print a little bit more informative 
info, like source file name/line?
And is there a way to use gdb/ocamldebug to give me a stacktrace when I have 
an uncaught exception?