-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Revert "Make SBBreakpoint/SBBreakpointLocation.SetCondition(nullptr) work again." #162544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…work aga…" This reverts commit f3e2c20.
@llvm/pr-subscribers-lldb Author: Kazu Hirata (kazutakahirata) ChangesReverts llvm/llvm-project#162370 The PR breaks multiple buildbots: https://lab.llvm.org/buildbot/#/builders/162/builds/32818 Full diff: https://github.com/llvm/llvm-project/pull/162544.diff 5 Files Affected:
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<std::recursive_mutex> 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<std::recursive_mutex> 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<std::recursive_mutex> 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<std::recursive_mutex> 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..0000000000000
--- 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 <memory>
-#include <mutex>
-
-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<lldb::SBDebugger> subsystems;
-};
-
-template <typename T> 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_cond_str = sb_object.GetCondition();
- // And make sure an unset condition returns nullptr:
- EXPECT_EQ(nullptr, out_cond_str);
- }
-}
-
-TEST_F(BreakpointClearConditionTest, BreakpointClearConditionTest) {
- // Create target
- SBTarget sb_target;
- SBError error;
- sb_target =
- m_sb_debugger.CreateTarget("", "x86_64-apple-macosx-", "remote-macosx",
- /*add_dependent=*/false, error);
-
- EXPECT_EQ(sb_target.IsValid(), true);
-
- // Create breakpoint
- SBBreakpoint sb_breakpoint = sb_target.BreakpointCreateByAddress(0xDEADBEEF);
- test_condition(sb_breakpoint);
-
- // Address breakpoints always have one location, so we can also use this
- // to test the location:
- SBBreakpointLocation sb_loc = sb_breakpoint.GetLocationAtIndex(0);
- EXPECT_EQ(sb_loc.IsValid(), true);
- test_condition(sb_loc);
-}
diff --git a/lldb/unittests/Breakpoint/CMakeLists.txt b/lldb/unittests/Breakpoint/CMakeLists.txt
index 3e4161313cd9d..3c234a4fea29a 100644
--- a/lldb/unittests/Breakpoint/CMakeLists.txt
+++ b/lldb/unittests/Breakpoint/CMakeLists.txt
@@ -1,14 +1,10 @@
-add_lldb_unittest(LLDBBreakpointTests
+add_lldb_unittest(LLDBBreakpointTests
BreakpointIDTest.cpp
WatchpointAlgorithmsTests.cpp
LINK_COMPONENTS
Support
LINK_LIBS
- liblldb
lldbBreakpoint
lldbCore
- LLVMTestingSupport
- lldbUtilityHelpers
- lldbPluginPlatformMacOSX
)
|
The build seems to be fixed as of 1395d43. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #162370
The PR breaks multiple buildbots:
https://lab.llvm.org/buildbot/#/builders/163/builds/27856
https://lab.llvm.org/buildbot/#/builders/162/builds/32818
https://lab.llvm.org/buildbot/#/builders/181/builds/29448