Skip to content

Commit 06b51ae

Browse files
[lldb] Update PlatformDarwin list of libraries with thread functions (llvm#127922)
Recent versions of the system changed where these functions live. (cherry picked from commit 81bc28d)
1 parent 3c84c55 commit 06b51ae

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ BreakpointSP PlatformDarwin::SetThreadCreationBreakpoint(Target &target) {
646646
"start_wqthread", "_pthread_wqthread", "_pthread_start",
647647
};
648648

649-
static const char *g_bp_modules[] = {"libsystem_c.dylib",
650-
"libSystem.B.dylib"};
649+
static const char *g_bp_modules[] = {"libsystem_c.dylib", "libSystem.B.dylib",
650+
"libsystem_pthread.dylib"};
651651

652652
FileSpecList bp_modules;
653653
for (size_t i = 0; i < std::size(g_bp_modules); i++) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
C_SOURCES := main.c
2+
3+
include Makefile.rules
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""Test that we get thread names when interrupting a process."""
2+
3+
import time
4+
import lldb
5+
from lldbsuite.test.decorators import *
6+
from lldbsuite.test.lldbtest import *
7+
from lldbsuite.test import lldbutil
8+
9+
10+
class TestInterruptThreadNames(TestBase):
11+
@skipUnlessDarwin
12+
def test_internal_bps_resolved(self):
13+
self.build()
14+
15+
source_file = lldb.SBFileSpec("main.c")
16+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
17+
self, "initial hello", source_file
18+
)
19+
20+
thread_start_func_names = [
21+
"start_wqthread",
22+
"_pthread_wqthread",
23+
"_pthread_start",
24+
]
25+
known_module_names = [
26+
"libsystem_c.dylib",
27+
"libSystem.B.dylib",
28+
"libsystem_pthread.dylib",
29+
]
30+
bps = []
31+
for func in thread_start_func_names:
32+
for module in known_module_names:
33+
bps.append(target.BreakpointCreateByName(func, module))
34+
num_resolved = 0
35+
for bp in bps:
36+
num_resolved += bp.GetNumResolvedLocations()
37+
self.assertGreater(num_resolved, 0)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
int main() {
3+
puts("initial hello");
4+
puts("hello from the other side");
5+
}

0 commit comments

Comments
 (0)