aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-10-11 08:47:47 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-10-11 08:47:47 +0000
commitd3d7896de378a9d127f355af1187cb47357f4f2a (patch)
tree682163c74130b2c5010b7a1078bdd22f61f79189 /gdb
parent5e533c94a6e360da727240bcc8d21fdcffd8d5d4 (diff)
downloadgdb-d3d7896de378a9d127f355af1187cb47357f4f2a.zip
gdb-d3d7896de378a9d127f355af1187cb47357f4f2a.tar.gz
gdb-d3d7896de378a9d127f355af1187cb47357f4f2a.tar.bz2
gdb/testsuite/
Fix missing _start PIE relocation on ppc64 due to stop on dl_main. * break-interp.exp (reach): Move the core body ... (reach_1): ... here. Use stop-on-solib-events for _dl_debug_state. (test_ld): Provide always real argument, even to the linker. Replace dl_main by _dl_debug_state.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.base/break-interp.exp117
2 files changed, 91 insertions, 34 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e01dd40..865568c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Fix missing _start PIE relocation on ppc64 due to stop on dl_main.
+ * break-interp.exp (reach): Move the core body ...
+ (reach_1): ... here. Use stop-on-solib-events for _dl_debug_state.
+ (test_ld): Provide always real argument, even to the linker. Replace
+ dl_main by _dl_debug_state.
+
+2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix results of prelinked PIEs on ppc*.
* gdb.base/break-interp.exp (reach, test_core, test_attach_gdb):
Accept also DISPLACEMENT "PRESENT".
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index c00db63..4025083 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -108,47 +108,87 @@ proc strip_debug {dest} {
}
}
-# `runto' does not check we stopped really at the function we specified.
-# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
-# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
-# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
-proc reach {func command displacement} {
+# Implementation of reach.
+
+proc reach_1 {func command displacement} {
global gdb_prompt expect_out
- global pf_prefix
- set old_ldprefix $pf_prefix
- lappend pf_prefix "reach-$func:"
+ if {$func == "_dl_debug_state"} {
+ # Breakpoint on _dl_debug_state can have problems due to its overlap
+ # with the existing internal breakpoint from GDB.
+ gdb_test_no_output "set stop-on-solib-events 1"
+ } elseif {! [gdb_breakpoint $func allow-pending]} {
+ return
+ }
- if [gdb_breakpoint $func allow-pending] {
- set test "reach"
- set test_displacement "seen displacement message as $displacement"
- gdb_test_multiple $command $test {
- -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
- # Missing "$gdb_prompt $" is intentional.
- if {$expect_out(1,string) == "0x0"} {
- set case "ZERO"
- } else {
- set case "NONZERO"
- }
- if {$displacement == $case || $displacement == "PRESENT"} {
- pass $test_displacement
- set displacement "FOUND-$displacement"
- } else {
- fail $test_displacement
- }
- exp_continue
+ set test "reach"
+ set test_displacement "seen displacement message as $displacement"
+ set debug_state_count 0
+ gdb_test_multiple $command $test {
+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
+ # Missing "$gdb_prompt $" is intentional.
+ if {$expect_out(1,string) == "0x0"} {
+ set case "ZERO"
+ } else {
+ set case "NONZERO"
}
- -re "Breakpoint \[0-9\]+, \\.?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
+ if {$displacement == $case || $displacement == "PRESENT"} {
+ pass $test_displacement
+ set displacement "FOUND-$displacement"
+ } else {
+ fail $test_displacement
+ }
+ exp_continue
+ }
+ -re "Breakpoint \[0-9\]+, \\.?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
+ if {$func == "_dl_debug_state"} {
+ fail $test
+ } else {
pass $test
}
- -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?$func \\(\\).*\r\n$gdb_prompt $" {
+ }
+ -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?$func \\(\\).*\r\n$gdb_prompt $" {
+ if {$func == "_dl_debug_state"} {
+ fail $test
+ } else {
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
- fail $test_displacement
+ -re "Stopped due to shared library event\r\n$gdb_prompt $" {
+ if {$func == "_dl_debug_state"} {
+ if {$debug_state_count == 0} {
+ # First stop does not yet relocate the _start function
+ # descriptor on ppc64.
+ set debug_state_count 1
+ send_gdb "continue\n"
+ exp_continue
+ } else {
+ pass $test
+ }
+ } else {
+ fail $test
+ }
}
}
+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ fail $test_displacement
+ }
+
+ if {$func == "_dl_debug_state"} {
+ gdb_test_no_output "set stop-on-solib-events 0"
+ }
+}
+
+# `runto' does not check we stopped really at the function we specified.
+# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
+# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
+# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
+proc reach {func command displacement} {
+ global pf_prefix
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "reach-$func:"
+
+ reach_1 $func $command $displacement
set pf_prefix $old_ldprefix
}
@@ -344,9 +384,18 @@ proc test_ld {file ifmain trynosym displacement} {
# prevents that from happening. So turn it off.
gdb_test "set disable-randomization off"
- reach "dl_main" "run segv" $displacement
+ if $ifmain {
+ gdb_test_no_output "set args segv"
+ } else {
+ global objdir binfile_test
+
+ # ld.so needs some executable to run to reach _dl_debug_state.
+ gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test"
+ }
+
+ reach "_dl_debug_state" "run" $displacement
- gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
+ gdb_test "bt" "#0 +\[^\r\n\]*\\m_dl_debug_state\\M.*" "dl bt"
if $ifmain {
reach "main" continue "NONE"
@@ -358,7 +407,7 @@ proc test_ld {file ifmain trynosym displacement} {
# Try re-run if the new PIE displacement takes effect.
gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
- reach "dl_main" "run segv" $displacement
+ reach "_dl_debug_state" "run" $displacement
if $ifmain {
test_core $file $displacement
@@ -391,7 +440,7 @@ proc test_ld {file ifmain trynosym displacement} {
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
if $ifmain {
- reach "dl_main" run $displacement
+ reach "_dl_debug_state" run $displacement
set test "info files"
set entrynohex ""