1""" 2Test handling of the situation where the main thread exits but the other threads 3in the process keep running. 4""" 5 6import lldb 7from lldbsuite.test.decorators import * 8from lldbsuite.test.lldbtest import * 9import lldbsuite.test.lldbutil as lldbutil 10 11 12class ThreadExitTestCase(TestBase): 13 NO_DEBUG_INFO_TESTCASE = True 14 15 # Needs os-specific implementation in the inferior 16 @skipIf(oslist=no_match(["linux"])) 17 def test(self): 18 self.build() 19 lldbutil.run_to_source_breakpoint( 20 self, "// break here", lldb.SBFileSpec("main.cpp") 21 ) 22 23 # There should be one (non-main) thread left 24 self.assertEqual(self.process().GetNumThreads(), 1) 25 26 # Ensure we can evaluate_expressions in this state 27 self.expect_expr("call_me()", result_value="12345") 28 29 self.runCmd("continue") 30 # Exit code depends on the version of the linux kernel 31 self.assertIn(self.process().GetExitStatus(), [42, 47]) 32