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

Side by Side Diff: gdb/testsuite/gdb.cp/casts.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/call-c.exp ('k') | gdb/testsuite/gdb.cp/class2.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 2002-2004, 2007-2012 Free Software Foundation, Inc. 1 # Copyright 2002-2004, 2007-2012 Free Software Foundation, Inc.
2 2
3 # This program is free software; you can redistribute it and/or modify 3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by 4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or 5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version. 6 # (at your option) any later version.
7 # 7 #
8 # This program is distributed in the hope that it will be useful, 8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 15
16 # This file is part of the gdb testsuite 16 # This file is part of the gdb testsuite
17 17
18 # Test casting, especially between class types or pointer-to-class 18 # Test casting, especially between class types or pointer-to-class
19 # types. 19 # types.
20 20
21 # This file is part of the gdb testsuite 21 # This file is part of the gdb testsuite
22 22
23 if $tracelevel then {
24 strace $tracelevel
25 }
26
27 # 23 #
28 # test running programs 24 # test running programs
29 # 25 #
30 26
31 27
32 if { [skip_cplus_tests] } { continue } 28 if { [skip_cplus_tests] } { continue }
33 29
34 set testfile "casts" 30 standard_testfile .cc
35 set srcfile ${testfile}.cc
36 set binfile ${objdir}/${subdir}/${testfile}
37 31
38 if [get_compiler_info ${binfile} "c++"] { 32 if [get_compiler_info "c++"] {
39 return -1; 33 return -1;
40 } 34 }
41 35
42 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb ug c++}] != "" } { 36 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
43 untested casts.exp 37 return -1
44 return -1
45 } 38 }
46 39
47
48 gdb_exit
49 gdb_start
50 gdb_reinitialize_dir $srcdir/$subdir
51 gdb_load ${binfile}
52
53 if ![runto_main] then { 40 if ![runto_main] then {
54 perror "couldn't run to breakpoint" 41 perror "couldn't run to breakpoint"
55 continue 42 continue
56 } 43 }
57 44
58 gdb_test "break [gdb_get_line_number "casts.exp: 1"]" \ 45 gdb_test "break [gdb_get_line_number "casts.exp: 1"]" \
59 "Breakpoint.*at.* file .*" \ 46 "Breakpoint.*at.* file .*" \
60 "" 47 ""
61 48
62 gdb_test "continue" "Breakpoint .* at .*casts.cc.*" "" 49 gdb_test "continue" "Breakpoint .* at .*casts.cc.*" ""
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 121
135 gdb_test "print dynamic_cast<Alpha *> (&derived)" \ 122 gdb_test "print dynamic_cast<Alpha *> (&derived)" \
136 " = \\(Alpha \\*\\) $nonzero_hex" \ 123 " = \\(Alpha \\*\\) $nonzero_hex" \
137 "dynamic_cast simple upcast" 124 "dynamic_cast simple upcast"
138 125
139 gdb_test "print dynamic_cast<Alpha *> (&doublyderived)" \ 126 gdb_test "print dynamic_cast<Alpha *> (&doublyderived)" \
140 " = \\(Alpha \\*\\) $nonzero_hex" \ 127 " = \\(Alpha \\*\\) $nonzero_hex" \
141 "dynamic_cast upcast to unique base" 128 "dynamic_cast upcast to unique base"
142 129
143 gdb_test "print dynamic_cast<Alpha &> (derived)" \ 130 gdb_test "print dynamic_cast<Alpha &> (derived)" \
144 " = \\(Alpha \\&\\) @$nonzero_hex: {.* = $nonzero_hex}" \ 131 " = \\(Alpha \\&\\) @$nonzero_hex: {.* = ${nonzero_hex}( <vtable for Derived .*>)?}" \
145 "dynamic_cast simple upcast to reference" 132 "dynamic_cast simple upcast to reference"
146 133
147 gdb_test "print dynamic_cast<Derived *> (ad)" \ 134 gdb_test "print dynamic_cast<Derived *> (ad)" \
148 " = \\(Derived \\*\\) $nonzero_hex" \ 135 " = \\(Derived \\*\\) ${nonzero_hex}( <vtable for Derived.*>)?" \
149 "dynamic_cast simple downcast" 136 "dynamic_cast simple downcast"
150 137
151 gdb_test "print dynamic_cast<VirtuallyDerived *> (add)" \ 138 gdb_test "print dynamic_cast<VirtuallyDerived *> (add)" \
152 " = \\(VirtuallyDerived \\*\\) $nonzero_hex" \ 139 " = \\(VirtuallyDerived \\*\\) $nonzero_hex" \
153 "dynamic_cast simple downcast to intermediate class" 140 "dynamic_cast simple downcast to intermediate class"
154 141
155 gdb_test "print dynamic_cast<VirtuallyDerived *> (ad)" \ 142 gdb_test "print dynamic_cast<VirtuallyDerived *> (ad)" \
156 " = \\(VirtuallyDerived \\*\\) 0x0" \ 143 " = \\(VirtuallyDerived \\*\\) 0x0" \
157 "dynamic_cast to non-existing base" 144 "dynamic_cast to non-existing base"
158 145
159 gdb_test "print dynamic_cast<VirtuallyDerived &> (*ad)" \ 146 gdb_test "print dynamic_cast<VirtuallyDerived &> (*ad)" \
160 "dynamic_cast failed" \ 147 "dynamic_cast failed" \
161 "dynamic_cast to reference to non-existing base" 148 "dynamic_cast to reference to non-existing base"
162 149
163 gdb_test "print dynamic_cast<DoublyDerived *> (add)" \ 150 gdb_test "print dynamic_cast<DoublyDerived *> (add)" \
164 " = \\(DoublyDerived \\*\\) $nonzero_hex" \ 151 " = \\(DoublyDerived \\*\\) ${nonzero_hex}( <vtable for DoublyDerived.*>)?" \
165 "dynamic_cast unique downcast" 152 "dynamic_cast unique downcast"
166 153
167 gdb_test "print dynamic_cast<Gamma *> (add)" \ 154 gdb_test "print dynamic_cast<Gamma *> (add)" \
168 " = \\(Gamma \\*\\) $nonzero_hex" \ 155 " = \\(Gamma \\*\\) $nonzero_hex" \
169 "dynamic_cast to sibling" 156 "dynamic_cast to sibling"
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.cp/call-c.exp ('k') | gdb/testsuite/gdb.cp/class2.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698