1 --- /dev/null 2008-04-03 00:39:30.714021604 +0200
2 +++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c 2008-04-05 20:26:29.000000000 +0200
4 +/* This testcase is part of GDB, the GNU debugger.
6 + Copyright 2008 Free Software Foundation, Inc.
8 + This program is free software; you can redistribute it and/or modify
9 + it under the terms of the GNU General Public License as published by
10 + the Free Software Foundation; either version 2 of the License, or
11 + (at your option) any later version.
13 + This program is distributed in the hope that it will be useful,
14 + but WITHOUT ANY WARRANTY; without even the implied warranty of
15 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 + GNU General Public License for more details.
18 + You should have received a copy of the GNU General Public License
19 + along with this program; if not, write to the Free Software
20 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 +jumper (void (*jumpto) (void))
27 --- /dev/null 2008-04-03 00:39:30.714021604 +0200
28 +++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.c 2008-04-05 20:26:48.000000000 +0200
30 +/* This testcase is part of GDB, the GNU debugger.
32 + Copyright 2008 Free Software Foundation, Inc.
34 + This program is free software; you can redistribute it and/or modify
35 + it under the terms of the GNU General Public License as published by
36 + the Free Software Foundation; either version 2 of the License, or
37 + (at your option) any later version.
39 + This program is distributed in the hope that it will be useful,
40 + but WITHOUT ANY WARRANTY; without even the implied warranty of
41 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 + GNU General Public License for more details.
44 + You should have received a copy of the GNU General Public License
45 + along with this program; if not, write to the Free Software
46 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
48 +extern void jumper (void (*jumpto) (void));
56 + a = b = c = 10; /* watchpoint-here */
67 --- /dev/null 2008-04-03 00:39:30.714021604 +0200
68 +++ gdb-6.3/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp 2008-04-05 20:33:19.000000000 +0200
70 +# Copyright 2008 Free Software Foundation, Inc.
72 +# This program is free software; you can redistribute it and/or modify
73 +# it under the terms of the GNU General Public License as published by
74 +# the Free Software Foundation; either version 2 of the License, or
75 +# (at your option) any later version.
77 +# This program is distributed in the hope that it will be useful,
78 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
79 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80 +# GNU General Public License for more details.
82 +# You should have received a copy of the GNU General Public License
83 +# along with this program; if not, write to the Free Software
84 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
86 +if $tracelevel then {
90 +set testfile "watchpoint-cond-gone"
91 +set srcfile ${testfile}.c
92 +set srcfilestripped ${testfile}-stripped.c
93 +set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
94 +set binfile ${objdir}/${subdir}/${testfile}
96 +# We need to generate a function without DWARF to crash older GDB.
97 +# Stepping into a dynamic function trampoline or stepping out of MAIN may work
98 +# but it is not a reliable FAIL case.
100 +if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != "" } {
101 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
104 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
105 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
110 +gdb_reinitialize_dir $srcdir/$subdir
113 +# Problem does not occur otherwise.
114 +gdb_test "set can-use-hw-watchpoints 0"
117 +gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
118 +gdb_continue_to_breakpoint "Place to set the watchpoint"
120 +# The condition `c == 30' is the tested culprit.
121 +gdb_test "watch c if c == 30" "" "Place the watchpoint"
123 +# No functionality, just to check the state.
124 +gdb_test "backtrace"
127 + "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
128 + "Catch the no longer valid watchpoint"