[LLVMdev] Catching exceptions passed through a JIT ExecutionEngine

Geoff Reedy geoff at programmer-monk.net
Thu Jul 21 14:56:21 PDT 2011


On Tue, Jul 12, 2011 at 07:25:16PM -0400, Peter Zion said
> Hi All,
> 
> I'm trying to catch an exception that is "passed through" an LLVM ExecutionEngine but I am unable to do so.  Specifically, in C++ code, inside a try/catch block, I call a JITted function, which in turn calls back into my code.  Everything works fine unless an exception is thrown; I would except the outermost try/catch(...) block to catch the exception thrown in my innermost C++ code, but instead I get the abort "terminate called after throwing an instance of 'MyException'".  I am compiling the system with g++ (on Linux and OSX); I haven't tried MSVC++.
> 
> Is there something that I need to do to get this behaviour to work?  I admit that I have only a fairly basic understanding of how exception handling is implemented in C++ but from what I've read it seems like the exception should unwind through what is, for all intents and purposes, a simple call stack...

There was an example program detailing how to do exactly this on the
wiki. Was the wiki content archived before it was taken down?



More information about the llvm-dev mailing list