From 07f3e969f7ff78c50bc3d6d42b9e50911b9f0af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 3 Jun 2024 09:35:52 +0200 Subject: [PATCH 1/2] Move lldb setup script from commandline to the "interactive" prompt. Older versions of lldb seem to have an issue with the `test_setup.lldb` script, or at least the `process handle` commands. Therefore the test hangs because the output does not contain the `received signal: SIGKILL`. lldb version 14.0.6 --- src/test/util.py | 5 ++++- src/test/util.sh | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/util.py b/src/test/util.py index f6e2993853a..df856a486c8 100644 --- a/src/test/util.py +++ b/src/test/util.py @@ -1,4 +1,4 @@ -import pexpect, re, signal, sys, time +import pexpect, re, signal, sys, time, os __all__ = [ 'expect_rr', 'expect_list', 'expect_debugger', 'restart_replay', 'interrupt_gdb', 'expect_gdb', 'send_gdb', @@ -236,6 +236,9 @@ def set_up(): timeout=TIMEOUT_SEC, encoding='utf-8', logfile=open(log_file, 'w')) child.delaybeforesend = 0 expect_debugger(r'\(rr\)') + if debugger_type == 'LLDB': + script = os.environ["TESTDIR"] + "/test_setup.lldb" + send_lldb(f'command source -s 0 {script}') except Exception as e: failed('initializing rr and debugger', e) diff --git a/src/test/util.sh b/src/test/util.sh index f257a42bcc8..9d3d62ff1e9 100644 --- a/src/test/util.sh +++ b/src/test/util.sh @@ -152,7 +152,7 @@ test_passed=y nonce= # Set up the environment and working directory. -TESTDIR="${SRCDIR}/src/test" +export TESTDIR="${SRCDIR}/src/test" # Make rr treat temp files as durable. This saves copying all test # binaries into the trace. @@ -350,7 +350,7 @@ function debug { function debug_lldb_only { expectscript=$1; replayargs=$2 _RR_TRACE_DIR="$workdir" test-monitor $TIMEOUT debug.err \ python3 $TESTDIR/$expectscript.py --lldb \ - $RR_EXE $GLOBAL_OPTIONS replay -o-S -o$TESTDIR/test_setup.lldb $replayargs + $RR_EXE $GLOBAL_OPTIONS replay $replayargs if [[ $? == 0 ]]; then passed_msg lldb else From ff788a38a296c3557a3f074d40a62821b5a20274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 3 Jun 2024 00:52:45 +0200 Subject: [PATCH 2/2] Fix test alternate_thread_diversion with older lldb versions. In old versions of lldb the output format of the `print` command was different, it shows a value history identifier. Therefore the output of `print get_value()` is not recognized in the alternate_thread_diversion test and the test times out. lldb version 14.0.6 'print' is an abbreviation for 'expression --' (rr) print get_value() (int) $0 = 1 lldb version 18.1.3 'print' is an abbreviation for 'dwim-print --' (rr) print get_value() (int) 1 --- src/test/util.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/test/util.py b/src/test/util.py index df856a486c8..bf2490c1269 100644 --- a/src/test/util.py +++ b/src/test/util.py @@ -137,11 +137,8 @@ def set_breakpoint_commands(number, commands): expect_debugger('(rr)') def expect_expression(expression, value): - send_debugger(f'print {expression}', f'print {expression}') - if debugger_type == 'GDB': - expect_debugger(f' = {value}') - else: - expect_debugger(fr'\) {value}') + send_debugger(f'print {expression}', f'expression -- {expression}') + expect_debugger(f' = {value}') def expect_threads(num_threads, selected_thread): send_debugger('info threads', 'thread list')