Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test thread states. |
| 3 | """ |
| 4 | |
| 5 | import os, time |
| 6 | import unittest2 |
| 7 | import lldb |
| 8 | from lldbtest import * |
| 9 | import lldbutil |
| 10 | |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 11 | class ThreadStateTestCase(TestBase): |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 12 | |
Greg Clayton | 4570d3e | 2013-12-10 23:19:29 +0000 | [diff] [blame] | 13 | mydir = TestBase.compute_mydir(__file__) |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 14 | |
| 15 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
| 16 | @dsym_test |
Enrico Granata | 03e474b | 2013-11-01 00:57:53 +0000 | [diff] [blame] | 17 | @expectedFailureDarwin("rdar://15367566") |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 18 | def test_state_after_breakpoint_with_dsym(self): |
| 19 | """Test thread state after breakpoint.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 20 | self.buildDsym(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 21 | self.thread_state_after_breakpoint_test() |
| 22 | |
Enrico Granata | 03e474b | 2013-11-01 00:57:53 +0000 | [diff] [blame] | 23 | @expectedFailureDarwin("rdar://15367566") |
Chaoren Lin | 72b8f05 | 2015-02-03 01:51:18 +0000 | [diff] [blame^] | 24 | @expectedFailureFreeBSD('llvm.org/pr15824') |
| 25 | @expectedFailureLLGS("llvm.org/pr15824") # thread states not properly maintained |
| 26 | @dwarf_test |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 27 | def test_state_after_breakpoint_with_dwarf(self): |
| 28 | """Test thread state after breakpoint.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 29 | self.buildDwarf(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 30 | self.thread_state_after_breakpoint_test() |
| 31 | |
| 32 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
| 33 | @dsym_test |
| 34 | def test_state_after_continue_with_dsym(self): |
| 35 | """Test thread state after continue.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 36 | self.buildDsym(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 37 | self.thread_state_after_continue_test() |
| 38 | |
| 39 | @dwarf_test |
| 40 | def test_state_after_continue_with_dwarf(self): |
| 41 | """Test thread state after continue.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 42 | self.buildDwarf(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 43 | self.thread_state_after_continue_test() |
| 44 | |
| 45 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
| 46 | @dsym_test |
| 47 | def test_state_after_expression_with_dsym(self): |
| 48 | """Test thread state after expression.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 49 | self.buildDsym(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 50 | self.thread_state_after_continue_test() |
| 51 | |
| 52 | @dwarf_test |
| 53 | def test_state_after_expression_with_dwarf(self): |
| 54 | """Test thread state after expression.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 55 | self.buildDwarf(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 56 | self.thread_state_after_continue_test() |
| 57 | |
| 58 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
| 59 | @dsym_test |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 60 | @unittest2.expectedFailure("llvm.org/pr16172") # thread states not properly maintained |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 61 | def test_process_interrupt_with_dsym(self): |
| 62 | """Test process interrupt.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 63 | self.buildDsym(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 64 | self.process_interrupt_test() |
| 65 | |
| 66 | @dwarf_test |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 67 | @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 68 | def test_process_interrupt_with_dwarf(self): |
| 69 | """Test process interrupt.""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 70 | self.buildDwarf(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 71 | self.process_interrupt_test() |
| 72 | |
| 73 | @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") |
| 74 | @dsym_test |
Daniel Malea | e8bdd1f | 2013-05-15 18:48:32 +0000 | [diff] [blame] | 75 | @unittest2.expectedFailure("llvm.org/pr15824") # thread states not properly maintained |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 76 | def test_process_state_with_dsym(self): |
| 77 | """Test thread states (comprehensive).""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 78 | self.buildDsym(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 79 | self.thread_states_test() |
| 80 | |
| 81 | @dwarf_test |
Daniel Malea | e8bdd1f | 2013-05-15 18:48:32 +0000 | [diff] [blame] | 82 | @unittest2.expectedFailure("llvm.org/pr15824") # thread states not properly maintained |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 83 | def test_process_state_with_dwarf(self): |
| 84 | """Test thread states (comprehensive).""" |
Andrew Kaylor | 93132f5 | 2013-05-28 23:04:25 +0000 | [diff] [blame] | 85 | self.buildDwarf(dictionary=self.getBuildFlags(use_cpp11=False)) |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 86 | self.thread_states_test() |
| 87 | |
| 88 | def setUp(self): |
| 89 | # Call super's setUp(). |
| 90 | TestBase.setUp(self) |
| 91 | # Find the line numbers for our breakpoints. |
| 92 | self.break_1 = line_number('main.c', '// Set first breakpoint here') |
| 93 | self.break_2 = line_number('main.c', '// Set second breakpoint here') |
| 94 | |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 95 | def thread_state_after_breakpoint_test(self): |
| 96 | """Test thread state after breakpoint.""" |
| 97 | exe = os.path.join(os.getcwd(), "a.out") |
| 98 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |
| 99 | |
| 100 | # This should create a breakpoint in the main thread. |
| 101 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1) |
| 102 | |
| 103 | # The breakpoint list should show 1 breakpoint with 1 location. |
| 104 | self.expect("breakpoint list -f", "Breakpoint location shown correctly", |
Matt Kopec | 36e5a7d | 2013-06-17 19:00:31 +0000 | [diff] [blame] | 105 | substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1]) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 106 | |
| 107 | # Run the program. |
| 108 | self.runCmd("run", RUN_SUCCEEDED) |
| 109 | |
| 110 | # The stop reason of the thread should be breakpoint. |
| 111 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 112 | substrs = ['stopped', |
| 113 | '* thread #1', |
| 114 | 'stop reason = breakpoint']) |
| 115 | |
| 116 | # Get the target process |
| 117 | target = self.dbg.GetSelectedTarget() |
| 118 | process = target.GetProcess() |
| 119 | |
| 120 | # Get the number of threads |
| 121 | num_threads = process.GetNumThreads() |
| 122 | |
| 123 | self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') |
| 124 | |
| 125 | # Get the thread object |
| 126 | thread = process.GetThreadAtIndex(0) |
| 127 | |
| 128 | # Make sure the thread is in the stopped state. |
| 129 | self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.") |
| 130 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 1.") |
| 131 | |
| 132 | # Kill the process |
| 133 | self.runCmd("process kill") |
| 134 | |
| 135 | def thread_state_after_continue_test(self): |
| 136 | """Test thread state after continue.""" |
| 137 | exe = os.path.join(os.getcwd(), "a.out") |
| 138 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |
| 139 | |
| 140 | # This should create a breakpoint in the main thread. |
| 141 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1) |
| 142 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_2, num_expected_locations=1) |
| 143 | |
| 144 | # The breakpoint list should show 1 breakpoints with 1 location. |
| 145 | self.expect("breakpoint list -f", "Breakpoint location shown correctly", |
Matt Kopec | 36e5a7d | 2013-06-17 19:00:31 +0000 | [diff] [blame] | 146 | substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1]) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 147 | |
| 148 | # Run the program. |
| 149 | self.runCmd("run", RUN_SUCCEEDED) |
| 150 | |
| 151 | # The stop reason of the thread should be breakpoint. |
| 152 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 153 | substrs = ['stopped', |
| 154 | '* thread #1', |
| 155 | 'stop reason = breakpoint']) |
| 156 | |
| 157 | # Get the target process |
| 158 | target = self.dbg.GetSelectedTarget() |
| 159 | process = target.GetProcess() |
| 160 | |
| 161 | # Get the number of threads |
| 162 | num_threads = process.GetNumThreads() |
| 163 | |
| 164 | self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') |
| 165 | |
| 166 | # Get the thread object |
| 167 | thread = process.GetThreadAtIndex(0) |
| 168 | |
| 169 | # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. |
| 170 | self.dbg.SetAsync(True) |
| 171 | self.runCmd("continue") |
| 172 | time.sleep(1) |
| 173 | |
| 174 | # Check the thread state. It should be running. |
| 175 | self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.") |
| 176 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' when it should be running.") |
| 177 | |
| 178 | # Go back to synchronous interactions |
| 179 | self.dbg.SetAsync(False) |
| 180 | |
| 181 | # Kill the process |
| 182 | self.runCmd("process kill") |
| 183 | |
| 184 | def thread_state_after_expression_test(self): |
| 185 | """Test thread state after expression.""" |
| 186 | exe = os.path.join(os.getcwd(), "a.out") |
| 187 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |
| 188 | |
| 189 | # This should create a breakpoint in the main thread. |
| 190 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1) |
| 191 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_2, num_expected_locations=1) |
| 192 | |
| 193 | # The breakpoint list should show 1 breakpoints with 1 location. |
| 194 | self.expect("breakpoint list -f", "Breakpoint location shown correctly", |
Matt Kopec | 36e5a7d | 2013-06-17 19:00:31 +0000 | [diff] [blame] | 195 | substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1]) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 196 | |
| 197 | # Run the program. |
| 198 | self.runCmd("run", RUN_SUCCEEDED) |
| 199 | |
| 200 | # The stop reason of the thread should be breakpoint. |
| 201 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 202 | substrs = ['stopped', |
| 203 | '* thread #1', |
| 204 | 'stop reason = breakpoint']) |
| 205 | |
| 206 | # Get the target process |
| 207 | target = self.dbg.GetSelectedTarget() |
| 208 | process = target.GetProcess() |
| 209 | |
| 210 | # Get the number of threads |
| 211 | num_threads = process.GetNumThreads() |
| 212 | |
| 213 | self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') |
| 214 | |
| 215 | # Get the thread object |
| 216 | thread = process.GetThreadAtIndex(0) |
| 217 | |
| 218 | # Get the inferior out of its loop |
| 219 | self.runCmd("expression g_test = 1") |
| 220 | |
| 221 | # Check the thread state |
| 222 | self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.") |
| 223 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.") |
| 224 | |
| 225 | # Let the process run to completion |
| 226 | self.runCmd("process continue") |
| 227 | |
| 228 | |
| 229 | def process_interrupt_test(self): |
| 230 | """Test process interrupt and continue.""" |
| 231 | exe = os.path.join(os.getcwd(), "a.out") |
| 232 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |
| 233 | |
| 234 | # This should create a breakpoint in the main thread. |
| 235 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1) |
| 236 | |
| 237 | # The breakpoint list should show 1 breakpoints with 1 location. |
| 238 | self.expect("breakpoint list -f", "Breakpoint location shown correctly", |
Matt Kopec | 36e5a7d | 2013-06-17 19:00:31 +0000 | [diff] [blame] | 239 | substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1]) |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 240 | |
| 241 | # Run the program. |
| 242 | self.runCmd("run", RUN_SUCCEEDED) |
| 243 | |
| 244 | # The stop reason of the thread should be breakpoint. |
| 245 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 246 | substrs = ['stopped', |
| 247 | '* thread #1', |
| 248 | 'stop reason = breakpoint']) |
| 249 | |
| 250 | # Get the target process |
| 251 | target = self.dbg.GetSelectedTarget() |
| 252 | process = target.GetProcess() |
| 253 | |
| 254 | # Get the number of threads |
| 255 | num_threads = process.GetNumThreads() |
| 256 | |
| 257 | self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') |
| 258 | |
| 259 | # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. |
| 260 | self.dbg.SetAsync(True) |
| 261 | self.runCmd("continue") |
| 262 | time.sleep(1) |
| 263 | |
| 264 | # Go back to synchronous interactions |
| 265 | self.dbg.SetAsync(False) |
| 266 | |
| 267 | # Stop the process |
| 268 | self.runCmd("process interrupt") |
| 269 | |
| 270 | # The stop reason of the thread should be signal. |
| 271 | self.expect("process status", STOPPED_DUE_TO_SIGNAL, |
| 272 | substrs = ['stopped', |
| 273 | '* thread #1', |
| 274 | 'stop reason = signal']) |
| 275 | |
| 276 | # Get the inferior out of its loop |
| 277 | self.runCmd("expression g_test = 1") |
| 278 | |
| 279 | # Run to completion |
| 280 | self.runCmd("continue") |
| 281 | |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 282 | def thread_states_test(self): |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 283 | """Test thread states (comprehensive).""" |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 284 | exe = os.path.join(os.getcwd(), "a.out") |
| 285 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |
| 286 | |
| 287 | # This should create a breakpoint in the main thread. |
| 288 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1) |
| 289 | lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_2, num_expected_locations=1) |
| 290 | |
| 291 | # The breakpoint list should show 2 breakpoints with 1 location each. |
| 292 | self.expect("breakpoint list -f", "Breakpoint location shown correctly", |
Matt Kopec | 36e5a7d | 2013-06-17 19:00:31 +0000 | [diff] [blame] | 293 | substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1, |
| 294 | "2: file = 'main.c', line = %d, locations = 1" % self.break_2]) |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 295 | |
| 296 | # Run the program. |
| 297 | self.runCmd("run", RUN_SUCCEEDED) |
| 298 | |
| 299 | # The stop reason of the thread should be breakpoint. |
| 300 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 301 | substrs = ['stopped', |
| 302 | '* thread #1', |
| 303 | 'stop reason = breakpoint']) |
| 304 | |
| 305 | # Get the target process |
| 306 | target = self.dbg.GetSelectedTarget() |
| 307 | process = target.GetProcess() |
| 308 | |
| 309 | # Get the number of threads |
| 310 | num_threads = process.GetNumThreads() |
| 311 | |
| 312 | self.assertTrue(num_threads == 1, 'Number of expected threads and actual threads do not match.') |
| 313 | |
| 314 | # Get the thread object |
| 315 | thread = process.GetThreadAtIndex(0) |
| 316 | |
| 317 | # Make sure the thread is in the stopped state. |
| 318 | self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.") |
| 319 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 1.") |
| 320 | |
| 321 | # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. |
| 322 | self.dbg.SetAsync(True) |
| 323 | self.runCmd("continue") |
| 324 | time.sleep(1) |
| 325 | |
| 326 | # Check the thread state. It should be running. |
| 327 | self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.") |
| 328 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' when it should be running.") |
| 329 | |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 330 | # Go back to synchronous interactions |
| 331 | self.dbg.SetAsync(False) |
| 332 | |
| 333 | # Stop the process |
| 334 | self.runCmd("process interrupt") |
| 335 | |
| 336 | # The stop reason of the thread should be signal. |
| 337 | self.expect("process status", STOPPED_DUE_TO_SIGNAL, |
| 338 | substrs = ['stopped', |
| 339 | '* thread #1', |
| 340 | 'stop reason = signal']) |
| 341 | |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 342 | # Check the thread state |
| 343 | self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after process stop.") |
| 344 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after process stop.") |
| 345 | |
| 346 | # Get the inferior out of its loop |
| 347 | self.runCmd("expression g_test = 1") |
| 348 | |
| 349 | # Check the thread state |
| 350 | self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.") |
| 351 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.") |
| 352 | |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 353 | # The stop reason of the thread should be signal. |
| 354 | self.expect("process status", STOPPED_DUE_TO_SIGNAL, |
| 355 | substrs = ['stopped', |
| 356 | '* thread #1', |
| 357 | 'stop reason = signal']) |
| 358 | |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 359 | # Run to breakpoint 2 |
| 360 | self.runCmd("continue") |
| 361 | |
Andrew Kaylor | 9f6c535 | 2013-04-30 23:39:14 +0000 | [diff] [blame] | 362 | # The stop reason of the thread should be breakpoint. |
| 363 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 364 | substrs = ['stopped', |
| 365 | '* thread #1', |
| 366 | 'stop reason = breakpoint']) |
| 367 | |
Andrew Kaylor | dbbe36b | 2013-04-23 21:42:03 +0000 | [diff] [blame] | 368 | # Make sure both threads are stopped |
| 369 | self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 2.") |
| 370 | self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 2.") |
| 371 | |
| 372 | # Run to completion |
| 373 | self.runCmd("continue") |
| 374 | |
| 375 | # At this point, the inferior process should have exited. |
| 376 | self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) |
| 377 | |
| 378 | if __name__ == '__main__': |
| 379 | import atexit |
| 380 | lldb.SBDebugger.Initialize() |
| 381 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 382 | unittest2.main() |