diff options
| author | 2022-06-06 12:56:01 -0400 | |
|---|---|---|
| committer | 2022-06-16 13:18:07 -0400 | |
| commit | 208ed712f42cfd277405a22663197dc1c5e84cfe (patch) | |
| tree | 56c1a3cbddf392d700e817cd4093564e3f096013 /src/core/debugger/debugger.cpp | |
| parent | Merge pull request #8457 from liamwhite/kprocess-suspend (diff) | |
| download | yuzu-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.cpp | 19 |
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 | ||
| 45 | enum class SignalType { | 45 | enum class SignalType { |
| 46 | Stopped, | 46 | Stopped, |
| 47 | Watchpoint, | ||
| 47 | ShuttingDown, | 48 | ShuttingDown, |
| 48 | }; | 49 | }; |
| 49 | 50 | ||
| 50 | struct SignalInfo { | 51 | struct SignalInfo { |
| 51 | SignalType type; | 52 | SignalType type; |
| 52 | Kernel::KThread* thread; | 53 | Kernel::KThread* thread; |
| 54 | const Kernel::DebugWatchpoint* watchpoint; | ||
| 53 | }; | 55 | }; |
| 54 | 56 | ||
| 55 | namespace Core { | 57 | namespace 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) { | |||
| 290 | Debugger::~Debugger() = default; | 298 | Debugger::~Debugger() = default; |
| 291 | 299 | ||
| 292 | bool Debugger::NotifyThreadStopped(Kernel::KThread* thread) { | 300 | bool 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 | |||
| 304 | bool Debugger::NotifyThreadWatchpoint(Kernel::KThread* thread, | ||
| 305 | const Kernel::DebugWatchpoint& watch) { | ||
| 306 | return impl && impl->SignalDebugger(SignalInfo{SignalType::Watchpoint, thread, &watch}); | ||
| 294 | } | 307 | } |
| 295 | 308 | ||
| 296 | void Debugger::NotifyShutdown() { | 309 | void 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 | ||