-def test(gdb):
- gdb.Command('break inside_f3')
- gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
- # Check we stopped in inside_f3
- backtrace = gdb.Command('-stack-list-frames')
- CheckBacktrace(backtrace['stack'], ['inside_f3', 'f3'])
- # Check we have one more thread
- thread_info = gdb.Command('-thread-info')
- AssertEquals(len(thread_info['threads']), 2)
- # Select another thread
- syscall_thread_id = thread_info['threads'][0]['id']
- if syscall_thread_id == thread_info['current-thread-id']:
- syscall_thread_id = thread_info['threads'][1]['id']
- gdb.Command('-thread-select %s' % syscall_thread_id)
- # Check that thread waits in usleep
- backtrace = gdb.Command('-stack-list-frames')
- CheckBacktrace(backtrace['stack'], ['pthread_join', 'test_syscall_thread'])
- gdb.Quit()
- return 0
+ def test_syscall_thread(self):
+ self.gdb.Command('break inside_f3')
+ self.gdb.ResumeAndExpectStop('continue', 'breakpoint-hit')
+ # Check we stopped in inside_f3
+ backtrace = self.gdb.Command('-stack-list-frames')
+ self.CheckBacktrace(backtrace['stack'], ['inside_f3', 'f3'])
+ # Check we have one more thread
+ thread_info = self.gdb.Command('-thread-info')
+ self.assertEquals(len(thread_info['threads']), 2)
+ # Select another thread
+ syscall_thread_id = thread_info['threads'][0]['id']
+ if syscall_thread_id == thread_info['current-thread-id']:
+ syscall_thread_id = thread_info['threads'][1]['id']
+ self.gdb.Command('-thread-select %s' % syscall_thread_id)
+ # Check that thread waits in usleep
+ backtrace = self.gdb.Command('-stack-list-frames')
+ self.CheckBacktrace(
+ backtrace['stack'], ['pthread_join', 'test_syscall_thread'])