From 3fddb3adb460904d722c1bb9c271ff41518e369e Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Tue, 27 Feb 2007 21:45:34 +0000 Subject: [PATCH] * gdb.mi/mi-var-block.exp, gdb.mi/mi2-var-block.exp * gdb.mi/mi-var-child.exp, gdb.mi/mi2-var-child.exp * gdb.mi/mi-var-child-f.exp, gdb.mi/mi-var-cmd.exp * gdb.mi/mi2-var-cmd.exp, gdb.mi/mi-var-display.exp * gdb.mi/mi2-var-display.exp, gdb.mi/gdb701.exp Revert tests to use mi_gdb_test and include value field in output of -var-create. --- gdb/testsuite/gdb.mi/gdb701.exp | 4 +- gdb/testsuite/gdb.mi/mi-var-block.exp | 16 +++-- gdb/testsuite/gdb.mi/mi-var-child-f.exp | 4 +- gdb/testsuite/gdb.mi/mi-var-child.exp | 28 +++++--- gdb/testsuite/gdb.mi/mi-var-cmd.exp | 87 ++++++++++++++++++------ gdb/testsuite/gdb.mi/mi-var-display.exp | 41 ++++++++--- gdb/testsuite/gdb.mi/mi2-var-block.exp | 16 +++-- gdb/testsuite/gdb.mi/mi2-var-child.exp | 29 +++++--- gdb/testsuite/gdb.mi/mi2-var-cmd.exp | 77 +++++++++++++++------ gdb/testsuite/gdb.mi/mi2-var-display.exp | 41 ++++++++--- 10 files changed, 250 insertions(+), 93 deletions(-) diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp index c75e7ce0f49..8a384da9c9c 100644 --- a/gdb/testsuite/gdb.mi/gdb701.exp +++ b/gdb/testsuite/gdb.mi/gdb701.exp @@ -50,7 +50,9 @@ mi_run_to_main # Step over "foo = 0" mi_next "step over \"foo = 0\"" -mi_create_varobj fooPtr foo "create fooPtr" +mi_gdb_test "-var-create fooPtr * foo" \ + "(&\".*\"\r\n)*\\^done,name=\"fooPtr\",numchild=\"3\",value=\".*\",type=\"Foo \\*\"" \ + "create fooPtr" mi_gdb_test "-var-list-children fooPtr" \ "(&\".*\"\r\n)*\\^done,numchild=\"3\",.*" \ diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp index 007297d1529..f044ccb7255 100644 --- a/gdb/testsuite/gdb.mi/mi-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi-var-block.exp @@ -44,7 +44,9 @@ mi_runto do_block_tests # Test: c_variable-3.2 # Desc: create cb and foo -mi_create_varobj cb cb "create local variable cb" +mi_gdb_test "-var-create cb * cb" \ + "\\^done,name=\"cb\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable cb" mi_gdb_test "-var-create foo * foo" \ "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ @@ -64,7 +66,9 @@ mi_gdb_test "-var-delete foo" \ # Test: c_variable-3.3 # Desc: create foo -mi_create_varobj foo foo "create local variable foo" +mi_gdb_test "-var-create foo * foo" \ + "\\^done,name=\"foo\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable foo" # step to "foo2 = 123;" mi_step_to "do_block_tests" "" "var-cmd.c" \ @@ -84,7 +88,9 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \ # Test: c_variable-3.5 # Desc: create inner block foo -mi_create_varobj inner_foo foo "create local variable inner_foo" +mi_gdb_test "-var-create inner_foo * foo" \ + "\\^done,name=\"inner_foo\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable inner_foo" # step to "foo2 = 0;" mi_step_to "do_block_tests" "" "var-cmd.c" \ @@ -93,7 +99,9 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \ # Test: c_variable-3.6 # Desc: create foo2 -mi_create_varobj foo2 foo2 "create local variable foo2" +mi_gdb_test "-var-create foo2 * foo2" \ + "\\^done,name=\"foo2\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable foo2" # Test: c_variable-3.7 # Desc: check that outer foo in scope and inner foo out of scope diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp index 9c96f5b762f..48d6682c428 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp @@ -38,7 +38,9 @@ mi_gdb_load ${binfile} mi_runto MAIN__ -mi_create_varobj "array" "array" "create local variable array" +mi_gdb_test "-var-create array * array" \ + "\\^done,name=\"array\",numchild=\"3\",value=\".*\",type=\"integer \\(2,-1:1\\)\"" \ + "create local variable array" mi_gdb_test "-var-list-children --all-values array" \ "\\^done,numchild=\"3\",children=\\\[child=\{name=\"array.-1\",exp=\"-1\",numchild=\"2\",value=\"\\\[2\\\]\",type=\"integer \\(2\\)\"\},child=\{name=\"array.0\",exp=\"0\",numchild=\"2\",value=\"\\\[2\\\]\",type=\"integer \\(2\\)\"\},child=\{name=\"array.1\",exp=\"1\",numchild=\"2\",value=\"\\\[2\\\]\",type=\"integer \\(2\\)\"\}\\\]" \ diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 146de37e100..324179fe328 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -56,8 +56,9 @@ mi_execute_to "exec-next" "end-stepping-range" do_children_tests {} ".*${srcfile # Test: c_variable-4.2 # Desc: create variable "struct_declarations" -mi_create_varobj struct_declarations struct_declarations \ - "create local variable struct_declarations" +mi_gdb_test "-var-create struct_declarations * struct_declarations" \ + "\\^done,name=\"struct_declarations\",numchild=\"11\",value=\"{...}\",type=\"struct _struct_decl\"" \ + "create local variable struct_declarations" # Test: c_variable-4.3 # Desc: children of struct_declarations @@ -563,7 +564,9 @@ mi_step_to do_children_tests {} ".*${srcfile}" \ # Test: c_variable-4.81 # Desc: create local variable "weird" -mi_create_varobj weird weird "create local variable weird" +mi_gdb_test "-var-create weird * weird" \ + "\\^done,name=\"weird\",numchild=\"11\",value=\"$hex\",type=\"weird_struct \\*\"" \ + "create local variable weird" # Test: c_variable-4.82 # Desc: children of weird @@ -625,8 +628,9 @@ mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \ # Test: c_variable-4.90 # Desc: create weird->int_ptr_ptr -mi_create_varobj weird->int_ptr_ptr weird->int_ptr_ptr \ - "create local variable weird->int_ptr_ptr" +mi_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \ + "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\\*\"" \ + "create local variable weird->int_ptr_ptr" # Test: c_variable-4.91 # Desc: children of weird->int_ptr_ptr @@ -890,8 +894,9 @@ mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcf # Test: c_variable-5.10 # Desc: create psnp->char_ptr -mi_create_varobj psnp->char_ptr psnp->char_ptr \ - "create local variable psnp->char_ptr" +mi_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \ + "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",value=\".*\",type=\"char \\*\\*\\*\\*\"" \ + "create local variable psnp->char_ptr" # Test: c_variable-5.11 # Desc: children of psnp->char_ptr @@ -962,8 +967,9 @@ mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ # Test: c_variable-5.19 # Desc: create psnp->long_ptr -mi_create_varobj psnp->long_ptr psnp->long_ptr \ - "create local variable psnp->long_ptr" +mi_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \ + "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\\*\\*\\*\"" \ + "create local variable psnp->long_ptr" # Test: c_variable-5.20 # Desc: children of psnp->long_ptr @@ -1028,7 +1034,9 @@ mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ # Test: c_variable-5.30 # Desc: create psnp->ptrs -mi_create_varobj psnp->ptrs psnp->ptrs "create local variable psnp->ptrs" +mi_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \ + "\\^done,name=\"psnp->ptrs\",numchild=\"3\",value=\"\\\[3\\\]\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \ + "create local variable psnp->ptrs" # Test: c_variable-5.31 # Desc: children of psnp->ptrs diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 34265ea2b2e..cea1f603321 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -52,7 +52,7 @@ mi_gdb_load ${binfile} # Desc: Create global variable mi_gdb_test "111-var-create global_simple * global_simple" \ - "111\\^done,name=\"global_simple\",numchild=\"6\",value=\".*\",type=\"simpleton\"" \ + "111\\^done,name=\"global_simple\",numchild=\"6\",value=\"{...}\",type=\"simpleton\"" \ "create global variable" # Test: c_variable-1.2 @@ -74,43 +74,76 @@ mi_runto do_locals_tests # Test: c_variable-1.4 # Desc: create local variables -mi_create_varobj linteger linteger "create local variable linteger" +mi_gdb_test "-var-create linteger * linteger" \ + "\\^done,name=\"linteger\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable linteger" -mi_create_varobj lpinteger lpinteger "create local variable lpinteger" +mi_gdb_test "-var-create lpinteger * lpinteger" \ + "\\^done,name=\"lpinteger\",numchild=\"1\",value=\"$hex\",type=\"int \\*\"" \ + "create local variable lpinteger" -mi_create_varobj lcharacter lcharacter "create local variable lcharacter" +mi_gdb_test "-var-create lcharacter * lcharacter" \ + "\\^done,name=\"lcharacter\",numchild=\"0\",value=\".*\",type=\"char\"" \ + "create local variablelcharacter " -mi_create_varobj lpcharacter lpcharacter "create local variable lpcharacter" +mi_gdb_test "-var-create lpcharacter * lpcharacter" \ + "\\^done,name=\"lpcharacter\",numchild=\"1\",value=\"$hex \\\\\".*\\\\\"\",type=\"char \\*\"" \ + "create local variable lpcharacter" -mi_create_varobj llong llong "create local variable llong" +mi_gdb_test "-var-create llong * llong" \ + "\\^done,name=\"llong\",numchild=\"0\",value=\".*\",type=\"long int\"" \ + "create local variable llong" -mi_create_varobj lplong lplong "create local variable lplong" +mi_gdb_test "-var-create lplong * lplong" \ + "\\^done,name=\"lplong\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\"" \ + "create local variable lplong" -mi_create_varobj lfloat lfloat "create local variable lfloat" +mi_gdb_test "-var-create lfloat * lfloat" \ + "\\^done,name=\"lfloat\",numchild=\"0\",value=\".*\",type=\"float\"" \ + "create local variable lfloat" -mi_create_varobj lpfloat lpfloat "create local variable lpfloat" +mi_gdb_test "-var-create lpfloat * lpfloat" \ + "\\^done,name=\"lpfloat\",numchild=\"1\",value=\"$hex\",type=\"float \\*\"" \ + "create local variable lpfloat" -mi_create_varobj ldouble ldouble "create local variable ldouble" +mi_gdb_test "-var-create ldouble * ldouble" \ + "\\^done,name=\"ldouble\",numchild=\"0\",value=\".*\",type=\"double\"" \ + "create local variable ldouble" -mi_create_varobj lpdouble lpdouble "create local variable lpdouble" +mi_gdb_test "-var-create lpdouble * lpdouble" \ + "\\^done,name=\"lpdouble\",numchild=\"1\",value=\"$hex\",type=\"double \\*\"" \ + "create local variable lpdouble" -mi_create_varobj lsimple lsimple "create local variable lsimple" +mi_gdb_test "-var-create lsimple * lsimple" \ + "\\^done,name=\"lsimple\",numchild=\"6\",value=\"{...}\",type=\"struct _simple_struct\"" \ + "create local variable lsimple" -mi_create_varobj lpsimple lpsimple "create local variable lpsimple" +mi_gdb_test "-var-create lpsimple * lpsimple" \ + "\\^done,name=\"lpsimple\",numchild=\"6\",value=\"$hex\",type=\"struct _simple_struct \\*\"" \ + "create local variable lpsimple" -mi_create_varobj func func "create local variable func" +mi_gdb_test "-var-create func * func" \ + "\\^done,name=\"func\",numchild=\"0\",value=\"$hex\",type=\"void \\(\\*\\)\\((void|)\\)\"" \ + "create local variable func" # Test: c_variable-1.5 # Desc: create lsimple.character -mi_create_varobj lsimple.character lsimple.character "create lsimple.character" +mi_gdb_test "-var-create lsimple.character * lsimple.character" \ + "\\^done,name=\"lsimple.character\",numchild=\"0\",value=\".*\",type=\"char\"" \ + "create lsimple.character" # Test: c_variable-1.6 # Desc: create lpsimple->integer -mi_create_varobj lsimple->integer lsimple->integer "create lsimple->integer" +mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \ + "\\^done,name=\"lsimple->integer\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create lsimple->integer" # Test: c_variable-1.7 # Desc: ceate lsimple.integer -mi_create_varobj lsimple.integer lsimple.integer "create lsimple->integer" +mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \ + "\\^done,name=\"lsimple.integer\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create lsimple->integer" + # Test: c_variable-1.9 # Desc: create type name @@ -370,7 +403,9 @@ mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\\\]" \ "assign same value to func (update)" -mi_create_varobj array_ptr array_ptr "create global variable array_ptr" +mi_gdb_test "-var-create array_ptr * array_ptr" \ + "\\^done,name=\"array_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\"" \ + "create global variable array_ptr" mi_gdb_test "-var-assign array_ptr array2" \ "\\^done,value=\"$hex\"" \ @@ -399,9 +434,13 @@ mi_continue_to subroutine1 # Test: c_variable-2.10 # Desc: create variable for locals i,l in subroutine1 -mi_create_varobj i i "create i" +mi_gdb_test "-var-create i * i" \ + "\\^done,name=\"i\",numchild=\"0\",value=\"4321\",type=\"int\"" \ + "create i" -mi_create_varobj l l "create l" +mi_gdb_test "-var-create l * l" \ + "\\^done,name=\"l\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\"" \ + "create l" # Test: c_variable-2.11 # Desc: create do_locals_tests local in subroutine1 @@ -556,7 +595,9 @@ mi_gdb_test "-var-update selected_a" \ # A varobj we fail to read during -var-update should be considered # out of scope. -mi_create_varobj null_ptr **0 "create null_ptr" +mi_gdb_test "-var-create null_ptr * **0" \ + {\^done,name="null_ptr",numchild="0",value=".*",type="int"} \ + "create null_ptr" # Allow this to succeed, if address zero is readable, although it # will not test what it was meant to. Most important is that GDB @@ -579,7 +620,9 @@ mi_gdb_test "kill" \ {&"kill\\n".*\^done} \ "kill program before endvar" -mi_create_varobj endvar _end "create endvar" +mi_gdb_test "-var-create endvar * _end" \ + {(\^done,name="endvar",numchild="0",value=".*",type=".*"|&".*unable to.*".*\^error,msg=".*")} \ + "create endvar" # Allow this to succeed whether the value is readable, unreadable, or # missing. Most important is that GDB does not crash. diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index 0b112aa1bd9..ca038d508a4 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -65,7 +65,9 @@ gdb_expect { # Test: c_variable-6.1 # Desc: create variable bar -mi_create_varobj bar bar "create local variable bar" +mi_gdb_test "-var-create bar * bar" \ + "\\^done,name=\"bar\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable bar" # Test: c_variable-6.2 # Desc: type of variable bar @@ -117,7 +119,9 @@ mi_gdb_test "-var-delete bar" \ # Test: c_variable-6.11 # Desc: create variable foo -mi_create_varobj foo foo "create local variable foo" +mi_gdb_test "-var-create foo * foo" \ + "\\^done,name=\"foo\",numchild=\"1\",value=\".*\",type=\"int \\*\"" \ + "create local variable foo" # Test: c_variable-6.12 # Desc: type of variable foo @@ -175,7 +179,9 @@ mi_gdb_test "-var-delete foo" \ # Test: c_variable-6.21 # Desc: create variable weird and children -mi_create_varobj weird weird "create local variable weird" +mi_gdb_test "-var-create weird * weird" \ + "\\^done,name=\"weird\",numchild=\"11\",value=\".*\",type=\"weird_struct \\*\"" \ + "create local variable weird" mi_gdb_test "-var-list-children weird" \ "\\^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=\"1\",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 \\(\\*\\)\\((void|)\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \ @@ -338,7 +344,9 @@ gdb_expect { # Test: c_variable-7.10 # Desc: create union u -mi_create_varobj u u "create local variable u" +mi_gdb_test "-var-create u * u" \ + "\\^done,name=\"u\",numchild=\"2\",value=\".*\",type=\"union named_union\"" \ + "create local variable u" # Test: c_variable-7.11 # Desc: value of u @@ -372,7 +380,9 @@ mi_gdb_test "-var-list-children u" \ # Test: c_variable-7.20 # Desc: create anonu -mi_create_varobj anonu anonu "create local variable anonu" +mi_gdb_test "-var-create anonu * anonu" \ + "\\^done,name=\"anonu\",numchild=\"3\",value=\".*\",type=\"union \{\\.\\.\\.\}\"" \ + "create local variable anonu" # Test: c_variable-7.21 # Desc: value of anonu @@ -406,7 +416,10 @@ mi_gdb_test "-var-list-children anonu" \ # Test: c_variable-7.30 # Desc: create struct s -mi_create_varobj s s "create local variable s" +mi_gdb_test "-var-create s * s" \ + "\\^done,name=\"s\",numchild=\"6\",value=\".*\",type=\"struct _simple_struct\"" \ + "create local variable s" + # Test: c_variable-7.31 # Desc: value of s @@ -441,7 +454,9 @@ mi_gdb_test "-var-list-children s" \ # Test: c_variable-7.40 # Desc: create anons -mi_create_varobj anons anons "create local variable anons" +mi_gdb_test "-var-create anons * anons" \ + "\\^done,name=\"anons\",numchild=\"3\",value=\".*\",type=\"struct \{\\.\\.\\.\}\"" \ + "create local variable anons" # Test: c_variable-7.41 # Desc: value of anons @@ -476,7 +491,9 @@ mi_gdb_test "-var-list-children anons" \ # Test: c_variable-7.50 # Desc: create enum e -mi_create_varobj e e "create local variable e" +mi_gdb_test "-var-create e * e" \ + "\\^done,name=\"e\",numchild=\"0\",value=\".*\",type=\"enum foo\"" \ + "create local variable e" setup_xfail "*-*-*" # Test: c_variable-7.51 @@ -512,7 +529,9 @@ mi_gdb_test "-var-list-children e" \ # Test: c_variable-7.60 # Desc: create anone -mi_create_varobj anone anone "create local variable anone" +mi_gdb_test "-var-create anone * anone" \ + "\\^done,name=\"anone\",numchild=\"0\",value=\".*\",type=\"enum \{\\.\\.\\.\}\"" \ + "create local variable anone" setup_xfail "*-*-*" # Test: c_variable-7.61 @@ -591,7 +610,9 @@ gdb_expect { # Test: c_variable-7.81 # Desc: Create variables in different scopes -mi_create_varobj a1 a "create local variable a1" +mi_gdb_test "-var-create a1 * a" \ + "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\"" \ + "create local variable a1" mi_gdb_test "-var-create a2 $fp a" \ "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\"" \ diff --git a/gdb/testsuite/gdb.mi/mi2-var-block.exp b/gdb/testsuite/gdb.mi/mi2-var-block.exp index f9499749f97..46071a7d4cc 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-block.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-block.exp @@ -45,7 +45,9 @@ mi_runto do_block_tests # Test: c_variable-3.2 # Desc: create cb and foo -mi_create_varobj cb cb "create local variable cb" +mi_gdb_test "-var-create cb * cb" \ + "\\^done,name=\"cb\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable cb" mi_gdb_test "-var-create foo * foo" \ "&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \ @@ -65,7 +67,9 @@ mi_gdb_test "-var-delete foo" \ # Test: c_variable-3.3 # Desc: create foo -mi_create_varobj foo foo "create local variable foo" +mi_gdb_test "-var-create foo * foo" \ + "\\^done,name=\"foo\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable foo" # step to "foo2 = 123;" mi_step_to "do_block_tests" "" "var-cmd.c" \ @@ -85,7 +89,9 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \ # Test: c_variable-3.5 # Desc: create inner block foo -mi_create_varobj inner_foo foo "create local variable inner_foo" +mi_gdb_test "-var-create inner_foo * foo" \ + "\\^done,name=\"inner_foo\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable inner_foo" # step to "foo2 = 0;" mi_step_to "do_block_tests" "" "var-cmd.c" \ @@ -94,7 +100,9 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \ # Test: c_variable-3.6 # Desc: create foo2 -mi_create_varobj foo2 foo2 "create local variable foo2" +mi_gdb_test "-var-create foo2 * foo2" \ + "\\^done,name=\"foo2\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable foo2" # Test: c_variable-3.7 # Desc: check that outer foo in scope and inner foo out of scope diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp index 28d503432c0..5ea9ab02a86 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp @@ -51,8 +51,9 @@ mi_runto do_children_tests # Test: c_variable-4.2 # Desc: create variable "struct_declarations" -mi_create_varobj struct_declarations struct_declarations \ - "create local variable struct_declarations" +mi_gdb_test "-var-create struct_declarations * struct_declarations" \ + "\\^done,name=\"struct_declarations\",numchild=\"11\",value=\"{...}\",type=\"struct _struct_decl\"" \ + "create local variable struct_declarations" # Test: c_variable-4.3 # Desc: children of struct_declarations @@ -558,7 +559,9 @@ mi_step_to do_children_tests {} {.*var-cmd.c} \ # Test: c_variable-4.81 # Desc: create local variable "weird" -mi_create_varobj weird weird "create local variable weird" +mi_gdb_test "-var-create weird * weird" \ + "\\^done,name=\"weird\",numchild=\"11\",value=\"$hex\",type=\"weird_struct \\*\"" \ + "create local variable weird" # Test: c_variable-4.82 # Desc: children of weird @@ -620,8 +623,9 @@ mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \ # Test: c_variable-4.90 # Desc: create weird->int_ptr_ptr -mi_create_varobj weird->int_ptr_ptr weird->int_ptr_ptr \ - "create local variable weird->int_ptr_ptr" +mi_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \ + "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\\*\"" \ + "create local variable weird->int_ptr_ptr" # Test: c_variable-4.91 # Desc: children of weird->int_ptr_ptr @@ -861,8 +865,9 @@ mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cm # Test: c_variable-5.10 # Desc: create psnp->char_ptr -mi_create_varobj psnp->char_ptr psnp->char_ptr \ - "create local variable psnp->char_ptr" +mi_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \ + "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",value=\".*\",type=\"char \\*\\*\\*\\*\"" \ + "create local variable psnp->char_ptr" # Test: c_variable-5.11 # Desc: children of psnp->char_ptr @@ -933,8 +938,9 @@ mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ # Test: c_variable-5.19 # Desc: create psnp->long_ptr -mi_create_varobj psnp->long_ptr psnp->long_ptr \ - "create local variable psnp->long_ptr" +mi_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \ + "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\\*\\*\\*\"" \ + "create local variable psnp->long_ptr" # Test: c_variable-5.20 # Desc: children of psnp->long_ptr @@ -999,8 +1005,9 @@ mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ # Test: c_variable-5.30 # Desc: create psnp->ptrs -mi_create_varobj psnp->ptrs psnp->ptrs "create local variable psnp->ptrs" - +mi_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \ + "\\^done,name=\"psnp->ptrs\",numchild=\"3\",value=\"\\\[3\\\]\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \ + "create local variable psnp->ptrs" # Test: c_variable-5.31 # Desc: children of psnp->ptrs diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp index 10790afac0f..e22d398a3b5 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp @@ -52,7 +52,7 @@ mi_gdb_load ${binfile} # Desc: Create global variable mi_gdb_test "111-var-create global_simple * global_simple" \ - "111\\^done,name=\"global_simple\",numchild=\"6\",value=\".*\",type=\"simpleton\"" \ + "111\\^done,name=\"global_simple\",numchild=\"6\",value=\"{...}\",type=\"simpleton\"" \ "create global variable" # Test: c_variable-1.2 @@ -74,43 +74,76 @@ mi_runto do_locals_tests # Test: c_variable-1.4 # Desc: create local variables -mi_create_varobj linteger linteger "create local variable linteger" +mi_gdb_test "-var-create linteger * linteger" \ + "\\^done,name=\"linteger\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable linteger" -mi_create_varobj lpinteger lpinteger "create local variable lpinteger" +mi_gdb_test "-var-create lpinteger * lpinteger" \ + "\\^done,name=\"lpinteger\",numchild=\"1\",value=\"$hex\",type=\"int \\*\"" \ + "create local variable lpinteger" -mi_create_varobj lcharacter lcharacter "create local variable lcharacter" +mi_gdb_test "-var-create lcharacter * lcharacter" \ + "\\^done,name=\"lcharacter\",numchild=\"0\",value=\".*\",type=\"char\"" \ + "create local variablelcharacter " -mi_create_varobj lpcharacter lpcharacter "create local variable lpcharacter" +mi_gdb_test "-var-create lpcharacter * lpcharacter" \ + "\\^done,name=\"lpcharacter\",numchild=\"1\",value=\"$hex \\\\\".*\\\\\"\",type=\"char \\*\"" \ + "create local variable lpcharacter" -mi_create_varobj llong llong "create local variable llong" +mi_gdb_test "-var-create llong * llong" \ + "\\^done,name=\"llong\",numchild=\"0\",value=\".*\",type=\"long int\"" \ + "create local variable llong" -mi_create_varobj lplong lplong "create local variable lplong" +mi_gdb_test "-var-create lplong * lplong" \ + "\\^done,name=\"lplong\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\"" \ + "create local variable lplong" -mi_create_varobj lfloat lfloat "create local variable lfloat" +mi_gdb_test "-var-create lfloat * lfloat" \ + "\\^done,name=\"lfloat\",numchild=\"0\",value=\".*\",type=\"float\"" \ + "create local variable lfloat" -mi_create_varobj lpfloat lpfloat "create local variable lpfloat" +mi_gdb_test "-var-create lpfloat * lpfloat" \ + "\\^done,name=\"lpfloat\",numchild=\"1\",value=\"$hex\",type=\"float \\*\"" \ + "create local variable lpfloat" -mi_create_varobj ldouble ldouble "create local variable ldouble" +mi_gdb_test "-var-create ldouble * ldouble" \ + "\\^done,name=\"ldouble\",numchild=\"0\",value=\".*\",type=\"double\"" \ + "create local variable ldouble" -mi_create_varobj lpdouble lpdouble "create local variable lpdouble" +mi_gdb_test "-var-create lpdouble * lpdouble" \ + "\\^done,name=\"lpdouble\",numchild=\"1\",value=\"$hex\",type=\"double \\*\"" \ + "create local variable lpdouble" -mi_create_varobj lsimple lsimple "create local variable lsimple" +mi_gdb_test "-var-create lsimple * lsimple" \ + "\\^done,name=\"lsimple\",numchild=\"6\",value=\"{...}\",type=\"struct _simple_struct\"" \ + "create local variable lsimple" -mi_create_varobj lpsimple lpsimple "create local variable lpsimple" +mi_gdb_test "-var-create lpsimple * lpsimple" \ + "\\^done,name=\"lpsimple\",numchild=\"6\",value=\"$hex\",type=\"struct _simple_struct \\*\"" \ + "create local variable lpsimple" -mi_create_varobj func func "create local variable func" +mi_gdb_test "-var-create func * func" \ + "\\^done,name=\"func\",numchild=\"0\",value=\"$hex\",type=\"void \\(\\*\\)\\((void|)\\)\"" \ + "create local variable func" # Test: c_variable-1.5 # Desc: create lsimple.character -mi_create_varobj lsimple.character lsimple.character "create lsimple.character" +mi_gdb_test "-var-create lsimple.character * lsimple.character" \ + "\\^done,name=\"lsimple.character\",numchild=\"0\",value=\".*\",type=\"char\"" \ + "create lsimple.character" # Test: c_variable-1.6 # Desc: create lpsimple->integer -mi_create_varobj lsimple->integer lsimple->integer "create lsimple->integer" +mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \ + "\\^done,name=\"lsimple->integer\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create lsimple->integer" # Test: c_variable-1.7 # Desc: ceate lsimple.integer -mi_create_varobj lsimple.integer lsimple.integer "create lsimple->integer" +mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \ + "\\^done,name=\"lsimple.integer\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create lsimple->integer" + # Test: c_variable-1.9 # Desc: create type name @@ -364,9 +397,13 @@ mi_continue_to "subroutine1" # Test: c_variable-2.10 # Desc: create variable for locals i,l in subroutine1 -mi_create_varobj i i "create i" +mi_gdb_test "-var-create i * i" \ + "\\^done,name=\"i\",numchild=\"0\",value=\"4321\",type=\"int\"" \ + "create i" -mi_create_varobj l l "create l" +mi_gdb_test "-var-create l * l" \ + "\\^done,name=\"l\",numchild=\"1\",value=\"$hex\",type=\"long int \\*\"" \ + "create l" # Test: c_variable-2.11 # Desc: create do_locals_tests local in subroutine1 @@ -501,7 +538,7 @@ mi_gdb_test "-var-delete l" \ mi_continue_to do_special_tests mi_gdb_test "-var-create selected_a @ a" \ - {\^done,name="selected_a",numchild="0",value=\".*\",type="int"} \ + {\^done,name="selected_a",numchild="0",value=".*",type="int"} \ "create selected_a" mi_continue_to incr_a diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp index 61f092b7576..539e4b67149 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp @@ -65,7 +65,9 @@ gdb_expect { # Test: c_variable-6.1 # Desc: create variable bar -mi_create_varobj bar bar "create local variable bar" +mi_gdb_test "-var-create bar * bar" \ + "\\^done,name=\"bar\",numchild=\"0\",value=\".*\",type=\"int\"" \ + "create local variable bar" # Test: c_variable-6.2 # Desc: type of variable bar @@ -117,7 +119,9 @@ mi_gdb_test "-var-delete bar" \ # Test: c_variable-6.11 # Desc: create variable foo -mi_create_varobj foo foo "create local variable foo" +mi_gdb_test "-var-create foo * foo" \ + "\\^done,name=\"foo\",numchild=\"1\",value=\".*\",type=\"int \\*\"" \ + "create local variable foo" # Test: c_variable-6.12 # Desc: type of variable foo @@ -175,7 +179,9 @@ mi_gdb_test "-var-delete foo" \ # Test: c_variable-6.21 # Desc: create variable weird and children -mi_create_varobj weird weird "create local variable weird" +mi_gdb_test "-var-create weird * weird" \ + "\\^done,name=\"weird\",numchild=\"11\",value=\".*\",type=\"weird_struct \\*\"" \ + "create local variable weird" mi_gdb_test "-var-list-children weird" \ "\\^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=\"1\",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 \\(\\*\\)\\((void|)\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \ @@ -338,7 +344,9 @@ gdb_expect { # Test: c_variable-7.10 # Desc: create union u -mi_create_varobj u u "create local variable u" +mi_gdb_test "-var-create u * u" \ + "\\^done,name=\"u\",numchild=\"2\",value=\".*\",type=\"union named_union\"" \ + "create local variable u" # Test: c_variable-7.11 # Desc: value of u @@ -372,7 +380,9 @@ mi_gdb_test "-var-list-children u" \ # Test: c_variable-7.20 # Desc: create anonu -mi_create_varobj anonu anonu "create local variable anonu" +mi_gdb_test "-var-create anonu * anonu" \ + "\\^done,name=\"anonu\",numchild=\"3\",value=\".*\",type=\"union \{\\.\\.\\.\}\"" \ + "create local variable anonu" # Test: c_variable-7.21 # Desc: value of anonu @@ -406,7 +416,10 @@ mi_gdb_test "-var-list-children anonu" \ # Test: c_variable-7.30 # Desc: create struct s -mi_create_varobj s s "create local variable s" +mi_gdb_test "-var-create s * s" \ + "\\^done,name=\"s\",numchild=\"6\",value=\".*\",type=\"struct _simple_struct\"" \ + "create local variable s" + # Test: c_variable-7.31 # Desc: value of s @@ -441,7 +454,9 @@ mi_gdb_test "-var-list-children s" \ # Test: c_variable-7.40 # Desc: create anons -mi_create_varobj anons anons "create local variable anons" +mi_gdb_test "-var-create anons * anons" \ + "\\^done,name=\"anons\",numchild=\"3\",value=\".*\",type=\"struct \{\\.\\.\\.\}\"" \ + "create local variable anons" # Test: c_variable-7.41 # Desc: value of anons @@ -476,7 +491,9 @@ mi_gdb_test "-var-list-children anons" \ # Test: c_variable-7.50 # Desc: create enum e -mi_create_varobj e e "create local variable e" +mi_gdb_test "-var-create e * e" \ + "\\^done,name=\"e\",numchild=\"0\",value=\".*\",type=\"enum foo\"" \ + "create local variable e" setup_xfail "*-*-*" # Test: c_variable-7.51 @@ -512,7 +529,9 @@ mi_gdb_test "-var-list-children e" \ # Test: c_variable-7.60 # Desc: create anone -mi_create_varobj anone anone "create local variable anone" +mi_gdb_test "-var-create anone * anone" \ + "\\^done,name=\"anone\",numchild=\"0\",value=\".*\",type=\"enum \{\\.\\.\\.\}\"" \ + "create local variable anone" setup_xfail "*-*-*" # Test: c_variable-7.61 @@ -591,7 +610,9 @@ gdb_expect { # Test: c_variable-7.81 # Desc: Create variables in different scopes -mi_create_varobj a1 a "create local variable a1" +mi_gdb_test "-var-create a1 * a" \ + "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\"" \ + "create local variable a1" mi_gdb_test "-var-create a2 $fp a" \ "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\"" \ -- 2.30.2