diff options
author | Liam <byteslice@airmail.cc> | 2022-05-31 01:35:01 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-06-01 06:01:25 +0200 |
commit | fb4b3c127f7c390358d7f4cadd2f58de116fec48 (patch) | |
tree | e2588a859d364a32be0cd9e0401a345c6492d1a7 /src/core/arm/dynarmic/arm_dynarmic_64.cpp | |
parent | Merge pull request #8368 from german77/seventimes (diff) | |
download | yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.tar yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.tar.gz yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.tar.bz2 yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.tar.lz yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.tar.xz yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.tar.zst yuzu-fb4b3c127f7c390358d7f4cadd2f58de116fec48.zip |
Diffstat (limited to 'src/core/arm/dynarmic/arm_dynarmic_64.cpp')
-rw-r--r-- | src/core/arm/dynarmic/arm_dynarmic_64.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 1b1334598..1f596cfef 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp @@ -15,6 +15,7 @@ #include "core/arm/dynarmic/arm_exclusive_monitor.h" #include "core/core.h" #include "core/core_timing.h" +#include "core/debugger/debugger.h" #include "core/hardware_properties.h" #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/svc.h" @@ -27,6 +28,7 @@ using namespace Common::Literals; constexpr Dynarmic::HaltReason break_loop = Dynarmic::HaltReason::UserDefined2; constexpr Dynarmic::HaltReason svc_call = Dynarmic::HaltReason::UserDefined3; +constexpr Dynarmic::HaltReason breakpoint = Dynarmic::HaltReason::UserDefined4; class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks { public: @@ -119,8 +121,13 @@ public: case Dynarmic::A64::Exception::SendEventLocal: case Dynarmic::A64::Exception::Yield: return; - case Dynarmic::A64::Exception::Breakpoint: default: + if (parent.system.DebuggerEnabled()) { + parent.breakpoint_pc = pc; + parent.jit.load()->HaltExecution(breakpoint); + return; + } + parent.LogBacktrace(); ASSERT_MSG(false, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})", static_cast<std::size_t>(exception), pc, MemoryReadCode(pc)); @@ -299,16 +306,31 @@ void ARM_Dynarmic_64::Run() { if (Has(hr, svc_call)) { Kernel::Svc::Call(system, svc_swi); } + + // Check to see if breakpoint is triggered. + // Recheck step condition in case stop is no longer desired. + Kernel::KThread* current_thread = system.Kernel().GetCurrentEmuThread(); + if (Has(hr, breakpoint)) { + jit.load()->SetPC(breakpoint_pc); + + if (system.GetDebugger().NotifyThreadStopped(current_thread)) { + current_thread->RequestSuspend(Kernel::SuspendType::Debug); + } + break; + } + if (ShouldStep()) { + // When stepping, this should be the only thread running. + ASSERT(system.GetDebugger().NotifyThreadStopped(current_thread)); + current_thread->RequestSuspend(Kernel::SuspendType::Debug); + break; + } + if (Has(hr, break_loop) || !uses_wall_clock) { break; } } } -void ARM_Dynarmic_64::Step() { - jit.load()->Step(); -} - ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_) |