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
Where did the exception occur?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Where did the exception occur?
> I am running my program from the top-level, and the programs aborts to the
> toplevel ans says:
> Uncaught exception: Not_found.
> Is there a way to tell where the exception occured, for example program
> languages like SICStus Prolog, Lisp, Visual C++, Visual Basic normally stops
> in a top-loop at the stack frame of the error. Is there a similar feature in
> OCaml?
> ----
> Mattias Waldau

Some programming languages use ``pushing'' exceptions (exceptions
that push a stack frame on the control stack then try to find a
handler), other languages use ``poping'' exceptions (exceptions pops
stack frames directly to the next handler). Caml uses the second kind,
which is considered more efficient. So there is no way in Caml to
start a new top-loop where the exception occurred.

However, you've got a nice replay debugger that allows you to step
back anywhere in the past of the computation of your (bte-code)
compiled program. So, you just have to go back to the point where the
exception is raised and then use the usual top-level of the debugger.

Hope this helps,

Pierre Weis

INRIA, Projet Cristal,,