old-cross-binutils/gdb/testsuite/gdb.mi/mi-var-child.exp
Tom Tromey 1d51a733d5 * printcmd.c (print_address_demangle): Remove special case for 0.
testsuite
	* gdb.mi/mi2-var-display.exp: Update.
	* gdb.mi/mi-var-display.exp: Update.
	* gdb.mi/mi-var-child.exp: Update.
	* gdb.cp/expand-psymtabs-cxx.exp: Update.
	* gdb.cp/cp-relocate.exp (get_func_address): Update.
2012-05-18 15:28:24 +00:00

1193 lines
50 KiB
Text

# Copyright 1999-2002, 2004-2005, 2007-2012 Free Software Foundation,
# Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi"
gdb_exit
if [mi_gdb_start] {
continue
}
set testfile "mi-var-child"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
untested mi-var-child.exp
return -1
}
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
mi_runto do_children_tests
set line_dlt_first_real [gdb_get_line_number "weird = &struct_declarations;"]
mi_continue_to_line $line_dlt_first_real "step to real start of do_children_test"
##### #####
# #
# children tests #
# #
##### #####
# Test: c_variable-4.2
# Desc: create 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
# STABS doesn't give us argument types for the func ptr structs, but
# Dwarf 2 does.
mi_list_varobj_children "struct_declarations" {
{struct_declarations.integer integer 0 int}
{struct_declarations.character character 0 char}
{struct_declarations.char_ptr char_ptr 1 "char \\*"}
{struct_declarations.long_int long_int 0 "long int"}
{struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
{struct_declarations.long_array long_array 12 "long int \\[12\\]"}
{struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
{struct_declarations.func_ptr_struct func_ptr_struct 0 \
"struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
{struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
{struct_declarations.u1 u1 4 "union \\{\\.\\.\\.\\}"}
{struct_declarations.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
} "get children of struct_declarations"
#gdbtk_test c_variable-4.3 {children of struct_declarations} {
# get_children struct_declarations
#} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2}
# Test: c_variable-4.4
# Desc: number of children of struct_declarations
mi_gdb_test "-var-info-num-children struct_declarations" \
"\\^done,numchild=\"11\"" \
"get number of children of struct_declarations"
# Test: c_variable-4.5
# Desc: children of struct_declarations.integer
mi_list_varobj_children "struct_declarations.integer" {} \
"get children of struct_declarations.integer"
# Test: c_variable-4.6
# Desc: number of children of struct_declarations.integer
mi_gdb_test "-var-info-num-children struct_declarations.integer" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.integer"
# Test: c_variable-4.7
# Desc: children of struct_declarations.character
mi_list_varobj_children "struct_declarations.character" {} \
"get children of struct_declarations.character"
# Test: c_variable-4.8
# Desc: number of children of struct_declarations.character
mi_gdb_test "-var-info-num-children struct_declarations.character" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.character"
# Test: c_variable-4.9
# Desc: children of struct_declarations.char_ptr
mi_list_varobj_children "struct_declarations.char_ptr" {
{{struct_declarations.char_ptr.\*char_ptr} {\*char_ptr} 0 char}
} "get children of struct_declarations.char_ptr"
# Test: c_variable-4.10
# Desc: number of children of struct_declarations.char_ptr
mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of struct_declarations.char_ptr"
# Test: c_variable-4.11
# Desc: children of struct_declarations.long_int
mi_list_varobj_children "struct_declarations.long_int" {} \
"get children of struct_declarations.long_int"
# Test: c_variable-4.12
# Desc: number of children of struct_declarations.long_int
mi_gdb_test "-var-info-num-children struct_declarations.long_int" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.long_int"
# Test: c_variable-4.13
# Desc: children of int_ptr_ptr
mi_list_varobj_children "struct_declarations.int_ptr_ptr" {
{{struct_declarations.int_ptr_ptr.\*int_ptr_ptr} {\*int_ptr_ptr} 1 {int \*}}
} "get children of struct_declarations.int_ptr_ptr"
#gdbtk_test c_variable-4.13 {children of int_ptr_ptr} {
# get_children struct_declarations.int_ptr_ptr
#} {*int_ptr_ptr}
# Test: c_variable-4.14
# Desc: number of children of int_ptr_ptr
mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of struct_declarations.int_ptr_ptr"
# Test: c_variable-4.15
# Desc: children of struct_declarations.long_array
mi_list_array_varobj_children "struct_declarations.long_array" 12 "long int" \
"get children of struct_declarations.long_array"
# Test: c_variable-4.16
# Desc: number of children of struct_declarations.long_array
mi_gdb_test "-var-info-num-children struct_declarations.long_array" \
"\\^done,numchild=\"12\"" \
"get number of children of struct_declarations.long_array"
# Test: c_variable-4.17
# Desc: children of struct_declarations.func_ptr
mi_list_varobj_children "struct_declarations.func_ptr" {} \
"get children of struct_declarations.func_ptr"
# Test: c_variable-4.18
# Desc: number of children of struct_declarations.func_ptr
mi_gdb_test "-var-info-num-children struct_declarations.func_ptr" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.func_ptr"
# Test: c_variable-4.19
# Desc: children of struct_declarations.func_ptr_struct
mi_list_varobj_children "struct_declarations.func_ptr_struct" {} \
"get children of struct_declarations.func_ptr_struct"
# Test: c_variable-4.20
# Desc: number of children of struct_declarations.func_ptr_struct
mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_struct" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.func_ptr_struct"
# Test: c_variable-4.21
# Desc: children of struct_declarations.func_ptr_ptr
mi_list_varobj_children "struct_declarations.func_ptr_ptr" {} \
"get children of struct_declarations.func_ptr_ptr"
# Test: c_variable-4.22
# Desc: number of children of struct_declarations.func_ptr_ptr
mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.func_ptr_ptr"
# Test: c_variable-4.23
# Desc: children of struct_declarations.u1
mi_list_varobj_children "struct_declarations.u1" {
{struct_declarations.u1.a a 0 int}
{struct_declarations.u1.b b 1 {char \*}}
{struct_declarations.u1.c c 0 {long int}}
{struct_declarations.u1.d d 0 {enum foo}}
} "get children of struct_declarations.u1"
# Test: c_variable-4.24
# Desc: number of children of struct_declarations.u1
mi_gdb_test "-var-info-num-children struct_declarations.u1" \
"\\^done,numchild=\"4\"" \
"get number of children of struct_declarations.u1"
# Test: c_variable-4.25
# Desc: children of struct_declarations.s2
mi_list_varobj_children "struct_declarations.s2" {
{struct_declarations.s2.u2 u2 3 {union \{\.\.\.\}}}
{struct_declarations.s2.g g 0 int}
{struct_declarations.s2.h h 0 char}
{struct_declarations.s2.i i 10 {long int \[10\]}}
} "get children of struct_declarations.s2"
#gdbtk_test c_variable-4.25 {children of struct_declarations.s2} {
# get_children struct_declarations.s2
#} {u2 g h i}
# Test: c_variable-4.26
# Desc: number of children of struct_declarations.s2
mi_gdb_test "-var-info-num-children struct_declarations.s2" \
"\\^done,numchild=\"4\"" \
"get number of children of struct_declarations.s2"
for {set i 1} {$i <= 9} {incr i} {
mi_list_varobj_children "struct_declarations.long_array.$i" {} \
"get children of struct_declarations.long_array.$i"
mi_gdb_test "-var-info-num-children struct_declarations.long_array.$i" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.long_array.$i"
}
# Test: c_variable-4.45
# Desc: children of struct_declarations.u1.a
mi_list_varobj_children "struct_declarations.u1.a" {} \
"get children of struct_declarations.u1.a"
# Test: c_variable-4.46
# Desc: number of children of struct_declarations.u1.a
mi_gdb_test "-var-info-num-children struct_declarations.u1.a" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.u1.a"
# Test: c_variable-4.47
# Desc: children of struct_declarations.u1.b
mi_list_varobj_children "struct_declarations.u1.b" {
{{struct_declarations.u1.b.\*b} {\*b} 0 char}
} "get children of struct_declarations.u1.b"
# Test: c_variable-4.48
# Desc: number of children of struct_declarations.u1.b
mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \
"\\^done,numchild=\"1\"" \
"get number of children of struct_declarations.u1.b"
# Test: c_variable-4.49
# Desc: children of struct_declarations.u1.c
mi_list_varobj_children "struct_declarations.u1.c" {} \
"get children of struct_declarations.u1.c"
# Test: c_variable-4.50
# Desc: number of children of struct_declarations.u1.c
mi_gdb_test "-var-info-num-children struct_declarations.u1.c" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.u1.c"
# Test: c_variable-4.51
# Desc: children of struct_declarations.u1.d
mi_list_varobj_children "struct_declarations.u1.d" {} \
"get children of struct_declarations.u1.d"
# Test: c_variable-4.52
# Desc: number of children of struct_declarations.u1.d
mi_gdb_test "-var-info-num-children struct_declarations.u1.d" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.u1.d"
# Test: c_variable-4.53
# Desc: children of struct_declarations.s2.u2
mi_list_varobj_children "struct_declarations.s2.u2" {
{"struct_declarations.s2.u2.u1s1" "u1s1" 4 {struct \{\.\.\.\}}}
{struct_declarations.s2.u2.f f 0 "long int"}
{struct_declarations.s2.u2.u1s2 u1s2 2 {struct \{\.\.\.\}}}
} "get children of struct_declarations.s2.u2"
# Test: c_variable-4.54
# Desc: number of children of struct_declarations.s2.u2
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2" \
"\\^done,numchild=\"3\"" \
"get number of children of struct_declarations.s2.u2"
# Test: c_variable-4.55
# Desc: children of struct_declarations.s2.g
mi_list_varobj_children struct_declarations.s2.g {} \
"get children of struct_declarations.s2.g"
# Test: c_variable-4.56
# Desc: number of children of struct_declarations.s2.g
mi_gdb_test "-var-info-num-children struct_declarations.s2.g" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.g"
# Test: c_variable-4.57
# Desc: children of struct_declarations.s2.h
mi_list_varobj_children struct_declarations.s2.h {} \
"get children of struct_declarations.s2.h"
# Test: c_variable-4.58
# Desc: number of children of struct_declarations.s2.h
mi_gdb_test "-var-info-num-children struct_declarations.s2.h" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.h"
# Test: c_variable-4.59
# Desc: children of struct_declarations.s2.i
set t {}
for {set i 0} {$i < 10} {incr i} {
lappend t [list struct_declarations.s2.i.$i $i 0 "long int"]
}
mi_list_varobj_children struct_declarations.s2.i $t \
"get children of struct_declarations.s2.i"
# Test: c_variable-4.60
# Desc: number of children of struct_declarations.s2.i
mi_gdb_test "-var-info-num-children struct_declarations.s2.i" \
"\\^done,numchild=\"10\"" \
"get number of children of struct_declarations.s2.i"
# Test: c_variable-4.61
# Desc: children of struct_declarations.s2.u2.u1s1
mi_list_varobj_children struct_declarations.s2.u2.u1s1 {
{struct_declarations.s2.u2.u1s1.d d 0 int}
{struct_declarations.s2.u2.u1s1.e e 10 {char \[10\]}}
{struct_declarations.s2.u2.u1s1.func func 0 {int \*\(\*\)\((void)?\)}}
{struct_declarations.s2.u2.u1s1.foo foo 0 efoo}
} "get children of struct_declarations.s2.u2.u1s1"
# Test: c_variable-4.62
# Desc: number of children of struct_declarations.s2.u2.u1s1
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1" \
"\\^done,numchild=\"4\"" \
"get number of children of struct_declarations.s2.u2.u1s1"
# Test: c_variable-4.63
# Desc: children of struct_declarations.s2.u2.f
mi_list_varobj_children struct_declarations.s2.u2.f {} \
"get children of struct_declarations.s2.u2.f"
# Test: c_variable-4.64
# Desc: number of children of struct_declarations.s2.u2.f
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.f" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.u2.f"
# Test: c_variable-4.65
# Desc: children of struct_declarations.s2.u2.u1s2
mi_list_varobj_children struct_declarations.s2.u2.u1s2 {
{struct_declarations.s2.u2.u1s2.array_ptr array_ptr 2 {char \[2\]}}
{struct_declarations.s2.u2.u1s2.func func 0 {int \(\*\)\((int, char \*)?\)}}
} "get children of struct_declarations.s2.u2.u1s2"
# Test: c_variable-4.66
# Desc: number of children of struct_declarations.s2.u2.u1s2
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2" \
"\\^done,numchild=\"2\"" \
"get number of children of struct_declarations.s2.u2.u1s2"
# Test: c_variable-4.67
# Desc: children of struct_declarations.s2.u2.u1s1.d
mi_list_varobj_children struct_declarations.s2.u2.u1s1.d {} \
"get children of struct_declarations.s2.u2.u1s1.d"
# Test: c_variable-4.68
# Desc: number of children of struct_declarations.s2.u2.u1s1.d
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.d" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.u2.u1s1.d"
# Test: c_variable-4.69
# Desc: children of struct_declarations.s2.u2.u1s1.e
set t {}
for {set i 0} {$i < 10} {incr i} {
lappend t [list struct_declarations.s2.u2.u1s1.e.$i $i 0 char]
}
mi_list_varobj_children struct_declarations.s2.u2.u1s1.e $t \
"get children of struct_declarations.s2.u2.u1s1.e"
# Test: c_variable-4.70
# Desc: number of children of struct_declarations.s2.u2.u1s1.e
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.e" \
"\\^done,numchild=\"10\"" \
"get number of children of struct_declarations.s2.u2.u1s1.e"
# Test: c_variable-4.71
# Desc: children of struct_declarations.s2.u2.u1s1.func
mi_list_varobj_children struct_declarations.s2.u2.u1s1.func {} \
"get children of struct_declarations.s2.u2.u1s1.func"
# Test: c_variable-4.72
# Desc: number of children of struct_declarations.s2.u2.u1s1.func
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.func" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.u2.u1s1.func"
# Test: c_variable-4.73
# Desc: children of struct_declarations.s2.u2.u1s1.foo
mi_list_varobj_children struct_declarations.s2.u2.u1s1.foo {} \
"get children of struct_declarations.s2.u2.u1s1.foo"
# Test: c_variable-4.74
# Desc: number of children of struct_declarations.s2.u2.u1s1.foo
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.foo" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.u2.u1s1.foo"
# Test: c_variable-4.75
# Desc: children of struct_declarations.s2.u2.u1s2.array_ptr
mi_list_varobj_children struct_declarations.s2.u2.u1s2.array_ptr {
{struct_declarations.s2.u2.u1s2.array_ptr.0 0 0 char}
{struct_declarations.s2.u2.u1s2.array_ptr.1 1 0 char}
} "get children of struct_declarations.s2.u2.u1s2.array_ptr"
# Test: c_variable-4.76
# Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.array_ptr" \
"\\^done,numchild=\"2\"" \
"get number of children of struct_declarations.s2.u2.u1s2.array_ptr"
# Test: c_variable-4.77
# Desc: children of struct_declarations.s2.u2.u1s2.func
mi_list_varobj_children struct_declarations.s2.u2.u1s2.func {} \
"get children of struct_declarations.s2.u2.u1s2.func"
# Test: c_variable-4.78
# Desc: number of children of struct_declarations.s2.u2.u1s2.func
mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.func" \
"\\^done,numchild=\"0\"" \
"get number of children of struct_declarations.s2.u2.u1s2.func"
# Test: c_variable-4.79
# Desc: children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
mi_list_varobj_children "struct_declarations.int_ptr_ptr.*int_ptr_ptr" {
{{struct_declarations.int_ptr_ptr.\*int_ptr_ptr.\*\*int_ptr_ptr} \
{\*\*int_ptr_ptr} 0 int}
} "get children of struct_declarations.int_ptr_ptr.*int_ptr_ptr"
# Test: c_variable-4.80
# Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr
mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr"
# Step to "struct_declarations.integer = 123;"
set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
mi_step_to do_children_tests {} ".*${srcfile}" \
$line_dct_123 "step to line \$line_dct_123"
# Test: c_variable-4.81
# Desc: create local variable "weird"
mi_create_varobj weird weird "create local variable weird"
# Test: c_variable-4.82
# Desc: children of weird
mi_list_varobj_children "weird" {
{weird.integer integer 0 int}
{weird.character character 0 char}
{weird.char_ptr char_ptr 1 "char \\*"}
{weird.long_int long_int 0 "long int"}
{weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
{weird.long_array long_array 12 "long int \\[12\\]"}
{weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
{weird.func_ptr_struct func_ptr_struct 0 \
"struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
{weird.func_ptr_ptr func_ptr_ptr 0 \
"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
{weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
{weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
} "get children of weird"
# Test: c_variable-4.83
# Desc: number of children of weird
mi_gdb_test "-var-info-num-children weird" \
"\\^done,numchild=\"11\"" \
"get number of children of weird"
# Test: c_variable-4.84
# Desc: children of weird->long_array
mi_list_array_varobj_children weird.long_array 12 "long int" \
"get children of weird.long_array"
#gdbtk_test c_variable-4.84 {children of weird->long_array} {
# get_children weird.long_array
#} {0 1 2 3 4 5 6 7 8 9 10 11}
# Test: c_variable-4.85
# Desc: number of children of weird.long_array
mi_gdb_test "-var-info-num-children weird.long_array" \
"\\^done,numchild=\"12\"" \
"get number of children of weird.long_array"
# Test: c_variable-4.86
# Desc: children of weird.int_ptr_ptr
mi_list_varobj_children weird.int_ptr_ptr {
{{weird.int_ptr_ptr.\*int_ptr_ptr} {\*int_ptr_ptr} 1 {int \*}}
} "get children of weird.int_ptr_ptr"
#gdbtk_test c_variable-4.86 {children of weird->int_ptr_ptr} {
# get_children weird.int_ptr_ptr
#} {*int_ptr_ptr}
# Test: c_variable-4.87
# Desc: number of children of weird.int_ptr_ptr
mi_gdb_test "-var-info-num-children weird.int_ptr_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of weird.int_ptr_ptr"
# Test: c_variable-4.88
# Desc: children of *weird->int_ptr_ptr
mi_list_varobj_children "weird.int_ptr_ptr.*int_ptr_ptr" {
{{weird.int_ptr_ptr.\*int_ptr_ptr.\*\*int_ptr_ptr} {\*\*int_ptr_ptr} 0 "int"}
} "get children of weird.int_ptr_ptr.*int_ptr_ptr"
#gdbtk_test c_variable-4.88 {children of *weird->int_ptr_ptr} {
# get_children weird.int_ptr_ptr.*int_ptr_ptr
#} {**int_ptr_ptr}
# Test: c_variable-4.89
# Desc: number of children *weird->int_ptr_ptr
mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of 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"
# Test: c_variable-4.91
# Desc: children of weird->int_ptr_ptr
mi_list_varobj_children "weird->int_ptr_ptr" {
{{weird->int_ptr_ptr.\*weird->int_ptr_ptr} {\*weird->int_ptr_ptr} 1 {int \*}}
} "get children of weird->int_ptr_ptr"
# Test: c_variable-4.92
# Desc: number of children of (weird->int_ptr_ptr)
mi_gdb_test "-var-info-num-children weird->int_ptr_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of weird->int_ptr_ptr"
# Test: c_variable-4.93
# Desc: children of *(weird->int_ptr_ptr)
mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr" {
{{weird->int_ptr_ptr.\*weird->int_ptr_ptr.\*\*weird->int_ptr_ptr} \
{\*\*weird->int_ptr_ptr} 0 int}
} "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr"
# Test: c_variable-4.94
# Desc: number of children of *(weird->int_ptr_ptr)
mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr"
# Test: c_variable-4.95
# Desc: children of *(*(weird->int_ptr_ptr))
mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
"get children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr"
# Test: c_variable-4.96
# Desc: number of children of *(*(weird->int_ptr_ptr))
mi_list_varobj_children "weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" {} \
"get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr"
# Test: c_variable-4.97
# Desc: is weird editable
mi_gdb_test "-var-show-attributes weird" \
"\\^done,attr=\"editable\"" \
"is weird editable"
# Test: c_variable-4.98
# Desc: is weird->int_ptr_ptr editable
mi_gdb_test "-var-show-attributes weird->int_ptr_ptr" \
"\\^done,attr=\"editable\"" \
"is weird->int_ptr_ptr editable"
# Test: c_variable-4.99
# Desc: is *(weird->int_ptr_ptr) editable
mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \
"\\^done,attr=\"editable\"" \
"is weird.int_ptr_ptr.*int_ptr_ptr editable"
# Test: c_variable-4.100
# Desc: is *(*(weird->int_ptr_ptr)) editable
mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \
"\\^done,attr=\"editable\"" \
"is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable"
# Test: c_variable-4.101
# Desc: is weird->u1 editable
mi_gdb_test "-var-show-attributes weird.u1" \
"\\^done,attr=\"noneditable\"" \
"is weird.u1 editable"
# Test: c_variable-4.102
# Desc: is weird->s2 editable
mi_gdb_test "-var-show-attributes weird.s2" \
"\\^done,attr=\"noneditable\"" \
"is weird.s2 editable"
# Test: c_variable-4.103
# Desc: is struct_declarations.u1.a editable
mi_gdb_test "-var-show-attributes struct_declarations.u1.a" \
"\\^done,attr=\"editable\"" \
"is struct_declarations.u1.a editable"
# Test: c_variable-4.104
# Desc: is struct_declarations.u1.b editable
mi_gdb_test "-var-show-attributes struct_declarations.u1.b" \
"\\^done,attr=\"editable\"" \
"is struct_declarations.u1.b editable"
# Test: c_variable-4.105
# Desc: is struct_declarations.u1.c editable
mi_gdb_test "-var-show-attributes struct_declarations.u1.c" \
"\\^done,attr=\"editable\"" \
"is struct_declarations.u1.c editable"
# Test: c_variable-4.106
# Desc: is struct_declarations.long_array editable
mi_gdb_test "-var-show-attributes struct_declarations.long_array" \
"\\^done,attr=\"noneditable\"" \
"is struct_declarations.long_array editable"
# Test: c_variable-4.107
# Desc: is struct_declarations.long_array[0] editable
mi_gdb_test "-var-show-attributes struct_declarations.long_array.0" \
"\\^done,attr=\"editable\"" \
"is struct_declarations.long_array.0 editable"
# Test: c_variable-4.108
# Desc: is struct_declarations editable
mi_gdb_test "-var-show-attributes struct_declarations" \
"\\^done,attr=\"noneditable\"" \
"is struct_declarations editable"
mi_gdb_test "-var-delete weird" \
"\\^done,ndeleted=\"26\"" \
"delete var weird"
##### #####
# #
# children and update tests #
# #
##### #####
# Test: c_variable-5.1
# Desc: check that nothing changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\\\]" \
"update all vars. None changed"
# Step over "struct_declarations.integer = 123;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
# Test: c_variable-5.2
# Desc: check that integer changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.integer\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.integer"
# Step over:
# weird->char_ptr = "hello";
# bar = 2121;
# foo = &bar;
mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
[expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
# Test: c_variable-5.3
# Desc: check that char_ptr changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.char_ptr"
# Step over "struct_declarations.int_ptr_ptr = &foo;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
# Test: c_variable-5.4
# Desc: check that int_ptr_ptr and children changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars int_ptr_ptr and children changed"
# Step over "weird->long_array[0] = 1234;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
# Test: c_variable-5.5
# Desc: check that long_array[0] changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.long_array.0 changed"
# Step over "struct_declarations.long_array[1] = 2345;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
# Test: c_variable-5.6
# Desc: check that long_array[1] changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.1\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.long_array.1 changed"
# Step over "weird->long_array[2] = 3456;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
# Test: c_variable-5.7
# Desc: check that long_array[2] changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.long_array.2 changed"
# Step over:
# struct_declarations.long_array[3] = 4567;
# weird->long_array[4] = 5678;
# struct_declarations.long_array[5] = 6789;
# weird->long_array[6] = 7890;
# struct_declarations.long_array[7] = 8901;
# weird->long_array[8] = 9012;
# struct_declarations.long_array[9] = 1234;
set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
$line_dct_nothing {} "step \$line_dct_nothing"
# Test: c_variable-5.8
# Desc: check that long_array[3-9] changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.long_array.3-9 changed"
# Step over "weird->func_ptr = nothing";
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1"
# Test: c_variable-5.9
# Desc: check that func_ptr changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.func_ptr changed"
# Step over "struct_declarations.long_array[10] = 3456";
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2"
mi_gdb_test "-var-update --no-values *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.long_array.10 changed, don't print values."
# Step over "struct_declarations.long_array[11] = 5678";
set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"]
mi_step_to do_children_tests {} ".*${srcfile}" \
$line_dct_a0_0 "step \$line_dct_a0_0"
mi_gdb_test "-var-update --all-values *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.11\",value=\"5678\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars struct_declarations.long_array.11 changed, print values."
mi_list_varobj_children {struct_declarations.long_array --all-values} {
{struct_declarations.long_array.0 0 0 "long int" 1234}
{struct_declarations.long_array.1 1 0 "long int" 2345}
{struct_declarations.long_array.2 2 0 "long int" 3456}
{struct_declarations.long_array.3 3 0 "long int" 4567}
{struct_declarations.long_array.4 4 0 "long int" 5678}
{struct_declarations.long_array.5 5 0 "long int" 6789}
{struct_declarations.long_array.6 6 0 "long int" 7890}
{struct_declarations.long_array.7 7 0 "long int" 8901}
{struct_declarations.long_array.8 8 0 "long int" 9012}
{struct_declarations.long_array.9 9 0 "long int" 1234}
{struct_declarations.long_array.10 10 0 "long int" 3456}
{struct_declarations.long_array.11 11 0 "long int" 5678}
} "listing of names and values of children"
mi_list_varobj_children {struct_declarations --simple-values} \
[list \
{struct_declarations.integer integer 0 int 123} \
{struct_declarations.character character 0 char {0 '\\\\000'}} \
[list struct_declarations.char_ptr char_ptr 1 "char \\*" "$hex \\\\\"hello\\\\\""] \
{struct_declarations.long_int long_int 0 "long int" 0} \
[list struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*" "$hex"] \
{struct_declarations.long_array long_array 12 "long int \\[12\\]"} \
[list struct_declarations.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)" "(@$hex: |)$hex <nothing>"] \
{struct_declarations.func_ptr_struct func_ptr_struct 0 \
"struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?" 0x0} \
{struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)" 0x0} \
{struct_declarations.u1 u1 4 "union \\{\\.\\.\\.\\}"} \
{struct_declarations.s2 s2 4 "struct \\{\\.\\.\\.\\}"} \
] "listing of children, simple types: names, type and values, complex types: names and types"
# Delete all variables
mi_gdb_test "-var-delete struct_declarations" \
"\\^done,ndeleted=\"67\"" \
"delete var struct_declarations"
mi_gdb_test "-var-delete weird->int_ptr_ptr" \
"\\^done,ndeleted=\"3\"" \
"delete var weird->int_ptr_ptr"
# Step over all lines:
# ...
# psnp = &snp0;
set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
# 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"
# Test: c_variable-5.11
# Desc: children of psnp->char_ptr
mi_list_varobj_children "psnp->char_ptr" {
{{psnp->char_ptr.\*psnp->char_ptr} {\*psnp->char_ptr} 1 {char \*\*\*}}
} "get children of psnp->char_ptr"
# Test: c_variable-5.12
# Desc: number of children of psnp->char_ptr
mi_gdb_test "-var-info-num-children psnp->char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->char_ptr"
# Test: c_variable-5.13
# Desc: children of *(psnp->char_ptr)
mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr" {
{{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr} \
{\*\*psnp->char_ptr} 1 {char \*\*}}
} "get children of psnp->char_ptr.*psnp->char_ptr"
# Test: c_variable-5.14
# Desc: number of children of *(psnp->char_ptr)
mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->char_ptr.*psnp->char_ptr"
# Test: c_variable-5.15
# Desc: children of *(*(psnp->char_ptr))
mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" {
{{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr} \
{\*\*\*psnp->char_ptr} 1 {char \*}}
} "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
# Test: c_variable-5.15B
# Desc: children of *(*(*(psnp->char_ptr)))
mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
{{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
{\*\*\*\*psnp->char_ptr} 0 char}
} "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
# Test: c_variable-5.16
# Desc: number of children of *(*(psnp->char_ptr))
mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr"
# Test: c_variable-5.17
# Desc: children of *(*(*(psnp->char_ptr)))
mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" {
{{psnp->char_ptr.\*psnp->char_ptr.\*\*psnp->char_ptr.\*\*\*psnp->char_ptr.\*\*\*\*psnp->char_ptr} \
{\*\*\*\*psnp->char_ptr} 0 char}
} "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
# Test: c_variable-5.18
# Desc: number of children of *(*(*(psnp->char_ptr)))
mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr"
# Test: c_variable-5.17B
# Desc: children of *(*(*(*(psnp->char_ptr))))
mi_list_varobj_children "psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" {} \
"get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
# Test: c_variable-5.18B
# Desc: number of children of *(*(*(*(psnp->char_ptr))))
mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \
"\\^done,numchild=\"0\"" \
"get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr"
# 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"
# Test: c_variable-5.20
# Desc: children of psnp->long_ptr
mi_list_varobj_children "psnp->long_ptr" {
{{psnp->long_ptr.\*psnp->long_ptr} {\*psnp->long_ptr} 1 {long int \*\*\*}}
} "get children of psnp->long_ptr"
# Test: c_variable-5.21
# Desc: number of children of psnp->long_ptr
mi_gdb_test "-var-info-num-children psnp->long_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->long_ptr"
# Test: c_variable-5.22
# Desc: children of *(psnp->long_ptr)
mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr" {
{{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr} {\*\*psnp->long_ptr} 1 {long int \*\*}}
} "get children of psnp->long_ptr.*psnp->long_ptr"
# Test: c_variable-5.23
# Desc: number of children of *(psnp->long_ptr)
mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->long_ptr.*psnp->long_ptr"
# Test: c_variable-5.24
# Desc: children of *(*(psnp->long_ptr))
mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" {
{{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr} \
{\*\*\*psnp->long_ptr} 1 {long int \*}}
} "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
# Test: c_variable-5.25
# Desc: number of children of *(*(psnp->long_ptr))
mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr"
# Test: c_variable-5.26
# Desc: children of *(*(*(psnp->long_ptr)))
mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" {
{{psnp->long_ptr.\*psnp->long_ptr.\*\*psnp->long_ptr.\*\*\*psnp->long_ptr.\*\*\*\*psnp->long_ptr}
{\*\*\*\*psnp->long_ptr} 0 {long int}}
} "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
# Test: c_variable-5.27
# Desc: number of children of *(*(*(psnp->long_ptr)))
mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr"
# Test: c_variable-5.28
# Desc: children of *(*(*(*(psnp->long_ptr))))
mi_list_varobj_children "psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" {} \
"get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
# Test: c_variable-5.29
# Desc: number of children of *(*(*(*(psnp->long_ptr))))
mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \
"\\^done,numchild=\"0\"" \
"get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr"
# Test: c_variable-5.30
# Desc: create psnp->ptrs
mi_create_varobj "psnp->ptrs" "psnp->ptrs" \
"create local variable psnp->ptrs"
# Test: c_variable-5.31
# Desc: children of psnp->ptrs
mi_list_varobj_children "psnp->ptrs" {
{psnp->ptrs.0 0 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.1 1 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.2 2 4 {struct _struct_n_pointer \*}}
} "get children of psnp->ptrs"
# Test: c_variable-5.32
# Desc: number of children of psnp->ptrs
mi_gdb_test "-var-info-num-children psnp->ptrs" \
"\\^done,numchild=\"3\"" \
"get number of children of psnp->ptrs"
# Test: c_variable-5.33
# Desc: children of psnp->ptrs[0]
mi_list_varobj_children "psnp->ptrs.0" {
{psnp->ptrs.0.char_ptr char_ptr 1 {char \*\*\*\*}}
{psnp->ptrs.0.long_ptr long_ptr 1 {long int \*\*\*\*}}
{psnp->ptrs.0.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
{psnp->ptrs.0.next next 4 {struct _struct_n_pointer \*}}
} "get children of psnp->ptrs.0"
# Test: c_variable-5.34
# Desc: number of children of psnp->ptrs[0]
mi_gdb_test "-var-info-num-children psnp->ptrs.0" \
"\\^done,numchild=\"4\"" \
"get number of children of psnp->ptrs.0"
# Test: c_variable-5.35
# Desc: children of psnp->ptrs[0]->next
mi_list_varobj_children "psnp->ptrs.0.next" {
{psnp->ptrs.0.next.char_ptr char_ptr 1 {char \*\*\*\*}}
{psnp->ptrs.0.next.long_ptr long_ptr 1 {long int \*\*\*\*}}
{psnp->ptrs.0.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
{psnp->ptrs.0.next.next next 4 {struct _struct_n_pointer \*}}
} "get children of psnp->ptrs.0.next"
#} {char_ptr long_ptr ptrs next}
# Test: c_variable-5.36
# Desc: number of children of psnp->ptrs[0]->next
mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \
"\\^done,numchild=\"4\"" \
"get number of children of psnp->ptrs.0.next"
# Test: c_variable-5.37
# Desc: children of psnp->ptrs[0]->next->char_ptr
mi_list_varobj_children "psnp->ptrs.0.next.char_ptr" {
{{psnp->ptrs.0.next.char_ptr.\*char_ptr} {\*char_ptr} 1 {char \*\*\*}}
} "get children of psnp->ptrs.0.next.char_ptr"
#gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} {
# get_children psnp->ptrs.0.next.char_ptr
#} {*char_ptr}
# Test: c_variable-5.38
# Desc: number of children of psnp->ptrs[0]->next->char_ptr
mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->ptrs.0.next.char_ptr"
# Test: c_variable-5.39
# Desc: children of *psnp->ptrs[0]->next->char_ptr
mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr" {
{{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr} {\*\*char_ptr} 1 {char \*\*}}
} "get children of psnp->ptrs.0.next.char_ptr.*char_ptr"
# Test: c_variable-5.40
# Desc: number of children of *psnp->ptrs[0]->next->char_ptr
mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr"
# Test: c_variable-5.41
# Desc: children of **psnp->ptrs[0]->next->char_ptr
mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" {
{{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr} \
{\*\*\*char_ptr} 1 {char \*}}
} "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
# Test: c_variable-5.41B
# Desc: children of ***psnp->ptrs[0]->next->char_ptr
mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
{{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
{\*\*\*\*char_ptr} 0 char}
} "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
# Test: c_variable-5.42
# Desc: number of children of **psnp->ptrs[0]->next->char_ptr
mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr"
# Test: c_variable-5.43
# Desc: children of ***psnp->ptrs[0]->next->char_ptr
mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" {
{{psnp->ptrs.0.next.char_ptr.\*char_ptr.\*\*char_ptr.\*\*\*char_ptr.\*\*\*\*char_ptr} \
{\*\*\*\*char_ptr} 0 char}
} "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
# Test: c_variable-5.44
# Desc: number of children of ***psnp->ptrs[0]->next->char_ptr
mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \
"\\^done,numchild=\"1\"" \
"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
# Test: c_variable-5.43B
# Desc: children of ****psnp->ptrs[0]->next->char_ptr
mi_list_varobj_children "psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" {} \
"get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
# Test: c_variable-5.44B
# Desc: number of children of ****psnp->ptrs[0]->next->char_ptr
mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \
"\\^done,numchild=\"0\"" \
"get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr"
# Test: c_variable-5.45
# Desc: children of psnp->ptrs[0]->next->next
mi_list_varobj_children "psnp->ptrs.0.next.next" {
{psnp->ptrs.0.next.next.char_ptr char_ptr 1 {char \*\*\*\*}}
{psnp->ptrs.0.next.next.long_ptr long_ptr 1 {long int \*\*\*\*}}
{psnp->ptrs.0.next.next.ptrs ptrs 3 {struct _struct_n_pointer \*\[3\]}}
{psnp->ptrs.0.next.next.next next 4 {struct _struct_n_pointer \*}}
} "get children of psnp->ptrs.0.next.next"
# Test: c_variable-5.46
# Desc: children of psnp->ptrs[0]->next->next->ptrs
mi_list_varobj_children "psnp->ptrs.0.next.next.ptrs" {
{psnp->ptrs.0.next.next.ptrs.0 0 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.0.next.next.ptrs.1 1 4 {struct _struct_n_pointer \*}}
{psnp->ptrs.0.next.next.ptrs.2 2 4 {struct _struct_n_pointer \*}}
} "get children of psnp->ptrs.0.next.next.ptrs"
# Step over "snp0.char_ptr = &b3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
# Test: c_variable-5.47
# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars psnp->char_ptr (and 0.char_ptr) changed"
# Step over "snp1.char_ptr = &c3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
# Test: c_variable-5.48
# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars psnp->next->char_ptr (and 1.char_ptr) changed"
# Step over "snp2.char_ptr = &a3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
# Test: c_variable-5.49
# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed"
# Step over "snp0.long_ptr = &y3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
# Test: c_variable-5.50
# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\},\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars psnp->long_ptr (and 0.long_ptr) changed"
# Step over "snp1.long_ptr = &x3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
# Test: c_variable-5.51
# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
# 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_changed=\"false\"\}\\\]" \
"update all vars psnp->next->long_ptr (and 1.long_ptr) changed"
clear_xfail *-*-*
# This command produces this error message:
# &"warning: varobj_list: assertion failed - mycount <> 0\n"
#
# Step over "snp2.long_ptr = &z3;"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
# Test: c_variable-5.52
# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
mi_gdb_test "-var-update *" \
"\\^done,changelist=\\\[\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
"update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed"
mi_prepare_inline_tests $srcfile
mi_run_inline_test child_deletion
mi_gdb_exit
return 0