aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads
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.threads
parent5edbb6ed920057df4cca423e3fc54f27f7685def (diff)
downloadbinutils-147fe7f9fb9a89b217d11d73053f53e8edacf90f.zip
binutils-147fe7f9fb9a89b217d11d73053f53e8edacf90f.tar.gz
binutils-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.threads')
-rw-r--r--gdb/testsuite/gdb.threads/attach-into-signal.exp3
-rw-r--r--gdb/testsuite/gdb.threads/attach-slow-waitpid.exp3
-rw-r--r--gdb/testsuite/gdb.threads/attach-stopped.exp3
-rw-r--r--gdb/testsuite/gdb.threads/check-libthread-db.exp42
4 files changed, 28 insertions, 23 deletions
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index 87e3407..91da960 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -17,7 +17,8 @@
# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
# This test only works on Linux
-require !use_gdb_stub isnative
+require can_spawn_for_attach
+require isnative
require {!is_remote host}
require {istarget *-linux*}
diff --git a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
index dc3e62a..28d70da 100644
--- a/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
+++ b/gdb/testsuite/gdb.threads/attach-slow-waitpid.exp
@@ -37,7 +37,8 @@
# during the attach phase.
# This test only works on Linux
-require !use_gdb_stub isnative
+require can_spawn_for_attach
+require isnative
require {!is_remote host}
require {istarget *-linux*}
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index 78e194c..0421ffc 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -18,7 +18,8 @@
# This file was updated by Jan Kratochvil <jan.kratochvil@redhat.com>.
# This test only works on Linux
-require !use_gdb_stub isnative
+require can_spawn_for_attach
+require isnative
require {!is_remote host}
require {istarget *-linux*}
diff --git a/gdb/testsuite/gdb.threads/check-libthread-db.exp b/gdb/testsuite/gdb.threads/check-libthread-db.exp
index 5662eed..6976fe6 100644
--- a/gdb/testsuite/gdb.threads/check-libthread-db.exp
+++ b/gdb/testsuite/gdb.threads/check-libthread-db.exp
@@ -102,25 +102,27 @@ with_test_prefix "automated load-time check" {
}
# Automated load-time check with NPTL fully operational.
- with_test_prefix "libpthread.so fully initialized" {
- clean_restart ${binfile}
-
- gdb_test_no_output "maint set check-libthread-db 1"
- gdb_test_no_output "set debug libthread-db 1"
-
- set test_spawn_id [spawn_wait_for_attach $binfile]
- set testpid [spawn_id_get_pid $test_spawn_id]
-
- gdb_test_sequence "attach $testpid" \
- "check debug libthread-db output" {
- "\[\r\n\]+Running libthread_db integrity checks:"
- "\[\r\n\]+\[ \]+Got thread 0x\[1-9a-f\]\[0-9a-f\]+ => \[0-9\]+ => 0x\[1-9a-f\]\[0-9a-f\]+ ... OK"
- "\[\r\n\]+\[ \]+Got thread 0x\[1-9a-f\]\[0-9a-f\]+ => \[0-9\]+ => 0x\[1-9a-f\]\[0-9a-f\]+ ... OK"
- "\[\r\n\]+libthread_db integrity checks passed."
- "\[\r\n\]+[Thread debugging using libthread_db enabled]"
- }
-
- gdb_exit
- kill_wait_spawned_process $test_spawn_id
+ if { [can_spawn_for_attach] } {
+ with_test_prefix "libpthread.so fully initialized" {
+ clean_restart ${binfile}
+
+ gdb_test_no_output "maint set check-libthread-db 1"
+ gdb_test_no_output "set debug libthread-db 1"
+
+ set test_spawn_id [spawn_wait_for_attach $binfile]
+ set testpid [spawn_id_get_pid $test_spawn_id]
+
+ gdb_test_sequence "attach $testpid" \
+ "check debug libthread-db output" {
+ "\[\r\n\]+Running libthread_db integrity checks:"
+ "\[\r\n\]+\[ \]+Got thread 0x\[1-9a-f\]\[0-9a-f\]+ => \[0-9\]+ => 0x\[1-9a-f\]\[0-9a-f\]+ ... OK"
+ "\[\r\n\]+\[ \]+Got thread 0x\[1-9a-f\]\[0-9a-f\]+ => \[0-9\]+ => 0x\[1-9a-f\]\[0-9a-f\]+ ... OK"
+ "\[\r\n\]+libthread_db integrity checks passed."
+ "\[\r\n\]+[Thread debugging using libthread_db enabled]"
+ }
+
+ gdb_exit
+ kill_wait_spawned_process $test_spawn_id
+ }
}
}