WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
49725
Add DWARF table generation support for JITted code
https://bugs.webkit.org/show_bug.cgi?id=49725
Summary
Add DWARF table generation support for JITted code
Kent Hansen
Reported
2010-11-18 04:21:25 PST
This is needed in order for libgcc to be able to unwind the stack if a C++ exception is thrown from native code called from JITted code. See
https://bugs.webkit.org/show_bug.cgi?id=49720
for testcase (Qt-specific).
Attachments
Add attachment
proposed patch, testcase, etc.
Kent Hansen
Comment 1
2010-11-22 02:05:11 PST
This might not be a problem with the JITed code itself, but rather with mixing C and C++ and exceptions. JITed code is not invoked directly, but through the ctiTrampoline() function, which has C linkage. So what we have is: C++ --> C --> C++ & throw. In a small test application, without JIT or anything, I'm not able to catch such an exception. From
http://yosefk.com/c++fqa/mixing.html#fqa-32.6
: "I've just tried this with the GNU C and C++ compilers. When a C++ function calls a C function which calls a C++ function which throws an exception, you can't even catch it at the first C++ function, not to mention disposing the resources allocated by the C function." From
http://developers.sun.com/solaris/articles/mixing.html#except
: "What happens if you call a C++ function from a C function, and the C++ function throws an exception? The C++ standard is somewhat vague about whether you can expect exceptions to behave properly, and on some systems you have to take special precautions. Generally, you must consult the user manuals to determine whether the code will work properly." Supposedly it does work on MSVC without having to do anything special. I'm not sure how to solve it for gcc. Could a frame description entry be dynamically registered with libgcc to establish unwinding rules for ctiTrampoline? Is this really worth the effort? FWIW, relevant section of the DWARF spec is 6.4 "Call Frame Information":
http://dwarfstd.org/Dwarf3Std.php
libgcc does provide a function to dynamically register a frame description entry, __register_frame(). (This is what LLVM uses to make exception handling work with JITed code.)
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug