1 Index: gdb/testsuite/ChangeLog
2 2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
4 * gdb.cp/constructortest.exp: New test.
5 * gdb.cp/constructortest.cc: Ditto.
6 * gdb.cp/templates.exp: Change break of dtor to be fully quoted.
8 2007-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
10 * gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the
11 `$delete' destructor variant.
13 2007-09-25 Jan Kratochvil <jan.kratochvil@redhat.com>
15 * gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting
18 2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
20 * gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs
22 * gdb.cp/constructortest.exp: Handle the change of settings breakpoints
23 always at all the ctor/dtor variants.
25 [ Removed the `gdb.cp/templates.exp' patch. ]
26 [ Updated the patch for "(X location") of GDB-6.8+. ]
28 --- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005
29 +++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005
31 +/* This testcase is part of GDB, the GNU debugger.
33 + Copyright 2005 Free Software Foundation, Inc.
35 + This program is free software; you can redistribute it and/or modify
36 + it under the terms of the GNU General Public License as published by
37 + the Free Software Foundation; either version 2 of the License, or
38 + (at your option) any later version.
40 + This program is distributed in the hope that it will be useful,
41 + but WITHOUT ANY WARRANTY; without even the implied warranty of
42 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 + GNU General Public License for more details.
45 + You should have received a copy of the GNU General Public License
46 + along with this program; if not, write to the Free Software
47 + Foundation, Inc., 59 Temple Place - Suite 330,
48 + Boston, MA 02111-1307, USA. */
68 +/* C and D are for the $delete destructor. */
87 +int main(int argc, char *argv[])
98 +A::A() /* Constructor A */
100 + x = 1; /* First line A */
101 + k = 4; /* Second line A */
104 +A::~A() /* Destructor A */
106 + x = 3; /* First line ~A */
107 + k = 6; /* Second line ~A */
112 + y = 2; /* First line B */
116 +C::C() /* Constructor C */
118 + x = 1; /* First line C */
121 +C::~C() /* Destructor C */
123 + x = 3; /* First line ~C */
128 + y = 2; /* First line D */
130 --- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
131 +++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
133 +# This testcase is part of GDB, the GNU debugger.
135 +# Copyright 2005, 2007 Free Software Foundation, Inc.
137 +# This program is free software; you can redistribute it and/or modify
138 +# it under the terms of the GNU General Public License as published by
139 +# the Free Software Foundation; either version 2 of the License, or
140 +# (at your option) any later version.
142 +# This program is distributed in the hope that it will be useful,
143 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
144 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145 +# GNU General Public License for more details.
147 +# You should have received a copy of the GNU General Public License
148 +# along with this program; if not, write to the Free Software
149 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
151 +# Check that GDB can break at multiple forms of constructors.
160 +set testfile "constructortest"
161 +set srcfile ${testfile}.cc
162 +set binfile ${objdir}/${subdir}/${testfile}
163 +# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC
165 +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } {
171 +gdb_reinitialize_dir $srcdir/$subdir
175 +# Run to `main' where we begin our tests.
178 +if ![runto_main] then {
182 +# Break on the various forms of the A::A constructor
183 +gdb_test "break A\:\:A" "Breakpoint 2 at .* \\(2 locations\\)" "breaking on A::A"
185 +# Verify that we break for the A constructor two times
186 +# Once for new A and once for new B
187 +gdb_continue_to_breakpoint "First line A"
188 +gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
189 +gdb_continue_to_breakpoint "First line A"
190 +gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
192 +# Now do the same for destructors
193 +gdb_test "break 'A::~A()'" ""
195 +# Verify that we break for the A destructor two times
196 +# Once for delete a and once for delete b
197 +gdb_continue_to_breakpoint "First line ~A"
198 +gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
199 +gdb_continue_to_breakpoint "First line ~A"
200 +gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
203 +# Verify that we can break by line number in a constructor and find
206 +gdb_test "break 'A::A()'" "" "break in constructor A 2"
207 +gdb_continue_to_breakpoint "First line A"
208 +set second_line [gdb_get_line_number "Second line A"]
209 +gdb_test "break $second_line" "Breakpoint .*, line $second_line. \\(2 locations\\)" "break by line in constructor"
210 +gdb_continue_to_breakpoint "Second line A"
211 +gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
212 +gdb_continue_to_breakpoint "Second line A"
213 +gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
215 +# Verify that we can break by line number in a destructor and find
217 +gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
218 +gdb_continue_to_breakpoint "First line ~A"
219 +set second_line_dtor [gdb_get_line_number "Second line ~A"]
220 +gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor. \\(2 locations\\)" "break by line in destructor"
221 +gdb_continue_to_breakpoint "Second line ~A"
222 +gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
223 +# FIXME: Analyse this case better.
224 +gdb_continue_to_breakpoint "Second line ~A"
225 +gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2"
226 +gdb_continue_to_breakpoint "Second line ~A"
227 +gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
230 +# Test now the $delete destructors.
235 +# Break on the various forms of the C::~C destructor
236 +gdb_test "break C\:\:~C" "Breakpoint .* \\(3 locations\\)" "breaking on C::~C"
237 +gdb_continue_to_breakpoint "First line ~C"
239 +# Verify that we can break by line number in a destructor and find
240 +# the $delete occurence
245 +set first_line_dtor [gdb_get_line_number "First line ~C"]
246 +gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor. \\(3 locations\\)" "break by line in destructor"
248 +# Run to `main' where we begin our tests.
249 +# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
250 +# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS.
252 +if ![gdb_breakpoint main] {
256 +set test "running to main"
257 +gdb_test_multiple "" $test {
258 + -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" {
263 +gdb_continue_to_breakpoint "First line ~C"