This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / pointers2.exp
CommitLineData
c906108c
SS
1# Copyright (C) 1997, 1998
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 2 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, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# This file was written by Elena Zannoni. (ezannoni@cygnus.com)
22
23
24# This file is part of the gdb testsuite
25#
26# tests for pointers
27# with elementary type variables and pointers.
28#
29
30
31if $tracelevel then {
32 strace $tracelevel
33 }
34
35#
36# test running programs
37#
38set prms_id 0
39set bug_id 0
40
41set testfile "pointers2"
42set srcfile ${testfile}.c
43set binfile ${objdir}/${subdir}/${testfile}
44
45if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
46 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
47}
48
49
50gdb_exit
51gdb_start
52gdb_reinitialize_dir $srcdir/$subdir
53gdb_load ${binfile}
54
55
56#
57# set it up at a breakpoint so we can play with the variable values
58#
59if ![runto_main] then {
60 perror "couldn't run to breakpoint"
61 continue
62}
63
64send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
65
66 send_gdb "cont\n"
67 gdb_expect {
68 -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
69 send_gdb "up\n"
70 gdb_expect {
71 -re ".*$gdb_prompt $" {}
72 timeout { fail "up from marker1" }
73 }
74 }
75 -re "$gdb_prompt $" { fail "continue to marker1" }
76 timeout { fail "(timeout) continue to marker1" }
77 }
78
79
80send_gdb "print *pUC\n"
81gdb_expect {
82 -re ".\[0-9\]* = 21 \'.025\'.*$gdb_prompt $" {
83 pass "print value of *pUC"
84 }
85 -re ".*$gdb_prompt $" { fail "print value of *pUC" }
86 timeout { fail "(timeout) print value of *pUC" }
87 }
88
89
90send_gdb "ptype pUC\n"
91gdb_expect {
92 -re "type = unsigned char \\*.*$gdb_prompt $" { pass "ptype pUC" }
93 -re ".*$gdb_prompt $" { fail "ptype pUC" }
94 timeout { fail "(timeout) ptype pUC" }
95}
96
97send_gdb "print *pS\n"
98gdb_expect {
99 -re ".\[0-9\]* = -14.*$gdb_prompt $" {
100 pass "print value of *pS"
101 }
102 -re ".*$gdb_prompt $" { fail "print value of *pS" }
103 timeout { fail "(timeout) print value of *pS" }
104 }
105
106
107send_gdb "ptype pS\n"
108gdb_expect {
109 -re "type = short \\*.*$gdb_prompt $" { pass "ptype pS" }
110 -re "type = short int \\*.*$gdb_prompt $" { pass "ptype pS" }
111 -re ".*$gdb_prompt $" { fail "ptype pS" }
112 timeout { fail "(timeout) ptype pS" }
113}
114
115send_gdb "print *pUS\n"
116gdb_expect {
117 -re ".\[0-9\]* = 7.*$gdb_prompt $" {
118 pass "print value of *pUS"
119 }
120 -re ".*$gdb_prompt $" { fail "print value of *pUS" }
121 timeout { fail "(timeout) print value of *pUS" }
122 }
123
124
125send_gdb "ptype pUS\n"
126gdb_expect {
127 -re "type = unsigned short \\*.*$gdb_prompt $" { pass "ptype pUS" }
128 -re "type = short unsigned int \\*.*$gdb_prompt $" { pass "ptype pUS" }
129 -re ".*$gdb_prompt $" { fail "ptype pUS" }
130 timeout { fail "(timeout) ptype pUS" }
131}
132
133send_gdb "print *pI\n"
134gdb_expect {
135 -re ".\[0-9\]* = 102.*$gdb_prompt $" {
136 pass "print value of *pI"
137 }
138 -re ".*$gdb_prompt $" { fail "print value of *pI" }
139 timeout { fail "(timeout) print value of *pI" }
140 }
141
142
143send_gdb "ptype pI\n"
144gdb_expect {
145 -re "type = int \\*.*$gdb_prompt $" { pass "ptype pI" }
146 -re ".*$gdb_prompt $" { fail "ptype pI" }
147 timeout { fail "(timeout) ptype pI" }
148}
149
150send_gdb "print *pUI\n"
151gdb_expect {
152 -re ".\[0-9\]* = 1002.*$gdb_prompt $" {
153 pass "print value of *pUI"
154 }
155 -re ".*$gdb_prompt $" { fail "print value of *pUI" }
156 timeout { fail "(timeout) print value of *pUI" }
157 }
158
159
160send_gdb "ptype pUI\n"
161gdb_expect {
162 -re "type = unsigned int \\*.*$gdb_prompt $" { pass "ptype pUI" }
163 -re ".*$gdb_prompt $" { fail "ptype pUI" }
164 timeout { fail "(timeout) ptype pUI" }
165}
166
167send_gdb "print *pL\n"
168gdb_expect {
169 -re ".\[0-9\]* = -234.*$gdb_prompt $" {
170 pass "print value of *pL"
171 }
172 -re ".*$gdb_prompt $" { fail "print value of *pL" }
173 timeout { fail "(timeout) print value of *pL" }
174 }
175
176
177send_gdb "ptype pL\n"
178gdb_expect {
179 -re "type = long \\*.*$gdb_prompt $" { pass "ptype pL" }
180 -re "type = long int \\*.*$gdb_prompt $" { pass "ptype pL" }
181 -re ".*$gdb_prompt $" { fail "ptype pL" }
182 timeout { fail "(timeout) ptype pL" }
183}
184
185send_gdb "print *pUL\n"
186gdb_expect {
187 -re ".\[0-9\]* = 234.*$gdb_prompt $" {
188 pass "print value of *pUL"
189 }
190 -re ".*$gdb_prompt $" { fail "print value of *pUL" }
191 timeout { fail "(timeout) print value of *pUL" }
192 }
193
194
195send_gdb "ptype pUL\n"
196gdb_expect {
197 -re "type = unsigned long \\*.*$gdb_prompt $" { pass "ptype pUL" }
198 -re "type = long unsigned int \\*.*$gdb_prompt $" { pass "ptype pUL" }
199 -re ".*$gdb_prompt $" { fail "ptype pUL" }
200 timeout { fail "(timeout) ptype pUL" }
201}
202
203send_gdb "print *pF\n"
204gdb_expect {
205 -re ".\[0-9\]* = 1.2\[0-9\]*e\\+10.*$gdb_prompt $" {
206 pass "print value of *pF"
207 }
208 -re ".*$gdb_prompt $" { fail "print value of *pF" }
209 timeout { fail "(timeout) print value of *pF" }
210 }
211
212
213send_gdb "ptype pF\n"
214gdb_expect {
215 -re "type = float \\*.*$gdb_prompt $" { pass "ptype pF" }
216 -re ".*$gdb_prompt $" { fail "ptype pF" }
217 timeout { fail "(timeout) ptype pF" }
218}
219
220send_gdb "print *pD\n"
221gdb_expect {
222 -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" {
223 pass "print value of *pD"
224 }
225 -re ".*$gdb_prompt $" { fail "print value of *pD" }
226 timeout { fail "(timeout) print value of *pD" }
227 }
228
229
230send_gdb "ptype pD\n"
231gdb_expect {
232 -re "type = double \\*.*$gdb_prompt $" { pass "ptype pD" }
233 -re ".*$gdb_prompt $" { fail "ptype pD" }
234 timeout { fail "(timeout) ptype pD" }
235}
236
237send_gdb "print ******ppppppC\n"
238gdb_expect {
239 -re ".\[0-9\]* = 65 \'A\'.*$gdb_prompt $" {
240 pass "print value of ******ppppppC"
241 }
242 -re ".*$gdb_prompt $" { fail "print value of ******ppppppC" }
243 timeout { fail "(timeout) print value of ******ppppppC" }
244 }
245
246
247send_gdb "ptype pC\n"
248gdb_expect {
249 -re "type = char \\*.*$gdb_prompt $" { pass "ptype pC" }
250 -re ".*$gdb_prompt $" { fail "ptype pC" }
251 timeout { fail "(timeout) ptype pC" }
252}
253
254send_gdb "ptype ppC\n"
255gdb_expect {
256 -re "type = char \\*\\*.*$gdb_prompt $" { pass "ptype ppC" }
257 -re ".*$gdb_prompt $" { fail "ptype ppC" }
258 timeout { fail "(timeout) ptype ppC" }
259}
260
261send_gdb "ptype pppC\n"
262gdb_expect {
263 -re "type = char \\*\\*\\*.*$gdb_prompt $" { pass "ptype pppC" }
264 -re ".*$gdb_prompt $" { fail "ptype pppC" }
265 timeout { fail "(timeout) ptype pppC" }
266}
267
268send_gdb "ptype ppppC\n"
269gdb_expect {
270 -re "type = char \\*\\*\\*\\*.*$gdb_prompt $" { pass "ptype ppppC" }
271 -re ".*$gdb_prompt $" { fail "ptype ppppC" }
272 timeout { fail "(timeout) ptype ppppC" }
273}
274
275send_gdb "ptype pppppC\n"
276gdb_expect {
277 -re "type = char \\*\\*\\*\\*\\*.*$gdb_prompt $" { pass "ptype pppppC" }
278 -re ".*$gdb_prompt $" { fail "ptype pppppC" }
279 timeout { fail "(timeout) ptype pppppC" }
280}
281
282send_gdb "ptype ppppppC\n"
283gdb_expect {
284 -re "type = char \\*\\*\\*\\*\\*\\*.*$gdb_prompt $" { pass "ptype ppppppC" }
285 -re ".*$gdb_prompt $" { fail "ptype ppppppC" }
286 timeout { fail "(timeout) ptype ppppppC" }
287}
288
This page took 0.032892 seconds and 4 git commands to generate.