summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorNick Roberts <nickrob@snap.net.nz>2007-02-08 20:35:08 +0000
committerNick Roberts <nickrob@snap.net.nz>2007-02-08 20:35:08 +0000
commite4b70feb1cb63999909ebfb5e062a592e87c6601 (patch)
tree6a079714528e4520c8af183024e183819d4c77c7 /gdb
parentfa0a9124379d2c13313d1e1a17b83317aa04eacb (diff)
downloadgdb-e4b70feb1cb63999909ebfb5e062a592e87c6601.tar.gz
Update tests to include value field in output of -var-create.
mi/mi-cmd-var.c (mi_cmd_var_create): Add value field.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.mi/gdb701.exp4
-rw-r--r--gdb/testsuite/gdb.mi/gdb792.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-block.exp16
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child-f.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child.exp30
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-cmd.exp89
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-display.exp43
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-block.exp16
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-child.exp29
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-cmd.exp77
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-display.exp43
-rw-r--r--gdb/testsuite/lib/mi-support.exp2
12 files changed, 100 insertions, 257 deletions
diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp
index 29882bece2d..c75e7ce0f49 100644
--- a/gdb/testsuite/gdb.mi/gdb701.exp
+++ b/gdb/testsuite/gdb.mi/gdb701.exp
@@ -50,9 +50,7 @@ mi_run_to_main
# Step over "foo = 0"
mi_next "step over \"foo = 0\""
-mi_gdb_test "-var-create fooPtr * foo" \
- "(&\".*\"\r\n)*\\^done,name=\"fooPtr\",numchild=\"3\",type=\"Foo \\*\"" \
- "create fooPtr"
+mi_create_varobj fooPtr foo "create fooPtr"
mi_gdb_test "-var-list-children fooPtr" \
"(&\".*\"\r\n)*\\^done,numchild=\"3\",.*" \
diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp
index 6b26cbdd985..f7910f41de9 100644
--- a/gdb/testsuite/gdb.mi/gdb792.exp
+++ b/gdb/testsuite/gdb.mi/gdb792.exp
@@ -50,7 +50,7 @@ if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""
mi_run_to_main
mi_gdb_test "-var-create - * a" \
- "(&\".*\"\r\n)*\\^done,name=\"var1\",numchild=\"3\",type=\"A\"" \
+ "(&\".*\"\r\n)*\\^done,name=\"var1\",numchild=\"3\",value=\".*\",type=\"A\"" \
"create var for class A"
mi_gdb_test "-var-list-children var1" \
@@ -82,7 +82,7 @@ mi_gdb_test "-var-list-children var1.protected.b.private" \
"list children of A.protected.b.private"
mi_gdb_test "-var-create - * c" \
- "(&\".*\"\r\n)*\\^done,name=\"var2\",numchild=\"3\",type=\"C\"" \
+ "(&\".*\"\r\n)*\\^done,name=\"var2\",numchild=\"3\",value=\".*\",type=\"C\"" \
"create var for class C which has baseclass A"
mi_gdb_test "-var-list-children var2" \
diff --git a/gdb/testsuite/gdb.mi/mi-var-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp
index d1e74fafe2b..007297d1529 100644
--- a/gdb/testsuite/gdb.mi/mi-var-block.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-block.exp
@@ -44,9 +44,7 @@ mi_runto do_block_tests
# Test: c_variable-3.2
# Desc: create cb and foo
-mi_gdb_test "-var-create cb * cb" \
- "\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \
- "create local variable cb"
+mi_create_varobj cb cb "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\"" \
@@ -66,9 +64,7 @@ mi_gdb_test "-var-delete foo" \
# Test: c_variable-3.3
# Desc: create foo
-mi_gdb_test "-var-create foo * foo" \
- "\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \
- "create local variable foo"
+mi_create_varobj foo foo "create local variable foo"
# step to "foo2 = 123;"
mi_step_to "do_block_tests" "" "var-cmd.c" \
@@ -88,9 +84,7 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \
# Test: c_variable-3.5
# Desc: create inner block foo
-mi_gdb_test "-var-create inner_foo * foo" \
- "\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \
- "create local variable inner_foo"
+mi_create_varobj inner_foo foo "create local variable inner_foo"
# step to "foo2 = 0;"
mi_step_to "do_block_tests" "" "var-cmd.c" \
@@ -99,9 +93,7 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \
# Test: c_variable-3.6
# Desc: create foo2
-mi_gdb_test "-var-create foo2 * foo2" \
- "\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \
- "create local variable foo2"
+mi_create_varobj foo2 foo2 "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 8e600145dcc..9c96f5b762f 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -38,9 +38,7 @@ mi_gdb_load ${binfile}
mi_runto MAIN__
-mi_gdb_test "-var-create array * array" \
- "\\^done,name=\"array\",numchild=\"3\",type=\"integer \\(2,-1:1\\)\"" \
- "create local variable array"
+mi_create_varobj "array" "array" "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 507c1f5e80f..146de37e100 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child.exp
@@ -56,9 +56,8 @@ mi_execute_to "exec-next" "end-stepping-range" do_children_tests {} ".*${srcfile
# Test: c_variable-4.2
# Desc: create variable "struct_declarations"
-mi_gdb_test "-var-create struct_declarations * struct_declarations" \
- "\\^done,name=\"struct_declarations\",numchild=\"11\",type=\"struct _struct_decl\"" \
- "create local variable struct_declarations"
+mi_create_varobj struct_declarations struct_declarations \
+ "create local variable struct_declarations"
# Test: c_variable-4.3
# Desc: children of struct_declarations
@@ -564,9 +563,7 @@ mi_step_to do_children_tests {} ".*${srcfile}" \
# Test: c_variable-4.81
# Desc: create local variable "weird"
-mi_gdb_test "-var-create weird * weird" \
- "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
- "create local variable weird"
+mi_create_varobj weird weird "create local variable weird"
# Test: c_variable-4.82
# Desc: children of weird
@@ -628,9 +625,8 @@ 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_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \
- "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"" \
- "create local variable weird->int_ptr_ptr"
+mi_create_varobj weird->int_ptr_ptr weird->int_ptr_ptr \
+ "create local variable weird->int_ptr_ptr"
# Test: c_variable-4.91
# Desc: children of weird->int_ptr_ptr
@@ -894,9 +890,8 @@ mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcf
# Test: c_variable-5.10
# Desc: create psnp->char_ptr
-mi_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \
- "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"" \
- "create local variable psnp->char_ptr"
+mi_create_varobj psnp->char_ptr psnp->char_ptr \
+ "create local variable psnp->char_ptr"
# Test: c_variable-5.11
# Desc: children of psnp->char_ptr
@@ -967,9 +962,8 @@ 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_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \
- "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"" \
- "create local variable psnp->long_ptr"
+mi_create_varobj psnp->long_ptr psnp->long_ptr \
+ "create local variable psnp->long_ptr"
# Test: c_variable-5.20
# Desc: children of psnp->long_ptr
@@ -1034,9 +1028,7 @@ 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_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \
- "\\^done,name=\"psnp->ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \
- "create local variable psnp->ptrs"
+mi_create_varobj psnp->ptrs psnp->ptrs "create local variable psnp->ptrs"
# Test: c_variable-5.31
# Desc: children of psnp->ptrs
@@ -1211,7 +1203,7 @@ mi_step_to do_children_tests {} ".*${srcfile}" \
# Why does this have a FIXME?
setup_xfail *-*-*
mi_gdb_test "-var-update *" \
- "FIXME\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \
+ "FIXME\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope_changed=\"false\"\}\\\]" \
"update all vars psnp->next->long_ptr (and 1.long_ptr) changed"
clear_xfail *-*-*
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 6129c062c62..34265ea2b2e 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\",type=\"simpleton\"" \
+ "111\\^done,name=\"global_simple\",numchild=\"6\",value=\".*\",type=\"simpleton\"" \
"create global variable"
# Test: c_variable-1.2
@@ -74,76 +74,43 @@ mi_runto do_locals_tests
# Test: c_variable-1.4
# Desc: create local variables
-mi_gdb_test "-var-create linteger * linteger" \
- "\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \
- "create local variable linteger"
+mi_create_varobj linteger linteger "create local variable linteger"
-mi_gdb_test "-var-create lpinteger * lpinteger" \
- "\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \
- "create local variable lpinteger"
+mi_create_varobj lpinteger lpinteger "create local variable lpinteger"
-mi_gdb_test "-var-create lcharacter * lcharacter" \
- "\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \
- "create local variablelcharacter "
+mi_create_varobj lcharacter lcharacter "create local variable lcharacter"
-mi_gdb_test "-var-create lpcharacter * lpcharacter" \
- "\\^done,name=\"lpcharacter\",numchild=\"1\",type=\"char \\*\"" \
- "create local variable lpcharacter"
+mi_create_varobj lpcharacter lpcharacter "create local variable lpcharacter"
-mi_gdb_test "-var-create llong * llong" \
- "\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \
- "create local variable llong"
+mi_create_varobj llong llong "create local variable llong"
-mi_gdb_test "-var-create lplong * lplong" \
- "\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \
- "create local variable lplong"
+mi_create_varobj lplong lplong "create local variable lplong"
-mi_gdb_test "-var-create lfloat * lfloat" \
- "\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \
- "create local variable lfloat"
+mi_create_varobj lfloat lfloat "create local variable lfloat"
-mi_gdb_test "-var-create lpfloat * lpfloat" \
- "\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \
- "create local variable lpfloat"
+mi_create_varobj lpfloat lpfloat "create local variable lpfloat"
-mi_gdb_test "-var-create ldouble * ldouble" \
- "\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \
- "create local variable ldouble"
+mi_create_varobj ldouble ldouble "create local variable ldouble"
-mi_gdb_test "-var-create lpdouble * lpdouble" \
- "\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \
- "create local variable lpdouble"
+mi_create_varobj lpdouble lpdouble "create local variable lpdouble"
-mi_gdb_test "-var-create lsimple * lsimple" \
- "\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \
- "create local variable lsimple"
+mi_create_varobj lsimple lsimple "create local variable lsimple"
-mi_gdb_test "-var-create lpsimple * lpsimple" \
- "\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \
- "create local variable lpsimple"
+mi_create_varobj lpsimple lpsimple "create local variable lpsimple"
-mi_gdb_test "-var-create func * func" \
- "\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"" \
- "create local variable func"
+mi_create_varobj func func "create local variable func"
# Test: c_variable-1.5
# Desc: create lsimple.character
-mi_gdb_test "-var-create lsimple.character * lsimple.character" \
- "\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \
- "create lsimple.character"
+mi_create_varobj lsimple.character lsimple.character "create lsimple.character"
# Test: c_variable-1.6
# Desc: create lpsimple->integer
-mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \
- "\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \
- "create lsimple->integer"
+mi_create_varobj lsimple->integer lsimple->integer "create lsimple->integer"
# Test: c_variable-1.7
# Desc: ceate lsimple.integer
-mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \
- "\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \
- "create lsimple->integer"
-
+mi_create_varobj lsimple.integer lsimple.integer "create lsimple->integer"
# Test: c_variable-1.9
# Desc: create type name
@@ -403,9 +370,7 @@ mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\\\]" \
"assign same value to func (update)"
-mi_gdb_test "-var-create array_ptr * array_ptr" \
- "\\^done,name=\"array_ptr\",numchild=\"1\",type=\"int \\*\"" \
- "create global variable array_ptr"
+mi_create_varobj array_ptr array_ptr "create global variable array_ptr"
mi_gdb_test "-var-assign array_ptr array2" \
"\\^done,value=\"$hex\"" \
@@ -434,13 +399,9 @@ mi_continue_to subroutine1
# Test: c_variable-2.10
# Desc: create variable for locals i,l in subroutine1
-mi_gdb_test "-var-create i * i" \
- "\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \
- "create i"
+mi_create_varobj i i "create i"
-mi_gdb_test "-var-create l * l" \
- "\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \
- "create l"
+mi_create_varobj l l "create l"
# Test: c_variable-2.11
# Desc: create do_locals_tests local in subroutine1
@@ -575,7 +536,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",type="int"} \
+ {\^done,name="selected_a",numchild="0",value=\".*\",type="int"} \
"create selected_a"
mi_continue_to incr_a
@@ -595,9 +556,7 @@ mi_gdb_test "-var-update selected_a" \
# A varobj we fail to read during -var-update should be considered
# out of scope.
-mi_gdb_test "-var-create null_ptr * **0" \
- {\^done,name="null_ptr",numchild="0",type="int"} \
- "create null_ptr"
+mi_create_varobj null_ptr **0 "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
@@ -620,9 +579,7 @@ mi_gdb_test "kill" \
{&"kill\\n".*\^done} \
"kill program before endvar"
-mi_gdb_test "-var-create endvar * _end" \
- {(\^done,name="endvar",numchild="0",type=".*"|&".*unable to.*".*\^error,msg=".*")} \
- "create endvar"
+mi_create_varobj endvar _end "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 acc98ab9fd8..0b112aa1bd9 100644
--- a/gdb/testsuite/gdb.mi/mi-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-display.exp
@@ -65,9 +65,7 @@ gdb_expect {
# Test: c_variable-6.1
# Desc: create variable bar
-mi_gdb_test "-var-create bar * bar" \
- "\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \
- "create local variable bar"
+mi_create_varobj bar bar "create local variable bar"
# Test: c_variable-6.2
# Desc: type of variable bar
@@ -119,9 +117,7 @@ mi_gdb_test "-var-delete bar" \
# Test: c_variable-6.11
# Desc: create variable foo
-mi_gdb_test "-var-create foo * foo" \
- "\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \
- "create local variable foo"
+mi_create_varobj foo foo "create local variable foo"
# Test: c_variable-6.12
# Desc: type of variable foo
@@ -179,9 +175,7 @@ mi_gdb_test "-var-delete foo" \
# Test: c_variable-6.21
# Desc: create variable weird and children
-mi_gdb_test "-var-create weird * weird" \
- "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
- "create local variable weird"
+mi_create_varobj weird weird "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 \{\\.\\.\\.\}\"\}\\\]" \
@@ -344,9 +338,7 @@ gdb_expect {
# Test: c_variable-7.10
# Desc: create union u
-mi_gdb_test "-var-create u * u" \
- "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \
- "create local variable u"
+mi_create_varobj u u "create local variable u"
# Test: c_variable-7.11
# Desc: value of u
@@ -380,9 +372,7 @@ mi_gdb_test "-var-list-children u" \
# Test: c_variable-7.20
# Desc: create anonu
-mi_gdb_test "-var-create anonu * anonu" \
- "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \
- "create local variable anonu"
+mi_create_varobj anonu anonu "create local variable anonu"
# Test: c_variable-7.21
# Desc: value of anonu
@@ -416,10 +406,7 @@ mi_gdb_test "-var-list-children anonu" \
# Test: c_variable-7.30
# Desc: create struct s
-mi_gdb_test "-var-create s * s" \
- "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \
- "create local variable s"
-
+mi_create_varobj s s "create local variable s"
# Test: c_variable-7.31
# Desc: value of s
@@ -454,9 +441,7 @@ mi_gdb_test "-var-list-children s" \
# Test: c_variable-7.40
# Desc: create anons
-mi_gdb_test "-var-create anons * anons" \
- "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \
- "create local variable anons"
+mi_create_varobj anons anons "create local variable anons"
# Test: c_variable-7.41
# Desc: value of anons
@@ -491,9 +476,7 @@ mi_gdb_test "-var-list-children anons" \
# Test: c_variable-7.50
# Desc: create enum e
-mi_gdb_test "-var-create e * e" \
- "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \
- "create local variable e"
+mi_create_varobj e e "create local variable e"
setup_xfail "*-*-*"
# Test: c_variable-7.51
@@ -529,9 +512,7 @@ mi_gdb_test "-var-list-children e" \
# Test: c_variable-7.60
# Desc: create anone
-mi_gdb_test "-var-create anone * anone" \
- "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \
- "create local variable anone"
+mi_create_varobj anone anone "create local variable anone"
setup_xfail "*-*-*"
# Test: c_variable-7.61
@@ -610,12 +591,10 @@ gdb_expect {
# Test: c_variable-7.81
# Desc: Create variables in different scopes
-mi_gdb_test "-var-create a1 * a" \
- "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \
- "create local variable a1"
+mi_create_varobj a1 a "create local variable a1"
mi_gdb_test "-var-create a2 $fp a" \
- "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \
+ "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\"" \
"create variable a2 in different scope"
#gdbtk_test c_variable-7.81 {create variables in different scopes} {
diff --git a/gdb/testsuite/gdb.mi/mi2-var-block.exp b/gdb/testsuite/gdb.mi/mi2-var-block.exp
index 08beb6a3efe..f9499749f97 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-block.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-block.exp
@@ -45,9 +45,7 @@ mi_runto do_block_tests
# Test: c_variable-3.2
# Desc: create cb and foo
-mi_gdb_test "-var-create cb * cb" \
- "\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \
- "create local variable cb"
+mi_create_varobj cb cb "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\"" \
@@ -67,9 +65,7 @@ mi_gdb_test "-var-delete foo" \
# Test: c_variable-3.3
# Desc: create foo
-mi_gdb_test "-var-create foo * foo" \
- "\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \
- "create local variable foo"
+mi_create_varobj foo foo "create local variable foo"
# step to "foo2 = 123;"
mi_step_to "do_block_tests" "" "var-cmd.c" \
@@ -89,9 +85,7 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \
# Test: c_variable-3.5
# Desc: create inner block foo
-mi_gdb_test "-var-create inner_foo * foo" \
- "\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \
- "create local variable inner_foo"
+mi_create_varobj inner_foo foo "create local variable inner_foo"
# step to "foo2 = 0;"
mi_step_to "do_block_tests" "" "var-cmd.c" \
@@ -100,9 +94,7 @@ mi_step_to "do_block_tests" "" "var-cmd.c" \
# Test: c_variable-3.6
# Desc: create foo2
-mi_gdb_test "-var-create foo2 * foo2" \
- "\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \
- "create local variable foo2"
+mi_create_varobj foo2 foo2 "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 a18b03c5732..28d503432c0 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp
@@ -51,9 +51,8 @@ mi_runto do_children_tests
# Test: c_variable-4.2
# Desc: create variable "struct_declarations"
-mi_gdb_test "-var-create struct_declarations * struct_declarations" \
- "\\^done,name=\"struct_declarations\",numchild=\"11\",type=\"struct _struct_decl\"" \
- "create local variable struct_declarations"
+mi_create_varobj struct_declarations struct_declarations \
+ "create local variable struct_declarations"
# Test: c_variable-4.3
# Desc: children of struct_declarations
@@ -559,9 +558,7 @@ mi_step_to do_children_tests {} {.*var-cmd.c} \
# Test: c_variable-4.81
# Desc: create local variable "weird"
-mi_gdb_test "-var-create weird * weird" \
- "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
- "create local variable weird"
+mi_create_varobj weird weird "create local variable weird"
# Test: c_variable-4.82
# Desc: children of weird
@@ -623,9 +620,8 @@ 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_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \
- "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"" \
- "create local variable weird->int_ptr_ptr"
+mi_create_varobj weird->int_ptr_ptr weird->int_ptr_ptr \
+ "create local variable weird->int_ptr_ptr"
# Test: c_variable-4.91
# Desc: children of weird->int_ptr_ptr
@@ -865,9 +861,8 @@ 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_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \
- "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"" \
- "create local variable psnp->char_ptr"
+mi_create_varobj psnp->char_ptr psnp->char_ptr \
+ "create local variable psnp->char_ptr"
# Test: c_variable-5.11
# Desc: children of psnp->char_ptr
@@ -938,9 +933,8 @@ 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_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \
- "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"" \
- "create local variable psnp->long_ptr"
+mi_create_varobj psnp->long_ptr psnp->long_ptr \
+ "create local variable psnp->long_ptr"
# Test: c_variable-5.20
# Desc: children of psnp->long_ptr
@@ -1005,9 +999,8 @@ 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_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \
- "\\^done,name=\"psnp->ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \
- "create local variable psnp->ptrs"
+mi_create_varobj psnp->ptrs psnp->ptrs "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 a5cfd99c4d9..10790afac0f 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\",type=\"simpleton\"" \
+ "111\\^done,name=\"global_simple\",numchild=\"6\",value=\".*\",type=\"simpleton\"" \
"create global variable"
# Test: c_variable-1.2
@@ -74,76 +74,43 @@ mi_runto do_locals_tests
# Test: c_variable-1.4
# Desc: create local variables
-mi_gdb_test "-var-create linteger * linteger" \
- "\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \
- "create local variable linteger"
+mi_create_varobj linteger linteger "create local variable linteger"
-mi_gdb_test "-var-create lpinteger * lpinteger" \
- "\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \
- "create local variable lpinteger"
+mi_create_varobj lpinteger lpinteger "create local variable lpinteger"
-mi_gdb_test "-var-create lcharacter * lcharacter" \
- "\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \
- "create local variablelcharacter "
+mi_create_varobj lcharacter lcharacter "create local variable lcharacter"
-mi_gdb_test "-var-create lpcharacter * lpcharacter" \
- "\\^done,name=\"lpcharacter\",numchild=\"1\",type=\"char \\*\"" \
- "create local variable lpcharacter"
+mi_create_varobj lpcharacter lpcharacter "create local variable lpcharacter"
-mi_gdb_test "-var-create llong * llong" \
- "\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \
- "create local variable llong"
+mi_create_varobj llong llong "create local variable llong"
-mi_gdb_test "-var-create lplong * lplong" \
- "\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \
- "create local variable lplong"
+mi_create_varobj lplong lplong "create local variable lplong"
-mi_gdb_test "-var-create lfloat * lfloat" \
- "\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \
- "create local variable lfloat"
+mi_create_varobj lfloat lfloat "create local variable lfloat"
-mi_gdb_test "-var-create lpfloat * lpfloat" \
- "\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \
- "create local variable lpfloat"
+mi_create_varobj lpfloat lpfloat "create local variable lpfloat"
-mi_gdb_test "-var-create ldouble * ldouble" \
- "\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \
- "create local variable ldouble"
+mi_create_varobj ldouble ldouble "create local variable ldouble"
-mi_gdb_test "-var-create lpdouble * lpdouble" \
- "\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \
- "create local variable lpdouble"
+mi_create_varobj lpdouble lpdouble "create local variable lpdouble"
-mi_gdb_test "-var-create lsimple * lsimple" \
- "\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \
- "create local variable lsimple"
+mi_create_varobj lsimple lsimple "create local variable lsimple"
-mi_gdb_test "-var-create lpsimple * lpsimple" \
- "\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \
- "create local variable lpsimple"
+mi_create_varobj lpsimple lpsimple "create local variable lpsimple"
-mi_gdb_test "-var-create func * func" \
- "\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\((void|)\\)\"" \
- "create local variable func"
+mi_create_varobj func func "create local variable func"
# Test: c_variable-1.5
# Desc: create lsimple.character
-mi_gdb_test "-var-create lsimple.character * lsimple.character" \
- "\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \
- "create lsimple.character"
+mi_create_varobj lsimple.character lsimple.character "create lsimple.character"
# Test: c_variable-1.6
# Desc: create lpsimple->integer
-mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \
- "\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \
- "create lsimple->integer"
+mi_create_varobj lsimple->integer lsimple->integer "create lsimple->integer"
# Test: c_variable-1.7
# Desc: ceate lsimple.integer
-mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \
- "\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \
- "create lsimple->integer"
-
+mi_create_varobj lsimple.integer lsimple.integer "create lsimple->integer"
# Test: c_variable-1.9
# Desc: create type name
@@ -397,13 +364,9 @@ mi_continue_to "subroutine1"
# Test: c_variable-2.10
# Desc: create variable for locals i,l in subroutine1
-mi_gdb_test "-var-create i * i" \
- "\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \
- "create i"
+mi_create_varobj i i "create i"
-mi_gdb_test "-var-create l * l" \
- "\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \
- "create l"
+mi_create_varobj l l "create l"
# Test: c_variable-2.11
# Desc: create do_locals_tests local in subroutine1
@@ -538,7 +501,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",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 a5bb29d8cfd..61f092b7576 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp
@@ -65,9 +65,7 @@ gdb_expect {
# Test: c_variable-6.1
# Desc: create variable bar
-mi_gdb_test "-var-create bar * bar" \
- "\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \
- "create local variable bar"
+mi_create_varobj bar bar "create local variable bar"
# Test: c_variable-6.2
# Desc: type of variable bar
@@ -119,9 +117,7 @@ mi_gdb_test "-var-delete bar" \
# Test: c_variable-6.11
# Desc: create variable foo
-mi_gdb_test "-var-create foo * foo" \
- "\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \
- "create local variable foo"
+mi_create_varobj foo foo "create local variable foo"
# Test: c_variable-6.12
# Desc: type of variable foo
@@ -179,9 +175,7 @@ mi_gdb_test "-var-delete foo" \
# Test: c_variable-6.21
# Desc: create variable weird and children
-mi_gdb_test "-var-create weird * weird" \
- "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
- "create local variable weird"
+mi_create_varobj weird weird "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 \{\\.\\.\\.\}\"\}\\\]" \
@@ -344,9 +338,7 @@ gdb_expect {
# Test: c_variable-7.10
# Desc: create union u
-mi_gdb_test "-var-create u * u" \
- "\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \
- "create local variable u"
+mi_create_varobj u u "create local variable u"
# Test: c_variable-7.11
# Desc: value of u
@@ -380,9 +372,7 @@ mi_gdb_test "-var-list-children u" \
# Test: c_variable-7.20
# Desc: create anonu
-mi_gdb_test "-var-create anonu * anonu" \
- "\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \
- "create local variable anonu"
+mi_create_varobj anonu anonu "create local variable anonu"
# Test: c_variable-7.21
# Desc: value of anonu
@@ -416,10 +406,7 @@ mi_gdb_test "-var-list-children anonu" \
# Test: c_variable-7.30
# Desc: create struct s
-mi_gdb_test "-var-create s * s" \
- "\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \
- "create local variable s"
-
+mi_create_varobj s s "create local variable s"
# Test: c_variable-7.31
# Desc: value of s
@@ -454,9 +441,7 @@ mi_gdb_test "-var-list-children s" \
# Test: c_variable-7.40
# Desc: create anons
-mi_gdb_test "-var-create anons * anons" \
- "\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \
- "create local variable anons"
+mi_create_varobj anons anons "create local variable anons"
# Test: c_variable-7.41
# Desc: value of anons
@@ -491,9 +476,7 @@ mi_gdb_test "-var-list-children anons" \
# Test: c_variable-7.50
# Desc: create enum e
-mi_gdb_test "-var-create e * e" \
- "\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \
- "create local variable e"
+mi_create_varobj e e "create local variable e"
setup_xfail "*-*-*"
# Test: c_variable-7.51
@@ -529,9 +512,7 @@ mi_gdb_test "-var-list-children e" \
# Test: c_variable-7.60
# Desc: create anone
-mi_gdb_test "-var-create anone * anone" \
- "\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \
- "create local variable anone"
+mi_create_varobj anone anone "create local variable anone"
setup_xfail "*-*-*"
# Test: c_variable-7.61
@@ -610,12 +591,10 @@ gdb_expect {
# Test: c_variable-7.81
# Desc: Create variables in different scopes
-mi_gdb_test "-var-create a1 * a" \
- "\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \
- "create local variable a1"
+mi_create_varobj a1 a "create local variable a1"
mi_gdb_test "-var-create a2 $fp a" \
- "\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \
+ "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\"" \
"create variable a2 in different scope"
#gdbtk_test c_variable-7.81 {create variables in different scopes} {
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 181d405442f..111bc840a48 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1019,7 +1019,7 @@ proc mi0_continue_to { bkptno func args file line test } {
# Name cannot be "-".
proc mi_create_varobj { name expression testname } {
mi_gdb_test "-var-create $name * $expression" \
- "\\^done,name=\"$name\",numchild=\"\[0-9\]+\",type=.*" \
+ "\\^done,name=\"$name\",numchild=\"\[0-9\]+\",value=\".*\",type=.*" \
$testname
}