================
@@ -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);
+
+  if (new_data.GetByteSize() != old_data.GetByteSize() ||
+      new_data.GetByteSize() == 0)
+    return true;
+
+  if (memcmp(new_data.GetDataStart(), old_data.GetDataStart(),
+             old_data.GetByteSize()) == 0)
+    return false; // Value has not changed, user requested modify watchpoint
+  else
+    return true;
----------------
JDevlieghere wrote:

else-after-return

https://github.com/llvm/llvm-project/pull/66308
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to