From d8d83e9b52d6dfd4c6dc8214dd875fab7a1600e4 Mon Sep 17 00:00:00 2001 From: Nick Roberts Date: Wed, 27 Jul 2005 02:21:16 +0000 Subject: [PATCH] * gdb.mi/var-cmd.c: Give long_array in _struct_decl 12 elements. (do_children_tests): Assign values to the extra elements. * gdb.mi/mi-var-child.exp: Adapt tests for extra elements and use them for tests for "-var-update --no-values" and "-var-update --all-values". Add test for "-var-list-children --simple-values". * gdb.mi/basics.c (callee4): Add integer array D[3]... * gdb.mi/mi-stack.exp (test_stack_locals_listing): ...to test "-stack-list-locals --simple-values" Improve doc strings and comments. --- gdb/testsuite/gdb.mi/basics.c | 3 +- gdb/testsuite/gdb.mi/mi-stack.exp | 22 +++++++-------- gdb/testsuite/gdb.mi/mi-var-child.exp | 53 ++++++++++++++++++++++++----------- gdb/testsuite/gdb.mi/var-cmd.c | 6 ++-- 4 files changed, 54 insertions(+), 30 deletions(-) diff --git a/gdb/testsuite/gdb.mi/basics.c b/gdb/testsuite/gdb.mi/basics.c index 0e3c1d8..eab044b 100644 --- a/gdb/testsuite/gdb.mi/basics.c +++ b/gdb/testsuite/gdb.mi/basics.c @@ -1,4 +1,4 @@ -/* Copyright 1999, 2000, 2004 +/* Copyright 1999, 2000, 2004, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -30,6 +30,7 @@ int callee4 (void) int A=1; int B=2; int C; + int D[3] = {0, 1 ,2}; C = A + B; return 0; diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index 44afc7e..0fe203f 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -152,19 +152,19 @@ proc test_stack_locals_listing {} { # Obtain lists for locals for the stack frames # Tests: - # -stack-list-locals 0 - # -stack-list-locals 1 - # -stack-list-locals 2 + # -stack-list-locals 0 (--no-values) + # -stack-list-locals 1 (--all-values) + # -stack-list-locals 2 (--simple-values) # -stack-list-arguments mi_gdb_test "232-stack-list-locals 0" \ - "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \ - "stack locals listing 0" + "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\",name=\"D\"\\\]" \ + "stack locals listing of names" set line_callee4_return_0 [gdb_get_line_number "return 0;"] -# step until A, B, C, have some reasonable values. -send_gdb "-exec-next 3\n" +# step until A, B, C, D have some reasonable values. +send_gdb "-exec-next 4\n" gdb_expect { -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" { pass "next's in callee4" @@ -173,12 +173,12 @@ gdb_expect { } mi_gdb_test "232-stack-list-locals 1" \ - "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\\\]" \ - "stack locals listing 1" + "232\\^done,locals=\\\[\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\},\{name=\"D\",value=\"\\{0, 1, 2\\}\"\}\\\]" \ + "stack locals listing of names and values" mi_gdb_test "232-stack-list-locals 2" \ - "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\}\\\]" \ - "stack locals listing 2" + "232\\^done,locals=\\\[\{name=\"A\",type=\"int\",value=\"1\"\},\{name=\"B\",type=\"int\",value=\"2\"\},\{name=\"C\",type=\"int\",value=\"3\"\},\{name=\"D\",type=\"int \\\[3\\\]\"\}\\\]" \ + "stack locals listing, simple types: names and values, complex type: names and types" mi_gdb_test "234-stack-list-locals" \ "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \ diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index d0fb395..834dd88 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation +# Copyright 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation # 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 @@ -59,7 +59,7 @@ mi_gdb_test "-var-create struct_declarations * struct_declarations" \ # STABS doesn't give us argument types for the func ptr structs, but # Dwarf 2 does. mi_gdb_test "-var-list-children struct_declarations" \ - "\\^done,numchild=\"11\",children=\\\[child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \ + "\\^done,numchild=\"11\",children=\\\[child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"12\",type=\"long int \\\[12\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\\\]" \ "get children of struct_declarations" #gdbtk_test c_variable-4.3 {children of struct_declarations} { @@ -140,13 +140,13 @@ mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \ # Test: c_variable-4.15 # Desc: children of struct_declarations.long_array mi_gdb_test "-var-list-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\\\]" \ + "\\^done,numchild=\"12\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.10\",exp=\"10\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.11\",exp=\"11\",numchild=\"0\",type=\"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=\"10\"" \ + "\\^done,numchild=\"12\"" \ "get number of children of struct_declarations.long_array" # Test: c_variable-4.17 @@ -565,7 +565,7 @@ mi_gdb_test "-var-create weird * weird" \ # Test: c_variable-4.82 # Desc: children of 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 \{\\.\\.\\.\}\"\}\\\]" \ + "\\^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=\"12\",type=\"long int \\\[12\\\]\"\},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 \{\\.\\.\\.\}\"\}\\\]" \ "get children of weird" # Test: c_variable-4.83 @@ -578,16 +578,16 @@ mi_gdb_test "-var-info-num-children weird" \ # Test: c_variable-4.84 # Desc: children of weird->long_array mi_gdb_test "-var-list-children weird.long_array" \ - "\\^done,numchild=\"10\",children=\\\[child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\\\]" \ + "\\^done,numchild=\"12\",children=\\\[child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.10\",exp=\"10\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.11\",exp=\"11\",numchild=\"0\",type=\"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} +#} {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=\"10\"" \ + "\\^done,numchild=\"12\"" \ "get number of children of weird.long_array" # Test: c_variable-4.86 @@ -736,7 +736,7 @@ mi_gdb_test "-var-show-attributes struct_declarations" \ "is struct_declarations editable" mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"24\"" \ + "\\^done,ndeleted=\"26\"" \ "delete var weird" ##### ##### @@ -833,14 +833,10 @@ mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ "update all vars struct_declarations.long_array.3-9 changed" -mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \ - "listing of names and values of children" -# Step over "weird->func_ptr = nothing;" -set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"] +# Step over "weird->func_ptr = nothing"; mi_step_to do_children_tests {} {.*var-cmd.c} \ - $line_dct_a0_0 "step \$line_dct_a0_0" + [expr $line_dct_nothing + 1] "step \$line_dct_nothing + 1" # Test: c_variable-5.9 # Desc: check that func_ptr changed @@ -848,9 +844,34 @@ mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ "update all vars struct_declarations.func_ptr changed" +# Step over "struct_declarations.long_array[10] = 3456"; +mi_step_to do_children_tests {} {.*var-cmd.c} \ + [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\"\}\\\]" \ + "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';"] +mi_step_to do_children_tests {} {.*var-cmd.c} \ + $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\"\}\\\]" \ + "update all vars struct_declarations.long_array.11 changed, print values." + +mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ + "\\^done,numchild=\"12\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.10\",exp=\"10\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.11\",exp=\"11\",numchild=\"0\",value=\"5678\",type=\"long int\"\}\\\]" \ + "listing of names and values of children" + +mi_gdb_test "-var-list-children --simple-values struct_declarations" \ + "\\^done,numchild=\"11\",children=\\\[child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",value=\"123\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",value=\"0 '\\\\\\\\0'\",type=\"char\"\},child=\{name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",value=\"$hex \\\\\"hello\\\\\"\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",value=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",value=\"$hex\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"12\",type=\"long int \\\[12\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",value=\"$hex \",type=\"void \\(\\*\\)\\(void\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",value=\"0\",type=\"struct _struct_decl \\(\\*\\)\\(int, char \\*, long int\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",value=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\(int, char \\*, long int\\)\"\},child=\{name=\"struct_declarations.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{...\}\"\},child=\{name=\"struct_declarations.s2\",exp=\"s2\",numchild=\"4\",type=\"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=\"65\"" \ + "\\^done,ndeleted=\"67\"" \ "delete var struct_declarations" mi_gdb_test "-var-delete weird->int_ptr_ptr" \ diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c index 2a297d2..06b3e35 100644 --- a/gdb/testsuite/gdb.mi/var-cmd.c +++ b/gdb/testsuite/gdb.mi/var-cmd.c @@ -1,4 +1,4 @@ -/* Copyright 1999, 2004 Free Software Foundation, Inc. +/* Copyright 1999, 2004, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -51,7 +51,7 @@ typedef struct _struct_decl { char *char_ptr; long long_int; int **int_ptr_ptr; - long long_array[10]; + long long_array[12]; void (*func_ptr) (void); struct _struct_decl (*func_ptr_struct) (int, char *, long); @@ -227,6 +227,8 @@ do_children_tests (void) struct_declarations.long_array[9] = 1234; weird->func_ptr = nothing; + struct_declarations.long_array[10] = 3456; + struct_declarations.long_array[11] = 5678; /* Struct/pointer/array tests */ a0 = '0'; -- 2.7.4