-
Notifications
You must be signed in to change notification settings - Fork 815
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
Exception logging (win32): Handle error codes correctly, add some more strings #414
Conversation
bors try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
@@ -74,7 +77,7 @@ uint8_t callProtected(trampoline_t trampoline, | |||
return TRUE; | |||
} | |||
|
|||
out_result->code = (uint64_t)signum; | |||
out_result->code = (uint64_t)caughtExceptionCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Thanks for fixing this.
EXCEPTION_GUARD_PAGE => "guard page", | ||
EXCEPTION_INVALID_HANDLE => "invalid handle", | ||
EXCEPTION_POSSIBLE_DEADLOCK => "possible deadlock", | ||
_ => "unknown exception code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having these extra cases will help with diagnosing errors. Thanks for adding them.
bors r+ |
1 similar comment
bors r+ |
414: Exception logging (win32): Handle error codes correctly, add some more strings r=syrusakbary a=hrydgard Ran into a situation with an unknown exception from Cranelift (will probably report that one separately). Turns out the signum was "1" though which does not seem to correspond to any of the Windows error codes, except possibly STATUS_GUARD_PAGE which is 0x80000001, but only if we lost the top bit somewhere. On Windows, exceptions seemed to be trapped by callProtected, which is implemented here: https://github.com/wasmerio/wasmer/blob/cade9a666f5dfedfc9352718988aa26f21b028f4/lib/win-exception-handler/exception_handling/exception_handling.c . It did not seem to correctly store and retrieve the exception code, instead always returning 1: ```longjmp(jmpBuf, 1);``` So I fixed it. And now the log output looks like this: ``` unhandled trap at 1560d5e7bab - code #c0000005: segmentation violation ``` Co-authored-by: Henrik Rydgård <henrik.rydgard@embark-studios.com> Co-authored-by: Syrus Akbary <me@syrusakbary.com> Co-authored-by: Mackenzie Clark <mackenzie.a.z.c@gmail.com>
Update Vite config, use the bundled SDK for FFMPEG example
Ran into a situation with an unknown exception from Cranelift (will probably report that one separately). Turns out the signum was "1" though which does not seem to correspond to any of the Windows error codes, except possibly STATUS_GUARD_PAGE which is 0x80000001, but only if we lost the top bit somewhere.
On Windows, exceptions seemed to be trapped by callProtected, which is implemented here: https://github.com/wasmerio/wasmer/blob/cade9a666f5dfedfc9352718988aa26f21b028f4/lib/win-exception-handler/exception_handling/exception_handling.c . It did not seem to correctly store and retrieve the exception code, instead always returning 1:
longjmp(jmpBuf, 1);
So I fixed it. And now the log output looks like this: