[LLVMdev] C++ Exception Handling Problem

Duncan Sands baldrick at free.fr
Tue Mar 10 02:07:49 PDT 2009


Hi Nyx,

> I'm in the process of creating a JIT and I've run into a problem with
> exception handling. The situation I'm in is that my program will JIT
> functions, which will call native C++ functions (part of the run-time
> support). These native functions can throw exceptions. However, I don't
> actually want to handle these exceptions in the JITted functions. There are
> already try/catch blocks in place in the C++ function that calls the JITted
> functions. 
> 
> The problem I run into is that when exceptions are thrown, they aren't
> caught anywhere. My program crashes with an error message: "terminate called
> after throwing an instance of 'RunError'". Where RunError is the exception
> type. Hence, the exceptions aren't getting caught where they should be.

does this happen in the non-jit context.  For example, suppose rather than
JITing your bitcode you compile it down to object code, and arrange for it
to be called from C++ and call C++.  Do exceptions then propagate and get
caught correctly?

Ciao,

Duncan.



More information about the llvm-dev mailing list