From b4d9d9661a0f8d40f2e0b863149cb341fc906d4c Mon Sep 17 00:00:00 2001 From: MerryMage Date: Fri, 28 Sep 2018 20:10:51 +0100 Subject: [PATCH] arm_dynarmic: Pass breakpoints to gdbstub Allow gdbstub to handle execution breakpoints --- externals/dynarmic | 2 +- src/core/arm/dynarmic/arm_dynarmic.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/externals/dynarmic b/externals/dynarmic index 68ca03e8d4..4e6848d1c9 160000 --- a/externals/dynarmic +++ b/externals/dynarmic @@ -1 +1 @@ -Subproject commit 68ca03e8d4822c78e15315e67ddbb1d6bf4d3827 +Subproject commit 4e6848d1c9e8dadc70595c15b5589f8b14aad478 diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 4220ebd3c1..3cfd2a6d66 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -12,6 +12,7 @@ #include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/core.h" #include "core/core_timing.h" +#include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/svc.h" #include "core/memory.h" @@ -125,6 +126,22 @@ public: } void ExceptionRaised(VAddr pc, Dynarmic::A32::Exception exception) override { + switch (exception) { + case Dynarmic::A32::Exception::UndefinedInstruction: + case Dynarmic::A32::Exception::UnpredictableInstruction: + break; + case Dynarmic::A32::Exception::Breakpoint: + if (GDBStub::IsConnected()) { + parent.jit->HaltExecution(); + parent.SetPC(pc); + Kernel::Thread* thread = Kernel::GetCurrentThread(); + parent.SaveContext(thread->context); + GDBStub::Break(); + GDBStub::SendTrap(thread, 5); + return; + } + break; + } ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})", static_cast(exception), pc, MemoryReadCode(pc)); }