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
how to set breakpoint at exception throw?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-06-30 (15:35)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: how to set breakpoint at exception throw?
> In the debugger, I'd like to put a breakpoint essentially in the
> 'raise' function.  The idea is to get control whenever an exception is
> raised, and be able to take a backtrace.
> Any ideas on how to do this?

Reverse execution is your friend: simply run the program under the
debugger; if an uncaught exception causes the program to terminate,
back-step (command "back") once, and voila, you're at the point where
the exception was raised, and you can examine the backtrace.

If your program traps all exceptions or performs finalization before
re-raising exceptions, you may have to back-step several times, but
eventually you'll hit the point where the exception was raised.

- Xavier Leroy