llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: None (hapeeeeee) <details> <summary>Changes</summary> This PR fixes a crash in `LLDB` caused by a dangling pointer to a reused `ValueObjectSP` when re-running the debuggee and setting the same watchpoint again. As described by @<!-- -->jasonmolenda, the fix is to reinitialize the dangling pointer in `Watchpoint::SetEnabled`. This PR closes [#<!-- -->135590](https://github.com/llvm/llvm-project/issues/135590). --- Full diff: https://github.com/llvm/llvm-project/pull/136682.diff 1 Files Affected: - (modified) lldb/source/Breakpoint/Watchpoint.cpp (+9) ``````````diff diff --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp index 2df848aaa0576..0fcc9b90c0ab5 100644 --- a/lldb/source/Breakpoint/Watchpoint.cpp +++ b/lldb/source/Breakpoint/Watchpoint.cpp @@ -409,6 +409,15 @@ bool Watchpoint::IsDisabledDuringEphemeralMode() { } void Watchpoint::SetEnabled(bool enabled, bool notify) { + // Whenever setting the enabled state of a watchpoint, we need to ensure + // that `m_new_value_sp` exists to avoid crash when reading old_data later. + // See https://github.com/llvm/llvm-project/issues/135590. + if (!m_new_value_sp) { + ExecutionContext exe_ctx; + m_target.GetProcessSP()->CalculateExecutionContext(exe_ctx); + CaptureWatchedValue(exe_ctx); + } + if (!enabled) { if (m_is_ephemeral) ++m_disabled_count; `````````` </details> https://github.com/llvm/llvm-project/pull/136682 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits