2 Test number of threads.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class ExitDuringBreakpointTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
18 # Call super's setUp().
20 # Find the line number for our breakpoint.
21 self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
24 """Test thread exit during breakpoint handling."""
25 self.build(dictionary=self.getBuildFlags())
26 exe = self.getBuildArtifact("a.out")
27 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
29 # This should create a breakpoint in the main thread.
30 lldbutil.run_break_set_by_file_and_line(
31 self, "main.cpp", self.breakpoint, num_expected_locations=1)
34 self.runCmd("run", RUN_SUCCEEDED)
36 # The stop reason of the thread should be breakpoint.
37 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
39 'stop reason = breakpoint'])
41 # Get the target process
42 target = self.dbg.GetSelectedTarget()
43 process = target.GetProcess()
45 # The exit probably occurred during breakpoint handling, but it isn't
46 # guaranteed. The main thing we're testing here is that the debugger
47 # handles this cleanly is some way.
49 # Get the number of threads
50 num_threads = process.GetNumThreads()
52 # Make sure we see at least five threads
55 'Number of expected threads and actual threads do not match.')
58 self.runCmd("continue")
60 # At this point, the inferior process should have exited.
62 process.GetState() == lldb.eStateExited,