[PATCH] D142224: [Support] Emulate SIGPIPE handling in raw_fd_ostream write for Windows
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 13:05:32 PST 2023
mstorsjo accepted this revision.
mstorsjo added a comment.
In D142224#4113245 <https://reviews.llvm.org/D142224#4113245>, @andrewng wrote:
> Updated to add comment regarding the strange looking use of `0xE0000000`.
Thanks, LGTM!
================
Comment at: llvm/lib/Support/Windows/Signals.inc:832
+ int RetCode = (int)EP->ExceptionRecord->ExceptionCode;
+ if (RetCode == (0xE0000000 | EX_IOERR))
+ return;
----------------
aganea wrote:
> andrewng wrote:
> > mstorsjo wrote:
> > > Do you have any reference for/comment about what `0xE0000000` is here?
> > The constant is used in `CrashRecoveryContext::HandleExit()` to raise an exception on Windows. I'll add a comment.
> That is not super-well documented in the Windows APIs. The 0xE prefix is the recommended way to throw user exceptions, it's actually a NTSTATUS code, with bit 29 set (that is, customer) and bits 30, 31 set (that is, STATUS_SEVERITY_ERROR): https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781
> This prefix code is also used for C++ exceptions in the MSVC ABI.
Thanks @aganea - perhaps we should explain this as reference in `CrashRecoveryContext::HandleExit()`? (Within this particular case, it's IMO enough to just reference `CrashRecoveryContext::HandleExit()`.)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142224/new/
https://reviews.llvm.org/D142224
More information about the llvm-commits
mailing list