Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 1998-2015 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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
a0b3c4fd | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
a0b3c4fd JM |
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. | |
e22f8b7c | 12 | # |
a0b3c4fd | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
a0b3c4fd | 15 | |
a0b3c4fd JM |
16 | # This file is part of the gdb testsuite |
17 | # file written by Elena Zannoni (ezannoni@cygnus.com) | |
96da2469 | 18 | # rewritten by Michael Chastain (mec.gnu@mindspring.com) |
a0b3c4fd JM |
19 | # |
20 | # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc | |
a0b3c4fd | 21 | |
96da2469 | 22 | # Call to template instantiations. |
a0b3c4fd | 23 | |
fc33412a | 24 | if { [skip_cplus_tests] } { continue } |
55b13a65 | 25 | |
f5f3a911 | 26 | standard_testfile cttiadd.cc cttiadd1.cc cttiadd2.cc cttiadd3.cc |
a0b3c4fd | 27 | |
4c93b1db | 28 | if [get_compiler_info "c++"] { |
ae59b1da | 29 | return -1 |
96da2469 | 30 | } |
a0b3c4fd | 31 | |
f5f3a911 TT |
32 | if {[prepare_for_testing $testfile.exp $testfile \ |
33 | [list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} { | |
34 | return -1 | |
35 | } | |
a0b3c4fd | 36 | |
a0b3c4fd JM |
37 | if ![runto_main] then { |
38 | perror "couldn't run to breakpoint" | |
39 | continue | |
40 | } | |
41 | ||
2789202a MC |
42 | gdb_breakpoint [gdb_get_line_number "marker add1"] |
43 | gdb_continue_to_breakpoint "marker add1" | |
96da2469 | 44 | |
6ea9fb37 | 45 | gdb_test "print c" "\\$\[0-9\]+ = 194 .*" |
96da2469 MC |
46 | gdb_test "print f" "\\$\[0-9\]+ = 9" |
47 | gdb_test "print i" "\\$\[0-9\]+ = 4" | |
48 | ||
2789202a MC |
49 | # TODO: this needs more work before actually deploying it. |
50 | # So bail out here. | |
51 | ||
52 | if { [ test_compiler_info gcc-*] } then { continue } | |
53 | ||
96da2469 MC |
54 | gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" { |
55 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
56 | pass "print add<int>(2,2)" | |
57 | } | |
58 | -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" { | |
59 | # TODO: kfail or xfail this | |
60 | fail "print add<int>(2,2)" | |
61 | } | |
62 | } | |
a0b3c4fd | 63 | |
96da2469 MC |
64 | # Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats |
65 | gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" { | |
66 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
67 | pass "print add<float>(2.25,2.25)" | |
68 | } | |
69 | -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" { | |
70 | # TODO: kfail or xfail this | |
71 | fail "print add<float>(2.25,2.25)" | |
72 | } | |
73 | } | |
a0b3c4fd | 74 | |
6ea9fb37 | 75 | gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" { |
0105cee2 | 76 | -re "\\$\[0-9\]+ = 130 .*\r\n$gdb_prompt $" { |
6ea9fb37 | 77 | pass "print add<unsigned char>('A','A')" |
96da2469 | 78 | } |
6ea9fb37 | 79 | -re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" { |
96da2469 | 80 | # TODO: kfail or xfail this |
6ea9fb37 | 81 | fail "print add<unsigned char>('A','A')" |
96da2469 MC |
82 | } |
83 | } | |
a0b3c4fd | 84 | |
96da2469 MC |
85 | gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" { |
86 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
87 | pass "print add2<int>(2,2)" | |
88 | } | |
89 | -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" { | |
90 | # TODO: kfail or xfail this | |
91 | fail "print add2<int>(2,2)" | |
92 | } | |
93 | } | |
a0b3c4fd | 94 | |
96da2469 MC |
95 | gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" { |
96 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
97 | pass "print add2<float>(2.25,2.25)" | |
98 | } | |
99 | -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" { | |
100 | # TODO: kfail or xfail this | |
101 | fail "print add2<float>(2.25,2.25)" | |
102 | } | |
103 | } | |
a0b3c4fd | 104 | |
6ea9fb37 | 105 | gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" { |
0105cee2 | 106 | -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" { |
6ea9fb37 | 107 | pass "print add2<unsigned char>('A','A')" |
96da2469 | 108 | } |
6ea9fb37 | 109 | -re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" { |
96da2469 | 110 | # TODO: kfail or xfail this |
6ea9fb37 | 111 | fail "print add2<unsigned char>('A','A')" |
96da2469 MC |
112 | } |
113 | } | |
a0b3c4fd | 114 | |
96da2469 MC |
115 | gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" { |
116 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
117 | pass "print add3<int>(2,2)" | |
118 | } | |
119 | -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" { | |
120 | # TODO: kfail or xfail this | |
121 | fail "print add3<int>(2,2)" | |
122 | } | |
123 | } | |
a0b3c4fd | 124 | |
96da2469 MC |
125 | gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" { |
126 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
127 | pass "print add3<float>(2.25,2.25)" | |
128 | } | |
129 | -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" { | |
130 | # TODO: kfail or xfail this | |
131 | fail "print add3<float>(2.25,2.25)" | |
132 | } | |
133 | } | |
a0b3c4fd | 134 | |
6ea9fb37 | 135 | gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" { |
0105cee2 | 136 | -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" { |
6ea9fb37 | 137 | pass "print add3<unsigned char>('A','A')" |
96da2469 | 138 | } |
6ea9fb37 | 139 | -re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" { |
96da2469 | 140 | # TODO: kfail or xfail this |
6ea9fb37 | 141 | fail "print add3<unsigned char>('A','A')" |
96da2469 MC |
142 | } |
143 | } | |
a0b3c4fd | 144 | |
96da2469 MC |
145 | gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" { |
146 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
147 | pass "print add4<int>(2,2)" | |
148 | } | |
149 | -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" { | |
150 | # TODO: kfail or xfail this | |
151 | fail "print add4<int>(2,2)" | |
152 | } | |
153 | } | |
a0b3c4fd | 154 | |
96da2469 MC |
155 | gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" { |
156 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
157 | pass "print add4<float>(2.25,2.25)" | |
158 | } | |
159 | -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" { | |
160 | # TODO: kfail or xfail this | |
161 | fail "print add4<float>(2.25,2.25)" | |
162 | } | |
163 | } | |
a0b3c4fd | 164 | |
6ea9fb37 | 165 | gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" { |
0105cee2 | 166 | -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" { |
6ea9fb37 | 167 | pass "print add4<unsigned char>('A','A')" |
96da2469 | 168 | } |
6ea9fb37 | 169 | -re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" { |
96da2469 | 170 | # TODO: kfail or xfail this |
6ea9fb37 | 171 | fail "print add4<unsigned char>('A','A')" |
96da2469 MC |
172 | } |
173 | } |