[Lldb-commits] [lldb] [lldb] Add 'modify' type watchpoints, make it default (PR #66308)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 13 20:05:08 PDT 2023
================
@@ -211,6 +212,35 @@ bool Watchpoint::CaptureWatchedValue(const ExecutionContext &exe_ctx) {
return (m_new_value_sp && m_new_value_sp->GetError().Success());
}
+bool Watchpoint::WatchedValueReportable(const ExecutionContext &exe_ctx) {
+ if (!m_watch_modify)
+ return true;
+ if (!m_type.IsValid())
+ return true;
+
+ ConstString watch_name("$__lldb__watch_value");
+ Address watch_address(GetLoadAddress());
+ ValueObjectSP newest_valueobj_sp = ValueObjectMemory::Create(
+ exe_ctx.GetBestExecutionContextScope(), watch_name.GetStringRef(),
+ watch_address, m_type);
+ newest_valueobj_sp = newest_valueobj_sp->CreateConstantValue(watch_name);
+ DataExtractor new_data;
+ DataExtractor old_data;
+ Status error;
+ newest_valueobj_sp->GetData(new_data, error);
+ m_new_value_sp->GetData(old_data, error);
+
----------------
jasonmolenda wrote:
In StopInfoWatchpoint::PerformAction() we decide if we're `m_should_stop` and if so, we call `Watchpoint::CaptureWatchedValue` (one of the things we do before that call is compare the value and decide if we're going to stop or not). CaptureWatchedValue copies the "new" value into the m_old_value_sp and then creates a new constant value object for m_new_value_sp. I copied that same way of creating the const ValueObject in this method; it's the method before this one in Watchpoint.cpp. So the copying of the new value to the previous value is already handled by that code in CaptureWatchedValue.
https://github.com/llvm/llvm-project/pull/66308
More information about the lldb-commits
mailing list