diff options
| author | 2022-06-21 16:04:57 -0700 | |
|---|---|---|
| committer | 2022-06-21 16:04:57 -0700 | |
| commit | 737c446fc18618cf80a1243104ac8f5114c29a22 (patch) | |
| tree | 881e88bcc52e4d0639906f61a9b1a5292e36767d /src/core/arm/arm_interface.cpp | |
| parent | Merge pull request #8468 from liamwhite/dispatch-tracking (diff) | |
| parent | core/debugger: memory breakpoint support (diff) | |
| download | yuzu-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/arm/arm_interface.cpp')
| -rw-r--r-- | src/core/arm/arm_interface.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index 9a285dfc6..6425e131f 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp | |||
| @@ -121,8 +121,15 @@ void ARM_Interface::Run() { | |||
| 121 | 121 | ||
| 122 | // Notify the debugger and go to sleep if a breakpoint was hit. | 122 | // Notify the debugger and go to sleep if a breakpoint was hit. |
| 123 | if (Has(hr, breakpoint)) { | 123 | if (Has(hr, breakpoint)) { |
| 124 | RewindBreakpointInstruction(); | ||
| 124 | system.GetDebugger().NotifyThreadStopped(current_thread); | 125 | system.GetDebugger().NotifyThreadStopped(current_thread); |
| 125 | current_thread->RequestSuspend(Kernel::SuspendType::Debug); | 126 | current_thread->RequestSuspend(SuspendType::Debug); |
| 127 | break; | ||
| 128 | } | ||
| 129 | if (Has(hr, watchpoint)) { | ||
| 130 | RewindBreakpointInstruction(); | ||
| 131 | system.GetDebugger().NotifyThreadWatchpoint(current_thread, *HaltedWatchpoint()); | ||
| 132 | current_thread->RequestSuspend(SuspendType::Debug); | ||
| 126 | break; | 133 | break; |
| 127 | } | 134 | } |
| 128 | 135 | ||
| @@ -136,4 +143,36 @@ void ARM_Interface::Run() { | |||
| 136 | } | 143 | } |
| 137 | } | 144 | } |
| 138 | 145 | ||
| 146 | void ARM_Interface::LoadWatchpointArray(const WatchpointArray& wp) { | ||
| 147 | watchpoints = ℘ | ||
| 148 | } | ||
| 149 | |||
| 150 | const Kernel::DebugWatchpoint* ARM_Interface::MatchingWatchpoint( | ||
| 151 | VAddr addr, u64 size, Kernel::DebugWatchpointType access_type) const { | ||
| 152 | if (!watchpoints) { | ||
| 153 | return nullptr; | ||
| 154 | } | ||
| 155 | |||
| 156 | const VAddr start_address{addr}; | ||
| 157 | const VAddr end_address{addr + size}; | ||
| 158 | |||
| 159 | for (size_t i = 0; i < Core::Hardware::NUM_WATCHPOINTS; i++) { | ||
| 160 | const auto& watch{(*watchpoints)[i]}; | ||
| 161 | |||
| 162 | if (end_address <= watch.start_address) { | ||
| 163 | continue; | ||
| 164 | } | ||
| 165 | if (start_address >= watch.end_address) { | ||
| 166 | continue; | ||
| 167 | } | ||
| 168 | if ((access_type & watch.type) == Kernel::DebugWatchpointType::None) { | ||
| 169 | continue; | ||
| 170 | } | ||
| 171 | |||
| 172 | return &watch; | ||
| 173 | } | ||
| 174 | |||
| 175 | return nullptr; | ||
| 176 | } | ||
| 177 | |||
| 139 | } // namespace Core | 178 | } // namespace Core |