]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/ctti.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / ctti.exp
CommitLineData
6aba47ca 1# Copyright 1998, 1999, 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
a0b3c4fd
JM
2
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
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
a0b3c4fd
JM
17# This file is part of the gdb testsuite
18# file written by Elena Zannoni (ezannoni@cygnus.com)
96da2469 19# rewritten by Michael Chastain (mec.gnu@mindspring.com)
a0b3c4fd
JM
20#
21# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
a0b3c4fd 22
96da2469 23# Call to template instantiations.
a0b3c4fd
JM
24
25if $tracelevel then {
96da2469 26 strace $tracelevel
a0b3c4fd
JM
27}
28
fc33412a 29if { [skip_cplus_tests] } { continue }
55b13a65 30
a0b3c4fd 31set testfile "cttiadd"
dd8c8ee7
MC
32set srcfile "${testfile}.cc"
33set srcfile1 "${testfile}1.cc"
34set srcfile2 "${testfile}2.cc"
35set srcfile3 "${testfile}3.cc"
36set objfile "${testfile}.o"
37set objfile1 "${testfile}1.o"
38set objfile2 "${testfile}2.o"
39set objfile3 "${testfile}3.o"
96da2469
MC
40set binfile "${objdir}/${subdir}/${testfile}"
41
dd8c8ee7 42if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
b60f0898
JB
43 untested ctti.exp
44 return -1
96da2469 45}
a0b3c4fd 46
dd8c8ee7 47if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
b60f0898
JB
48 untested ctti.exp
49 return -1
a0b3c4fd
JM
50}
51
dd8c8ee7 52if { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
b60f0898
JB
53 untested ctti.exp
54 return -1
96da2469 55}
a0b3c4fd 56
dd8c8ee7 57if { [gdb_compile "$srcdir/$subdir/$srcfile3" "$objdir/$subdir/$objfile3" object {debug c++}] != "" } {
b60f0898
JB
58 untested ctti.exp
59 return -1
96da2469 60}
a0b3c4fd 61
dd8c8ee7 62if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2 $objdir/$subdir/$objfile3" "${binfile}" executable {debug c++}] != "" } {
b60f0898
JB
63 untested ctti.exp
64 return -1
96da2469 65}
a0b3c4fd 66
96da2469
MC
67if [get_compiler_info ${binfile} "c++"] {
68 return -1;
69}
a0b3c4fd
JM
70
71gdb_exit
72gdb_start
73gdb_reinitialize_dir $srcdir/$subdir
74gdb_load ${binfile}
75
a0b3c4fd
JM
76if ![runto_main] then {
77 perror "couldn't run to breakpoint"
78 continue
79}
80
2789202a
MC
81gdb_breakpoint [gdb_get_line_number "marker add1"]
82gdb_continue_to_breakpoint "marker add1"
96da2469 83
6ea9fb37 84gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
96da2469
MC
85gdb_test "print f" "\\$\[0-9\]+ = 9"
86gdb_test "print i" "\\$\[0-9\]+ = 4"
87
2789202a
MC
88# TODO: this needs more work before actually deploying it.
89# So bail out here.
90
91if { [ test_compiler_info gcc-*] } then { continue }
92
96da2469
MC
93gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
94 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
95 pass "print add<int>(2,2)"
96 }
97 -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
98 # TODO: kfail or xfail this
99 fail "print add<int>(2,2)"
100 }
101}
a0b3c4fd 102
96da2469
MC
103# Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
104gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
105 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
106 pass "print add<float>(2.25,2.25)"
107 }
108 -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
109 # TODO: kfail or xfail this
110 fail "print add<float>(2.25,2.25)"
111 }
112}
a0b3c4fd 113
6ea9fb37 114gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
96da2469 115 -re "\\$\[0-9\]+ = -126 .*\r\n$gdb_prompt $" {
6ea9fb37 116 pass "print add<unsigned char>('A','A')"
96da2469 117 }
6ea9fb37 118 -re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
96da2469 119 # TODO: kfail or xfail this
6ea9fb37 120 fail "print add<unsigned char>('A','A')"
96da2469
MC
121 }
122}
a0b3c4fd 123
96da2469
MC
124gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
125 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
126 pass "print add2<int>(2,2)"
127 }
128 -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
129 # TODO: kfail or xfail this
130 fail "print add2<int>(2,2)"
131 }
132}
a0b3c4fd 133
96da2469
MC
134gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
135 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
136 pass "print add2<float>(2.25,2.25)"
137 }
138 -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
139 # TODO: kfail or xfail this
140 fail "print add2<float>(2.25,2.25)"
141 }
142}
a0b3c4fd 143
6ea9fb37 144gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
96da2469 145 -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
6ea9fb37 146 pass "print add2<unsigned char>('A','A')"
96da2469 147 }
6ea9fb37 148 -re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
96da2469 149 # TODO: kfail or xfail this
6ea9fb37 150 fail "print add2<unsigned char>('A','A')"
96da2469
MC
151 }
152}
a0b3c4fd 153
96da2469
MC
154gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
155 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
156 pass "print add3<int>(2,2)"
157 }
158 -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
159 # TODO: kfail or xfail this
160 fail "print add3<int>(2,2)"
161 }
162}
a0b3c4fd 163
96da2469
MC
164gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
165 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
166 pass "print add3<float>(2.25,2.25)"
167 }
168 -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
169 # TODO: kfail or xfail this
170 fail "print add3<float>(2.25,2.25)"
171 }
172}
a0b3c4fd 173
6ea9fb37 174gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
96da2469 175 -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
6ea9fb37 176 pass "print add3<unsigned char>('A','A')"
96da2469 177 }
6ea9fb37 178 -re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
96da2469 179 # TODO: kfail or xfail this
6ea9fb37 180 fail "print add3<unsigned char>('A','A')"
96da2469
MC
181 }
182}
a0b3c4fd 183
96da2469
MC
184gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
185 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
186 pass "print add4<int>(2,2)"
187 }
188 -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
189 # TODO: kfail or xfail this
190 fail "print add4<int>(2,2)"
191 }
192}
a0b3c4fd 193
96da2469
MC
194gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
195 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
196 pass "print add4<float>(2.25,2.25)"
197 }
198 -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
199 # TODO: kfail or xfail this
200 fail "print add4<float>(2.25,2.25)"
201 }
202}
a0b3c4fd 203
6ea9fb37 204gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
96da2469 205 -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
6ea9fb37 206 pass "print add4<unsigned char>('A','A')"
96da2469 207 }
6ea9fb37 208 -re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
96da2469 209 # TODO: kfail or xfail this
6ea9fb37 210 fail "print add4<unsigned char>('A','A')"
96da2469
MC
211 }
212}