return -1
}
-proc args_test { name arglist } {
+# If SINGLE_QUOTES_NEWLINE_KFAIL true, arguments made of exactly '' or a
+# newline character will fail, so kfail those tests.
+
+proc args_test { name arglist {single_quotes_newline_kfail false}} {
global srcdir
global subdir
global testfile
set i 1
foreach arg $arglist {
+ if { $single_quotes_newline_kfail
+ && ($arg == {''} || $arg == {\\n}) } {
+ setup_kfail "gdb/27989" "*-*-*"
+ }
gdb_test "print argv\[$i\]" "\\\$$decimal = $hex \"$arg\"" \
"argv\[$i\] for $name"
set i [expr $i + 1]
save_vars { GDBFLAGS } {
set old_gdbflags $GDBFLAGS
+ # Single quotes and newlines are not well handled by the extended-remote
+ # target: https://sourceware.org/bugzilla/show_bug.cgi?id=27989
+ set single_quotes_newline_kfail \
+ [expr { [target_info exists gdb_protocol] \
+ && [target_info gdb_protocol] == "extended-remote" }]
+
set GDBFLAGS "$old_gdbflags --args $binfile 1 3"
args_test basic {{1} {3}}
# Try with arguments containing literal single quotes.
set GDBFLAGS "$old_gdbflags --args $binfile 1 '' 3"
- args_test "one empty with single quotes" {{1} {''} {3}}
+ args_test "one empty with single quotes" {{1} {''} {3}} $single_quotes_newline_kfail
set GDBFLAGS "$old_gdbflags --args $binfile 1 '' '' 3"
- args_test "two empty with single quotes" {{1} {''} {''} {3}}
+ args_test "two empty with single quotes" {{1} {''} {''} {3}} $single_quotes_newline_kfail
# try with arguments containing literal newlines.
set GDBFLAGS "$old_gdbflags --args $binfile 1 {\n} 3"
- args_test "one newline" {{1} {\\n} {3}}
+ args_test "one newline" {{1} {\\n} {3}} $single_quotes_newline_kfail
set GDBFLAGS "$old_gdbflags --args $binfile 1 {\n} {\n} 3"
- args_test "two newlines" {{1} {\\n} {\\n} {3}}
+ args_test "two newlines" {{1} {\\n} {\\n} {3}} $single_quotes_newline_kfail
}