Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test lldb Python event APIs. |
| 3 | """ |
| 4 | |
| 5 | import os, time |
| 6 | import re |
| 7 | import unittest2 |
| 8 | import lldb, lldbutil |
| 9 | from lldbtest import * |
| 10 | |
| 11 | class EventAPITestCase(TestBase): |
| 12 | |
Greg Clayton | 4570d3e | 2013-12-10 23:19:29 +0000 | [diff] [blame] | 13 | mydir = TestBase.compute_mydir(__file__) |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 14 | |
Robert Flack | 13c7ad9 | 2015-03-30 14:12:17 +0000 | [diff] [blame] | 15 | @skipUnlessDarwin |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 16 | @python_api_test |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 17 | @dsym_test |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 18 | def test_listen_for_and_print_event_with_dsym(self): |
| 19 | """Exercise SBEvent API.""" |
| 20 | self.buildDsym() |
| 21 | self.do_listen_for_and_print_event() |
| 22 | |
| 23 | @python_api_test |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 24 | @dwarf_test |
Pavel Labath | 8e9c266 | 2015-06-02 12:50:25 +0000 | [diff] [blame] | 25 | @expectedFailureLinux("llvm.org/pr23730") # Flaky, fails ~1/10 cases |
| 26 | @skipIfLinux # skip to avoid crashes |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 27 | def test_listen_for_and_print_event_with_dwarf(self): |
| 28 | """Exercise SBEvent API.""" |
| 29 | self.buildDwarf() |
| 30 | self.do_listen_for_and_print_event() |
| 31 | |
Robert Flack | 13c7ad9 | 2015-03-30 14:12:17 +0000 | [diff] [blame] | 32 | @skipUnlessDarwin |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 33 | @python_api_test |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 34 | @dsym_test |
Johnny Chen | 3635eae | 2010-12-21 19:52:54 +0000 | [diff] [blame] | 35 | def test_wait_for_event_with_dsym(self): |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 36 | """Exercise SBListener.WaitForEvent() API.""" |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 37 | self.buildDsym() |
Johnny Chen | 3635eae | 2010-12-21 19:52:54 +0000 | [diff] [blame] | 38 | self.do_wait_for_event() |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 39 | |
| 40 | @python_api_test |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 41 | @dwarf_test |
Johnny Chen | 3635eae | 2010-12-21 19:52:54 +0000 | [diff] [blame] | 42 | def test_wait_for_event_with_dwarf(self): |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 43 | """Exercise SBListener.WaitForEvent() API.""" |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 44 | self.buildDwarf() |
Johnny Chen | 3635eae | 2010-12-21 19:52:54 +0000 | [diff] [blame] | 45 | self.do_wait_for_event() |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 46 | |
Robert Flack | 13c7ad9 | 2015-03-30 14:12:17 +0000 | [diff] [blame] | 47 | @skipUnlessDarwin |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 48 | @python_api_test |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 49 | @dsym_test |
| 50 | def test_add_listener_to_broadcaster_with_dsym(self): |
Johnny Chen | 77c4697 | 2010-12-22 00:56:47 +0000 | [diff] [blame] | 51 | """Exercise some SBBroadcaster APIs.""" |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 52 | self.buildDsym() |
Johnny Chen | 77c4697 | 2010-12-22 00:56:47 +0000 | [diff] [blame] | 53 | self.do_add_listener_to_broadcaster() |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 54 | |
Ed Maste | 2ec8e1b | 2014-10-29 20:02:54 +0000 | [diff] [blame] | 55 | @skipIfFreeBSD # llvm.org/pr21325 |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 56 | @python_api_test |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 57 | @dwarf_test |
Tamas Berghammer | a98788d | 2015-05-21 14:04:17 +0000 | [diff] [blame] | 58 | @expectedFailureLinux("llvm.org/pr23617") # Flaky, fails ~1/10 cases |
Johnny Chen | 24086bc | 2012-04-06 19:54:10 +0000 | [diff] [blame] | 59 | def test_add_listener_to_broadcaster_with_dwarf(self): |
Johnny Chen | 77c4697 | 2010-12-22 00:56:47 +0000 | [diff] [blame] | 60 | """Exercise some SBBroadcaster APIs.""" |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 61 | self.buildDwarf() |
Johnny Chen | 77c4697 | 2010-12-22 00:56:47 +0000 | [diff] [blame] | 62 | self.do_add_listener_to_broadcaster() |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 63 | |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 64 | def setUp(self): |
| 65 | # Call super's setUp(). |
| 66 | TestBase.setUp(self) |
| 67 | # Find the line number to of function 'c'. |
| 68 | self.line = line_number('main.c', '// Find the line number of function "c" here.') |
| 69 | |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 70 | def do_listen_for_and_print_event(self): |
| 71 | """Create a listener and use SBEvent API to print the events received.""" |
| 72 | exe = os.path.join(os.getcwd(), "a.out") |
| 73 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 74 | self.dbg.SetAsync(True) |
| 75 | |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 76 | # Create a target by the debugger. |
| 77 | target = self.dbg.CreateTarget(exe) |
| 78 | self.assertTrue(target, VALID_TARGET) |
| 79 | |
| 80 | # Now create a breakpoint on main.c by name 'c'. |
| 81 | breakpoint = target.BreakpointCreateByName('c', 'a.out') |
| 82 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 83 | listener = lldb.SBListener("my listener") |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 84 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 85 | # Now launch the process, and do not stop at the entry point. |
| 86 | error = lldb.SBError() |
| 87 | process = target.Launch (listener, |
| 88 | None, # argv |
| 89 | None, # envp |
| 90 | None, # stdin_path |
| 91 | None, # stdout_path |
| 92 | None, # stderr_path |
| 93 | None, # working directory |
| 94 | 0, # launch flags |
| 95 | False, # Stop at entry |
| 96 | error) # error |
| 97 | |
| 98 | self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED) |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 99 | |
| 100 | # Create an empty event object. |
| 101 | event = lldb.SBEvent() |
| 102 | |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 103 | traceOn = self.TraceOn() |
| 104 | if traceOn: |
| 105 | lldbutil.print_stacktraces(process) |
| 106 | |
| 107 | # Create MyListeningThread class to wait for any kind of event. |
| 108 | import threading |
| 109 | class MyListeningThread(threading.Thread): |
| 110 | def run(self): |
| 111 | count = 0 |
| 112 | # Let's only try at most 4 times to retrieve any kind of event. |
| 113 | # After that, the thread exits. |
| 114 | while not count > 3: |
| 115 | if traceOn: |
| 116 | print "Try wait for event..." |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 117 | if listener.WaitForEvent(5, event): |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 118 | if traceOn: |
| 119 | desc = lldbutil.get_description(event) |
| 120 | print "Event description:", desc |
| 121 | print "Event data flavor:", event.GetDataFlavor() |
| 122 | print "Process state:", lldbutil.state_type_to_str(process.GetState()) |
| 123 | print |
| 124 | else: |
| 125 | if traceOn: |
| 126 | print "timeout occurred waiting for event..." |
| 127 | count = count + 1 |
| 128 | return |
| 129 | |
| 130 | # Let's start the listening thread to retrieve the events. |
| 131 | my_thread = MyListeningThread() |
| 132 | my_thread.start() |
| 133 | |
| 134 | # Use Python API to continue the process. The listening thread should be |
| 135 | # able to receive the state changed events. |
| 136 | process.Continue() |
| 137 | |
| 138 | # Use Python API to kill the process. The listening thread should be |
| 139 | # able to receive the state changed event, too. |
| 140 | process.Kill() |
| 141 | |
| 142 | # Wait until the 'MyListeningThread' terminates. |
| 143 | my_thread.join() |
| 144 | |
Johnny Chen | 3635eae | 2010-12-21 19:52:54 +0000 | [diff] [blame] | 145 | def do_wait_for_event(self): |
| 146 | """Get the listener associated with the debugger and exercise WaitForEvent API.""" |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 147 | exe = os.path.join(os.getcwd(), "a.out") |
| 148 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 149 | self.dbg.SetAsync(True) |
| 150 | |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 151 | # Create a target by the debugger. |
| 152 | target = self.dbg.CreateTarget(exe) |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 153 | self.assertTrue(target, VALID_TARGET) |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 154 | |
| 155 | # Now create a breakpoint on main.c by name 'c'. |
| 156 | breakpoint = target.BreakpointCreateByName('c', 'a.out') |
| 157 | #print "breakpoint:", breakpoint |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 158 | self.assertTrue(breakpoint and |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 159 | breakpoint.GetNumLocations() == 1, |
| 160 | VALID_BREAKPOINT) |
| 161 | |
Johnny Chen | d762ff1 | 2011-02-03 23:15:53 +0000 | [diff] [blame] | 162 | # Get the debugger listener. |
| 163 | listener = self.dbg.GetListener() |
| 164 | |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 165 | # Now launch the process, and do not stop at entry point. |
Greg Clayton | 6f907e6 | 2011-01-23 17:46:22 +0000 | [diff] [blame] | 166 | error = lldb.SBError() |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 167 | process = target.Launch (listener, |
| 168 | None, # argv |
| 169 | None, # envp |
| 170 | None, # stdin_path |
| 171 | None, # stdout_path |
| 172 | None, # stderr_path |
| 173 | None, # working directory |
| 174 | 0, # launch flags |
| 175 | False, # Stop at entry |
| 176 | error) # error |
Johnny Chen | 2494f55 | 2011-07-20 00:14:20 +0000 | [diff] [blame] | 177 | self.assertTrue(error.Success() and process, PROCESS_IS_VALID) |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 178 | |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 179 | # Create an empty event object. |
| 180 | event = lldb.SBEvent() |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 181 | self.assertFalse(event, "Event should not be valid initially") |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 182 | |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 183 | # Create MyListeningThread to wait for any kind of event. |
| 184 | import threading |
| 185 | class MyListeningThread(threading.Thread): |
| 186 | def run(self): |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 187 | count = 0 |
| 188 | # Let's only try at most 3 times to retrieve any kind of event. |
| 189 | while not count > 3: |
| 190 | if listener.WaitForEvent(5, event): |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 191 | #print "Got a valid event:", event |
Johnny Chen | 3a709ac | 2011-07-08 23:02:33 +0000 | [diff] [blame] | 192 | #print "Event data flavor:", event.GetDataFlavor() |
| 193 | #print "Event type:", lldbutil.state_type_to_str(event.GetType()) |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 194 | return |
| 195 | count = count + 1 |
| 196 | print "Timeout: listener.WaitForEvent" |
| 197 | |
| 198 | return |
| 199 | |
Johnny Chen | 4f8caab | 2010-12-21 05:43:37 +0000 | [diff] [blame] | 200 | # Use Python API to kill the process. The listening thread should be |
| 201 | # able to receive a state changed event. |
Johnny Chen | 5a0bee7 | 2011-06-15 22:14:12 +0000 | [diff] [blame] | 202 | process.Kill() |
Johnny Chen | 4f8caab | 2010-12-21 05:43:37 +0000 | [diff] [blame] | 203 | |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 204 | # Let's start the listening thread to retrieve the event. |
| 205 | my_thread = MyListeningThread() |
| 206 | my_thread.start() |
| 207 | |
Johnny Chen | 4f8caab | 2010-12-21 05:43:37 +0000 | [diff] [blame] | 208 | # Wait until the 'MyListeningThread' terminates. |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 209 | my_thread.join() |
Johnny Chen | 4f8caab | 2010-12-21 05:43:37 +0000 | [diff] [blame] | 210 | |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 211 | self.assertTrue(event, |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 212 | "My listening thread successfully received an event") |
Johnny Chen | 4f8caab | 2010-12-21 05:43:37 +0000 | [diff] [blame] | 213 | |
Johnny Chen | 77c4697 | 2010-12-22 00:56:47 +0000 | [diff] [blame] | 214 | def do_add_listener_to_broadcaster(self): |
| 215 | """Get the broadcaster associated with the process and wait for broadcaster events.""" |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 216 | exe = os.path.join(os.getcwd(), "a.out") |
| 217 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 218 | self.dbg.SetAsync(True) |
| 219 | |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 220 | # Create a target by the debugger. |
| 221 | target = self.dbg.CreateTarget(exe) |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 222 | self.assertTrue(target, VALID_TARGET) |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 223 | |
| 224 | # Now create a breakpoint on main.c by name 'c'. |
| 225 | breakpoint = target.BreakpointCreateByName('c', 'a.out') |
| 226 | #print "breakpoint:", breakpoint |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 227 | self.assertTrue(breakpoint and |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 228 | breakpoint.GetNumLocations() == 1, |
| 229 | VALID_BREAKPOINT) |
| 230 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 231 | listener = lldb.SBListener("my listener") |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 232 | |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 233 | # Now launch the process, and do not stop at the entry point. |
| 234 | error = lldb.SBError() |
| 235 | process = target.Launch (listener, |
| 236 | None, # argv |
| 237 | None, # envp |
| 238 | None, # stdin_path |
| 239 | None, # stdout_path |
| 240 | None, # stderr_path |
| 241 | None, # working directory |
| 242 | 0, # launch flags |
| 243 | False, # Stop at entry |
| 244 | error) # error |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 245 | |
| 246 | # Create an empty event object. |
| 247 | event = lldb.SBEvent() |
Johnny Chen | 4ebd019 | 2011-05-24 18:22:45 +0000 | [diff] [blame] | 248 | self.assertFalse(event, "Event should not be valid initially") |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 249 | |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 250 | |
| 251 | # The finite state machine for our custom listening thread, with an |
Bruce Mitchener | e171da5 | 2015-07-22 00:16:02 +0000 | [diff] [blame^] | 252 | # initial state of None, which means no event has been received. |
Siva Chandra | 8a1f769 | 2015-05-08 00:43:28 +0000 | [diff] [blame] | 253 | # It changes to 'connected' after 'connected' event is received (for remote platforms) |
| 254 | # It changes to 'running' after 'running' event is received (should happen only if the |
| 255 | # currentstate is either 'None' or 'connected') |
| 256 | # It changes to 'stopped' if a 'stopped' event is received (should happen only if the |
| 257 | # current state is 'running'.) |
| 258 | self.state = None |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 259 | |
| 260 | # Create MyListeningThread to wait for state changed events. |
| 261 | # By design, a "running" event is expected following by a "stopped" event. |
| 262 | import threading |
| 263 | class MyListeningThread(threading.Thread): |
| 264 | def run(self): |
| 265 | #print "Running MyListeningThread:", self |
| 266 | |
| 267 | # Regular expression pattern for the event description. |
| 268 | pattern = re.compile("data = {.*, state = (.*)}$") |
| 269 | |
| 270 | # Let's only try at most 6 times to retrieve our events. |
| 271 | count = 0 |
| 272 | while True: |
Greg Clayton | a6cffde | 2014-10-17 23:58:27 +0000 | [diff] [blame] | 273 | if listener.WaitForEvent(5, event): |
Johnny Chen | 9ae9820 | 2011-04-23 00:34:56 +0000 | [diff] [blame] | 274 | desc = lldbutil.get_description(event) |
| 275 | #print "Event description:", desc |
| 276 | match = pattern.search(desc) |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 277 | if not match: |
| 278 | break; |
Siva Chandra | 8a1f769 | 2015-05-08 00:43:28 +0000 | [diff] [blame] | 279 | if match.group(1) == 'connected': |
| 280 | # When debugging remote targets with lldb-server, we |
| 281 | # first get the 'connected' event. |
| 282 | self.context.assertTrue(self.context.state == None) |
| 283 | self.context.state = 'connected' |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 284 | continue |
Siva Chandra | 8a1f769 | 2015-05-08 00:43:28 +0000 | [diff] [blame] | 285 | elif match.group(1) == 'running': |
| 286 | self.context.assertTrue(self.context.state == None or self.context.state == 'connected') |
| 287 | self.context.state = 'running' |
| 288 | continue |
| 289 | elif match.group(1) == 'stopped': |
| 290 | self.context.assertTrue(self.context.state == 'running') |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 291 | # Whoopee, both events have been received! |
Siva Chandra | 8a1f769 | 2015-05-08 00:43:28 +0000 | [diff] [blame] | 292 | self.context.state = 'stopped' |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 293 | break |
| 294 | else: |
| 295 | break |
| 296 | print "Timeout: listener.WaitForEvent" |
| 297 | count = count + 1 |
| 298 | if count > 6: |
| 299 | break |
| 300 | |
| 301 | return |
| 302 | |
| 303 | # Use Python API to continue the process. The listening thread should be |
| 304 | # able to receive the state changed events. |
Johnny Chen | 5a0bee7 | 2011-06-15 22:14:12 +0000 | [diff] [blame] | 305 | process.Continue() |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 306 | |
| 307 | # Start the listening thread to receive the "running" followed by the |
| 308 | # "stopped" events. |
| 309 | my_thread = MyListeningThread() |
| 310 | # Supply the enclosing context so that our listening thread can access |
| 311 | # the 'state' variable. |
| 312 | my_thread.context = self |
| 313 | my_thread.start() |
| 314 | |
| 315 | # Wait until the 'MyListeningThread' terminates. |
| 316 | my_thread.join() |
| 317 | |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 318 | # The final judgement. :-) |
Siva Chandra | 8a1f769 | 2015-05-08 00:43:28 +0000 | [diff] [blame] | 319 | self.assertTrue(self.state == 'stopped', |
Johnny Chen | f2df189 | 2010-12-22 00:32:54 +0000 | [diff] [blame] | 320 | "Both expected state changed events received") |
Johnny Chen | f667ab5 | 2010-12-21 02:06:56 +0000 | [diff] [blame] | 321 | |
| 322 | |
| 323 | if __name__ == '__main__': |
| 324 | import atexit |
| 325 | lldb.SBDebugger.Initialize() |
| 326 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 327 | unittest2.main() |