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