[Lldb-commits] [lldb] 81bc28d - [lldb] Update PlatformDarwin list of libraries with thread functions (#127922)

via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 20 08:26:51 PST 2025


Author: Felipe de Azevedo Piovezan
Date: 2025-02-20T08:26:47-08:00
New Revision: 81bc28d0bcaca3e7386ced2138566e4d0a838ad5

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

LOG: [lldb] Update PlatformDarwin list of libraries with thread functions (#127922)

Recent versions of the system changed where these functions live.

Added: 
    lldb/test/API/macosx/thread_start_bps/Makefile
    lldb/test/API/macosx/thread_start_bps/TestBreakpointsThreadInit.py
    lldb/test/API/macosx/thread_start_bps/main.c

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 51e9a6d81b839..665500f23e95d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -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++) {

diff  --git a/lldb/test/API/macosx/thread_start_bps/Makefile b/lldb/test/API/macosx/thread_start_bps/Makefile
new file mode 100644
index 0000000000000..10495940055b6
--- /dev/null
+++ b/lldb/test/API/macosx/thread_start_bps/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules

diff  --git a/lldb/test/API/macosx/thread_start_bps/TestBreakpointsThreadInit.py b/lldb/test/API/macosx/thread_start_bps/TestBreakpointsThreadInit.py
new file mode 100644
index 0000000000000..1c6fd4f91c73e
--- /dev/null
+++ b/lldb/test/API/macosx/thread_start_bps/TestBreakpointsThreadInit.py
@@ -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)

diff  --git a/lldb/test/API/macosx/thread_start_bps/main.c b/lldb/test/API/macosx/thread_start_bps/main.c
new file mode 100644
index 0000000000000..1a0af000b5b04
--- /dev/null
+++ b/lldb/test/API/macosx/thread_start_bps/main.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+int main() {
+  puts("initial hello");
+  puts("hello from the other side");
+}


        


More information about the lldb-commits mailing list