From f6f8024fb5c1f7ea962ebf28980b018488e1eb31 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Tue, 25 May 2021 21:57:29 +0100 Subject: [PATCH] a32_emit_x64: Dump x64 disassembly upon fastmem patch failure --- src/dynarmic/backend/x64/a32_emit_x64.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dynarmic/backend/x64/a32_emit_x64.cpp b/src/dynarmic/backend/x64/a32_emit_x64.cpp index ea37b805..056639b6 100644 --- a/src/dynarmic/backend/x64/a32_emit_x64.cpp +++ b/src/dynarmic/backend/x64/a32_emit_x64.cpp @@ -26,6 +26,7 @@ #include "dynarmic/common/common_types.h" #include "dynarmic/common/scope_exit.h" #include "dynarmic/common/variant_util.h" +#include "dynarmic/common/x64_disassemble.h" #include "dynarmic/frontend/A32/location_descriptor.h" #include "dynarmic/frontend/A32/types.h" #include "dynarmic/interface/A32/coprocessor.h" @@ -897,7 +898,15 @@ std::optional A32EmitX64::ShouldFastmem(A32EmitC FakeCall A32EmitX64::FastmemCallback(u64 rip_) { const auto iter = fastmem_patch_info.find(rip_); - ASSERT(iter != fastmem_patch_info.end()); + + if (iter == fastmem_patch_info.end()) { + fmt::print("dynarmic: Segfault happened within JITted code at rip = {:016x}\n", rip_); + fmt::print("Segfault wasn't at a fastmem patch location!\n"); + fmt::print("Now dumping code.......\n\n"); + Common::DumpDisassembledX64((void*)(rip_ & ~u64(0xFFF)), 0x1000); + ASSERT_FALSE("iter != fastmem_patch_info.end()"); + } + if (conf.recompile_on_fastmem_failure) { const auto marker = iter->second.marker; do_not_fastmem.emplace(marker);