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