Index: gdb/testsuite/gdb.server/ext-attach.exp |
diff --git a/gdb/testsuite/gdb.server/ext-attach.exp b/gdb/testsuite/gdb.server/ext-attach.exp |
index edf08fd4c97b60e21a516cdf72033da9e665fc27..c5aec84d20166fb58ac47440400e00ed5c20c014 100644 |
--- a/gdb/testsuite/gdb.server/ext-attach.exp |
+++ b/gdb/testsuite/gdb.server/ext-attach.exp |
@@ -19,9 +19,7 @@ |
load_lib gdbserver-support.exp |
-set testfile "ext-attach" |
-set srcfile ${testfile}.c |
-set binfile ${objdir}/${subdir}/${testfile} |
+standard_testfile |
if { [skip_gdbserver_tests] } { |
return 0 |
@@ -32,15 +30,13 @@ if [is_remote target] then { |
return 0 |
} |
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
- untested ext-attach.exp |
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { |
return -1 |
} |
-gdb_exit |
-gdb_start |
-gdb_load $binfile |
-gdb_reinitialize_dir $srcdir/$subdir |
+# Make sure we're disconnected, in case we're testing with an |
+# extended-remote board, therefore already connected. |
+gdb_test "disconnect" ".*" |
set target_exec [gdbserver_download_current_prog] |
gdbserver_start_extended |
@@ -57,14 +53,16 @@ if { [istarget "*-*-cygwin*"] } { |
set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] |
} |
-gdb_test "attach $testpid" "Attached to.*" \ |
+gdb_test "attach $testpid" \ |
+ "Attaching to program: .*, process $testpid.*(in|at).*" \ |
"attach to remote program 1" |
gdb_test "backtrace" ".*main.*" "backtrace 1" |
-gdb_test "detach" "Detached from remote process.*\\." |
+gdb_test "detach" "Detaching from program.*process.*" |
gdb_test "backtrace" "No stack\\." "backtrace with no program" |
-gdb_test "attach $testpid" "Attached to.*" \ |
+gdb_test "attach $testpid" \ |
+ "Attaching to program: .*, process $testpid.*(in|at).*" \ |
"attach to remote program 2" |
gdb_test "backtrace" ".*main.*" "backtrace 2" |