[Lldb-commits] [lldb] [lldb] refactor watchpoint functionality (PR #159807)

via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 19 18:06:05 PDT 2025


================
@@ -1093,22 +1097,30 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
     }
 
     Status error;
-    WatchpointSP watch_sp =
-        target.CreateWatchpoint(addr, size, &compiler_type, watch_type, error);
-    if (watch_sp) {
-      watch_sp->SetWatchSpec(std::string(expr));
-      Stream &output_stream = result.GetOutputStream();
-      output_stream.Printf("Watchpoint created: ");
-      watch_sp->GetDescription(&output_stream, lldb::eDescriptionLevelFull);
-      output_stream.EOL();
-      result.SetStatus(eReturnStatusSuccessFinishResult);
-    } else {
-      result.AppendErrorWithFormat("Watchpoint creation failed (addr=0x%" PRIx64
-                                   ", size=%" PRIu64 ").\n",
-                                   addr, (uint64_t)size);
-      if (error.AsCString(nullptr))
-        result.AppendError(error.AsCString());
+    WatchpointSP watch_sp;
+    watch_sp =
----------------
dlav-sc wrote:

If you are asking about `WatchpointSP watch_sp;`, then I myself don't know why this line is placed separately :) It seems I changed this lines several times.

Fixed it.

https://github.com/llvm/llvm-project/pull/159807


More information about the lldb-commits mailing list