[Lldb-commits] [lldb] [llvm] [lldb][Expression] Emit a 'Note' diagnostic that indicates the language used for expression evaluation (PR #161688)

2025-10-12 Thread Michael Buch via lldb-commits

https://github.com/Michael137 edited 
https://github.com/llvm/llvm-project/pull/161688
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Revert "Make SBBreakpoint/SBBreakpointLocation.SetCondition(nullptr) work again." (PR #162544)

2025-10-12 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes

Reverts llvm/llvm-project#162370

The PR breaks multiple buildbots:

https://lab.llvm.org/buildbot/#/builders/162/builds/32818
https://lab.llvm.org/buildbot/#/builders/181/builds/29448


---
Full diff: https://github.com/llvm/llvm-project/pull/162544.diff


5 Files Affected:

- (modified) lldb/source/API/SBBreakpoint.cpp (+2-9) 
- (modified) lldb/source/API/SBBreakpointLocation.cpp (+2-9) 
- (modified) lldb/unittests/API/CMakeLists.txt (-1) 
- (removed) lldb/unittests/API/SBBreakpointClearConditionTest.cpp (-69) 
- (modified) lldb/unittests/Breakpoint/CMakeLists.txt (+1-5) 


``diff
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index 23dba462478c9..07c0a2ea907ba 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -275,11 +275,7 @@ void SBBreakpoint::SetCondition(const char *condition) {
   if (bkpt_sp) {
 std::lock_guard guard(
 bkpt_sp->GetTarget().GetAPIMutex());
-// Treat a null pointer as resetting the condition.
-if (!condition)
-  bkpt_sp->SetCondition(StopCondition());
-else
-  bkpt_sp->SetCondition(StopCondition(condition));
+bkpt_sp->SetCondition(StopCondition(condition));
   }
 }
 
@@ -292,10 +288,7 @@ const char *SBBreakpoint::GetCondition() {
 
   std::lock_guard guard(
   bkpt_sp->GetTarget().GetAPIMutex());
-  StopCondition cond = bkpt_sp->GetCondition();
-  if (!cond)
-return nullptr;
-  return ConstString(cond.GetText()).GetCString();
+  return ConstString(bkpt_sp->GetCondition().GetText()).GetCString();
 }
 
 void SBBreakpoint::SetAutoContinue(bool auto_continue) {
diff --git a/lldb/source/API/SBBreakpointLocation.cpp 
b/lldb/source/API/SBBreakpointLocation.cpp
index 2feaa5c805a15..e786435c4f8af 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -160,11 +160,7 @@ void SBBreakpointLocation::SetCondition(const char 
*condition) {
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-// Treat a nullptr as clearing the condition
-if (!condition)
-  loc_sp->SetCondition(StopCondition());
-else
-  loc_sp->SetCondition(StopCondition(condition));
+loc_sp->SetCondition(StopCondition(condition));
   }
 }
 
@@ -177,10 +173,7 @@ const char *SBBreakpointLocation::GetCondition() {
 
   std::lock_guard guard(
   loc_sp->GetTarget().GetAPIMutex());
-  StopCondition cond = loc_sp->GetCondition();
-  if (!cond)
-return nullptr;
-  return ConstString(cond.GetText()).GetCString();
+  return ConstString(loc_sp->GetCondition().GetText()).GetCString();
 }
 
 void SBBreakpointLocation::SetAutoContinue(bool auto_continue) {
diff --git a/lldb/unittests/API/CMakeLists.txt 
b/lldb/unittests/API/CMakeLists.txt
index b86054fb353f7..1e778181435b4 100644
--- a/lldb/unittests/API/CMakeLists.txt
+++ b/lldb/unittests/API/CMakeLists.txt
@@ -2,7 +2,6 @@ add_lldb_unittest(APITests
   SBCommandInterpreterTest.cpp
   SBLineEntryTest.cpp
   SBMutexTest.cpp
-  SBBreakpointClearConditionTest.cpp
 
   SBAPITEST
 
diff --git a/lldb/unittests/API/SBBreakpointClearConditionTest.cpp 
b/lldb/unittests/API/SBBreakpointClearConditionTest.cpp
deleted file mode 100644
index 993f7f90d97c0..0
--- a/lldb/unittests/API/SBBreakpointClearConditionTest.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-//===--===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-// Use the umbrella header for -Wdocumentation.
-#include "lldb/API/LLDB.h"
-
-#include "TestingSupport/SubsystemRAII.h"
-#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBBreakpointLocation.h"
-#include "lldb/API/SBDebugger.h"
-#include "lldb/API/SBTarget.h"
-#include "gtest/gtest.h"
-#include 
-#include 
-
-using namespace lldb_private;
-using namespace lldb;
-
-class BreakpointClearConditionTest : public ::testing::Test {
-public:
-  void SetUp() override {
-m_sb_debugger = SBDebugger::Create(/*source_init_files=*/false);
-  };
-
-  void TearDown() override { SBDebugger::Destroy(m_sb_debugger); }
-  SBDebugger m_sb_debugger;
-  SubsystemRAII subsystems;
-};
-
-template  void test_condition(T sb_object) {
-  const char *in_cond_str = "Here is a condition";
-  sb_object.SetCondition(in_cond_str);
-  // Make sure we set the condition correctly:
-  const char *out_cond_str = sb_object.GetCondition();
-  EXPECT_STREQ(in_cond_str, out_cond_str);
-  // Now unset it by passing in nullptr and make sure that works:
-  const char *empty_tokens[2] = {nullptr, ""};
-  for (auto token : empty_tokens) {
-sb_object.SetCondition(token);
-out_con

[Lldb-commits] [lldb] [lldb/cmake] unittests: Breakpoint: remove liblldb dep (PR #162571)

2025-10-12 Thread Justin Stitt via lldb-commits

https://github.com/JustinStitt edited 
https://github.com/llvm/llvm-project/pull/162571
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Allow empty memory reference in disassemble arguments (PR #162517)

2025-10-12 Thread Walter Erquinigo via lldb-commits


@@ -156,11 +156,14 @@ DecodeMemoryReference(llvm::StringRef memoryReference);
 ///Indicates if the key is required to be present, otherwise report an 
error
 ///if the key is missing.
 ///
+/// \param[in] allow_empty
+///Interpret empty string as a valid value, don't report an error.

walter-erquinigo wrote:

add a comment here pointing to the VSCode patch you sent, just as a reference 
of how this was needed in the first place

https://github.com/llvm/llvm-project/pull/162517
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f3e2c20 - Make SBBreakpoint/SBBreakpointLocation.SetCondition(nullptr) work again. (#162370)

2025-10-12 Thread via lldb-commits

Author: jimingham
Date: 2025-10-08T13:01:20-07:00
New Revision: f3e2c20a23b11fbe1149e5d2e3631109af6d3238

URL: 
https://github.com/llvm/llvm-project/commit/f3e2c20a23b11fbe1149e5d2e3631109af6d3238
DIFF: 
https://github.com/llvm/llvm-project/commit/f3e2c20a23b11fbe1149e5d2e3631109af6d3238.diff

LOG: Make SBBreakpoint/SBBreakpointLocation.SetCondition(nullptr) work again. 
(#162370)

The addition of the StopCondition in the lldb_private layer meant that
clearing a breakpoint condition with:

sb_break.SetCondition(nullptr);

now crashes. Also, GetCondition for an empty condition used to return a
nullptr, but now it returns "".

This patch fixes that crash and makes the SB GetCondition always return
nullptr for an empty condition.

Added: 
lldb/unittests/API/SBBreakpointClearConditionTest.cpp

Modified: 
lldb/source/API/SBBreakpoint.cpp
lldb/source/API/SBBreakpointLocation.cpp
lldb/unittests/API/CMakeLists.txt
lldb/unittests/Breakpoint/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/API/SBBreakpoint.cpp 
b/lldb/source/API/SBBreakpoint.cpp
index 07c0a2ea907ba..23dba462478c9 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -275,7 +275,11 @@ void SBBreakpoint::SetCondition(const char *condition) {
   if (bkpt_sp) {
 std::lock_guard guard(
 bkpt_sp->GetTarget().GetAPIMutex());
-bkpt_sp->SetCondition(StopCondition(condition));
+// Treat a null pointer as resetting the condition.
+if (!condition)
+  bkpt_sp->SetCondition(StopCondition());
+else
+  bkpt_sp->SetCondition(StopCondition(condition));
   }
 }
 
@@ -288,7 +292,10 @@ const char *SBBreakpoint::GetCondition() {
 
   std::lock_guard guard(
   bkpt_sp->GetTarget().GetAPIMutex());
-  return ConstString(bkpt_sp->GetCondition().GetText()).GetCString();
+  StopCondition cond = bkpt_sp->GetCondition();
+  if (!cond)
+return nullptr;
+  return ConstString(cond.GetText()).GetCString();
 }
 
 void SBBreakpoint::SetAutoContinue(bool auto_continue) {

diff  --git a/lldb/source/API/SBBreakpointLocation.cpp 
b/lldb/source/API/SBBreakpointLocation.cpp
index e786435c4f8af..2feaa5c805a15 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -160,7 +160,11 @@ void SBBreakpointLocation::SetCondition(const char 
*condition) {
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-loc_sp->SetCondition(StopCondition(condition));
+// Treat a nullptr as clearing the condition
+if (!condition)
+  loc_sp->SetCondition(StopCondition());
+else
+  loc_sp->SetCondition(StopCondition(condition));
   }
 }
 
@@ -173,7 +177,10 @@ const char *SBBreakpointLocation::GetCondition() {
 
   std::lock_guard guard(
   loc_sp->GetTarget().GetAPIMutex());
-  return ConstString(loc_sp->GetCondition().GetText()).GetCString();
+  StopCondition cond = loc_sp->GetCondition();
+  if (!cond)
+return nullptr;
+  return ConstString(cond.GetText()).GetCString();
 }
 
 void SBBreakpointLocation::SetAutoContinue(bool auto_continue) {

diff  --git a/lldb/unittests/API/CMakeLists.txt 
b/lldb/unittests/API/CMakeLists.txt
index 1e778181435b4..b86054fb353f7 100644
--- a/lldb/unittests/API/CMakeLists.txt
+++ b/lldb/unittests/API/CMakeLists.txt
@@ -2,6 +2,7 @@ add_lldb_unittest(APITests
   SBCommandInterpreterTest.cpp
   SBLineEntryTest.cpp
   SBMutexTest.cpp
+  SBBreakpointClearConditionTest.cpp
 
   SBAPITEST
 

diff  --git a/lldb/unittests/API/SBBreakpointClearConditionTest.cpp 
b/lldb/unittests/API/SBBreakpointClearConditionTest.cpp
new file mode 100644
index 0..993f7f90d97c0
--- /dev/null
+++ b/lldb/unittests/API/SBBreakpointClearConditionTest.cpp
@@ -0,0 +1,69 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+// Use the umbrella header for -Wdocumentation.
+#include "lldb/API/LLDB.h"
+
+#include "TestingSupport/SubsystemRAII.h"
+#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBTarget.h"
+#include "gtest/gtest.h"
+#include 
+#include 
+
+using namespace lldb_private;
+using namespace lldb;
+
+class BreakpointClearConditionTest : public ::testing::Test {
+public:
+  void SetUp() override {
+m_sb_debugger = SBDebugger::Create(/*source_init_files=*/false);
+  };
+
+  void TearDown() override { SBDebugger::Destroy(m_sb_debugger); }
+  SBDebugger m_sb_debugger;
+  SubsystemRAII subsystems;
+};
+
+template  void test_condition(T sb_object) {
+  const char *in_cond_str = "Here is a conditio