]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
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 | |
3 | @@ -0,0 +1,23 @@ | |
4 | +/* This testcase is part of GDB, the GNU debugger. | |
5 | + | |
6 | + Copyright 2008 Free Software Foundation, Inc. | |
7 | + | |
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. | |
12 | + | |
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. | |
17 | + | |
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. */ | |
21 | + | |
22 | +void | |
23 | +jumper (void (*jumpto) (void)) | |
24 | +{ | |
25 | + (*jumpto) (); | |
26 | +} | |
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 | |
29 | @@ -0,0 +1,37 @@ | |
30 | +/* This testcase is part of GDB, the GNU debugger. | |
31 | + | |
32 | + Copyright 2008 Free Software Foundation, Inc. | |
33 | + | |
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. | |
38 | + | |
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. | |
43 | + | |
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. */ | |
47 | + | |
48 | +extern void jumper (void (*jumpto) (void)); | |
49 | + | |
50 | +void | |
51 | +func () | |
52 | +{ | |
53 | + int a, b, c; | |
54 | + | |
55 | + a = b = c = 5; | |
56 | + a = b = c = 10; /* watchpoint-here */ | |
57 | + c = a + b; | |
58 | +} | |
59 | + | |
60 | +int | |
61 | +main () | |
62 | +{ | |
63 | + jumper (func); | |
64 | + | |
65 | + return 0; | |
66 | +} | |
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 | |
69 | @@ -0,0 +1,59 @@ | |
70 | +# Copyright 2008 Free Software Foundation, Inc. | |
71 | + | |
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. | |
76 | +# | |
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. | |
81 | +# | |
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. | |
85 | + | |
86 | +if $tracelevel then { | |
87 | + strace $tracelevel | |
88 | +} | |
89 | + | |
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} | |
95 | + | |
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. | |
99 | + | |
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." | |
102 | +} | |
103 | + | |
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." | |
106 | +} | |
107 | + | |
108 | +gdb_exit | |
109 | +gdb_start | |
110 | +gdb_reinitialize_dir $srcdir/$subdir | |
111 | +gdb_load ${binfile} | |
112 | + | |
113 | +# Problem does not occur otherwise. | |
114 | +gdb_test "set can-use-hw-watchpoints 0" | |
115 | + | |
116 | +runto_main | |
117 | +gdb_breakpoint [gdb_get_line_number "watchpoint-here"] | |
118 | +gdb_continue_to_breakpoint "Place to set the watchpoint" | |
119 | + | |
120 | +# The condition `c == 30' is the tested culprit. | |
121 | +gdb_test "watch c if c == 30" "" "Place the watchpoint" | |
122 | + | |
123 | +# No functionality, just to check the state. | |
124 | +gdb_test "backtrace" | |
125 | + | |
126 | +gdb_test "finish" \ | |
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" |