2 from lldbsuite.test.lldbtest import *
3 from lldbsuite.test.decorators import *
4 from gdbclientutils import *
7 class TestThreadSelectionBug(GDBRemoteTestBase):
9 class MyResponder(MockGDBServerResponder):
11 # Simulate process stopping due to a raise(SIGINT)
12 return "T01reason:signal"
14 self.server.responder = MyResponder()
15 target = self.createTarget("a.yaml")
16 process = self.connect(target)
17 python_os_plugin_path = os.path.join(self.getSourceDir(),
18 'operating_system.py')
19 command = "settings set target.process.python-os-plugin-path '{}'".format(
20 python_os_plugin_path)
21 self.dbg.HandleCommand(command)
23 self.assertTrue(process, PROCESS_IS_VALID)
24 self.assertEqual(process.GetNumThreads(), 3)
26 # Verify our OS plug-in threads showed up
27 thread = process.GetThreadByID(0x1)
30 "Make sure there is a thread 0x1 after we load the python OS plug-in")
31 thread = process.GetThreadByID(0x2)
34 "Make sure there is a thread 0x2 after we load the python OS plug-in")
35 thread = process.GetThreadByID(0x3)
38 "Make sure there is a thread 0x3 after we load the python OS plug-in")
40 # Verify that a thread other than 3 is selected.
41 thread = process.GetSelectedThread()
42 self.assertNotEqual(thread.GetThreadID(), 0x3)
44 # Verify that we select the thread backed by physical thread 1, rather
45 # than virtual thread 1. The mapping comes from the OS plugin, where we
46 # specified that thread 3 is backed by real thread 1.
48 thread = process.GetSelectedThread()
49 self.assertEqual(thread.GetThreadID(), 0x3)