summaryrefslogtreecommitdiff
path: root/src/core/debugger/debugger.cpp
diff options
context:
space:
mode:
authorGravatar Liam2022-06-06 12:56:01 -0400
committerGravatar Liam2022-06-16 13:18:07 -0400
commit208ed712f42cfd277405a22663197dc1c5e84cfe (patch)
tree56c1a3cbddf392d700e817cd4093564e3f096013 /src/core/debugger/debugger.cpp
parentMerge pull request #8457 from liamwhite/kprocess-suspend (diff)
downloadyuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.gz
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.tar.xz
yuzu-208ed712f42cfd277405a22663197dc1c5e84cfe.zip
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