This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: {commit: gdb/mi] -stack-list-locals and -var-list-children


Daniel,


I believe that this is a problem in the patch, not in the testcase. If I step to the same PC in a non-MI GDB, the values are correct, but above only the first few are initialized.

If I execute this silly little command sequence:

b do_children_tests
b 208
run
-var-create struct_declarations * struct_declarations
-var-list-children struct_declarations
-var-list-children --all-values struct_declarations.long_array
continue
-var-list-children --all-values struct_declarations.long_array
print struct_declarations.long_array


I get this output:
~"GNU gdb 2004-01-23-cvs\n"
~"Copyright 2004 Free Software Foundation, Inc.\n"
~"GDB is free software, covered by the GNU General Public License, and you are\n"
~"welcome to change it and/or distribute copies of it under certain conditions.\n"
~"Type \"show copying\" to see the conditions.\n"
~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-linux-gnu\"..."
~"Using host libthread_db library \"/lib/tls/i686/cmov/libthread_db.so.1\".\n"
~"\n"
(gdb)
&"b do_children_tests\n"
^done
(gdb)
&"b 208\n"
^done
(gdb)
&"run\n"
^done,reason="breakpoint-hit",bkptno="1",thread- id="0",frame={addr="0x080484d0",func="do_children_tests",args=[],file=" /opt/src/gdb/src/gdb/testsuite/gdb.mi/var-cmd.c",line="190"}
(gdb)
^done,name="struct_declarations",numchild="11",type="struct _struct_decl"
(gdb)
^done,numchild="11",children=[child={name="struct_declarations.integer" ,exp="integer",numchild="0",type="int"},child={name="struct_declaration s.character",exp="character",numchild="0",type="char"},child={name="str uct_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",n umchild="1",type="int **"},child={name="struct_declarations.long_array",exp="long_array",numc hild="10",type="long int [10]"},child={name="struct_declarations.func_ptr",exp="func_ptr",numchi ld="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 {...}"}]
(gdb)
^done,numchild="10",children=[child={name="struct_declarations.long_arr ay.0",exp="0",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.1",exp="1",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.2",exp="2",numchild=" 0",value="1986358784",type="long int"},child={name="struct_declarations.long_array.3",exp="3",numchild=" 0",value="28281",type="long int"},child={name="struct_declarations.long_array.4",exp="4",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.5",exp="5",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.6",exp="6",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.7",exp="7",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.8",exp="8",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.9",exp="9",numchild=" 0",value="0",type="long int"}]
(gdb)
&"continue\n"
^done,reason="breakpoint-hit",bkptno="2",thread- id="0",frame={addr="0x08048573",func="do_children_tests",args=[],file=" /opt/src/gdb/src/gdb/testsuite/gdb.mi/var-cmd.c",line="208"}
(gdb)
^done,numchild="10",children=[child={name="struct_declarations.long_arr ay.0",exp="0",numchild="0",value="0",type="long int"},child={name="struct_declarations.long_array.1",exp="1",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.2",exp="2",numchild=" 0",value="1986358784",type="long int"},child={name="struct_declarations.long_array.3",exp="3",numchild=" 0",value="28281",type="long int"},child={name="struct_declarations.long_array.4",exp="4",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.5",exp="5",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.6",exp="6",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.7",exp="7",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.8",exp="8",numchild=" 0",value="0",type="long int"},child={name="struct_declarations.long_array.9",exp="9",numchild=" 0",value="0",type="long int"}]
(gdb)
&"print struct_declarations.long_array\n"
~"$1 = {"
~"1234, "
~"2345, "
~"3456, "
~"4567, "
~"5678, "
~"6789, "
~"7890, "
~"8901, "
~"9012, "
~"1234}\n"
^done
(gdb)



Note that the varobj is out of date.





This is intended behavior. After continuing the target, you need to explicitly call -var-update then -var-evaluate-expression (or var-list-children) before you get new values. That way, if you want to you can use varobj's to store historic values - like the $ variables in gdb - or use them to represent the variables, depending on whether you update them or not. This is the way it is described in the manual.

Jim
--
Jim Ingham                                   jingham@apple.com
Developer Tools
Apple Computer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]