aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.base/args.exp11
-rw-r--r--gdb/testsuite/gdb.base/inferior-args.exp48
-rw-r--r--gdb/testsuite/gdb.base/startup-with-shell.exp37
3 files changed, 50 insertions, 46 deletions
diff --git a/gdb/testsuite/gdb.base/args.exp b/gdb/testsuite/gdb.base/args.exp
index 34d722a..363d74a 100644
--- a/gdb/testsuite/gdb.base/args.exp
+++ b/gdb/testsuite/gdb.base/args.exp
@@ -29,15 +29,6 @@ if {[build_executable $testfile.exp $testfile $srcfile] == -1} {
return -1
}
-set startup_with_shell_modes { "on" }
-if {![gdb_protocol_is_remote]} {
- lappend startup_with_shell_modes "off"
-} else {
- # Some of these tests will not work when using the remote protocol
- # due to bug PR gdb/28392.
- unsupported "gdbserver 'startup-with-shell off' broken PR gdb/28392"
-}
-
# NAME is the name to use for the tests and ARGLIST is the list of
# arguments that are passed to GDB when it is started.
#
@@ -55,7 +46,7 @@ proc args_test { name arglist {re_list {}} } {
set re_list $arglist
}
- foreach_with_prefix startup_with_shell $::startup_with_shell_modes {
+ foreach_with_prefix startup_with_shell { on off } {
save_vars { ::GDBFLAGS } {
set ::GDBFLAGS "$::GDBFLAGS --args $::binfile $arglist"
diff --git a/gdb/testsuite/gdb.base/inferior-args.exp b/gdb/testsuite/gdb.base/inferior-args.exp
index 79b73e6..a1977db 100644
--- a/gdb/testsuite/gdb.base/inferior-args.exp
+++ b/gdb/testsuite/gdb.base/inferior-args.exp
@@ -174,22 +174,48 @@ set bs "\\\\"
lappend item [list "$hex \"$bs\"\"" "$hex \"$bs$bs$bs\"\""]
lappend test_desc_list $item
-set startup_with_shell_modes { "on" }
-if {![gdb_protocol_is_remote]} {
- lappend startup_with_shell_modes "off"
-} else {
- # Due to PR gdb/28392 gdbserver doesn't currently support having
- # startup-with-shell off, and then attempting to pass arguments
- # containing whitespace.
- unsupported "bug gdb/28392: gdbserver doesn't support this"
-}
-
+# test three
+# ----------
+#
+# This test focuses on sending special shell characters within a
+# double quote argument, and each special character is prefixed with a
+# backslash.
+#
+# In a POSIX shell, within a double quoted argument, only $ (dollar),
+# ` (backtick), " (double quote), \ (backslash), and newline can be
+# escaped. All other backslash characters are literal backslashes.
+#
+# As with the previous test, the double quotes are lost when the
+# arguments are sent through gdbserver_start, as such, this test isn't
+# going to work when using the native-gdbserver board, hence we set
+# the second arguemnt to 'false'.
+lappend test_desc_list [list "test three" \
+ false \
+ { "\&" "\<" "\#" "\^" "\>" "\$" "\`" } \
+ [list "$hex \"\\\\\\\\&\"" \
+ "$hex \"\\\\\\\\<\"" \
+ "$hex \"\\\\\\\\#\"" \
+ "$hex \"\\\\\\\\\\^\"" \
+ "$hex \"\\\\\\\\>\"" \
+ "$hex \"\\\$\"" \
+ "$hex \"`\""]]
+
+# test four
+# ---------
+#
+# This test passes two arguments, a single and double quote, each
+# escaped with a backslash.
+lappend test_desc_list [list "test four" \
+ true \
+ { \' \" } \
+ [list "$hex \"'\"" \
+ "$hex \"\\\\\"\""]]
foreach desc $test_desc_list {
lassign $desc name stub_suitable args re_list
with_test_prefix $name {
foreach_with_prefix set_method { "start" "starti" "run" "set args" } {
- foreach_with_prefix startup_with_shell $startup_with_shell_modes {
+ foreach_with_prefix startup_with_shell { on off } {
do_test $set_method $startup_with_shell $args $re_list \
$stub_suitable
}
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
index 495c43e..e27f17a 100644
--- a/gdb/testsuite/gdb.base/startup-with-shell.exp
+++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
@@ -59,12 +59,8 @@ proc initial_setup_simple { startup_with_shell run_args } {
# If PROBLEMATIC_ON is true then when startup-with-shell is on we
# expect the comparison to fail, so setup an xfail.
#
-# If PROBLEMATIC_OFF is true then when startup-with-shell is off we
-# expect the comparison to fail, so setup an xfail.
-#
# TESTNAME is a string used in the test names.
-proc run_test { args on_re off_re testname { problematic_on false } \
- { problematic_off false } } {
+proc run_test { args on_re off_re testname { problematic_on false } } {
foreach startup_with_shell { "on" "off" } {
with_test_prefix "$testname, startup_with_shell: ${startup_with_shell}" {
if {![initial_setup_simple $startup_with_shell $args]} {
@@ -76,7 +72,7 @@ proc run_test { args on_re off_re testname { problematic_on false } \
set problematic $problematic_on
} else {
set re $off_re
- set problematic $problematic_off
+ set problematic false
}
if { $problematic } {
@@ -91,9 +87,8 @@ proc run_test { args on_re off_re testname { problematic_on false } \
# This is like the run_test proc except that RE is used as the
# expected argument regexp when startup-with-shell is both on and off.
# For the other arguments, see run_test.
-proc run_test_same { args re testname { problematic_on false } \
- { problematic_off false } } {
- run_test $args $re $re $testname $problematic_on $problematic_off
+proc run_test_same { args re testname } {
+ run_test $args $re $re $testname
}
# The regexp to match a single '\' character.
@@ -129,13 +124,11 @@ save_vars { env(TEST) } {
run_test_same "\"\\a\"" \
"\"${bs}${bs}a\"" \
- "retain backslash in double quote arg" \
- false $is_remote_p
+ "retain backslash in double quote arg"
run_test_same "'\\a'" \
"\"${bs}${bs}a\"" \
- "retain backslash in single quote arg" \
- false $is_remote_p
+ "retain backslash in single quote arg"
run_test_same "\"\\\$\"" \
"\"\\\$\"" \
@@ -143,8 +136,7 @@ run_test_same "\"\\\$\"" \
run_test_same "'\\\$'" \
"\"${bs}${bs}\\\$\"" \
- "'\$' is not escaped in single quote arg" \
- false $is_remote_p
+ "'\$' is not escaped in single quote arg"
run_test_same "\"\\`\"" \
"\"\\`\"" \
@@ -152,25 +144,20 @@ run_test_same "\"\\`\"" \
run_test_same "'\\`'" \
"\"${bs}${bs}`\"" \
- "'`' is not escaped in single quote arg" \
- false $is_remote_p
+ "'`' is not escaped in single quote arg"
run_test_same "\"\\\"\"" \
"\"${bs}\"\"" \
- "'\"' can be escaped in double quote arg" \
- false $is_remote_p
+ "'\"' can be escaped in double quote arg"
run_test_same "'\\\"'" \
"\"${bs}${bs}${bs}\"\"" \
- "'\"' is not escaped in single quote arg" \
- false $is_remote_p
+ "'\"' is not escaped in single quote arg"
run_test_same "\"\\\\\"" \
"\"${bs}${bs}\"" \
- "'\\' can be escaped in double quote arg" \
- false $is_remote_p
+ "'\\' can be escaped in double quote arg"
run_test_same "'\\\\'" \
"\"${bs}${bs}${bs}${bs}\"" \
- "'\\' is not escaped in single quote arg" \
- false $is_remote_p
+ "'\\' is not escaped in single quote arg"