Index: gdb/testsuite/gdb.server/wrapper.exp |
diff --git a/gdb/testsuite/gdb.server/server-mon.exp b/gdb/testsuite/gdb.server/wrapper.exp |
similarity index 52% |
copy from gdb/testsuite/gdb.server/server-mon.exp |
copy to gdb/testsuite/gdb.server/wrapper.exp |
index f47fe155cd21983100a5e41da0d2434c55659ee6..a5fb7142072f48e511558f99f7cd5efdea843819 100644 |
--- a/gdb/testsuite/gdb.server/server-mon.exp |
+++ b/gdb/testsuite/gdb.server/wrapper.exp |
@@ -1,6 +1,6 @@ |
# This testcase is part of GDB, the GNU debugger. |
-# Copyright 2007-2012 Free Software Foundation, Inc. |
+# Copyright 2013 Free Software Foundation, Inc. |
# This program is free software; you can redistribute it and/or modify |
# it under the terms of the GNU General Public License as published by |
@@ -15,17 +15,23 @@ |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
-# Test gdbserver monitor commands. |
+# Test --wrapper option of GDBserver. |
load_lib gdbserver-support.exp |
-standard_testfile server.c |
+standard_testfile |
if { [skip_gdbserver_tests] } { |
return 0 |
} |
-if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { |
+if { [istarget *-*-mingw*] |
+ || [istarget *-*-cygwin*] } { |
+ unsupported "gdbserver does not support --wrapper on this target (PR server/15967)" |
+ return -1 |
+} |
+ |
+if { [prepare_for_testing $testfile.exp $testfile $srcfile debug] } { |
return -1 |
} |
@@ -33,20 +39,16 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { |
# extended-remote board, therefore already connected. |
gdb_test "disconnect" ".*" |
-gdbserver_run "" |
- |
-gdb_test_multiple "monitor help" "monitor help" { |
- -re "Unknown monitor command.*$gdb_prompt $" { |
- fail "monitor help" |
- } |
- -re "The following monitor commands.*$gdb_prompt $" { |
- pass "monitor help" |
- } |
-} |
+set target_exec [gdbserver_download_current_prog] |
+# Start GDBserver with option '--wrapper'. |
+set res [gdbserver_start "--wrapper env TEST=1 --" $target_exec] |
-gdb_test "monitor" "Unknown monitor command.*Protocol error.*" |
+set gdbserver_protocol [lindex $res 0] |
+set gdbserver_gdbport [lindex $res 1] |
+gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport |
-gdb_test "monitor set debug 1" "Debug output enabled\\." |
-gdb_test "monitor set debug 0" "Debug output disabled\\." |
-gdb_test "monitor set remote-debug 1" "Protocol debug output enabled\\." |
-gdb_test "monitor set remote-debug 0" "Protocol debug output disabled\\." |
+gdb_breakpoint marker |
+gdb_test "continue" "Breakpoint.* marker .*" "continue to marker" |
+# Test env var TEST is correctly passed to the program through |
+# --wrapper. |
+gdb_test "print d" "\\$${decimal} = ${hex} \"1\".*" |