+2014-10-14 Yao Qi <yao@codesourcery.com>
+
+ * gdb.mi/mi-var-child.c (nothing1): New function.
+ (nothing2): New function.
+ (do_children_tests): Set function pointers by nothing1 and
+ nothing2.
+ * gdb.mi/mi-var-child.exp: Step over new added statements.
+ Update test to match the new output.
+ * gdb.mi/var-cmd.c (nothing1): New function.
+ (nothing2): New function.
+ (do_children_tests): Set function pointers by nothing1 and
+ nothing2.
+ * gdb.mi/mi-var-display.exp: Update test to match output.
+ Step to the line specified by $line_dct_nothing.
+ Increase the number of lines to step.
+
2014-10-14 Yao Qi <yao@codesourcery.com>
* gdb.mi/mi-var-child.exp: Use mi_varobj_update to simplify
{
}
+struct _struct_decl
+nothing1 (int a, char *b, long c)
+{
+ struct _struct_decl foo;
+
+ return foo;
+}
+
+struct _struct_decl *
+nothing2 (int a, char *b, long c)
+{
+ return (struct _struct_decl *) 0;
+}
+
void
subroutine1 (int i, long *l)
{
struct_declarations.long_array[9] = 1234;
weird->func_ptr = nothing;
+ weird->func_ptr_struct = nothing1;
+ weird->func_ptr_ptr = nothing2;
struct_declarations.long_array[10] = 3456;
struct_declarations.long_array[11] = 5678;
mi_varobj_update * {struct_declarations.func_ptr} \
"update all vars struct_declarations.func_ptr changed"
-# Step over "struct_declarations.long_array[10] = 3456";
+# Step over "weird->func_ptr_struct = nothing1"
mi_step_to do_children_tests {} ".*${srcfile}" \
[expr $line_dct_nothing + 2] "step \$line_dct_nothing + 2"
+mi_varobj_update * {struct_declarations.func_ptr_struct} \
+ "update all vars struct_declarations.func_ptr_struct changed"
+
+# Step over "weird->func_ptr_ptr = nothing2"
+mi_step_to do_children_tests {} ".*${srcfile}" \
+ [expr $line_dct_nothing + 3] "step \$line_dct_nothing + 3"
+mi_varobj_update * {struct_declarations.func_ptr_ptr} \
+ "update all vars struct_declarations.func_ptr_ptr changed"
+
+# Step over "struct_declarations.long_array[10] = 3456";
+mi_step_to do_children_tests {} ".*${srcfile}" \
+ [expr $line_dct_nothing + 4] "step \$line_dct_nothing + 4"
mi_gdb_test "-var-update --no-values *" \
"\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.10\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\\\]" \
[list struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*" "$hex"] \
{struct_declarations.long_array long_array 12 "long \\[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\\))?" 0x0} \
- {struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
- "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)" 0x0} \
+ [list struct_declarations.func_ptr_struct func_ptr_struct 0 \
+ "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?" "$hex <nothing1>"] \
+ [list struct_declarations.func_ptr_ptr func_ptr_ptr 0 \
+ "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)" "$hex <nothing2>"] \
{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"
"set format variable weird.func_ptr_struct"
mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
- "\\^done,format=\"natural\",value=\"0x0\"" \
+ "\\^done,format=\"natural\",value=\"$hex <nothing2>\"" \
"set format variable weird.func_ptr_ptr in natural"
mi_gdb_test "-var-set-format weird.u1 natural" \
# Step over "weird->func_ptr = nothing;"
-set line_dct_a0_0 [gdb_get_line_number "a0\[0\] = '0';"]
-mi_step_to do_children_tests {} {.*var-cmd.c} \
- $line_dct_a0_0 "step \$line_dct_a0_0"
+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
# psnp = &snp0;
set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
-mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+mi_execute_to "exec-step 45" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
[expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
# Test: c_variable-5.10
{
}
+struct _struct_decl
+nothing1 (int a, char *b, long c)
+{
+ struct _struct_decl foo;
+
+ return foo;
+}
+
+struct _struct_decl *
+nothing2 (int a, char *b, long c)
+{
+ return (struct _struct_decl *) 0;
+}
+
void
subroutine1 (int i, long *l)
{
struct_declarations.long_array[9] = 1234;
weird->func_ptr = nothing;
+ weird->func_ptr_struct = nothing1;
+ weird->func_ptr_ptr = nothing2;
/* Struct/pointer/array tests */
a0[0] = '0';