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
Feature wish: Localization information for exceptions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jan Kybic <kybic@f...>
Subject: Feature wish: Localization information for exceptions
        I have a wish: would it be possible to print some kind of localization
information when a native code Ocaml program is aborted due to
exceptions such as 'index out of bounds' or 'Stack overflow'?
When a program is aborted due to failed 'assert', this information is
printed, so I thought maybe it would not be so difficult to do it for other
exceptions too. At least knowing which function threw the exception would
be great.

Otherwise, localizing the cause of the error is quite time
consuming. I know there is a debugger for byte code programs which can
be used but for my applications (numerical calculations) the byte-code
programs are too slow. 

If I remember correctly there is a patch for the Ocaml compiler to
print the stack trace when program is aborted on exceptions. Are there
plans to include such a patch into the official compiler?

While I am at it, is there any chance of using native-code debugger
for Ocaml? That would be an equally acceptable solution.

For the moment, I am forced to instrument my program with frequent
debug prints so that I can localize the problem spot. And since I need
that these debug prints be completely removed for the production
version in order not to slow it down, I am surrounding each debug
print command with IFDEF DEBUG .. ELSE () ENDIF which is quite
cumbersome and obscures the code itself. Is there any other solution?

Thank you,


Jan Kybic <>                       tel. +420 2 2435 5721                      ICQ 200569450