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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.mi/] [mi-var-display.exp] - Blame information for rev 107

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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