diff --git a/gdb-6.3-ia64-info-frame-fix-20050725.patch b/gdb-6.3-ia64-info-frame-fix-20050725.patch index 3b2bd9a..9d613fd 100644 --- a/gdb-6.3-ia64-info-frame-fix-20050725.patch +++ b/gdb-6.3-ia64-info-frame-fix-20050725.patch @@ -41,7 +41,7 @@ testsuite: + --- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix 2005-07-25 16:42:50.000000000 -0400 +++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp 2005-07-25 16:42:01.000000000 -0400 -@@ -0,0 +1,66 @@ +@@ -0,0 +1,73 @@ +# Copyright 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -90,7 +90,10 @@ testsuite: +} + +gdb_exit ++set match_max_old [match_max] ++match_max -d 1000000 +gdb_start ++match_max -d $match_max_old +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + @@ -106,5 +109,9 @@ testsuite: +gdb_test "continue" "Breakpoint.*x.*" "continue to x" + +gdb_test "f 1" ".*signal handler called.*" "frame 1" -+gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame" -+ ++ ++# gdb-7.0+ no longer prints the pseudo registers as they are computed. ++# frame_info says: /* For moment, only display registers that were saved on the ++# stack. */ ++gdb_test "set debug frame 1" ++gdb_test "info frame" "Stack level 1, .*frame_unwind_register_value \\(frame=1,regnum=750\\(p63\\),\[^\r\n\]*\r\n\[^\r\n\]*-> computed bytes=.*" "info sigtramp frame" diff --git a/gdb-6.3-watchpoint-cond-gone-test.patch b/gdb-6.3-watchpoint-cond-gone-test.patch deleted file mode 100644 index cd8a237..0000000 --- a/gdb-6.3-watchpoint-cond-gone-test.patch +++ /dev/null @@ -1,128 +0,0 @@ ---- /dev/null 2008-04-03 00:39:30.714021604 +0200 -+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c 2008-04-05 20:26:29.000000000 +0200 -@@ -0,0 +1,23 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -+ -+void -+jumper (void (*jumpto) (void)) -+{ -+ (*jumpto) (); -+} ---- /dev/null 2008-04-03 00:39:30.714021604 +0200 -+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.c 2008-04-05 20:26:48.000000000 +0200 -@@ -0,0 +1,37 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -+ -+extern void jumper (void (*jumpto) (void)); -+ -+void -+func () -+{ -+ int a, b, c; -+ -+ a = b = c = 5; -+ a = b = c = 10; /* watchpoint-here */ -+ c = a + b; -+} -+ -+int -+main () -+{ -+ jumper (func); -+ -+ return 0; -+} ---- /dev/null 2008-04-03 00:39:30.714021604 +0200 -+++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp 2008-04-05 20:33:19.000000000 +0200 -@@ -0,0 +1,59 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set testfile "watchpoint-cond-gone" -+set srcfile ${testfile}.c -+set srcfilestripped ${testfile}-stripped.c -+set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o -+set binfile ${objdir}/${subdir}/${testfile} -+ -+# We need to generate a function without DWARF to crash older GDB. -+# Stepping into a dynamic function trampoline or stepping out of MAIN may work -+# but it is not a reliable FAIL case. -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# Problem does not occur otherwise. -+gdb_test "set can-use-hw-watchpoints 0" -+ -+runto_main -+gdb_breakpoint [gdb_get_line_number "watchpoint-here"] -+gdb_continue_to_breakpoint "Place to set the watchpoint" -+ -+# The condition `c == 30' is the tested culprit. -+gdb_test "watch c if c == 30" "" "Place the watchpoint" -+ -+# No functionality, just to check the state. -+gdb_test "backtrace" -+ -+gdb_test "finish" \ -+ "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \ -+ "Catch the no longer valid watchpoint" diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch index b2dc451..ab0c902 100644 --- a/gdb-6.5-bz216711-clone-is-outermost.patch +++ b/gdb-6.5-bz216711-clone-is-outermost.patch @@ -162,6 +162,154 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c }; /* Floating-point registers. */ +--- a/gdb/ia64-tdep.c ++++ b/gdb/ia64-tdep.c +@@ -2122,6 +2122,137 @@ static const struct frame_unwind ia64_frame_unwind = + default_frame_sniffer + }; + ++/* Detect the outermost frame; during unwind of ++ #6 0x2000000000347100 in __clone2 () from /lib/libc.so.6.1 ++ avoid the additional bogus frame ++ #7 0x0000000000000000 in ?? () */ ++ ++static char linux_clone2_code[] = ++{ ++/* libc/sysdeps/unix/sysv/linux/ia64/clone2.S */ ++ 0x09, 0x00, 0x20, 0x12, 0x90, 0x11, 0x00, 0x40, ++ 0x28, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00, ++/* st4 [r9]=r8 */ ++/* st4 [r10]=r8 */ ++/* ;; */ ++/* #endif */ ++ 0x02, 0x50, 0x21, 0x40, 0x18, 0x14, 0x90, 0x02, ++ 0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00, ++/* 1: ld8 out1=[in0],8 |* Retrieve code pointer. *| */ ++/* mov out0=in4 |* Pass proper argument to fn *| */ ++/* ;; */ ++ 0x11, 0x08, 0x00, 0x40, 0x18, 0x10, 0x60, 0x50, ++ 0x05, 0x80, 0x03, 0x00, 0x68, 0x00, 0x80, 0x12, ++/* ld8 gp=[in0] |* Load function gp. *| */ ++/* mov b6=out1 */ ++/* br.call.dptk.many rp=b6 |* Call fn(arg) in the child *| */ ++/* ;; */ ++ 0x10, 0x48, 0x01, 0x10, 0x00, 0x21, 0x10, 0x00, ++ 0xa0, 0x00, 0x42, 0x00, 0x98, 0xdf, 0xf7, 0x5b, ++/* mov out0=r8 |* Argument to _exit *| */ ++/* mov gp=loc0 */ ++/* .globl HIDDEN_JUMPTARGET(_exit) */ ++/* br.call.dpnt.many rp=HIDDEN_JUMPTARGET(_exit) */ ++/* |* call _exit with result from fn. *| */ ++ 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, ++ 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x84, 0x00 ++/* ret |* Not reached. *| */ ++}; ++ ++#define LINUX_CLONE_PRE_SLOTS 3 /* Number of slots before PC. */ ++#define LINUX_CLONE_LEN (sizeof linux_clone2_code) ++ ++static int ++ia64_linux_clone2_running (struct frame_info *this_frame) ++{ ++ CORE_ADDR pc = get_frame_pc (this_frame); ++ char buf[LINUX_CLONE_LEN]; ++ struct minimal_symbol *minsym; ++ long long instr; ++ ++ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_PRE_SLOTS * 16, ++ buf, LINUX_CLONE_LEN)) ++ return 0; ++ ++ if (memcmp (buf, linux_clone2_code, LINUX_CLONE_PRE_SLOTS * 16) != 0) ++ return 0; ++ ++ /* Adjust the expected "_exit" address. */ ++ minsym = lookup_minimal_symbol_text ("_exit", NULL); ++ if (minsym == NULL) ++ return 0; ++ ++ instr = slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], 2); ++ instr &= ~(((1L << 20) - 1) << 13); ++ /* Address is relative to the jump instruction slot, not the next one. */ ++ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4) ++ & ((1L << 20) - 1)) << 13; ++ replace_slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], instr, 2); ++ ++ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16], ++ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], ++ LINUX_CLONE_LEN - (LINUX_CLONE_PRE_SLOTS * 16)) != 0) ++ return 0; ++ ++ return 1; ++} ++ ++static int ++ia64_outermost_frame (struct frame_info *this_frame) ++{ ++ CORE_ADDR pc = get_frame_pc (this_frame); ++ char *name; ++ ++ find_pc_partial_function (pc, &name, NULL, NULL); ++ ++ /* If we have NAME, we can optimize the search. ++ `clone' NAME still needs to have the code checked as its name may be ++ present in the user code. ++ `__clone' NAME should not be present in the user code but in the initial ++ parts of the `__clone' implementation the unwind still makes sense. ++ More detailed unwinding decision would be too much sensitive to possible ++ subtle changes in specific glibc revisions. */ ++ if (name == NULL || strcmp (name, "clone2") == 0 ++ || strcmp ("__clone2", name) == 0) ++ return (ia64_linux_clone2_running (this_frame) != 0); ++ ++ return 0; ++} ++ ++static void ++ia64_clone2_frame_this_id (struct frame_info *this_frame, void **this_cache, ++ struct frame_id *this_id) ++{ ++ /* Leave the default outermost frame at *THIS_ID. */ ++} ++ ++static struct value * ++ia64_clone2_frame_prev_register (struct frame_info *this_frame, ++ void **this_cache, int regnum) ++{ ++ return frame_unwind_got_register (this_frame, regnum, regnum); ++} ++ ++static int ++ia64_clone2_frame_sniffer (const struct frame_unwind *self, ++ struct frame_info *this_frame, ++ void **this_prologue_cache) ++{ ++ if (ia64_outermost_frame (this_frame)) ++ return 1; ++ ++ return 0; ++} ++ ++static const struct frame_unwind ia64_clone2_frame_unwind = ++{ ++ NORMAL_FRAME, ++ &ia64_clone2_frame_this_id, ++ &ia64_clone2_frame_prev_register, ++ NULL, ++ &ia64_clone2_frame_sniffer ++}; ++ + /* Signal trampolines. */ + + static void +@@ -3824,6 +3955,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + set_gdbarch_dummy_id (gdbarch, ia64_dummy_id); + + set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc); ++ frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind); + #ifdef HAVE_LIBUNWIND_IA64_H + frame_unwind_append_unwinder (gdbarch, + &ia64_libunwind_sigtramp_frame_unwind); Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 diff --git a/gdb-7.0-upstream.patch b/gdb-7.0-upstream.patch index 80b8f2d..130b47e 100644 --- a/gdb-7.0-upstream.patch +++ b/gdb-7.0-upstream.patch @@ -3221,3 +3221,65 @@ http://sourceware.org/ml/gdb-cvs/2009-12/msg00128.html -# Verify GDB really could not catch any other breakpoint location. - -gdb_continue_to_breakpoint "uncaught return" ".*exit-line.*" + + + +http://sourceware.org/ml/gdb-cvs/2009-11/msg00213.html + +[ cut ] + +--- src/gdb/testsuite/gdb.base/condbreak.exp 2009/01/03 05:58:03 1.13 ++++ src/gdb/testsuite/gdb.base/condbreak.exp 2009/11/25 20:43:29 1.14 +@@ -207,10 +207,10 @@ + setup_xfail hppa2.0w-*-* 11512CLLbs + send_gdb "continue\n" + gdb_expect { +- -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { ++ -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" { + pass "run until breakpoint at marker2" + } +- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { ++ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" { + xfail "run until breakpoint at marker2" + } + -re "$gdb_prompt $" { + + + +Fix for gfortran-4.1: + -PASS: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ + +FAIL: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ (unknown output after running) + +RFC: Move language-changed message to verbose +http://sourceware.org/ml/gdb-patches/2009-11/msg00031.html +http://sourceware.org/ml/gdb-cvs/2009-11/msg00034.html + +### src/gdb/ChangeLog 2009/11/05 19:53:03 1.11030 +### src/gdb/ChangeLog 2009/11/05 20:43:52 1.11031 +## -1,3 +1,8 @@ ++2009-11-05 Daniel Jacobowitz ++ ++ * top.c (execute_command): Select a frame before checking the current ++ language. Only output a message if verbose. ++ + 2009-11-05 Tom Tromey + + * symtab.h (SYMBOL_SET_LINKAGE_NAME): Update comment. +--- src/gdb/top.c 2009/10/19 09:51:42 1.172 ++++ src/gdb/top.c 2009/11/05 20:43:52 1.173 +@@ -457,10 +457,13 @@ + + } + +- /* Tell the user if the language has changed (except first time). */ ++ /* Tell the user if the language has changed (except first time). ++ First make sure that a new frame has been selected, in case this ++ command or the hooks changed the program state. */ ++ deprecated_safe_get_selected_frame (); + if (current_language != expected_language) + { +- if (language_mode == language_mode_auto) ++ if (language_mode == language_mode_auto && info_verbose) + { + language_info (1); /* Print what changed. */ + } diff --git a/gdb-testsuite-unknown-output.patch b/gdb-testsuite-unknown-output.patch new file mode 100644 index 0000000..89decac --- /dev/null +++ b/gdb-testsuite-unknown-output.patch @@ -0,0 +1,69 @@ +http://sourceware.org/ml/gdb-patches/2009-12/msg00473.html +Subject: [patch] testsuite: false MI "unknown output after running" regression + +Hi, + +the attached patch will turn the results this way: +-KFAIL: gdb.mi/mi-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104) ++KFAIL: gdb.mi/mi-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104) +-XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (unknown output after running) ++XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (stopped at wrong place) +-KFAIL: gdb.mi/mi2-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104) ++KFAIL: gdb.mi/mi2-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104) +-XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (unknown output after running) ++XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (stopped at wrong place) + +This is a fix of KFAIL-kind regression due to: +commit 26d086d741fb1bb0eee9d50e0bafa7c5e388023f +Re: [RFA] fix *stopped for CLI commands +http://sourceware.org/ml/gdb-patches/2009-02/msg00278.html +http://sourceware.org/ml/gdb-cvs/2009-02/msg00084.html +part: +gdb/testsuite/ +2009-02-14 Vladimir Prus + * lib/mi-support.exp (mi_expect_stop): Adjust the order of fields. + (mi_expect_interrupt): Likewise. + * gdb.mi/mi-cli.exp: Check that "step" results in proper *stopped + response. + +re-wdiff-ed for your convenience as: + verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" + -re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" { + -re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}[-$any-]{+thread-id=\"$decimal\",stopped-threads=$any+}\r\n$prompt_re" { + +FYI there is: set any "\[^\n\]*" + +"stopped at wrong place" is the right kind of KFAIL/XFAIL (tested +gcc-4.1.2-46.el5_4.1.x86_64 and gcc-4.4.2-20.fc12.x86_64) as discussed +in PR gdb/2104. + +In the last case there is missing comma (,) after the former patch above. + +$after_stopped was IMO missing there even before. It is in use only by +gdb.mi/mi-simplerun.exp and gdb.mi/mi2-simplerun.exp. Also fixed below. + +No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. + + +Thanks, +Jan + + +gdb/testsuite/ +2009-12-31 Jan Kratochvil + + * lib/mi-support.exp (mi_expect_stop ): Insert + missing $after_stopped and comma (,) expectation. + +--- a/gdb/testsuite/lib/mi-support.exp ++++ b/gdb/testsuite/lib/mi-support.exp +@@ -1038,7 +1038,7 @@ proc mi_expect_stop { reason func args file line extra test } { + pass "$test" + return $expect_out(2,string) + } +- -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" { ++ -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" { + verbose -log "got $expect_out(buffer)" + fail "$test (stopped at wrong place)" + return -1 + diff --git a/gdb-watchpoint-cond-gone.patch b/gdb-watchpoint-cond-gone.patch new file mode 100644 index 0000000..12a4c76 --- /dev/null +++ b/gdb-watchpoint-cond-gone.patch @@ -0,0 +1,231 @@ +http://sourceware.org/ml/gdb-patches/2009-12/msg00394.html +Subject: [patch] Fix watchpoint-at-epilogue 7.0 regression (s390x) + +Hi, + +attached testcase regressed 6.8->7.0 on some s390x systems. + +At the moment PC is at epilogue (after frame pointer got destroyed and PC is +still in the calleed function) we must not try any unwinding as it can try to +unwind a garbage. + +Correct way would be to implement epilogue unwinder (such as +amd64_epilogue_frame_unwind or i386_epilogue_frame_unwind ones) but it would +not be so easy on s390x as it would need full prologue-analyzer: After SP gets +restored there can be various instructions before the last jump - GDB needs to +interpret the jump to find the register value where it is going to jump to. +00000048279aa09c : +[...] + 48279aa1b8: eb 6f f0 d0 00 04 lmg %r6,%r15,208(%r15) + 48279aa1be: 50 32 10 00 st %r3,0(%r2,%r1) # SP (%r15) is gone hone + 48279aa1c2: b3 74 00 00 lzer %r0 + 48279aa1c6: 07 f4 br %r4 # %r4 is the target +[...] + +Just an easy fix is to be more careful and do not try any unwinding if we find +PC is in the epilogue (previous instruction modifies SP=%r15). + +It is even a performance optimization and I see no regression risk there. + +The specific s390x error is: +#0 throw_error (error=MEMORY_ERROR, fmt=0x8042676a "Cannot access memory at address %s") at exceptions.c:415 +#1 in memory_error (status=5, memaddr=0) at corefile.c:220 +#2 in read_memory (memaddr=0, myaddr=0x3ffffc7f7f0 "", len=8) at corefile.c:238 +#3 in read_memory_unsigned_integer (memaddr=0, len=8, byte_order=BFD_ENDIAN_BIG) at corefile.c:321 +#4 in s390_backchain_frame_unwind_cache (this_frame=0x80608958, info=0x80608a08) at s390-tdep.c:1525 +#5 in s390_frame_unwind_cache (this_frame=0x80608958, this_prologue_cache=0x80608970) at s390-tdep.c:1572 +#6 in s390_frame_this_id (this_frame=0x80608958, this_prologue_cache=0x80608970, this_id=0x806089b8) at s390-tdep.c:1583 +#7 in get_frame_id (fi=0x80608958) at frame.c:335 +#8 in frame_find_by_id (id={stack_addr = 4398044824952, code_addr = 2147484952, special_addr = 0, stack_addr_p = 1, code_addr_p = 1, special_addr_p = 0, inline_depth = 0}) at frame.c:587 +#9 in watchpoint_check (p=0x8095bbc0) at breakpoint.c:3203 +#10 in catch_errors (func=0x801262c0 , func_args=0x8095bbc0, errstring=0x80a26410 "Error evaluating expression for watchpoint 3\n", mask=6) at exceptions.c:510 +#11 in bpstat_check_watchpoint (bs=0x8095bbc0) at breakpoint.c:3404 +#12 in bpstat_stop_status (aspace=0x8061fcb0, bp_addr=2147485040, ptid={pid = 17372, lwp = 17372, tid = 0}) at breakpoint.c:3594 +#13 in handle_inferior_event (ecs=0x3ffffc80520) at infrun.c:3588 + +I did not analyze why 6.8 did not error out, the GDB code is similar there. + +No regressions on: +{x86_64,x86_64-m32,i686}-fedora12-linux-gnu (CVS HEAD GDB) +s390x-rhel48-linux-gnu (CVS HEAD GDB) +s390-rhel48-linux-gnu (CVS HEAD GDB) +s390x-rhel54-linux-gnu (Fedora 12 GDB) +s390-rhel54-linux-gnu (Fedora 12 GDB) + + +Thanks, +Jan + + +gdb/ +2009-12-25 Jan Kratochvil + + * breakpoint.c (watchpoint_check): Check the call + gdbarch_in_function_epilogue_p before calling frame_find_by_id. + Extend the comment. + +gdb/testsuite/ +2009-12-25 Jan Kratochvil + + * gdb.base/watchpoint-cond-gone.exp, gdb.base/watchpoint-cond-gone.c, + gdb.base/watchpoint-cond-gone-stripped.c: New. + +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -3200,6 +3200,17 @@ watchpoint_check (void *p) + struct gdbarch *frame_arch = get_frame_arch (frame); + CORE_ADDR frame_pc = get_frame_pc (frame); + ++ /* in_function_epilogue_p() returns a non-zero value if we're still ++ in the function but the stack frame has already been invalidated. ++ Since we can't rely on the values of local variables after the ++ stack has been destroyed, we are treating the watchpoint in that ++ state as `not changed' without further checking. Don't mark ++ watchpoints as changed if the current frame is in an epilogue - ++ even if they are in some other frame, our view of the stack ++ is likely to be wrong and frame_find_by_id could error out. */ ++ if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc)) ++ return WP_VALUE_NOT_CHANGED; ++ + fr = frame_find_by_id (b->watchpoint_frame); + within_current_scope = (fr != NULL); + +@@ -3216,17 +3227,6 @@ watchpoint_check (void *p) + within_current_scope = 0; + } + +- /* in_function_epilogue_p() returns a non-zero value if we're still +- in the function but the stack frame has already been invalidated. +- Since we can't rely on the values of local variables after the +- stack has been destroyed, we are treating the watchpoint in that +- state as `not changed' without further checking. Don't mark +- watchpoints as changed if the current frame is in an epilogue - +- even if they are in some other frame, our view of the stack +- is likely to be wrong. */ +- if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc)) +- return WP_VALUE_NOT_CHANGED; +- + if (within_current_scope) + /* If we end up stopping, the current frame will get selected + in normal_stop. So this call to select_frame won't affect +--- /dev/null ++++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c +@@ -0,0 +1,23 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++void ++jumper (void (*jumpto) (void)) ++{ ++ (*jumpto) (); ++} +--- /dev/null ++++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c +@@ -0,0 +1,37 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++extern void jumper (void (*jumpto) (void)); ++ ++static void ++func (void) ++{ ++ volatile int c; ++ ++ c = 5; ++ c = 10; /* watchpoint-here */ ++ c = 20; ++} ++ ++int ++main (void) ++{ ++ jumper (func); ++ ++ return 0; ++} +--- /dev/null ++++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp +@@ -0,0 +1,51 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++set testfile "watchpoint-cond-gone" ++set srcfile ${testfile}.c ++set srcfilestripped ${testfile}-stripped.c ++set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o ++set binfile ${objdir}/${subdir}/${testfile} ++ ++# We need to generate a function without DWARF to crash older GDB. ++# Stepping into a dynamic function trampoline or stepping out of MAIN may work ++# but it is not a reliable FAIL case. ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != "" ++ || [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++clean_restart ${testfile} ++ ++# Problem does not occur otherwise. ++gdb_test "set can-use-hw-watchpoints 0" ++ ++if ![runto_main] { ++ return -1 ++} ++ ++gdb_breakpoint [gdb_get_line_number "watchpoint-here"] ++gdb_continue_to_breakpoint "Place to set the watchpoint" ++ ++# The condition `c == 30' is the subject being tested. ++gdb_test "watch c if c == 30" "" "Place the watchpoint" ++ ++# We may stay either in the function itself or only at the first instruction of ++# its caller depending on the epilogue unwinder (or valid epilogue CFI) presence. ++gdb_test "finish" \ ++ "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \ ++ "Catch the no longer valid watchpoint" + diff --git a/gdb.spec b/gdb.spec index 0bf1d17..fb07537 100644 --- a/gdb.spec +++ b/gdb.spec @@ -36,7 +36,7 @@ Version: 7.0 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 14%{?_with_upstream:.upstream}%{dist} +Release: 15%{?_with_upstream:.upstream}%{dist} License: GPLv3+ Group: Development/Debuggers @@ -318,8 +318,8 @@ Patch309: gdb-6.3-mapping-zero-inode-test.patch # Test a crash on `focus cmd', `focus prev' commands. Patch311: gdb-6.3-focus-cmd-prev-test.patch -# Test crash on a sw watchpoint condition getting out of the scope. -Patch314: gdb-6.3-watchpoint-cond-gone-test.patch +# Fix error on a sw watchpoint active at function epilogue (hit on s390x). +Patch314: gdb-watchpoint-cond-gone.patch # Test various forms of threads tracking across exec() (BZ 442765). Patch315: gdb-6.8-bz442765-threaded-exec-test.patch @@ -423,6 +423,9 @@ Patch396: gdb-ppc-hw-watchpoint-twice.patch # Fix regression by python on ia64 due to stale current frame. Patch397: gdb-follow-child-stale-parent.patch +# testsuite: Fix false MI "unknown output after running" regression. +Patch398: gdb-testsuite-unknown-output.patch + BuildRequires: ncurses-devel texinfo gettext flex bison expat-devel Requires: readline BuildRequires: readline-devel @@ -667,6 +670,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch395 -p1 %patch396 -p1 %patch397 -p1 +%patch398 -p1 find -name "*.orig" | xargs rm -f ! find -name "*.rej" # Should not happen. @@ -978,6 +982,13 @@ fi %endif %changelog +* Fri Jan 1 2009 Jan Kratochvil - 7.0-15.fc12 +- Fix error on a sw watchpoint active at function epilogue (hit on s390x). +- testsuite: Fix false MI "unknown output after running" regression. +- testsuite: Update ia64-sigtramp.exp for recent GDB. +- Implement bt-clone-stop.exp fix also for ia64. +- testsuite: Upstream condbreak.exp results stability fix (Daniel Jacobowitz). + * Thu Dec 24 2009 Jan Kratochvil - 7.0-14.fc12 - testsuite: Fix constructortest.exp and expand-sals.exp for gcc-4.4.2-20.fc12.