Skip to content

[lldb] Update PlatformDarwin list of libraries with thread functions #127922

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ BreakpointSP PlatformDarwin::SetThreadCreationBreakpoint(Target &target) {
"start_wqthread", "_pthread_wqthread", "_pthread_start",
};

static const char *g_bp_modules[] = {"libsystem_c.dylib",
"libSystem.B.dylib"};
static const char *g_bp_modules[] = {"libsystem_c.dylib", "libSystem.B.dylib",
"libsystem_pthread.dylib"};

FileSpecList bp_modules;
for (size_t i = 0; i < std::size(g_bp_modules); i++) {
Expand Down
3 changes: 3 additions & 0 deletions lldb/test/API/macosx/thread_start_bps/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
C_SOURCES := main.c

include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""Test that we get thread names when interrupting a process."""

import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil


class TestInterruptThreadNames(TestBase):
@skipUnlessDarwin
def test_internal_bps_resolved(self):
self.build()

source_file = lldb.SBFileSpec("main.c")
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, "initial hello", source_file
)

thread_start_func_names = [
"start_wqthread",
"_pthread_wqthread",
"_pthread_start",
]
known_module_names = [
"libsystem_c.dylib",
"libSystem.B.dylib",
"libsystem_pthread.dylib",
]
bps = []
for func in thread_start_func_names:
for module in known_module_names:
bps.append(target.BreakpointCreateByName(func, module))
num_resolved = 0
for bp in bps:
num_resolved += bp.GetNumResolvedLocations()
self.assertGreater(num_resolved, 0)
5 changes: 5 additions & 0 deletions lldb/test/API/macosx/thread_start_bps/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
puts("initial hello");
puts("hello from the other side");
}