This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Fix gdb.base/argv0-symlink.exp FAIL in long dirpath
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Sun, 19 Jan 2014 18:54:42 +0100
- Subject: [patch] Fix gdb.base/argv0-symlink.exp FAIL in long dirpath
- Authentication-results: sourceware.org; auth=none
Hi,
when you build GDB in a very long directory pathname it will:
(gdb) print argv[0]
$1 = 0x7fffffffdb07 "/home/jkratoch/redhat/", 'x' <repeats 178 times>...
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
With the fix:
(gdb) print argv[0]
$1 = 0x7fffffffdb07 "/home/jkratoch/redhat/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/gdb-test/gdb/testsuite/gdb.base/argv0-symlink-filelink"
(gdb) PASS: gdb.base/argv0-symlink.exp: kept file symbolic link name
The "set print repeats unlimited" part is there to prevent the following
output, it would still PASS (as only its tail is matched) but it is not much
correct.
(gdb) print argv[0]
$1 = 0x7fffffffdb07 "/home/jkratoch/redhat/", 'x' <repeats 195 times>, "/gdb-test/gdb/testsuite/gdb.base/argv0-symlink-filelink"
(gdb) PASS: gdb.base/argv0-symlink.exp: kept file symbolic link name
I will check it in.
Tested on x86_64-fedora20-linux-gnu.
Jan
gdb/testsuite/
2014-01-19 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix gdb.base/argv0-symlink.exp FAIL in long dirpath.
* gdb.base/argv0-symlink.exp (elements first, repeats first)
(elements second, repeats second): New.
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
index 0e0202d..7bf5c2f 100644
--- a/gdb/testsuite/gdb.base/argv0-symlink.exp
+++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
@@ -36,6 +36,10 @@ if ![runto_main] {
return -1
}
+# Very long directory paths could be cut below.
+gdb_test_no_output "set print elements unlimited" "elements first"
+gdb_test_no_output "set print repeats unlimited" "repeats first"
+
gdb_test {print argv[0]} "/$filelink\"" $test
# For a link named /PATH/TO/DIR/LINK, we want to check the output
@@ -67,6 +71,10 @@ if ![runto_main] {
return -1
}
+# Very long directory paths could be cut below.
+gdb_test_no_output "set print elements unlimited" "elements second"
+gdb_test_no_output "set print repeats unlimited" "repeats second"
+
# gdbserver does not have this issue.
if ![is_remote target] {
setup_kfail "*-*-*" gdb/15934