From a9e8793603f4ed3c71903400ec997a04b207bc5b Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 6 Apr 2008 01:40:10 +0000 Subject: [PATCH] - Test crash on a sw watchpoint condition getting out of the scope. --- gdb-6.3-watchpoint-cond-gone-test.patch | 128 ++++++++++++++++++++++++ gdb.spec | 5 + 2 files changed, 133 insertions(+) create mode 100644 gdb-6.3-watchpoint-cond-gone-test.patch diff --git a/gdb-6.3-watchpoint-cond-gone-test.patch b/gdb-6.3-watchpoint-cond-gone-test.patch new file mode 100644 index 0000000..52d5667 --- /dev/null +++ b/gdb-6.3-watchpoint-cond-gone-test.patch @@ -0,0 +1,128 @@ +--- /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.*" \ ++ "Catch the no longer valid watchpoint" diff --git a/gdb.spec b/gdb.spec index 34b1ae8..e46ae74 100644 --- a/gdb.spec +++ b/gdb.spec @@ -349,6 +349,9 @@ 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 + BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext BuildRequires: flex bison sharutils expat-devel Requires: readline @@ -514,6 +517,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch306 -p1 %patch309 -p1 %patch311 -p1 +%patch314 -p1 find -name "*.orig" | xargs rm -f ! find -name "*.rej" # Should not happen. @@ -759,6 +763,7 @@ fi - New test of GCORE for shmid 0 shared memory mappings. - New test of a crash on `focus cmd', `focus prev' commands. - Fix a minor test race of the hardware watchpoints after the fork call. +- Test crash on a sw watchpoint condition getting out of the scope. * Fri Mar 28 2008 Jan Kratochvil - 6.8-1 - Upgrade to the latest upstream final release gdb-6.8.