upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/allocator_proxy_test.cpp
diff options
context:
space:
mode:
authorGeremy Cambus <43472014+GeremC@users.noreply.github.com>2026-11-23 16:53:02 +0100
committerGitHub <noreply@github.com>2026-11-23 09:53:02 -0600
commitc3f171d0cbaea1a5deed2e1fa2f9a69346863399 (patch)
tree05f956d44ea657d4f0a3a00e067945ab6766cd22 /runtime/test/allocator_proxy_test.cpp
parent44aae3e172f3abc8659d4de5e1665adb257c6bfa (diff)
allocator_proxy, queue_proxy tests: take the guard fault's code in the filter (#6864)
Squash-merged after diff review of PR #6864 - allocator_proxy, queue_proxy tests: take the guard fault's code in the filter (Wine 9)
Diffstat (limited to 'runtime/test/allocator_proxy_test.cpp')
-rw-r--r--runtime/test/allocator_proxy_test.cpp7
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
68ULONG_PTR g_fault_address = 0; 68ULONG_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).
71DWORD g_fault_code = 0;
69 72
70int record_fault(EXCEPTION_POINTERS* info) { 73int 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.
81DWORD read_slot_guarded(void* const* vtable, unsigned slot) { 85DWORD 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