[Lldb-commits] [lldb] [LLDB] Fix crash after second run when set a previous watchpoint. (PR #136649)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 22 03:26:27 PDT 2025
https://github.com/hapeeeeee updated https://github.com/llvm/llvm-project/pull/136649
>From 563cbddfe9b7da394c818a03e05924c0f7d39d5f Mon Sep 17 00:00:00 2001
From: hapeeeeee <623151737 at qq.com>
Date: Tue, 22 Apr 2025 11:34:38 +0800
Subject: [PATCH] [lldb] Fix crash after second run when set a previous
watchpoint.
---
lldb/source/Breakpoint/Watchpoint.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
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;
More information about the lldb-commits
mailing list