OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [assign.exp] - Blame information for rev 840

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 1998, 1999, 2007, 2008 Free Software Foundation, Inc.
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 3 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, see .
15
 
16
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
20
 
21
# This file is part of the gdb testsuite
22
#
23
# tests for all the assignemnt operators
24
# with mixed types and with int type variables
25
#
26
 
27
if $tracelevel then {
28
        strace $tracelevel
29
        }
30
 
31
#
32
# test running programs
33
#
34
set prms_id 0
35
set bug_id 0
36
 
37
set testfile "all-types"
38
set srcfile ${testfile}.c
39
set binfile ${objdir}/${subdir}/${testfile}
40
 
41
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
42
     untested assign.exp
43
     return -1
44
    }
45
 
46
 
47
 
48
gdb_exit
49
gdb_start
50
gdb_reinitialize_dir $srcdir/$subdir
51
gdb_load ${binfile}
52
 
53
 
54
#
55
# set it up at a breakpoint so we can play with the variable values
56
#
57
 
58
if ![runto_main] then {
59
    perror "couldn't run to breakpoint"
60
    continue
61
}
62
 
63
gdb_test "next" "return 0;" "continuing after dummy()"
64
 
65
send_gdb "print v_int=57\n"
66
gdb_expect {
67
    -re ".*57.*$gdb_prompt $" {
68
        send_gdb "print v_int\n"
69
        gdb_expect {
70
            -re ".*57.*$gdb_prompt $" {
71
                pass "v_int=57"
72
              }
73
            -re ".*$gdb_prompt $" { fail "v_int=57" }
74
            timeout           { fail "(timeout) v_int=57" }
75
         }
76
         }
77
    -re ".*$gdb_prompt $" { fail "v_int=57" }
78
    timeout           { fail "(timeout) v_int=57" }
79
  }
80
 
81
 
82
gdb_test "set variable v_int = 6" "" "set v_int to 6"
83
 
84
 
85
send_gdb "print v_int+=57\n"
86
gdb_expect {
87
    -re ".*63.*$gdb_prompt $" {
88
        send_gdb "print v_int\n"
89
        gdb_expect {
90
            -re ".*63.*$gdb_prompt $" {
91
                pass "v_int+=57"
92
              }
93
            -re ".*$gdb_prompt $" { fail "v_int+=57" }
94
            timeout           { fail "(timeout) v_int+=57" }
95
         }
96
         }
97
    -re ".*$gdb_prompt $" { fail "v_int+=57" }
98
    timeout           { fail "(timeout) v_int+=57" }
99
  }
100
 
101
gdb_test "set variable v_int = 6" "" "set v_int to 6"
102
 
103
send_gdb "print v_int-=57\n"
104
gdb_expect {
105
    -re ".*-51.*$gdb_prompt $" {
106
        send_gdb "print v_int\n"
107
        gdb_expect {
108
            -re ".*-51.*$gdb_prompt $" {
109
                pass "v_int-=57"
110
              }
111
            -re ".*$gdb_prompt $" { fail "v_int-=57" }
112
            timeout           { fail "(timeout) v_int-=57" }
113
         }
114
         }
115
    -re ".*$gdb_prompt $" { fail "v_int-=57" }
116
    timeout           { fail "(timeout) v_int-=57" }
117
  }
118
 
119
gdb_test "set variable v_int = 6" "" "set v_int to 6"
120
 
121
send_gdb "print v_int*=5\n"
122
gdb_expect {
123
    -re ".*30.*$gdb_prompt $" {
124
        send_gdb "print v_int\n"
125
        gdb_expect {
126
            -re ".*30.*$gdb_prompt $" {
127
                pass "v_int*=5"
128
              }
129
            -re ".*$gdb_prompt $" { fail "v_int*=5" }
130
            timeout           { fail "(timeout) v_int*=5" }
131
         }
132
         }
133
    -re ".*$gdb_prompt $" { fail "v_int*=5" }
134
    timeout           { fail "(timeout) v_int*=5" }
135
  }
136
 
137
gdb_test "set variable v_int = 6" "" "set v_int to 6"
138
 
139
send_gdb "print v_int/=4\n"
140
gdb_expect {
141
    -re ".*1.*$gdb_prompt $" {
142
        send_gdb "print v_int\n"
143
        gdb_expect {
144
            -re ".*1.*$gdb_prompt $" {
145
                pass "v_int/=4"
146
              }
147
            -re ".*$gdb_prompt $" { fail "v_int/=4" }
148
            timeout           { fail "(timeout) v_int/=4" }
149
         }
150
         }
151
    -re ".*$gdb_prompt $" { fail "v_int/=4" }
152
    timeout           { fail "(timeout) v_int/=4" }
153
  }
154
 
155
 
156
 
157
gdb_test "set variable v_int = 6" "" "set v_int to 6"
158
 
159
send_gdb "print v_int%=4\n"
160
gdb_expect {
161
    -re ".*2.*$gdb_prompt $" {
162
        send_gdb "print v_int\n"
163
        gdb_expect {
164
            -re ".*2.*$gdb_prompt $" {
165
                pass "v_int%=4"
166
              }
167
            -re ".*$gdb_prompt $" { fail "v_int%=4" }
168
            timeout           { fail "(timeout) v_int%=4" }
169
         }
170
         }
171
    -re ".*$gdb_prompt $" { fail "v_int%=4" }
172
    timeout           { fail "(timeout) v_int%=4" }
173
  }
174
 
175
 
176
 
177
gdb_test "set variable v_int = 6" "" "set v_int to 6"
178
 
179
 
180
 
181
send_gdb "print v_int+=v_char\n"
182
gdb_expect {
183
    -re ".*71.*$gdb_prompt $" {
184
        send_gdb "print v_int\n"
185
        gdb_expect {
186
            -re ".*71.*$gdb_prompt $" {
187
                pass "v_int+=char"
188
              }
189
            -re ".*$gdb_prompt $" { fail "v_int+=v_char" }
190
            timeout           { fail "(timeout) v_int+=v_char" }
191
         }
192
         }
193
    -re ".*$gdb_prompt $" { fail "v_int+=v_char" }
194
    timeout           { fail "(timeout) v_int+=v_char" }
195
  }
196
 
197
 
198
gdb_test "set variable v_int = 6" "" "set v_int to 6"
199
 
200
 
201
 
202
send_gdb "print v_int+=v_signed_char\n"
203
gdb_expect {
204
    -re ".*72.*$gdb_prompt $" {
205
        send_gdb "print v_int\n"
206
        gdb_expect {
207
            -re ".*72.*$gdb_prompt $" {
208
                pass "v_int+=signed_char"
209
              }
210
            -re ".*$gdb_prompt $" { fail "v_int+=v_signed_char" }
211
            timeout           { fail "(timeout) v_int+=v_signed_char" }
212
         }
213
         }
214
    -re ".*$gdb_prompt $" { fail "v_int+=v_signed_char" }
215
    timeout           { fail "(timeout) v_int+=v_signed_char" }
216
  }
217
 
218
 
219
gdb_test "set variable v_int = 6" "" "set v_int to 6"
220
 
221
 
222
 
223
send_gdb "print v_int+=v_unsigned_char\n"
224
gdb_expect {
225
    -re ".*73.*$gdb_prompt $" {
226
        send_gdb "print v_int\n"
227
        gdb_expect {
228
            -re ".*73.*$gdb_prompt $" {
229
                pass "v_int+=unsigned_char"
230
              }
231
            -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" }
232
            timeout           { fail "(timeout) v_int+=v_unsigned_char" }
233
         }
234
         }
235
    -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" }
236
    timeout           { fail "(timeout) v_int+=v_unsigned_char" }
237
  }
238
 
239
 
240
gdb_test "set variable v_int = 6" "" "set v_int to 6"
241
 
242
 
243
 
244
send_gdb "print v_int+=v_short\n"
245
gdb_expect {
246
    -re ".*9.*$gdb_prompt $" {
247
        send_gdb "print v_int\n"
248
        gdb_expect {
249
            -re ".*9.*$gdb_prompt $" {
250
                pass "v_int+=short"
251
              }
252
            -re ".*$gdb_prompt $" { fail "v_int+=v_short" }
253
            timeout           { fail "(timeout) v_int+=v_short" }
254
         }
255
         }
256
    -re ".*$gdb_prompt $" { fail "v_int+=v_short" }
257
    timeout           { fail "(timeout) v_int+=v_short" }
258
  }
259
 
260
 
261
gdb_test "set variable v_int = 6" "" "set v_int to 6"
262
 
263
 
264
 
265
send_gdb "print v_int+=v_signed_short\n"
266
gdb_expect {
267
    -re ".*10.*$gdb_prompt $" {
268
        send_gdb "print v_int\n"
269
        gdb_expect {
270
            -re ".*10.*$gdb_prompt $" {
271
                pass "v_int+=signed_short"
272
              }
273
            -re ".*$gdb_prompt $" { fail "v_int+=v_signed_short" }
274
            timeout           { fail "(timeout) v_int+=v_signed_short" }
275
         }
276
         }
277
    -re ".*$gdb_prompt $" { fail "v_int+=v_signed_short" }
278
    timeout           { fail "(timeout) v_int+=v_signed_short" }
279
  }
280
 
281
 
282
gdb_test "set variable v_int = 6" "" "set v_int to 6"
283
 
284
 
285
 
286
send_gdb "print v_int+=v_unsigned_short\n"
287
gdb_expect {
288
    -re ".*11.*$gdb_prompt $" {
289
        send_gdb "print v_int\n"
290
        gdb_expect {
291
            -re ".*11.*$gdb_prompt $" {
292
                pass "v_int=+unsigned_short"
293
              }
294
            -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" }
295
            timeout           { fail "(timeout) v_int+=v_unsigned_short" }
296
         }
297
         }
298
    -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" }
299
    timeout           { fail "(timeout) v_int+=v_unsigned_short" }
300
  }
301
 
302
 
303
gdb_test "set variable v_int = 6" "" "set v_int to 6"
304
 
305
 
306
 
307
send_gdb "print v_int+=v_signed_int\n"
308
gdb_expect {
309
    -re ".*13.*$gdb_prompt $" {
310
        send_gdb "print v_int\n"
311
        gdb_expect {
312
            -re ".*13.*$gdb_prompt $" {
313
                pass "v_int+=signed_int"
314
              }
315
            -re ".*$gdb_prompt $" { fail "v_int+=v_signed_int" }
316
            timeout           { fail "(timeout) v_int+=v_signed_int" }
317
         }
318
         }
319
    -re ".*$gdb_prompt $" { fail "v_int+=v_signed_int" }
320
    timeout           { fail "(timeout) v_int+=v_signed_int" }
321
  }
322
 
323
 
324
gdb_test "set variable v_int = 6" "" "set v_int to 6"
325
 
326
 
327
 
328
send_gdb "print v_int+=v_unsigned_int\n"
329
gdb_expect {
330
    -re ".*14.*$gdb_prompt $" {
331
        send_gdb "print v_int\n"
332
        gdb_expect {
333
            -re ".*14.*$gdb_prompt $" {
334
                pass "v_int+=unsigned_int"
335
              }
336
            -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" }
337
            timeout           { fail "(timeout) v_int+=v_unsigned_int" }
338
         }
339
         }
340
    -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" }
341
    timeout           { fail "(timeout) v_int+=v_unsigned_int" }
342
  }
343
 
344
 
345
gdb_test "set variable v_int = 6" "" "set v_int to 6"
346
 
347
 
348
 
349
send_gdb "print v_int+=v_long\n"
350
gdb_expect {
351
    -re ".*15.*$gdb_prompt $" {
352
        send_gdb "print v_int\n"
353
        gdb_expect {
354
            -re ".*15.*$gdb_prompt $" {
355
                pass "v_int+=long"
356
              }
357
            -re ".*$gdb_prompt $" { fail "v_int+=v_long" }
358
            timeout           { fail "(timeout) v_int+=v_long" }
359
         }
360
         }
361
    -re ".*$gdb_prompt $" { fail "v_int+=v_long" }
362
    timeout           { fail "(timeout) v_int+=v_long" }
363
  }
364
 
365
 
366
gdb_test "set variable v_int = 6" "" "set v_int to 6"
367
 
368
 
369
 
370
send_gdb "print v_int+=v_signed_long\n"
371
gdb_expect {
372
    -re ".*16.*$gdb_prompt $" {
373
        send_gdb "print v_int\n"
374
        gdb_expect {
375
            -re ".*16.*$gdb_prompt $" {
376
                pass "v_int+=signed_long"
377
              }
378
            -re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
379
            timeout           { fail "(timeout) v_int+=v_signed_long" }
380
         }
381
         }
382
    -re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
383
    timeout           { fail "(timeout) v_int+=v_signed_long" }
384
  }
385
 
386
 
387
gdb_test "set variable v_int = 6" "" "set v_int to 6"
388
 
389
 
390
send_gdb "print v_int+=v_unsigned_long\n"
391
gdb_expect {
392
    -re ".*17.*$gdb_prompt $" {
393
        send_gdb "print v_int\n"
394
        gdb_expect {
395
            -re ".*17.*$gdb_prompt $" {
396
                pass "v_int+=unsigned_long"
397
              }
398
            -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" }
399
            timeout           { fail "(timeout) v_int+=v_unsigned_long" }
400
         }
401
         }
402
    -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" }
403
    timeout           { fail "(timeout) v_int+=v_unsigned_long" }
404
  }
405
 
406
 
407
gdb_test "set variable v_int = 6" "" "set v_int to 6"
408
 
409
 
410
send_gdb "print v_int+=v_float\n"
411
gdb_expect {
412
    -re ".*106\r\n$gdb_prompt $" {
413
        send_gdb "print v_int\n"
414
        gdb_expect {
415
            -re ".*106\r\n$gdb_prompt $" {
416
                pass "v_int+=v_float"
417
              }
418
            -re ".*$gdb_prompt $" { fail "v_int+=v_float" }
419
            timeout           { fail "(timeout) v_int+=v_float" }
420
         }
421
         }
422
    -re ".*$gdb_prompt $" { fail "v_int+=v_float" }
423
    timeout           { fail "(timeout) v_int+=v_float" }
424
  }
425
 
426
 
427
gdb_test "set variable v_int = 6" "" "set v_int to 6"
428
 
429
 
430
send_gdb "print v_int+=v_double\n"
431
gdb_expect {
432
    -re ".*206\r\n$gdb_prompt $" {
433
        send_gdb "print v_int\n"
434
        gdb_expect {
435
            -re ".*206\r\n$gdb_prompt $" {
436
                pass "v_int+=double"
437
              }
438
            -re ".*$gdb_prompt $" { fail "v_int+=v_double" }
439
            timeout           { fail "(timeout) v_int+=v_double" }
440
         }
441
         }
442
    -re ".*$gdb_prompt $" { fail "v_int+=v_double" }
443
    timeout           { fail "(timeout) v_int+=v_double" }
444
  }
445
 
446
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.