58 lines · python
1"""Test that we get thread names when interrupting a process."""2 3import time4import lldb5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestInterruptThreadNames(TestBase):11 @skipUnlessDarwin12 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_file18 )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 = 035 for bp in bps:36 num_resolved += bp.GetNumResolvedLocations()37 self.assertGreater(num_resolved, 0)38 39 @skipUnlessDarwin40 def test_internal_bps_deleted_on_relaunch(self):41 self.build()42 43 source_file = lldb.SBFileSpec("main.c")44 target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(45 self, "initial hello", source_file46 )47 48 self.runCmd("break list --internal")49 output = self.res.GetOutput()50 self.assertEqual(output.count("thread-creation"), 1)51 52 process.Kill()53 self.runCmd("run", RUN_SUCCEEDED)54 55 self.runCmd("break list --internal")56 output = self.res.GetOutput()57 self.assertEqual(output.count("thread-creation"), 1)58