datacratic/soa — pull request #126 by RAttab (2014-08-28 14:22:35+00:00)
Title: Simplified buggy gcc-specific js exception handling code.

Fixes an issue whereby the JS wrappers are segfaulting when trying to handle exceptions.

The old code relied on a bunch of gcc specific hidden interfaces that are not documented. After a couple hours of debugging assembly and ready through the libstdc++ source code, it seems like the __do_catch vtable entry for the std::type_info entry JSPassException is 0 which leads to a jump at address zero hence the segfault.

I don't think it's worth investing more time into that code when there's a simple standard compliant way of handling the exceptions which doesn't segfault. Note that the new version is not 100% compatible with the old version since the catch(...) clause has no way of accessing the type_info object of the exception and I can't extract the type name for the error message.