Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Side by Side Diff: gdb/testsuite/gdb.cp/virtfunc.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.cp/virtfunc.cc ('k') | gdb/testsuite/gdb.cp/virtfunc2.exp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 1992, 1994-1999, 2001-2004, 2006-2012 Free Software 1 # Copyright 1992, 1994-1999, 2001-2004, 2006-2012 Free Software
2 # Foundation, Inc. 2 # Foundation, Inc.
3 3
4 # This program is free software; you can redistribute it and/or modify 4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by 5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or 6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version. 7 # (at your option) any later version.
8 # 8 #
9 # This program is distributed in the hope that it will be useful, 9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. 12 # GNU General Public License for more details.
13 # 13 #
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16
17 # This file was written by Fred Fish. (fnf@cygnus.com) 17 # This file was written by Fred Fish. (fnf@cygnus.com)
18 # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. 18 # And rewritten by Michael Chastain <mec.gnu@mindspring.com>.
19 19
20 set nl "\[\r\n\]+" 20 set nl "\[\r\n\]+"
21 21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 if { [skip_cplus_tests] } { continue } 22 if { [skip_cplus_tests] } { continue }
27 23
28 load_lib "cp-support.exp" 24 load_lib "cp-support.exp"
29 25
30 set testfile "virtfunc" 26 standard_testfile .cc
31 set srcfile ${testfile}.cc
32 set binfile ${objdir}/${subdir}/${testfile}
33 27
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ debug}] != "" } { 28 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
35 untested virtfunc.exp 29 return -1
36 return -1
37 } 30 }
38 31
39 proc test_ptype_of_classes {} { 32 proc test_ptype_of_classes {} {
40 33
41 # class VA 34 # class VA
42 35
43 cp_test_ptype_class \ 36 cp_test_ptype_class \
44 "ptype VA" "" "class" "VA" \ 37 "ptype VA" "" "class" "VA" \
45 { 38 {
46 { field public "int va;" } 39 { field public "int va;" }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 # and call D::vg as if it were non-virtual. We still have 216 # and call D::vg as if it were non-virtual. We still have
224 # to e.g. adjust "this", though. 217 # to e.g. adjust "this", though.
225 kfail "gdb/1064" "print pEe->D::vg()" 218 kfail "gdb/1064" "print pEe->D::vg()"
226 } 219 }
227 -re "Attempt to take address of value not located in memory.$nl$gdb_prom pt $" { 220 -re "Attempt to take address of value not located in memory.$nl$gdb_prom pt $" {
228 kfail "gdb/1064" "print pEe->D::vg()" 221 kfail "gdb/1064" "print pEe->D::vg()"
229 } 222 }
230 } 223 }
231 } 224 }
232 225
226 # A helper proc that creates a regular expression matching a
227 # particular vtable. NAME is the type name. Each element of ARGS is
228 # the name of a function in the vtable.
229
230 proc make_one_vtable_result {name args} {
231 global hex
232
233 set nls "\[\r\n\]+"
234
235 set result "vtable for '${name}' @ $hex .subobject @ $hex.:$nls"
236 set count 0
237 foreach func $args {
238 append result ".${count}.: $hex <$func..>${nls}"
239 incr count
240 }
241
242 return $result
243 }
244
245 # Test "info vtbl".
246
247 proc test_info_vtbl {} {
248 global hex
249
250 set nls "\[\r\n\]+"
251
252 set vt_A [make_one_vtable_result A A::f]
253 set vt_B [make_one_vtable_result B B::f]
254 set vt_V [make_one_vtable_result V VB::vvb V::vv]
255 set vt_V2 [make_one_vtable_result V VB::vvb "virtual thunk to E::vv"]
256 set vt_D [make_one_vtable_result D D::vg D::vd]
257 set vt_D2 [make_one_vtable_result D "non-virtual thunk to E::vg" D::vd]
258 set vt_E [make_one_vtable_result E E::f E::vg E::vv]
259
260 gdb_test "info vtbl a" "${vt_A}${vt_V}"
261 gdb_test "info vtbl b" "${vt_B}${vt_V}"
262 gdb_test "info vtbl c" "${vt_V}"
263 gdb_test "info vtbl d" "${vt_D}${vt_V}"
264 gdb_test "info vtbl e" "${vt_E}${vt_D2}${vt_V2}"
265 gdb_test "info vtbl pEe" "${vt_E}${vt_D2}${vt_V2}"
266
267 gdb_test "info vtbl" "Argument required.*"
268 gdb_test "info vtbl va" \
269 "This object does not have a virtual function table.*"
270 gdb_test "info vtbl all_count" \
271 "This object does not have a virtual function table.*"
272 }
273
233 proc do_tests {} { 274 proc do_tests {} {
234 global srcdir subdir binfile
235 global gdb_prompt
236
237
238 gdb_exit
239 gdb_start
240 gdb_reinitialize_dir $srcdir/$subdir
241 gdb_load $binfile
242
243 gdb_test_no_output "set language c++" "" 275 gdb_test_no_output "set language c++" ""
244 gdb_test_no_output "set width 0" "" 276 gdb_test_no_output "set width 0" ""
245 277
246 if ![runto_main] then { 278 if ![runto_main] then {
247 perror "couldn't run to breakpoint" 279 perror "couldn't run to breakpoint"
248 return 280 return
249 } 281 }
250 test_ptype_of_classes 282 test_ptype_of_classes
283 test_info_vtbl
251 284
252 gdb_breakpoint test_calls 285 gdb_breakpoint test_calls
253 gdb_test "continue" ".*Breakpoint .* test_calls.*" "" 286 gdb_test "continue" ".*Breakpoint .* test_calls.*" ""
254 test_virtual_calls 287 test_virtual_calls
255 288
256 gdb_test "next" ".*pAa->f.*" "next to pAa->f call" 289 gdb_test "next" ".*pAa->f.*" "next to pAa->f call"
257 gdb_test "next" ".*pDe->vg.*" "next to pDe->vg call" 290 gdb_test "next" ".*pDe->vg.*" "next to pDe->vg call"
258 gdb_test "step" ".*E::vg.*" "step through thunk into E::vg" 291 gdb_test "step" ".*E::vg.*" "step through thunk into E::vg"
259 } 292 }
260 293
261 do_tests 294 do_tests
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.cp/virtfunc.cc ('k') | gdb/testsuite/gdb.cp/virtfunc2.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698