diff options
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/Breakpoint/Watchpoint.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Target/StopInfo.cpp | 23 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index a9fe4ee4a22..7c048fadf4a 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -313,7 +313,9 @@ Watchpoint::SetEnabled(bool enabled) if (!enabled) { SetHardwareIndex(LLDB_INVALID_INDEX32); - ClearSnapshots(); + // Don't clear the snapshots for now. + // Within StopInfo.cpp, we purposely do disable/enable watchpoint while performing watchpoint actions. + //ClearSnapshots(); } m_enabled = enabled; } diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp index 434b0067712..c090b183c40 100644 --- a/lldb/source/Target/StopInfo.cpp +++ b/lldb/source/Target/StopInfo.cpp @@ -446,6 +446,26 @@ public: return m_should_stop; } + // Make sure watchpoint is properly disabled and subsequently enabled while performing watchpoint actions. + class WatchpointSentry { + public: + WatchpointSentry(Process *p, Watchpoint *w): + process(p), + watchpoint(w) + { + if (process && watchpoint) + process->DisableWatchpoint(watchpoint); + } + ~WatchpointSentry() + { + if (process && watchpoint) + process->EnableWatchpoint(watchpoint); + } + private: + Process *process; + Watchpoint *watchpoint; + }; + // Perform any action that is associated with this stop. This is done as the // Event is removed from the event queue. virtual void @@ -462,6 +482,9 @@ public: { ExecutionContext exe_ctx (m_thread.GetStackFrameAtIndex(0)); Process* process = exe_ctx.GetProcessPtr(); + + WatchpointSentry sentry(process, wp_sp.get()); + { // check if this process is running on an architecture where watchpoints trigger // before the associated instruction runs. if so, disable the WP, single-step and then |

