[Lldb-commits] [lldb] [lldb] Fix TestMultithreaded.py when libc++ symbols are present (PR #174664)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 9 13:04:31 PST 2026
https://github.com/bulbazord updated https://github.com/llvm/llvm-project/pull/174664
>From b599b4e47eae939d8df442d71f0ab0fafcc6ec40 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Tue, 6 Jan 2026 14:37:08 -0800
Subject: [PATCH 1/4] [lldb] Fix TestMultithreaded.py when libc++ symbols are
present
There are a few test cases in TestMultithreaded.py. Most of them set a
breakpoint by name on "next". There's no problem with doing that, but
one of the tests cases in particular relies on being able to grab a
specific breakpoint location corresponding to the test inferior.
If you have libc++ symbols, this test will also have breakpoint
locations for symbols named `next` in libc++. I could have changed the
test to find the correct `next` breakpoint location, but it seems easier
to give it a more uncommon name instead.
---
lldb/test/API/api/multithreaded/inferior.cpp | 4 ++--
lldb/test/API/api/multithreaded/listener_test.cpp.template | 2 +-
.../api/multithreaded/test_breakpoint_callback.cpp.template | 2 +-
.../test_breakpoint_location_callback.cpp.template | 2 +-
lldb/test/API/api/multithreaded/test_stop-hook.cpp.template | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lldb/test/API/api/multithreaded/inferior.cpp b/lldb/test/API/api/multithreaded/inferior.cpp
index 3755bdd04f880..f83bd1bcf4649 100644
--- a/lldb/test/API/api/multithreaded/inferior.cpp
+++ b/lldb/test/API/api/multithreaded/inferior.cpp
@@ -3,7 +3,7 @@
-int next() {
+int my_next() {
static int i = 0;
std::cout << "incrementing " << i << std::endl;
return ++i;
@@ -12,6 +12,6 @@ int next() {
int main() {
int i = 0;
while (i < 5)
- i = next();
+ i = my_next();
return 0;
}
diff --git a/lldb/test/API/api/multithreaded/listener_test.cpp.template b/lldb/test/API/api/multithreaded/listener_test.cpp.template
index e305d1af4893f..9a661a1f26c5b 100644
--- a/lldb/test/API/api/multithreaded/listener_test.cpp.template
+++ b/lldb/test/API/api/multithreaded/listener_test.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, std::vector<string> args) {
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid()) throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
std::unique_ptr<char> working_dir(get_working_dir());
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template b/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template
index 4133025aa495a..74318e9f64db4 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, vector<string> args) {
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid()) throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
breakpoint.SetCallback(BPCallback, 0);
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
index 0b0dc5652e850..1868f2af485f7 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, vector<string> args) {
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid()) throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
if(breakpoint.GetNumLocations() != 1) throw Exception("unexpected amount of breakpoint locations");
diff --git a/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template b/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
index 393e717cceb5a..6e3ef4b51138b 100644
--- a/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, std::vector<std::string> args) {
if (!target.IsValid())
throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
if (!breakpoint.IsValid())
throw Exception("invalid breakpoint");
>From a577f20107dfce66f422769c88b23b626f86be6a Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Tue, 6 Jan 2026 14:45:04 -0800
Subject: [PATCH 2/4] format
---
lldb/test/API/api/multithreaded/inferior.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/lldb/test/API/api/multithreaded/inferior.cpp b/lldb/test/API/api/multithreaded/inferior.cpp
index f83bd1bcf4649..2f1505a24d8d8 100644
--- a/lldb/test/API/api/multithreaded/inferior.cpp
+++ b/lldb/test/API/api/multithreaded/inferior.cpp
@@ -1,8 +1,6 @@
#include <iostream>
-
-
int my_next() {
static int i = 0;
std::cout << "incrementing " << i << std::endl;
>From 08ec5aa6742de036eeb6270376f45a0eb11b7595 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Thu, 8 Jan 2026 14:06:04 -0800
Subject: [PATCH 3/4] Implement Jim's suggestion
---
lldb/test/API/api/multithreaded/inferior.cpp | 4 ++--
.../test/API/api/multithreaded/listener_test.cpp.template | 2 +-
.../multithreaded/test_breakpoint_callback.cpp.template | 2 +-
.../test_breakpoint_location_callback.cpp.template | 8 +++++++-
.../API/api/multithreaded/test_stop-hook.cpp.template | 2 +-
5 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/lldb/test/API/api/multithreaded/inferior.cpp b/lldb/test/API/api/multithreaded/inferior.cpp
index 2f1505a24d8d8..1997b783469ab 100644
--- a/lldb/test/API/api/multithreaded/inferior.cpp
+++ b/lldb/test/API/api/multithreaded/inferior.cpp
@@ -1,7 +1,7 @@
#include <iostream>
-int my_next() {
+int next() {
static int i = 0;
std::cout << "incrementing " << i << std::endl;
return ++i;
@@ -10,6 +10,6 @@ int my_next() {
int main() {
int i = 0;
while (i < 5)
- i = my_next();
+ i = next();
return 0;
}
diff --git a/lldb/test/API/api/multithreaded/listener_test.cpp.template b/lldb/test/API/api/multithreaded/listener_test.cpp.template
index 9a661a1f26c5b..e305d1af4893f 100644
--- a/lldb/test/API/api/multithreaded/listener_test.cpp.template
+++ b/lldb/test/API/api/multithreaded/listener_test.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, std::vector<string> args) {
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid()) throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
std::unique_ptr<char> working_dir(get_working_dir());
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template b/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template
index 74318e9f64db4..4133025aa495a 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, vector<string> args) {
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid()) throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
breakpoint.SetCallback(BPCallback, 0);
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
index 1868f2af485f7..edbda611ebc89 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
@@ -33,7 +33,13 @@ void test(SBDebugger &dbg, vector<string> args) {
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid()) throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
+ // Only look for the breakpoint in the main module.
+ SBFileSpec main_module(args.at(0).c_str(), /*resolve=*/true);
+ SBFileSpecList module_list;
+ module_list.Append(main_module);
+
+ SBBreakpoint breakpoint =
+ target.BreakpointCreateByName("next", module_list, SBFileSpecList());
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
if(breakpoint.GetNumLocations() != 1) throw Exception("unexpected amount of breakpoint locations");
diff --git a/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template b/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
index 6e3ef4b51138b..393e717cceb5a 100644
--- a/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_stop-hook.cpp.template
@@ -33,7 +33,7 @@ void test(SBDebugger &dbg, std::vector<std::string> args) {
if (!target.IsValid())
throw Exception("invalid target");
- SBBreakpoint breakpoint = target.BreakpointCreateByName("my_next");
+ SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
if (!breakpoint.IsValid())
throw Exception("invalid breakpoint");
>From 971338e0c761d9133f163fb7d2403df37cf6fb5b Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Fri, 9 Jan 2026 13:04:17 -0800
Subject: [PATCH 4/4] use function name mask
---
.../test_breakpoint_location_callback.cpp.template | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
index edbda611ebc89..a4bc65ab91331 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp.template
@@ -38,8 +38,8 @@ void test(SBDebugger &dbg, vector<string> args) {
SBFileSpecList module_list;
module_list.Append(main_module);
- SBBreakpoint breakpoint =
- target.BreakpointCreateByName("next", module_list, SBFileSpecList());
+ SBBreakpoint breakpoint = target.BreakpointCreateByName(
+ "next", eFunctionNameTypeFull, module_list, SBFileSpecList());
if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
if(breakpoint.GetNumLocations() != 1) throw Exception("unexpected amount of breakpoint locations");
More information about the lldb-commits
mailing list