diff options
author | Yao Qi <yao@codesourcery.com> | 2014-10-14 15:40:15 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-10-18 20:58:06 +0800 |
commit | 673dc4a0542b54d8da67e53eaaa94ace90085421 (patch) | |
tree | e1cdd366733e1b927e4e5c08b9dfbc9e500cc294 /gdb/testsuite/gdb.base | |
parent | b53dfeb26ed06e97fff1e8f469e33637ebdf6624 (diff) | |
download | gdb-673dc4a0542b54d8da67e53eaaa94ace90085421.zip gdb-673dc4a0542b54d8da67e53eaaa94ace90085421.tar.gz gdb-673dc4a0542b54d8da67e53eaaa94ace90085421.tar.bz2 |
Skip testing argv[0] on target argv[0] isn't available
I see the following two fails on arm-none-eabi target, because argv[0]
isn't available.
print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept directory symbolic link name
My first thought is to check [target_info exists noargs], and skip the
test if it returns true. However, noargs is set in gdbserver board
files, so argv0-symlink.exp will be skipped on gdbserver board file.
The change is too aggressive.
When the program is running with gdbserver, argv[1] to argv[N] aren't
available, but argv[0] is. Fortunately, argv0-symlink.exp only
requires argv[0]. argv0-symlink.exp can be run with gdbserver board
file, as what we do now.
What we need to check is whether argv[0] is available, so I add a new
proc gdb_has_argv0 to do so by starting a program, and check
argc/argv[0] to see whether argv[0] is available.
Dan fixed the similar problem by checking noargs, which is too strong.
https://sourceware.org/ml/gdb-patches/2010-02/msg00398.html as a
result, the test is skipped on gdbserver. This patch fixed it too.
gdb/testsuite:
2014-10-18 Yao Qi <yao@codesourcery.com>
* gdb.base/argv0-symlink.exp: Check argv[0] value if
gdb_has_argv0 return true.
* gdb.guile/scm-value.exp (test_value_in_inferior): Don't
check [target_info exists noargs], check [gdb_has_argv0]
instead.
* gdb.python/py-value.exp (test_value_in_inferior): Likewise.
* lib/gdb.exp (gdb_has_argv0, gdb_has_argv0_1): New
procedures.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/argv0-symlink.exp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp index d849b4c..cd459bb 100644 --- a/gdb/testsuite/gdb.base/argv0-symlink.exp +++ b/gdb/testsuite/gdb.base/argv0-symlink.exp @@ -15,6 +15,8 @@ standard_testfile +set has_argv0 [gdb_has_argv0] + if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } { return -1 } @@ -39,7 +41,11 @@ if ![runto_main] { gdb_test_no_output "set print repeats 10000" gdb_test_no_output "set print elements 10000" -gdb_test {print argv[0]} "/$filelink\"" $test +if { $has_argv0 } { + gdb_test {print argv[0]} "/$filelink\"" $test +} else { + unsupported $test +} # For a link named /PATH/TO/DIR/LINK, we want to check the output # against "/DIR/LINK", but computed in a way that doesn't make @@ -73,9 +79,14 @@ if ![runto_main] { gdb_test_no_output "set print repeats 10000" gdb_test_no_output "set print elements 10000" -# gdbserver does not have this issue. -if ![is_remote target] { - setup_kfail "*-*-*" gdb/15934 +if { $has_argv0 } { + # gdbserver does not have this issue. + if ![is_remote target] { + setup_kfail "*-*-*" gdb/15934 + } + gdb_test {print argv[0]} "/$dirlink/$filelink\"" $test +} else { + unsupported $test } -gdb_test {print argv[0]} "/$dirlink/$filelink\"" $test + gdb_test "info inferiors" "/$lastdir/$filelink *" "$test for info inferiors" |