diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 6c5ea25b1b..bcc18f8387 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1841,17 +1841,17 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept } #if defined(ARCH_X64) -#define RIP(ctx) ctx->Rip + const exec_addr = pExp->ContextRecord->Rip; #elif defined(ARCH_ARM64) -#define RIP(ctx) ctx->Pc + const exec_addr = pExp->ContextRecord->Pc; #else #error "Unimplemented exception handling for this architecture" #endif - fmt::append(msg, "Instruction address: %p.\n", RIP(pExp->ContextRecord)); + fmt::append(msg, "Instruction address: %p.\n", exec_addr); DWORD64 unwind_base; - if (const auto rtf = RtlLookupFunctionEntry(RIP(pExp->ContextRecord), &unwind_base, nullptr)) + if (const auto rtf = RtlLookupFunctionEntry(exec_addr, &unwind_base, nullptr)) { // Get function address const DWORD64 func_addr = rtf->BeginAddress + unwind_base; @@ -1868,7 +1868,7 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept { const DWORD64 base = reinterpret_cast(info.lpBaseOfDll); - if (RIP(pExp->ContextRecord) >= base && RIP(pExp->ContextRecord) < base + info.SizeOfImage) + if (exec_addr >= base && exec_addr < base + info.SizeOfImage) { std::string module_name; for (DWORD size = 15; module_name.size() != size;)