From 9839849c0c357cc478acf1a9dd3e96e6b65ceaf1 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 20 May 2024 16:42:08 +0200 Subject: [gdb/testsuite] Fix can_spawn_for_attach_1 consistency check When running test-case gdb.testsuite/gdb-caching-proc-consistency.exp with target board native-gdbserver, we run into: ... (gdb) ERROR: tcl error sourcing gdb.testsuite/gdb-caching-proc-consistency.exp. ERROR: gdbserver does not support attach 4827 without extended-remote while executing "error "gdbserver does not support $command without extended-remote"" (procedure "gdb_test_multiple" line 51) invoked from within "gdb_test_multiple "attach $test_pid" "can spawn for attach" { -re -wrap "$attaching_re\r\n.*ptrace: Operation not permitted\\." { # Not permitte..." (procedure "gdb_real__can_spawn_for_attach_1" line 27) invoked from within "gdb_real__can_spawn_for_attach_1" ... The problem is that: - can_spawn_for_attach_1 is a helper function for can_spawn_for_attach, designed to be called only from that function, and - can_spawn_for_attach_1 is a gdb_caching_proc, and consequently test-case gdb.testsuite/gdb-caching-proc-consistency.exp calls can_spawn_for_attach_1 directly. Fix this by copying the early-outs from can_spawn_for_attach to can_spawn_for_attach_1. Tested on x86_64-linux. Reported-By: Simon Marchi Reviewed-By: Alexandra Petlanova Hajkova --- gdb/testsuite/lib/gdb.exp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gdb') diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index aea0ba5..55f6ab1 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6191,6 +6191,13 @@ proc gdb_exit { } { # return 0 only if we cannot attach because it's unsupported. gdb_caching_proc can_spawn_for_attach_1 {} { + # For the benefit of gdb-caching-proc-consistency.exp, which + # calls can_spawn_for_attach_1 directly. Keep in sync with + # can_spawn_for_attach. + if { [is_remote target] || [target_info exists use_gdb_stub] } { + return 0 + } + # Assume yes. set res 1 -- cgit v1.1