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 MultipleBreakpointTestCase(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')
25 bugnumber="llvm.org/pr15824 thread states not properly maintained")
27 oslist=lldbplatformutil.getDarwinOSTriples(),
28 bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>")
31 bugnumber="llvm.org/pr18190 thread states not properly maintained")
32 @skipIfWindows # This is flakey on Windows: llvm.org/pr24668, llvm.org/pr38373
33 @expectedFailureNetBSD
35 """Test simultaneous breakpoints in multiple threads."""
36 self.build(dictionary=self.getBuildFlags())
37 exe = self.getBuildArtifact("a.out")
38 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
40 # This should create a breakpoint in the main thread.
41 lldbutil.run_break_set_by_file_and_line(
42 self, "main.cpp", self.breakpoint, num_expected_locations=1)
45 self.runCmd("run", RUN_SUCCEEDED)
47 # The stop reason of the thread should be breakpoint.
48 # The breakpoint may be hit in either thread 2 or thread 3.
49 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
51 'stop reason = breakpoint'])
53 # Get the target process
54 target = self.dbg.GetSelectedTarget()
55 process = target.GetProcess()
57 # Get the number of threads
58 num_threads = process.GetNumThreads()
60 # Make sure we see all three threads
63 'Number of expected threads and actual threads do not match.')
65 # Get the thread objects
66 thread1 = process.GetThreadAtIndex(0)
67 thread2 = process.GetThreadAtIndex(1)
68 thread3 = process.GetThreadAtIndex(2)
70 # Make sure both threads are stopped
73 "Primary thread didn't stop during breakpoint")
76 "Secondary thread didn't stop during breakpoint")
79 "Tertiary thread didn't stop during breakpoint")
81 # Delete the first breakpoint then continue
82 self.runCmd("breakpoint delete 1")
85 self.runCmd("continue")
87 # At this point, the inferior process should have exited.
89 process.GetState() == lldb.eStateExited,