summaryrefslogtreecommitdiff
path: root/src/core/debugger/debugger.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2022-06-21 16:04:57 -0700
committerGravatar GitHub2022-06-21 16:04:57 -0700
commit737c446fc18618cf80a1243104ac8f5114c29a22 (patch)
tree881e88bcc52e4d0639906f61a9b1a5292e36767d /src/core/debugger/debugger.cpp
parentMerge pull request #8468 from liamwhite/dispatch-tracking (diff)
parentcore/debugger: memory breakpoint support (diff)
downloadyuzu-737c446fc18618cf80a1243104ac8f5114c29a22.tar.gz
yuzu-737c446fc18618cf80a1243104ac8f5114c29a22.tar.xz
yuzu-737c446fc18618cf80a1243104ac8f5114c29a22.zip
Merge pull request #8432 from liamwhite/watchpoint
core/debugger: memory breakpoint support
Diffstat (limited to 'src/core/debugger/debugger.cpp')
-rw-r--r--src/core/debugger/debugger.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/debugger/debugger.cpp b/src/core/debugger/debugger.cpp
index ab3940922..ac64d2f9d 100644
--- a/src/core/debugger/debugger.cpp
+++ b/src/core/debugger/debugger.cpp
@@ -44,12 +44,14 @@ static std::span<const u8> ReceiveInto(Readable& r, Buffer& buffer) {
44 44
45enum class SignalType { 45enum class SignalType {
46 Stopped, 46 Stopped,
47 Watchpoint,
47 ShuttingDown, 48 ShuttingDown,
48}; 49};
49 50
50struct SignalInfo { 51struct SignalInfo {
51 SignalType type; 52 SignalType type;
52 Kernel::KThread* thread; 53 Kernel::KThread* thread;
54 const Kernel::DebugWatchpoint* watchpoint;
53}; 55};
54 56
55namespace Core { 57namespace Core {
@@ -157,13 +159,19 @@ private:
157 void PipeData(std::span<const u8> data) { 159 void PipeData(std::span<const u8> data) {
158 switch (info.type) { 160 switch (info.type) {
159 case SignalType::Stopped: 161 case SignalType::Stopped:
162 case SignalType::Watchpoint:
160 // Stop emulation. 163 // Stop emulation.
161 PauseEmulation(); 164 PauseEmulation();
162 165
163 // Notify the client. 166 // Notify the client.
164 active_thread = info.thread; 167 active_thread = info.thread;
165 UpdateActiveThread(); 168 UpdateActiveThread();
166 frontend->Stopped(active_thread); 169
170 if (info.type == SignalType::Watchpoint) {
171 frontend->Watchpoint(active_thread, *info.watchpoint);
172 } else {
173 frontend->Stopped(active_thread);
174 }
167 175
168 break; 176 break;
169 case SignalType::ShuttingDown: 177 case SignalType::ShuttingDown:
@@ -290,12 +298,17 @@ Debugger::Debugger(Core::System& system, u16 port) {
290Debugger::~Debugger() = default; 298Debugger::~Debugger() = default;
291 299
292bool Debugger::NotifyThreadStopped(Kernel::KThread* thread) { 300bool Debugger::NotifyThreadStopped(Kernel::KThread* thread) {
293 return impl && impl->SignalDebugger(SignalInfo{SignalType::Stopped, thread}); 301 return impl && impl->SignalDebugger(SignalInfo{SignalType::Stopped, thread, nullptr});
302}
303
304bool Debugger::NotifyThreadWatchpoint(Kernel::KThread* thread,
305 const Kernel::DebugWatchpoint& watch) {
306 return impl && impl->SignalDebugger(SignalInfo{SignalType::Watchpoint, thread, &watch});
294} 307}
295 308
296void Debugger::NotifyShutdown() { 309void Debugger::NotifyShutdown() {
297 if (impl) { 310 if (impl) {
298 impl->SignalDebugger(SignalInfo{SignalType::ShuttingDown, nullptr}); 311 impl->SignalDebugger(SignalInfo{SignalType::ShuttingDown, nullptr, nullptr});
299 } 312 }
300} 313}
301 314