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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.mi/] [mi-var-display.exp] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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
# Test essential Machine interface (MI) operations
18
#
19
# Verify that, using the MI, we can create, update, delete variables.
20
#
21
 
22
 
23
load_lib mi-support.exp
24
set MIFLAGS "-i=mi"
25
 
26
gdb_exit
27
if [mi_gdb_start] {
28
    continue
29
}
30
 
31
set testfile "var-cmd"
32
set srcfile ${testfile}.c
33
set binfile ${objdir}/${subdir}/mi-var-display
34
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35
    untested mi-var-display.exp
36
    return -1
37
}
38
 
39
mi_delete_breakpoints
40
mi_gdb_reinitialize_dir $srcdir/$subdir
41
mi_gdb_load ${binfile}
42
 
43
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
44
 
45
mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
46
    "break-insert operation"
47
 
48
mi_run_cmd
49
mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
50
        $line_dct_end { "" "disp=\"keep\"" } "run to main"
51
 
52
#####       #####
53
#               #
54
# Display tests #
55
#               #
56
#####       #####
57
 
58
# Test: c_variable-6.1
59
# Desc: create variable bar
60
mi_create_varobj bar bar "create local variable bar"
61
 
62
# Test: c_variable-6.2
63
# Desc: type of variable bar
64
mi_gdb_test "-var-info-type bar" \
65
        "\\^done,type=\"int\"" \
66
        "info type variable bar"
67
 
68
# Test: c_variable-6.3
69
# Desc: format of variable bar
70
mi_gdb_test "-var-show-format bar" \
71
        "\\^done,format=\"natural\"" \
72
        "show format variable bar"
73
 
74
# Test: c_variable-6.4
75
# Desc: value of variable bar
76
mi_gdb_test "-var-evaluate-expression bar" \
77
        "\\^done,value=\"2121\"" \
78
        "eval variable bar"
79
 
80
# Test: c_variable-6.5
81
# Desc: change format of bar to hex
82
mi_gdb_test "-var-set-format bar hexadecimal" \
83
        "\\^done,format=\"hexadecimal\",value=\"0x849\"" \
84
        "set format variable bar"
85
 
86
# Test: c_variable-6.6
87
# Desc: value of bar with new format
88
mi_gdb_test "-var-evaluate-expression bar" \
89
        "\\^done,value=\"0x849\"" \
90
        "eval variable bar with new format"
91
 
92
# Test: c_variable-6.7
93
# Desc: change value of bar
94
mi_gdb_test "-var-assign bar 3" \
95
        "\\^done,value=\"0x3\"" \
96
        "assing to variable bar"
97
 
98
mi_gdb_test "-var-set-format bar decimal" \
99
        "\\^done,format=\"decimal\",value=\"3\"" \
100
        "set format variable bar"
101
 
102
mi_gdb_test "-var-evaluate-expression bar" \
103
        "\\^done,value=\"3\"" \
104
        "eval variable bar with new value"
105
 
106
mi_gdb_test "-var-delete bar" \
107
        "\\^done,ndeleted=\"1\"" \
108
        "delete var bar"
109
 
110
# Test: c_variable-6.11
111
# Desc: create variable foo
112
mi_create_varobj foo foo "create local variable foo"
113
 
114
# Test: c_variable-6.12
115
# Desc: type of variable foo
116
mi_gdb_test "-var-info-type foo" \
117
        "\\^done,type=\"int \\*\"" \
118
        "info type variable foo"
119
 
120
# Test: c_variable-6.13
121
# Desc: format of variable foo
122
mi_gdb_test "-var-show-format foo" \
123
        "\\^done,format=\"natural\"" \
124
        "show format variable foo"
125
 
126
# Test: c_variable-6.14
127
# Desc: value of variable foo
128
mi_gdb_test "-var-evaluate-expression foo" \
129
        "\\^done,value=\"$hex\"" \
130
        "eval variable foo"
131
 
132
# Test: c_variable-6.15
133
# Desc: change format of var to octal
134
mi_gdb_test "-var-set-format foo octal" \
135
        "\\^done,format=\"octal\",value=\"$octal\"" \
136
        "set format variable foo"
137
 
138
mi_gdb_test "-var-show-format foo" \
139
        "\\^done,format=\"octal\"" \
140
        "show format variable foo"
141
 
142
# Test: c_variable-6.16
143
# Desc: value of foo with new format
144
mi_gdb_test "-var-evaluate-expression foo" \
145
        "\\^done,value=\"\[0-7\]+\"" \
146
        "eval variable foo"
147
 
148
# Test: c_variable-6.17
149
# Desc: change value of foo
150
mi_gdb_test "-var-assign foo 3" \
151
        "\\^done,value=\"03\"" \
152
        "assing to variable foo"
153
 
154
mi_gdb_test "-var-set-format foo decimal" \
155
        "\\^done,format=\"decimal\",value=\"3\"" \
156
        "set format variable foo"
157
 
158
# Test: c_variable-6.18
159
# Desc: check new value of foo
160
mi_gdb_test "-var-evaluate-expression foo" \
161
        "\\^done,value=\"3\"" \
162
        "eval variable foo"
163
 
164
 
165
# Test: c_variable-6.19
166
# Desc: check optional format parameter of var-evaluate-expression
167
#       and check that current format is not changed
168
mi_gdb_test "-var-evaluate-expression -f hex foo" \
169
        "\\^done,value=\"0x3\"" \
170
        "eval variable foo in hex"
171
 
172
mi_gdb_test "-var-show-format foo" \
173
        "\\^done,format=\"decimal\"" \
174
        "show format variable foo after eval in hex"
175
 
176
mi_gdb_test "-var-evaluate-expression -f octal foo" \
177
        "\\^done,value=\"03\"" \
178
        "eval variable foo in octal"
179
 
180
mi_gdb_test "-var-show-format foo" \
181
        "\\^done,format=\"decimal\"" \
182
        "show format variable foo after eval in octal"
183
 
184
mi_gdb_test "-var-evaluate-expression -f decimal foo" \
185
        "\\^done,value=\"3\"" \
186
        "eval variable foo in decimal"
187
 
188
mi_gdb_test "-var-show-format foo" \
189
        "\\^done,format=\"decimal\"" \
190
        "show format variable foo after eval in decimal"
191
 
192
mi_gdb_test "-var-evaluate-expression -f nat foo" \
193
        "\\^done,value=\"0x3\"" \
194
        "eval variable foo in natural"
195
 
196
mi_gdb_test "-var-show-format foo" \
197
        "\\^done,format=\"decimal\"" \
198
        "show format variable foo after eval in natural"
199
 
200
mi_gdb_test "-var-evaluate-expression -f bin foo" \
201
        "\\^done,value=\"11\"" \
202
        "eval variable foo in binary"
203
 
204
mi_gdb_test "-var-show-format foo" \
205
        "\\^done,format=\"decimal\"" \
206
        "show format variable foo after eval in binary"
207
 
208
mi_gdb_test "-var-delete foo" \
209
        "\\^done,ndeleted=\"1\"" \
210
        "delete var foo"
211
 
212
# Test: c_variable-6.21
213
# Desc: create variable weird and children
214
mi_create_varobj weird weird "create local variable weird"
215
 
216
mi_list_varobj_children weird {
217
        {weird.integer integer 0 int}
218
        {weird.character character 0 char}
219
        {weird.char_ptr char_ptr 1 "char \\*"}
220
        {weird.long_int long_int 0 "long int"}
221
        {weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
222
        {weird.long_array long_array 10 "long int \\[10\\]"}
223
        {weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
224
        {weird.func_ptr_struct func_ptr_struct 0 \
225
                 "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
226
        {weird.func_ptr_ptr func_ptr_ptr 0 \
227
                 "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
228
        {weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
229
        {weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
230
} "get children local variable weird"
231
 
232
 
233
# Test: c_variable-6.23
234
# Desc: change format of weird.func_ptr and weird.func_ptr_ptr
235
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
236
        "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
237
        "set format variable weird.func_ptr"
238
 
239
mi_gdb_test "-var-show-format weird.func_ptr" \
240
        "\\^done,format=\"hexadecimal\"" \
241
        "show format variable weird.func_ptr"
242
 
243
mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
244
        "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
245
        "set format variable weird.func_ptr_ptr"
246
 
247
mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
248
        "\\^done,format=\"hexadecimal\"" \
249
        "show format variable weird.func_ptr_ptr"
250
 
251
# Test: c_variable-6.24
252
# Desc: format of weird and children
253
mi_gdb_test "-var-set-format weird natural" \
254
        "\\^done,format=\"natural\",value=\"$hex\"" \
255
        "set format variable weird"
256
 
257
mi_gdb_test "-var-set-format weird.integer natural" \
258
        "\\^done,format=\"natural\",value=\"123\"" \
259
        "set format variable weird.integer"
260
 
261
mi_gdb_test "-var-set-format weird.character natural" \
262
        "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
263
        "set format variable weird.character"
264
 
265
mi_gdb_test "-var-set-format weird.char_ptr natural" \
266
        "\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \
267
        "set format variable weird.char_ptr"
268
 
269
mi_gdb_test "-var-set-format weird.long_int natural" \
270
        "\\^done,format=\"natural\",value=\"0\"" \
271
        "set format variable weird.long_int"
272
 
273
mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
274
        "\\^done,format=\"natural\",value=\"$hex\"" \
275
        "set format variable weird.int_ptr_ptr"
276
 
277
mi_gdb_test "-var-set-format weird.long_array natural" \
278
        "\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \
279
        "set format variable weird.long_array"
280
 
281
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
282
        "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
283
        "set format variable weird.func_ptr"
284
 
285
mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
286
        "\\^done,format=\"hexadecimal\",value=\"$hex\"" \
287
        "set format variable weird.func_ptr_struct"
288
 
289
mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
290
        "\\^done,format=\"natural\",value=\"0\"" \
291
        "set format variable weird.func_ptr_ptr"
292
 
293
mi_gdb_test "-var-set-format weird.u1 natural" \
294
        "\\^done,format=\"natural\",value=\"\{...\}\"" \
295
        "set format variable weird.u1"
296
 
297
mi_gdb_test "-var-set-format weird.s2 natural" \
298
        "\\^done,format=\"natural\",value=\"\{...\}\"" \
299
        "set format variable weird.s2"
300
 
301
# Test: c_variable-6.25
302
# Desc: value of weird and children
303
#gdbtk_test c_variable-6.25 {value of weird and children} {
304
#  set values {}
305
#  foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] {
306
#    lappend values [value $v $f]
307
#  }
308
 
309
#  set values
310
#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
311
 
312
# Test: c_variable-6.26
313
# Desc: change format of weird and children to octal
314
#gdbtk_test c_variable-6.26 {change format of weird and children to octal} {
315
#  set formats {}
316
#  foreach v [lsort [array names var]] {
317
#    $var($v) format octal
318
#    lappend formats [$var($v) format]
319
#  }
320
 
321
#  set formats
322
#} {octal octal octal octal octal octal octal octal octal octal octal octal}
323
 
324
# Test: c_variable-6.27
325
# Desc: value of weird and children with new format
326
#gdbtk_test c_variable-6.27 {value of foo with new format} {
327
#  set values {}
328
#  foreach v [lsort [array names var]] {
329
#    lappend values [value $v o]
330
#  }
331
 
332
#  set values
333
#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
334
 
335
# Test: c_variable-6.30
336
# Desc: create more children of weird
337
#gdbtk_test c_variable-6.30 {create more children of weird} {
338
#  foreach v [array names var] {
339
#    get_children $v
340
#  }
341
 
342
#  # Do it twice to get more children
343
#  foreach v [array names var] {
344
#    get_children $v
345
#  }
346
 
347
#  lsort [array names var]
348
#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d}
349
 
350
# Test: c_variable-6.31
351
# Desc: check that all children of weird change
352
#       Ok, obviously things like weird.s2 and weird.u1 will not change!
353
#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} {
354
#  $var(weird) value 0x2121
355
#  check_update
356
#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}}
357
 
358
mi_gdb_test "-var-delete weird" \
359
        "\\^done,ndeleted=\"12\"" \
360
        "delete var weird"
361
 
362
 
363
#####               #####
364
#                       #
365
# Special Display Tests #
366
#                       #
367
#####               #####
368
 
369
# Stop at the end of "do_special_tests"
370
 
371
set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
372
 
373
mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \
374
        "break-insert operation 2"
375
 
376
mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
377
    ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
378
    "continue to do_special_tests"
379
 
380
# Test: c_variable-7.10
381
# Desc: create union u
382
mi_create_varobj u u "create local variable u"
383
 
384
# Test: c_variable-7.11
385
# Desc: value of u
386
mi_gdb_test "-var-evaluate-expression u" \
387
        "\\^done,value=\"\{\\.\\.\\.\}\"" \
388
        "eval variable u"
389
 
390
# Test: c_variable-7.12
391
# Desc: type of u
392
mi_gdb_test "-var-info-type u" \
393
        "\\^done,type=\"union named_union\"" \
394
        "info type variable u"
395
 
396
# Test: c_variable-7.13
397
# Desc: is u editable
398
mi_gdb_test "-var-show-attributes u" \
399
        "\\^done,attr=\"noneditable\"" \
400
        "is u editable"
401
 
402
# Test: c_variable-7.14
403
# Desc: number of children of u
404
mi_gdb_test "-var-info-num-children u" \
405
        "\\^done,numchild=\"2\"" \
406
        "get number of children of u"
407
 
408
# Test: c_variable-7.15
409
# Desc: children of u
410
mi_list_varobj_children u {
411
        {u.integer integer 0 int}
412
        {u.char_ptr char_ptr 1 {char \*}}
413
} "get children of u"
414
 
415
# Test: c_variable-7.20
416
# Desc: create anonu
417
mi_create_varobj anonu anonu "create local variable anonu"
418
 
419
# Test: c_variable-7.21
420
# Desc: value of anonu
421
mi_gdb_test "-var-evaluate-expression anonu" \
422
        "\\^done,value=\"\{\\.\\.\\.\}\"" \
423
        "eval variable anonu"
424
 
425
# Test: c_variable-7.22
426
# Desc: type of anonu
427
mi_gdb_test "-var-info-type anonu" \
428
        "\\^done,type=\"union \{\\.\\.\\.\}\"" \
429
        "info type variable anonu"
430
 
431
# Test: c_variable-7.23
432
# Desc: is anonu editable
433
mi_gdb_test "-var-show-attributes anonu" \
434
        "\\^done,attr=\"noneditable\"" \
435
        "is anonu editable"
436
 
437
# Test: c_variable-7.24
438
# Desc: number of children of anonu
439
mi_gdb_test "-var-info-num-children anonu" \
440
        "\\^done,numchild=\"3\"" \
441
        "get number of children of anonu"
442
 
443
# Test: c_variable-7.25
444
# Desc: children of anonu
445
mi_list_varobj_children "anonu" {
446
        {anonu.a a 0 int}
447
        {anonu.b b 0 char}
448
        {anonu.c c 0 "long int"}
449
} "get children of anonu"
450
 
451
# Test: c_variable-7.30
452
# Desc: create struct s
453
mi_create_varobj s s "create local variable s"
454
 
455
 
456
# Test: c_variable-7.31
457
# Desc: value of s
458
mi_gdb_test "-var-evaluate-expression s" \
459
        "\\^done,value=\"\{\\.\\.\\.\}\"" \
460
        "eval variable s"
461
 
462
# Test: c_variable-7.32
463
# Desc: type of s
464
mi_gdb_test "-var-info-type s" \
465
        "\\^done,type=\"struct _simple_struct\"" \
466
        "info type variable s"
467
 
468
# Test: c_variable-7.33
469
# Desc: is s editable
470
mi_gdb_test "-var-show-attributes s" \
471
        "\\^done,attr=\"noneditable\"" \
472
        "is s editable"
473
 
474
# Test: c_variable-7.34
475
# Desc: number of children of s
476
mi_gdb_test "-var-info-num-children s" \
477
        "\\^done,numchild=\"6\"" \
478
        "get number of children of s"
479
 
480
# Test: c_variable-7.35
481
# Desc: children of s
482
mi_list_varobj_children s {
483
        {s.integer integer 0 int}
484
        {s.unsigned_integer unsigned_integer 0 "unsigned int"}
485
        {s.character character 0 char}
486
        {s.signed_character signed_character 0 "signed char"}
487
        {s.char_ptr char_ptr 1 {char \*}}
488
        {s.array_of_10 array_of_10 10 {int \[10\]}}
489
} "get children of s"
490
#} {integer unsigned_integer character signed_character char_ptr array_of_10}
491
 
492
# Test: c_variable-7.40
493
# Desc: create anons
494
mi_create_varobj anons anons "create local variable anons"
495
 
496
# Test: c_variable-7.41
497
# Desc: value of anons
498
mi_gdb_test "-var-evaluate-expression anons" \
499
        "\\^done,value=\"\{\\.\\.\\.\}\"" \
500
        "eval variable anons"
501
 
502
# Test: c_variable-7.42
503
# Desc: type of anons
504
mi_gdb_test "-var-info-type anons" \
505
        "\\^done,type=\"struct \{\\.\\.\\.\}\"" \
506
        "info type variable anons"
507
 
508
# Test: c_variable-7.43
509
# Desc: is anons editable
510
mi_gdb_test "-var-show-attributes anons" \
511
        "\\^done,attr=\"noneditable\"" \
512
        "is anons editable"
513
 
514
# Test: c_variable-7.44
515
# Desc: number of children of anons
516
mi_gdb_test "-var-info-num-children anons" \
517
        "\\^done,numchild=\"3\"" \
518
        "get number of children of anons"
519
 
520
# Test: c_variable-7.45
521
# Desc: children of anons
522
mi_list_varobj_children anons {
523
        {anons.a a 0 int}
524
        {anons.b b 0 char}
525
        {anons.c c 0 "long int"}
526
} "get children of anons"
527
 
528
# Test: c_variable-7.50
529
# Desc: create enum e
530
mi_create_varobj e e "create local variable e"
531
 
532
setup_xfail "*-*-*"
533
# Test: c_variable-7.51
534
# Desc: value of e
535
mi_gdb_test "-var-evaluate-expression e" \
536
        "\\^done,value=\"FIXME\"" \
537
        "eval variable e"
538
clear_xfail "*-*-*"
539
 
540
# Test: c_variable-7.52
541
# Desc: type of e
542
mi_gdb_test "-var-info-type e" \
543
        "\\^done,type=\"enum foo\"" \
544
        "info type variable e"
545
 
546
# Test: c_variable-7.53
547
# Desc: is e editable
548
mi_gdb_test "-var-show-attributes e" \
549
        "\\^done,attr=\"editable\"" \
550
        "is e editable"
551
 
552
# Test: c_variable-7.54
553
# Desc: number of children of e
554
mi_gdb_test "-var-info-num-children e" \
555
        "\\^done,numchild=\"0\"" \
556
        "get number of children of e"
557
 
558
# Test: c_variable-7.55
559
# Desc: children of e
560
mi_gdb_test "-var-list-children e" \
561
        "\\^done,numchild=\"0\",has_more=\"0\"" \
562
        "get children of e"
563
 
564
# Test: c_variable-7.60
565
# Desc: create anone
566
mi_create_varobj anone anone "create local variable anone"
567
 
568
# Test: c_variable-7.61
569
# Desc: value of anone
570
mi_gdb_test "-var-evaluate-expression anone" \
571
        "\\^done,value=\"A\"" \
572
        "eval variable anone"
573
 
574
# Test: c_variable-7.70
575
# Desc: create anone
576
mi_gdb_test "-var-create anone * anone" \
577
        "\\^error,msg=\"Duplicate variable object name\"" \
578
        "create duplicate local variable anone"
579
 
580
 
581
# Test: c_variable-7.72
582
# Desc: type of anone
583
mi_gdb_test "-var-info-type anone" \
584
        "\\^done,type=\"enum \{\\.\\.\\.\}\"" \
585
        "info type variable anone"
586
 
587
 
588
# Test: c_variable-7.73
589
# Desc: is anone editable
590
mi_gdb_test "-var-show-attributes anone" \
591
        "\\^done,attr=\"editable\"" \
592
        "is anone editable"
593
 
594
# Test: c_variable-7.74
595
# Desc: number of children of anone
596
mi_gdb_test "-var-info-num-children anone" \
597
        "\\^done,numchild=\"0\"" \
598
        "get number of children of anone"
599
 
600
# Test: c_variable-7.75
601
# Desc: children of anone
602
mi_gdb_test "-var-list-children anone" \
603
        "\\^done,numchild=\"0\",has_more=\"0\"" \
604
        "get children of anone"
605
 
606
 
607
# Record fp
608
 
609
send_gdb "p/x \$fp\n"
610
gdb_expect {
611
    -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
612
        pass "print FP register"
613
        set fp $expect_out(1,string)
614
    }
615
#    -re ".*" { fail "print FP register"}
616
    timeout { fail "print FP register (timeout)"}
617
}
618
 
619
mi_continue_to "incr_a"
620
 
621
# Test: c_variable-7.81
622
# Desc: Create variables in different scopes
623
mi_gdb_test "-var-create a1 * a" \
624
        "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
625
        "create local variable a1"
626
 
627
mi_gdb_test "-var-create a2 $fp a" \
628
        "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
629
        "create variable a2 in different scope"
630
 
631
#gdbtk_test c_variable-7.81 {create variables in different scopes} {
632
#  set a1 [gdb_variable create -expr a]
633
#  set a2 [gdb_variable create -expr a -frame $fp]
634
 
635
#  set vals {}
636
#  lappend vals [$a1 value]
637
#  lappend vals [$a2 value]
638
#  set vals
639
#} {2 1}
640
 
641
 
642
mi_gdb_exit
643
return 0

powered by: WebSVN 2.1.0

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