1import lldb 2from lldbsuite.test.lldbtest import * 3from lldbsuite.test import lldbutil 4from lldbsuite.test.decorators import * 5 6 7class TestCase(TestBase): 8 def test_invalid_arg(self): 9 self.build() 10 11 lldbutil.run_to_source_breakpoint( 12 self, "// break here", lldb.SBFileSpec("main.cpp") 13 ) 14 15 self.expect( 16 "thread select 0x1ffffffff", 17 error=True, 18 startstr="error: Invalid thread index '0x1ffffffff'", 19 ) 20 self.expect( 21 "thread select -t 0x1ffffffff", 22 error=True, 23 startstr="error: Invalid thread ID", 24 ) 25 self.expect( 26 "thread select 1 2 3", 27 error=True, 28 startstr="error: 'thread select' takes exactly one thread index argument, or a thread ID option:", 29 ) 30 self.expect( 31 "thread select -t 1234 1", 32 error=True, 33 startstr="error: 'thread select' cannot take both a thread ID option and a thread index argument:", 34 ) 35 # Parses but not a valid thread id. 36 self.expect( 37 "thread select 0xffffffff", 38 error=True, 39 startstr="error: Invalid thread index #0xffffffff.", 40 ) 41 self.expect( 42 "thread select -t 0xffffffff", 43 error=True, 44 startstr="error: Invalid thread ID", 45 ) 46 47 def test_thread_select_tid(self): 48 self.build() 49 50 lldbutil.run_to_source_breakpoint( 51 self, "// break here", lldb.SBFileSpec("main.cpp") 52 ) 53 self.runCmd( 54 "thread select -t %d" % self.thread().GetThreadID(), 55 ) 56