Skip to content

Commit

Permalink
Make when_threads test work with LLDB
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Jun 8, 2024
1 parent e4bf38d commit ca36c98
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
48 changes: 22 additions & 26 deletions src/test/when_threads.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,42 @@
from util import *
import re

send_gdb('break do_thread')
expect_gdb('Breakpoint 1')
send_gdb('continue')
expect_gdb('Breakpoint 1')
bp = breakpoint_at_function('do_thread')
cont()
expect_breakpoint_stop(bp)

send_gdb('when-ticks')
expect_gdb(re.compile(r'Current tick: (\d+)'))
send_custom_command('when-ticks')
expect_debugger(re.compile(r'Current tick: (\d+)'))
thread_ticks = int(last_match().group(1))
send_gdb('when-tid')
expect_gdb(re.compile(r'Current tid: (\d+)'))
send_custom_command('when-tid')
expect_debugger(re.compile(r'Current tid: (\d+)'))
thread_tid = int(last_match().group(1))

send_gdb('info threads')
expect_gdb('do_thread')
send_gdb('when-ticks')
expect_gdb(re.compile(r'Current tick: (\d+)'))
expect_threads(2, 2)
send_custom_command('when-ticks')
expect_debugger(re.compile(r'Current tick: (\d+)'))
thread_ticks2 = int(last_match().group(1))
assert thread_ticks == thread_ticks2
send_gdb('when-tid')
expect_gdb(re.compile(r'Current tid: (\d+)'))
send_custom_command('when-tid')
expect_debugger(re.compile(r'Current tid: (\d+)'))
thread_tid2 = int(last_match().group(1))
assert thread_tid == thread_tid2

send_gdb('thread 1')
expect_gdb('Switching')
send_gdb('when-ticks')
expect_gdb(re.compile(r'Current tick: (\d+)'))
select_thread(1)
send_custom_command('when-ticks')
expect_debugger(re.compile(r'Current tick: (\d+)'))
main_ticks = int(last_match().group(1))
send_gdb('when-tid')
expect_gdb(re.compile(r'Current tid: (\d+)'))
send_custom_command('when-tid')
expect_debugger(re.compile(r'Current tid: (\d+)'))
main_tid = int(last_match().group(1))

send_gdb('info threads')
expect_gdb('do_thread')
send_gdb('when-ticks')
expect_gdb(re.compile(r'Current tick: (\d+)'))
expect_threads(2, 1)
send_custom_command('when-ticks')
expect_debugger(re.compile(r'Current tick: (\d+)'))
main_ticks2 = int(last_match().group(1))
assert main_ticks == main_ticks2
send_gdb('when-tid')
expect_gdb(re.compile(r'Current tid: (\d+)'))
send_custom_command('when-tid')
expect_debugger(re.compile(r'Current tid: (\d+)'))
main_tid2 = int(last_match().group(1))
assert main_tid == main_tid2

Expand Down
2 changes: 1 addition & 1 deletion src/test/when_threads.run
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
source `dirname $0`/util.sh
debug_test_gdb_only
debug_test

0 comments on commit ca36c98

Please sign in to comment.