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