diff options
Diffstat (limited to 'runtime/test/allocator_proxy_test.cpp')
| -rw-r--r-- | runtime/test/allocator_proxy_test.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/test/allocator_proxy_test.cpp b/runtime/test/allocator_proxy_test.cpp index 733e37cac..5f89366f5 100644 --- a/runtime/test/allocator_proxy_test.cpp +++ b/runtime/test/allocator_proxy_test.cpp | |||
| @@ -66,8 +66,12 @@ HRESULT call_slot(void* object, unsigned slot) { | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | ULONG_PTR g_fault_address = 0; | 68 | ULONG_PTR g_fault_address = 0; |
| 69 | // The code is taken in the filter, from the exception record: GetExceptionCode() in the __except body returns 0 | ||
| 70 | // under Wine 9.0 (clang-cl reads it from what the unwind hands the handler, which that Wine does not supply). | ||
| 71 | DWORD g_fault_code = 0; | ||
| 69 | 72 | ||
| 70 | int record_fault(EXCEPTION_POINTERS* info) { | 73 | int record_fault(EXCEPTION_POINTERS* info) { |
| 74 | g_fault_code = info->ExceptionRecord->ExceptionCode; | ||
| 71 | g_fault_address = info->ExceptionRecord->NumberParameters >= 2 ? info->ExceptionRecord->ExceptionInformation[1] : 0; | 75 | g_fault_address = info->ExceptionRecord->NumberParameters >= 2 ? info->ExceptionRecord->ExceptionInformation[1] : 0; |
| 72 | return EXCEPTION_EXECUTE_HANDLER; | 76 | return EXCEPTION_EXECUTE_HANDLER; |
| 73 | } | 77 | } |
| @@ -80,12 +84,13 @@ __declspec(noinline) void* read_entry(void* const* vtable, unsigned slot) { | |||
| 80 | // Reads vtable[slot] the way a call through it does. The exception code, or 0 when the read worked. | 84 | // Reads vtable[slot] the way a call through it does. The exception code, or 0 when the read worked. |
| 81 | DWORD read_slot_guarded(void* const* vtable, unsigned slot) { | 85 | DWORD read_slot_guarded(void* const* vtable, unsigned slot) { |
| 82 | g_fault_address = 0; | 86 | g_fault_address = 0; |
| 87 | g_fault_code = 0; | ||
| 83 | __try { | 88 | __try { |
| 84 | void* volatile entry = read_entry(vtable, slot); | 89 | void* volatile entry = read_entry(vtable, slot); |
| 85 | (void)entry; | 90 | (void)entry; |
| 86 | return 0; | 91 | return 0; |
| 87 | } __except (record_fault(GetExceptionInformation())) { | 92 | } __except (record_fault(GetExceptionInformation())) { |
| 88 | return GetExceptionCode(); | 93 | return g_fault_code; |
| 89 | } | 94 | } |
| 90 | } | 95 | } |
| 91 | 96 | ||