aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-05-06 14:27:09 +0200
committerTom de Vries <tdevries@suse.de>2024-05-06 14:27:09 +0200
commit147fe7f9fb9a89b217d11d73053f53e8edacf90f (patch)
tree8640ea8b8f2345cbc947483ca8c3b53b2a281965 /gdb/testsuite/gdb.base
parent5edbb6ed920057df4cca423e3fc54f27f7685def (diff)
downloadgdb-147fe7f9fb9a89b217d11d73053f53e8edacf90f.zip
gdb-147fe7f9fb9a89b217d11d73053f53e8edacf90f.tar.gz
gdb-147fe7f9fb9a89b217d11d73053f53e8edacf90f.tar.bz2
[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 <pedro@palves.net>
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/break-interp.exp4
-rw-r--r--gdb/testsuite/gdb.base/dprintf-detach.exp2
-rw-r--r--gdb/testsuite/gdb.base/run-control-while-bg-execution.exp3
3 files changed, 8 insertions, 1 deletions
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
}
}