Fix compilation warning

This commit is contained in:
kd-11 2024-09-07 15:20:25 +00:00 committed by kd-11
parent b31280e387
commit 4f27af9949

View File

@ -1841,17 +1841,17 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
} }
#if defined(ARCH_X64) #if defined(ARCH_X64)
#define RIP(ctx) ctx->Rip const exec_addr = pExp->ContextRecord->Rip;
#elif defined(ARCH_ARM64) #elif defined(ARCH_ARM64)
#define RIP(ctx) ctx->Pc const exec_addr = pExp->ContextRecord->Pc;
#else #else
#error "Unimplemented exception handling for this architecture" #error "Unimplemented exception handling for this architecture"
#endif #endif
fmt::append(msg, "Instruction address: %p.\n", RIP(pExp->ContextRecord)); fmt::append(msg, "Instruction address: %p.\n", exec_addr);
DWORD64 unwind_base; 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 // Get function address
const DWORD64 func_addr = rtf->BeginAddress + unwind_base; 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<DWORD64>(info.lpBaseOfDll); const DWORD64 base = reinterpret_cast<DWORD64>(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; std::string module_name;
for (DWORD size = 15; module_name.size() != size;) for (DWORD size = 15; module_name.size() != size;)