From 067c5d5eafcf3311a39bb2f2c22f80192eba7454 Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:40:00 +0200 Subject: [PATCH] Thread.cpp: Report VM addresses on VM segfault --- Utilities/Thread.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index c31a0b804f7f..1d49f9c701f8 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1818,6 +1818,11 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept pExp->ExceptionRecord->ExceptionInformation[0] == 1 ? "writing" : "reading"; fmt::append(msg, "Segfault %s location %p at %p.\n", cause, pExp->ExceptionRecord->ExceptionInformation[1], pExp->ExceptionRecord->ExceptionAddress); + + if (vm::try_get_addr(reinterpret_cast(pExp->ExceptionRecord->ExceptionInformation[1])).second) + { + fmt::append(msg, "Sudo Addr: %p, VM Addr: %p\n", vm::g_sudo_addr, vm::g_base_addr); + } } else { @@ -1999,6 +2004,11 @@ static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept std::string msg = fmt::format("Segfault %s location %p at %p.\n", cause, info->si_addr, RIP(context)); + if (vm::try_get_addr(info->si_addr).second) + { + fmt::append(msg, "Sudo Addr: %p, VM Addr: %p\n", vm::g_sudo_addr, vm::g_base_addr); + } + append_thread_name(msg); sys_log.fatal("\n%s", msg);