From 147fe7f9fb9a89b217d11d73053f53e8edacf90f Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 6 May 2024 14:27:09 +0200 Subject: [gdb/testsuite] Handle ptrace operation not permitted in can_spawn_for_attach When running the testsuite on a system with kernel.yama.ptrace_scope set to 1, we run into attach failures. Fix this by recognizing "ptrace: Operation not permitted" in can_spawn_for_attach. Tested on aarch64-linux and x86_64-linux. Approved-By: Pedro Alves --- gdb/testsuite/gdb.base/break-interp.exp | 4 ++++ gdb/testsuite/gdb.base/dprintf-detach.exp | 2 +- gdb/testsuite/gdb.base/run-control-while-bg-execution.exp | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'gdb/testsuite/gdb.base') diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp index addacde..d7f84db 100644 --- a/gdb/testsuite/gdb.base/break-interp.exp +++ b/gdb/testsuite/gdb.base/break-interp.exp @@ -318,6 +318,10 @@ proc test_attach_gdb {file pid displacement prefix} { } proc test_attach {file displacement {relink_args ""}} { + if { ![can_spawn_for_attach] } { + return + } + global board_info global exec diff --git a/gdb/testsuite/gdb.base/dprintf-detach.exp b/gdb/testsuite/gdb.base/dprintf-detach.exp index 550d319..b4184d6 100644 --- a/gdb/testsuite/gdb.base/dprintf-detach.exp +++ b/gdb/testsuite/gdb.base/dprintf-detach.exp @@ -21,7 +21,7 @@ load_lib gdbserver-support.exp # The test relies on "detach/attach". -require !use_gdb_stub +require can_spawn_for_attach standard_testfile set escapedbinfile [string_to_regexp ${binfile}] diff --git a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp index f1cbd93..380047a 100644 --- a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp +++ b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp @@ -110,6 +110,9 @@ proc do_test { action1 action2 } { foreach_with_prefix action1 { kill detach add none } { foreach_with_prefix action2 { start run attach } { + if { $action2 == "attach" && ![can_spawn_for_attach] } { + continue + } do_test $action1 $action2 } } -- cgit v1.1