diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-07-05 18:01:53 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-07-05 18:01:53 +0000 |
commit | 5e3b36f8799d7928f5c5ac5e871c0968b5874369 (patch) | |
tree | 819e2ed544aa1320a504ea740f2435ba9a6a395c /gdb/testsuite/gdb.base/attach-pie-misread.exp | |
parent | 86e4bafc3b0bb0148b95807d37b36aae14cdf56c (diff) | |
download | gdb-5e3b36f8799d7928f5c5ac5e871c0968b5874369.zip gdb-5e3b36f8799d7928f5c5ac5e871c0968b5874369.tar.gz gdb-5e3b36f8799d7928f5c5ac5e871c0968b5874369.tar.bz2 |
gdb/testsuite/
* 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
change.
* gdb.base/break-interp.exp: Load prelink-support.exp. Rename calls of
copy to file_copy. Move setting opts --dynamic-linker and -rpath,
mkdir $dir and ldd its parsing and copying to lib/prelink-support.exp.
Replace build_executable by build_executable_own_libs's function
build_executable_own_libs.
(prelinkNO): Create new stub to call prelink_no.
(prelinkYES): Create new stub to call prelink_yes.
(test_attach): Rename calls of copy to file_copy.
(section_get, prelinkNO_run, prelinkNO, prelinkYES, symlink_resolve)
(copy): Move to ...
* lib/prelink-support.exp: ... a new file. Rename prelinkNO to
prelink_no, prelinkYES to prelink_yes, copy to file_copy.
* gdb.base/prelink.exp: Disable testcase also for is_remote and
skip_shlib_tests. Load prelink-support.exp. Replace gdb_compile with
special flags by gdb_compile_shlib. Replace second gdb_compile by
build_executable_own_libs. Replace "prelink -R" execution by a call of
prelink_yes. Replace "prelink -u" and second "prelink -R" execution by
a second call of prelink_yes. Replace restart commands by
clean_restart.
(prelink): Rename to ...
(seen displacement message): ... this test. Extend its expectation
strictness.
Diffstat (limited to 'gdb/testsuite/gdb.base/attach-pie-misread.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/attach-pie-misread.exp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/gdb/testsuite/gdb.base/attach-pie-misread.exp b/gdb/testsuite/gdb.base/attach-pie-misread.exp index 334272b..10e4936 100644 --- a/gdb/testsuite/gdb.base/attach-pie-misread.exp +++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp @@ -18,13 +18,15 @@ if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_test continue } +load_lib prelink-support.exp + set test "attach-pie-misread" set srcfile ${test}.c set genfile ${objdir}/${subdir}/${test}-gen.h set executable ${test} set binfile ${objdir}/${subdir}/${executable} -if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie"]] == -1} { +if {[build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie"]] == ""} { return -1 } @@ -94,7 +96,8 @@ if {$result == 0} { fail $test } -if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]] == -1} { +set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]] +if {$prelink_args == ""} { return -1 } @@ -104,20 +107,8 @@ file delete -- $genfile set phdr [read_phdr $binfile "readelf rebuilt with stub_size"] set dynamic_vaddr_prelinkno [lindex $phdr 0] -set command "exec /usr/sbin/prelink -q -N --no-exec-shield -R $binfile" -verbose -log "command is $command" -set result [catch $command output] -verbose -log "result is $result" -verbose -log "output is $output" - -set test "prelink -R" -if {$result == 0 && $output == ""} { - pass $test -} elseif {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} { - untested attach-pie-misread.exp +if ![prelink_yes $prelink_args] { return -1 -} else { - fail $test } set phdr [read_phdr $binfile "readelf with prelink -R"] @@ -168,6 +159,10 @@ foreach align_mult {1 2} { set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]] verbose -log "shifted_offset is $shifted_offset" + # For normal prelink (prelink_yes call), we need to supply $prelink_args. + # For the prelink `-r' option below, $prelink_args is not required. + # Moreover, if it was used, the problem would not longer be reproducible + # as the libraries would also get relocated. set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile" verbose -log "command is $command" set result [catch $command output] |