-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Win64 Exception Handling #166
Comments
A preliminary patch was posted here I extended the llvm-objdump part of this patch. The last version is now committed in LLVM 3.3. |
That required an awful lot of staying power on your side for such a small patch… ;) |
Let's view it from the other side: IMHO the code really improved from 'it works' to understandable code. :-) But there is only a handful lines left of the original patch from João.... |
Encouraged by the warm feedback at DConf I like to report some progress with the Win64 exception issue. :-) With my latest LLVM changes I can throw an exception (via Stay tuned - I am going to crack this nut. :-) |
See here: http://article.gmane.org/gmane.comp.compilers.llvm.cvs/145727 I now try to get DRuntime to handle the exception. |
Here is the complete patch against LLVM 3.4 trunk. With this patch I can add Win64 SEH unwind information to all druntime and phobos modules with no failure! The LLVM test suite passes except one test. |
Can't wait to see the D test suite passing. ;) But how would Dwarf EH be relevant here? You mean the libunwind EH interface? |
No. There are 2 pieces of EH information. Base here is the unwinding information required by Win64. But part of that is the language handler specific data - which is the Dwarf EH code (the LSDA aka |
Ah, yes, of course. By the way, what is plaguing me now on OS X (the file/parallelism release mode segfaults) seems to be an issue with the MC EH table generation, will post a new bug as soon as I have pushed the rest of the OS X changes. |
There is slow progress: I committed the first 3 (out of 5) parts of my patch in LLVM 3.4. Part 4 is in the review queue. |
There are now more people interested in this stuff, especially integrating this into clang. Here is the main review link: http://reviews.llvm.org/D3418 |
There is some progress. vadimcn rewrote my patch. It looks that he solved the parameter alignment, too. Here is the main review link: http://reviews.llvm.org/D4081 |
Awesome! So, does that mean the last roadblock between MSC parity is just the VC8/PDB debuginfo? |
There is still issue #463 but this is minor compared with the code generation. Yes, I hope it will happen with LLVM 3.5. |
'it' will happen; you mean, CV8 debuginfo? |
Looks like it got merged. |
Yes, the patch was merged. Really good news. There is still an issue left (begin and end of function code is always the same label) but this sounds trivial to fix. It is really a problem of the MC layer - using the GNU assembler seems to produce the correct EH tables. |
Yeah finally 👍 |
It's a building block but not the final solution. E.g. #463 needs also some love. |
... and the patch got reverted in r211480... :-( |
Nooo! :( |
It regressed part of the legacy JIT tests on Win64 (LLVM has currently two JIT backends in the tree). |
Patch is re-applied in r211691 with a fix for the JIT problem. Note that there is still the bug in the MC layer. |
I guess the error message I'm getting now might be related to that MC bug. |
Yes, that is the symptom described on LLVM commit list. |
Indeed. They disabled the tables for now in clang: http://llvm.org/viewvc/llvm-project?view=revision&revision=212137 |
A fix was proposed, see comment of twobit at http://reviews.llvm.org/D4081 |
Works but as already commented by rnk the .xdata/.pdatas should be COMDATs. |
cc me |
http://reviews.llvm.org/D5181 But exception handling still doesn't work in D. extern(C) int printf(const char* fmt, ...);
void foo()
{
printf("foo pre\n");
throw new Exception("foo ex");
printf("foo post\n");
}
void main()
{
try
{
printf("main pre\n");
foo();
printf("main post\n");
}
catch (Exception e)
{
printf("exception caught: %s\n", e.toString().ptr);
}
finally
{
printf("finally\n");
}
printf("exit\n");
}
|
Slightly modified, in this case it reaches the catch. extern(C) int printf(const char* fmt, ...) nothrow;
void foo()
{
printf("foo pre\n");
throw new Exception("foo ex");
printf("foo post\n");
}
void main()
{
try
{
printf("main pre\n");
foo();
printf("main post\n");
}
catch (Exception e)
{
printf("catch\n");
printf("exception caught: %s %s %d\n", e.msg.ptr, e.file.ptr, e.line);
}
finally
{
printf("finally\n");
}
printf("exit\n");
}
|
Some movement on the Clang front: http://article.gmane.org/gmane.comp.compilers.clang.devel/39152 |
With commit ldc-developers/druntime@d12cc01 both test cases from Trass3r seems to work. |
Closing this issue because it works now in master with LLVM 3.6. |
Nice! Like, really, really nice! ;) |
Ohmygawd! This is good! |
Not yet. Only line tables. |
Seems to be moving along slowly in LLVM.
Can devs please keep this issue updated with the current state of progress?
The text was updated successfully, but these errors were encountered: