Skip to content

Commit

Permalink
Update tests to account for change in gdb error message
Browse files Browse the repository at this point in the history
bminor/binutils-gdb@0891970
changed the message gdb reports when execution reaches the end of history, from
`No more reverse-execution history` to `Reached end of recorded history`.
Abstract over this with a utility function `expect_history_end()`.
  • Loading branch information
rocallahan committed Jan 25, 2025
1 parent 5990223 commit 82e7055
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/test/dlopen.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
expect_gdb('EXIT-SUCCESS')
expect_gdb('SIGKILL')
send_gdb('reverse-continue')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/mmap_replace_most_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
send_gdb('restart 1')
expect_gdb('stopped')
send_gdb('rc')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('restart 1')
expect_gdb('stopped')
send_gdb('c')
Expand Down
2 changes: 1 addition & 1 deletion src/test/mprotect_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
send_gdb('ignore 1 1000000')
expect_gdb('Will ignore')
send_gdb('reverse-continue')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/ptrace_remote_unmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
send_gdb('restart 1')
expect_gdb('stopped')
send_gdb('rc')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
16 changes: 8 additions & 8 deletions src/test/reverse_continue_exec_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
import re

send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

send_gdb('b main')
expect_gdb('Breakpoint 1')
send_gdb('c')
expect_gdb('Breakpoint 1')
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
20 changes: 10 additions & 10 deletions src/test/reverse_continue_fork_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
import re

send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

send_gdb('stepi')
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

send_gdb('stepi')
send_gdb('reverse-stepi')
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/reverse_continue_int3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
expect_gdb('SIGTRAP')

send_gdb('rc')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/reverse_continue_process_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
send_gdb('c')
expect_gdb('SIGKILL')
send_gdb('reverse-continue')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
12 changes: 6 additions & 6 deletions src/test/reverse_continue_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
import re

send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('b main')
expect_gdb('Breakpoint 1')
send_gdb('c')
expect_gdb('Breakpoint 1')
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-stepi')
expect_gdb('No more reverse-execution history')
expect_history_end()
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/reverse_step_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
expect_gdb('received signal')

send_gdb('reverse-continue')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/reverse_watchpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
expect_gdb('New value = 0')

send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/simple_winch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
expect_gdb('Breakpoint 1')
send_gdb('!kill -WINCH 0')
send_gdb('reverse-cont')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
2 changes: 1 addition & 1 deletion src/test/stack_overflow_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
send_gdb('reverse-stepi')
expect_gdb('SIGSEGV')
send_gdb('reverse-continue')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()
11 changes: 11 additions & 0 deletions src/test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'get_gdb_version', 'breakpoint_at_function',
'watchpoint_at_address', 'cont', 'backtrace', 'up',
'expect_breakpoint_stop', 'expect_watchpoint_stop',
'expect_history_end', 'history_end_regex',
'delete_watchpoint', 'expect_signal_stop',
'set_breakpoint_commands', 'select_thread',
'scheduler_locking_on', 'scheduler_locking_off',
Expand Down Expand Up @@ -121,6 +122,16 @@ def up():
def backtrace():
send_debugger('bt', 'thread backtrace')

def history_end_regex():
if debugger_type == 'GDB':
return 'No more reverse-execution history|Reached end of recorded history'
else:
# Add LLDB case
assert False

def expect_history_end():
expect_debugger(history_end_regex())

def expect_breakpoint_stop(number):
if debugger_type == 'GDB':
expect_debugger(f'Breakpoint {number}')
Expand Down
2 changes: 1 addition & 1 deletion src/test/vfork_read_clone_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
expect_gdb('Program received signal SIGKILL')

send_gdb('rc')
expect_gdb(['(No more reverse-execution history)', '(child)'])
expect_gdb([f'({history_end_regex()})', '(child)'])

assert 'child' not in last_match().group(1)

Expand Down
2 changes: 1 addition & 1 deletion src/test/watch_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
expect_gdb('Hardware watchpoint 2')

send_gdb('reverse-continue')
expect_gdb('No more reverse-execution history')
expect_history_end()

ok()

0 comments on commit 82e7055

Please sign in to comment.