aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-07-05 18:02:56 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-07-05 18:02:56 +0000
commit1a219cc7417a257cf173ccb36f96dad4c36e471e (patch)
tree93725fa936ab20ba3e2143cc19e11a13107754bf /gdb
parent5e3b36f8799d7928f5c5ac5e871c0968b5874369 (diff)
downloadfsf-binutils-gdb-1a219cc7417a257cf173ccb36f96dad4c36e471e.zip
fsf-binutils-gdb-1a219cc7417a257cf173ccb36f96dad4c36e471e.tar.gz
fsf-binutils-gdb-1a219cc7417a257cf173ccb36f96dad4c36e471e.tar.bz2
gdb/testsuite/
Cope with missing /usr/sbin/prelink. * lib/prelink-support.exp (prelink_no): <result == 1 && $output is "no such file or directory">: New. (prelink_yes): Likewise. Return on failed prelink_no.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/lib/prelink-support.exp41
2 files changed, 48 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8d52e40..ced176c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,6 +1,14 @@
2010-07-05 Jan Kratochvil <jan.kratochvil@redhat.com>
Joel Brobecker <brobecker@adacore.com>
+ Cope with missing /usr/sbin/prelink.
+ * lib/prelink-support.exp (prelink_no):
+ <result == 1 && $output is "no such file or directory">: New.
+ (prelink_yes): Likewise. Return on failed prelink_no.
+
+2010-07-05 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Joel Brobecker <brobecker@adacore.com>
+
* gdb.base/attach-pie-misread.exp: Load prelink-support.exp. Replace
build_executable by build_executable_own_libs. Replace "prelink -R"
execution by a call of prelink_yes. Comment why "prelink -r" needs no
diff --git a/gdb/testsuite/lib/prelink-support.exp b/gdb/testsuite/lib/prelink-support.exp
index 6d9e909..6dd95a0 100644
--- a/gdb/testsuite/lib/prelink-support.exp
+++ b/gdb/testsuite/lib/prelink-support.exp
@@ -187,6 +187,30 @@ proc prelink_no {arg {name {}}} {
set result [catch $command output]
verbose -log "result is $result"
verbose -log "output is $output"
+ if {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
+ # Without prelink, at least verify that all the binaries do not
+ # contain the ".gnu.prelink_undo" section (which would mean that they
+ # have already been prelinked).
+ set test "$test (missing /usr/sbin/prelink)"
+ foreach bin [split $arg] {
+ if [string match "-*" $bin] {
+ # Skip prelink options.
+ continue
+ }
+ set readelf_program [transform readelf]
+ set command "exec $readelf_program -WS $bin"
+ verbose -log "command is $command"
+ set result [catch $command output]
+ verbose -log "result is $result"
+ verbose -log "output is $output"
+ if {$result != 0 || [string match {* .gnu.prelink_undo *} $output]} {
+ fail "$test ($bin is already prelinked)"
+ return 0
+ }
+ }
+ pass $test
+ return 1
+ }
if {$result == 0 && $output == ""} {
verbose -log "$name has been now unprelinked"
set command "exec /usr/sbin/prelink -uN $arg"
@@ -217,7 +241,9 @@ proc prelink_yes {arg {name ""}} {
# Try to unprelink it first so that, if it has been already prelinked
# before, we get a different address now, making the new result unaffected
# by any previous prelinking.
- prelink_no $arg "$name pre-unprelink"
+ if ![prelink_no $arg "$name pre-unprelink"] {
+ return 0
+ }
set test "prelink $name"
@@ -239,6 +265,19 @@ proc prelink_yes {arg {name ""}} {
set result [catch $command output]
verbose -log "result is $result"
verbose -log "output is $output"
+ if {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
+ set test "$test (missing /usr/sbin/prelink)"
+
+ # We could not find prelink. We could check whether $args is already
+ # prelinked but we don't, because:
+ # - It is unlikely that someone uninstalls prelink after having
+ # prelinked the system ld.so;
+ # - We still cannot change its prelinked address.
+ # Therefore, we just skip the test.
+
+ xfail $test
+ return 0
+ }
if {$result == 0 && $output == ""} {
pass $test
return 1