📄 mi2-var-display.exp
字号:
##### ###### ## Special Display Tests ## ###### ###### Stop in "do_special_tests"set line_dst_a_1 [gdb_get_line_number "a = 1;"]mi_gdb_test "200-break-insert do_special_tests" \ "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",times=\"0\"\}" \ "break-insert operation"send_gdb "-exec-continue\n"gdb_expect { -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\\\[\\\],file=\".*var-cmd.c\",line=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" { pass "continue to do_special_tests" } timeout { fail "continue to do_special_tests (timeout)" }}# Test: c_variable-7.10# Desc: create union umi_gdb_test "-var-create u * u" \ "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \ "create local variable u"# Test: c_variable-7.11# Desc: value of umi_gdb_test "-var-evaluate-expression u" \ "\\^done,value=\"\{\\.\\.\\.\}\"" \ "eval variable u"# Test: c_variable-7.12# Desc: type of umi_gdb_test "-var-info-type u" \ "\\^done,type=\"union named_union\"" \ "info type variable u"# Test: c_variable-7.13# Desc: is u editablemi_gdb_test "-var-show-attributes u" \ "\\^done,attr=\"noneditable\"" \ "is u editable"# Test: c_variable-7.14# Desc: number of children of umi_gdb_test "-var-info-num-children u" \ "\\^done,numchild=\"2\"" \ "get number of children of u"# Test: c_variable-7.15# Desc: children of umi_gdb_test "-var-list-children u" \ "\\^done,numchild=\"2\",children=\\\[child=\{name=\"u.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"u.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\}\\\]" \ "get children of u"# Test: c_variable-7.20# Desc: create anonumi_gdb_test "-var-create anonu * anonu" \ "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \ "create local variable anonu"# Test: c_variable-7.21# Desc: value of anonumi_gdb_test "-var-evaluate-expression anonu" \ "\\^done,value=\"\{\\.\\.\\.\}\"" \ "eval variable anonu"# Test: c_variable-7.22# Desc: type of anonumi_gdb_test "-var-info-type anonu" \ "\\^done,type=\"union \{\\.\\.\\.\}\"" \ "info type variable anonu"# Test: c_variable-7.23# Desc: is anonu editablemi_gdb_test "-var-show-attributes anonu" \ "\\^done,attr=\"noneditable\"" \ "is anonu editable"# Test: c_variable-7.24# Desc: number of children of anonumi_gdb_test "-var-info-num-children anonu" \ "\\^done,numchild=\"3\"" \ "get number of children of anonu"# Test: c_variable-7.25# Desc: children of anonumi_gdb_test "-var-list-children anonu" \ "\\^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\"\}\\\]" \ "get children of anonu"# Test: c_variable-7.30# Desc: create struct smi_gdb_test "-var-create s * s" \ "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \ "create local variable s"# Test: c_variable-7.31# Desc: value of smi_gdb_test "-var-evaluate-expression s" \ "\\^done,value=\"\{\\.\\.\\.\}\"" \ "eval variable s"# Test: c_variable-7.32# Desc: type of smi_gdb_test "-var-info-type s" \ "\\^done,type=\"struct _simple_struct\"" \ "info type variable s"# Test: c_variable-7.33# Desc: is s editablemi_gdb_test "-var-show-attributes s" \ "\\^done,attr=\"noneditable\"" \ "is s editable"# Test: c_variable-7.34# Desc: number of children of smi_gdb_test "-var-info-num-children s" \ "\\^done,numchild=\"6\"" \ "get number of children of s"# Test: c_variable-7.35# Desc: children of smi_gdb_test "-var-list-children s" \ "\\^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=\"1\",type=\"char \\*\"\},child=\{name=\"s.array_of_10\",exp=\"array_of_10\",numchild=\"10\",type=\"int \\\[10\\\]\"\}\\\]" \ "get children of s"#} {integer unsigned_integer character signed_character char_ptr array_of_10}# Test: c_variable-7.40# Desc: create anonsmi_gdb_test "-var-create anons * anons" \ "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \ "create local variable anons"# Test: c_variable-7.41# Desc: value of anonsmi_gdb_test "-var-evaluate-expression anons" \ "\\^done,value=\"\{\\.\\.\\.\}\"" \ "eval variable anons"# Test: c_variable-7.42# Desc: type of anonsmi_gdb_test "-var-info-type anons" \ "\\^done,type=\"struct \{\\.\\.\\.\}\"" \ "info type variable anons"# Test: c_variable-7.43# Desc: is anons editablemi_gdb_test "-var-show-attributes anons" \ "\\^done,attr=\"noneditable\"" \ "is anons editable"# Test: c_variable-7.44# Desc: number of children of anonsmi_gdb_test "-var-info-num-children anons" \ "\\^done,numchild=\"3\"" \ "get number of children of anons"# Test: c_variable-7.45# Desc: children of anonsmi_gdb_test "-var-list-children anons" \ "\\^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\"\}\\\]" \ "get children of anons"# Test: c_variable-7.50# Desc: create enum emi_gdb_test "-var-create e * e" \ "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \ "create local variable e"setup_xfail "*-*-*"# Test: c_variable-7.51# Desc: value of emi_gdb_test "-var-evaluate-expression e" \ "\\^done,value=\"FIXME\"" \ "eval variable e"clear_xfail "*-*-*"# Test: c_variable-7.52# Desc: type of emi_gdb_test "-var-info-type e" \ "\\^done,type=\"enum foo\"" \ "info type variable e"# Test: c_variable-7.53# Desc: is e editablemi_gdb_test "-var-show-attributes e" \ "\\^done,attr=\"editable\"" \ "is e editable"# Test: c_variable-7.54# Desc: number of children of emi_gdb_test "-var-info-num-children e" \ "\\^done,numchild=\"0\"" \ "get number of children of e"# Test: c_variable-7.55# Desc: children of emi_gdb_test "-var-list-children e" \ "\\^done,numchild=\"0\"" \ "get children of e"# Test: c_variable-7.60# Desc: create anonemi_gdb_test "-var-create anone * anone" \ "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \ "create local variable anone"setup_xfail "*-*-*"# Test: c_variable-7.61# Desc: value of anonemi_gdb_test "-var-evaluate-expression anone" \ "\\^done,value=\"A\"" \ "eval variable anone"clear_xfail "*-*-*"# Test: c_variable-7.70# Desc: create anonemi_gdb_test "-var-create anone * anone" \ "&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \ "create duplicate local variable anone"# Test: c_variable-7.72# Desc: type of anonemi_gdb_test "-var-info-type anone" \ "\\^done,type=\"enum \{\\.\\.\\.\}\"" \ "info type variable anone"# Test: c_variable-7.73# Desc: is anone editablemi_gdb_test "-var-show-attributes anone" \ "\\^done,attr=\"editable\"" \ "is anone editable"# Test: c_variable-7.74# Desc: number of children of anonemi_gdb_test "-var-info-num-children anone" \ "\\^done,numchild=\"0\"" \ "get number of children of anone"# Test: c_variable-7.75# Desc: children of anonemi_gdb_test "-var-list-children anone" \ "\\^done,numchild=\"0\"" \ "get children of anone"# Record fpsend_gdb "p/x \$fp\n"gdb_expect { -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { pass "print FP register" set fp $expect_out(1,string) }# -re ".*" { fail "print FP register"} timeout { fail "print FP register (timeout)"}}set line_incr_a_b_a [gdb_get_line_number "b = a;"]mi_gdb_test "200-break-insert incr_a" \ "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",times=\"0\"\}" \ "break-insert operation"send_gdb "-exec-continue\n"gdb_expect { -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"2\.*\"\}\\\],file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\"\}\r\n$mi_gdb_prompt$" { pass "continue to incr_a" } -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\r\n$mi_gdb_prompt$" { fail "continue to incr_a (compiler debug info incorrect)" } -re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" { fail "continue to incr_a (unknown output)" } timeout { fail "continue to incr_a (timeout)" }}# Test: c_variable-7.81# Desc: Create variables in different scopesmi_gdb_test "-var-create a1 * a" \ "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \ "create local variable a1"mi_gdb_test "-var-create a2 $fp a" \ "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \ "create variable a2 in different scope"#gdbtk_test c_variable-7.81 {create variables in different scopes} {# set a1 [gdb_variable create -expr a]# set a2 [gdb_variable create -expr a -frame $fp]# set vals {}# lappend vals [$a1 value]# lappend vals [$a2 value]# set vals#} {2 1}mi_gdb_exitreturn 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -