aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/lib/gdb.exp26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6f6acfe..819dfbf 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5151,6 +5151,32 @@ gdb_caching_proc can_spawn_for_attach {
return 1
}
+# Centralize the failure checking of "attach" command.
+# Return 0 if attach failed, otherwise return 1.
+
+proc gdb_attach { testpid args } {
+ parse_args {
+ {pattern ""}
+ }
+
+ if { [llength $args] != 0 } {
+ error "Unexpected arguments: $args"
+ }
+
+ gdb_test_multiple "attach $testpid" "attach" {
+ -re -wrap "Attaching to.*ptrace: Operation not permitted\\." {
+ unsupported "$gdb_test_name (Operation not permitted)"
+ return 0
+ }
+ -re -wrap "$pattern" {
+ pass $gdb_test_name
+ return 1
+ }
+ }
+
+ return 0
+}
+
# Kill a progress previously started with spawn_wait_for_attach, and
# reap its wait status. PROC_SPAWN_ID is the spawn id associated with
# the process.