This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Exception handling tables for function generated on the fly
- From: Andrew Haley <aph at redhat dot com>
- To: Tom Quarendon <tom at quarendon dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 13 Aug 2008 10:15:48 +0100
- Subject: Re: Exception handling tables for function generated on the fly
- References: <48A1B059.1040400@quarendon.net>
Tom Quarendon wrote:
> If I do this I get std::terminate called from __cxa_throw. Researching
> this it seems that I somehow need to register some exception handling
> tables to correspond to the "magic" function to enable the exception
> handler to allow the exception to propagate through.
Right.
> I'd welcome any pointers to where I might be able to get some
> information on this. I've looked at the C++ ABI documentation which
> helps a bit, and I've found some information on the format that the
> tables need to be in (and indeed I've looked at the assembler generated
> by the gcc compiler if I code up "magic" and compile it directly), but I
> don't yet see quite how to put it all together.
There's no quick way to solve this: you'll just have to study DWARF
unwinder data and figure out how to generate it. It's not particularly
difficult, but there is a fair bit to learn. As you're writing a JIT
it may well be that you can use a simplified subset of DWARF; you don't
need to cater for every possibility.
Call __register_frame_info() when you're done.
Andrew.