gdb/gdb-ppc-test-break-interp-5of6.patch
Jan Kratochvil a30b292533 - Backport gdb.base/break-interp.exp test (+prelink fix) on PPC (BZ 663449).
- Backport gdb.cp/infcall-dlopen.exp test (BZ 639645).
- New testcase py-prettyprint.exp:print hint_error (for BZ 611569, BZ 629236).
- New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435).
2011-01-02 05:04:50 +01:00

178 lines
5.8 KiB
Diff

http://sourceware.org/ml/gdb-cvs/2010-10/msg00066.html
### src/gdb/testsuite/ChangeLog 2010/10/11 08:45:11 1.2472
### src/gdb/testsuite/ChangeLog 2010/10/11 08:47:47 1.2473
## -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".
--- src/gdb/testsuite/gdb.base/break-interp.exp 2010/10/11 08:45:12 1.21
+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/10/11 08:47:47 1.22
@@ -108,47 +108,87 @@
}
}
-# `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 @@
# 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 @@
# 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 @@
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 ""