2012-02-24 Pedro Alves <palves@redhat.com>

* gdb.base/break-interp.exp (test_ld): Use with_test_prefix.
	(top level): Use with_test_prefix.
This commit is contained in:
Pedro Alves
2012-02-24 14:09:08 +00:00
parent 13fc3e3cf9
commit 11337c2fed
2 changed files with 204 additions and 207 deletions

View File

@ -1,3 +1,8 @@
2012-02-24 Pedro Alves <palves@redhat.com>
* gdb.base/break-interp.exp (test_ld): Use with_test_prefix.
(top level): Use with_test_prefix.
2012-02-24 Pedro Alves <palves@redhat.com> 2012-02-24 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-into-signal.exp (corefunc): Use * gdb.threads/attach-into-signal.exp (corefunc): Use

View File

@ -411,12 +411,10 @@ proc test_ld {file ifmain trynosym displacement} {
return return
} }
global pf_prefix with_test_prefix "symbol-less" {
set old_ldprefix $pf_prefix # Test also `exec-file'-command loaded $FILE - therefore
append pf_prefix " symbol-less:" # without symbols. SYMBOL_OBJFILE is not available and only
# EXEC_BFD must be used.
# Test also `exec-file'-command loaded $FILE - therefore without symbols.
# SYMBOL_OBJFILE is not available and only EXEC_BFD must be used.
gdb_exit gdb_exit
gdb_start gdb_start
@ -424,7 +422,8 @@ proc test_ld {file ifmain trynosym displacement} {
gdb_test_no_output "set debug-file-directory" gdb_test_no_output "set debug-file-directory"
gdb_reinitialize_dir $srcdir/$subdir gdb_reinitialize_dir $srcdir/$subdir
# Print the "PIE (Position Independent Executable) displacement" message. # Print the "PIE (Position Independent Executable)
# displacement" message.
gdb_test_no_output "set verbose on" gdb_test_no_output "set verbose on"
# Test no (error) message has been printed by `exec-file'. # Test no (error) message has been printed by `exec-file'.
@ -465,8 +464,8 @@ proc test_ld {file ifmain trynosym displacement} {
gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached" gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
} }
} else { } else {
# There is no symbol to break at ld.so. Moreover it can exit with an # There is no symbol to break at ld.so. Moreover it can
# error code. # exit with an error code.
set test "ld.so exit" set test "ld.so exit"
set test_displacement "seen displacement message as $displacement" set test_displacement "seen displacement message as $displacement"
@ -495,14 +494,12 @@ proc test_ld {file ifmain trynosym displacement} {
fail $test_displacement fail $test_displacement
} }
} }
}
set pf_prefix $old_ldprefix
} }
# Create separate binaries for each testcase - to make the possible reported # Create separate binaries for each testcase - to make the possible reported
# problem reproducible after the whole test run finishes. # problem reproducible after the whole test run finishes.
set old_ldprefix $pf_prefix
foreach ldprelink {NO YES} { foreach ldprelink {NO YES} {
foreach ldsepdebug {NO IN SEP} { foreach ldsepdebug {NO IN SEP} {
# Skip running the ldsepdebug test if we do not have system separate # Skip running the ldsepdebug test if we do not have system separate
@ -527,9 +524,7 @@ foreach ldprelink {NO YES} {
# possibly unprelinked ld.so to test all the combinations for GDB. # possibly unprelinked ld.so to test all the combinations for GDB.
set interp_saved ${interp}-saved set interp_saved ${interp}-saved
set pf_prefix $old_ldprefix with_test_prefix "$ldname" {
append pf_prefix " $ldname:"
if {$ldsepdebug == "NO"} { if {$ldsepdebug == "NO"} {
file_copy $interp_system $interp file_copy $interp_system $interp
# Never call strip-debug before unprelink: # Never call strip-debug before unprelink:
@ -583,9 +578,10 @@ foreach ldprelink {NO YES} {
if {$ldprelink == "NO"} { if {$ldprelink == "NO"} {
set displacement "NONZERO" set displacement "NONZERO"
} else { } else {
# x86* kernel loads prelinked PIE binary at its prelinked address # x86* kernel loads prelinked PIE binary at its
# but ppc* kernel loads it at a random address. prelink normally # prelinked address but ppc* kernel loads it at a
# skips PIE binaries during the system scan. # random address. prelink normally skips PIE binaries
# during the system scan.
set displacement "PRESENT" set displacement "PRESENT"
} }
test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
@ -593,12 +589,12 @@ foreach ldprelink {NO YES} {
if ![file_copy $interp $interp_saved] { if ![file_copy $interp $interp_saved] {
continue continue
} }
set old_binprefix $pf_prefix
foreach binprelink {NO YES} { foreach binprelink {NO YES} {
foreach binsepdebug {NO IN SEP} { foreach binsepdebug {NO IN SEP} {
# "ATTACH" is like "YES" but it is modified during run. # "ATTACH" is like "YES" but it is modified during
# It cannot be used for problem reproducibility after the # run. It cannot be used for problem
# testcase ends. # reproducibility after the testcase ends.
foreach binpie {NO YES ATTACH} { foreach binpie {NO YES ATTACH} {
# This combination is not possible, non-PIE (fixed address) # This combination is not possible, non-PIE (fixed address)
# binary cannot be prelinked to any (other) address. # binary cannot be prelinked to any (other) address.
@ -609,9 +605,7 @@ foreach ldprelink {NO YES} {
set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}" set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}"
set exec $binprefix-$binname set exec $binprefix-$binname
set pf_prefix $old_binprefix with_test_prefix "$binname" {
append pf_prefix " $binname:"
set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]" set opts "ldflags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
if {$binsepdebug != "NO"} { if {$binsepdebug != "NO"} {
lappend opts {debug} lappend opts {debug}
@ -635,10 +629,9 @@ foreach ldprelink {NO YES} {
} elseif {$binprelink == "NO"} { } elseif {$binprelink == "NO"} {
set displacement "NONZERO" set displacement "NONZERO"
} else { } else {
# x86* kernel loads prelinked PIE binary at its # x86* kernel loads prelinked PIE binary at its prelinked
# prelinked address but ppc* kernel loads it at # address but ppc* kernel loads it at a random address.
# a random address. prelink normally skips PIE # prelink normally skips PIE binaries during the system scan.
# binaries during the system scan.
set displacement "PRESENT" set displacement "PRESENT"
} }
@ -647,21 +640,19 @@ foreach ldprelink {NO YES} {
if {$binpie != "ATTACH"} { if {$binpie != "ATTACH"} {
test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
} else { } else {
# If the file has been randomly prelinked it must # If the file has been randomly prelinked it must be
# be "NONZERO". We could see "ZERO" only if it was # "NONZERO". We could see "ZERO" only if it was unprelinked
# unprelinked and it is now running at the same # and it is now running at the same address - which is 0 but
# address - which is 0 but executable can never run # executable can never run at address 0.
# at address 0.
set displacement "NONZERO" set displacement "NONZERO"
test_attach $exec $displacement $relink_args test_attach $exec $displacement $relink_args
# ATTACH means that executables and libraries have # ATTACH means that executables and libraries have been
# been modified after they have been run. They # modified after they have been run. They cannot be reused
# cannot be reused for problem reproducibility after # for problem reproducibility after the testcase ends in
# the testcase ends in the ATTACH case. Therefore # the ATTACH case. Therefore they are rather deleted not
# they are rather deleted not to confuse after the # to confuse after the run finishes.
# run finishes.
set exec_debug [system_debug_get $exec] set exec_debug [system_debug_get $exec]
if {$exec_debug != ""} { if {$exec_debug != ""} {
# `file delete [glob "${exec_debug}*"]' does not work. # `file delete [glob "${exec_debug}*"]' does not work.
@ -679,8 +670,9 @@ foreach ldprelink {NO YES} {
} }
} }
} }
}
file delete $interp_saved file delete $interp_saved
} }
}
} }
set pf_prefix $old_ldprefix