[RFC] Variable objects for STL containers

Nick Roberts nickrob@snap.net.nz
Fri Feb 15 21:57:00 GMT 2008


 > > Here's a sample transaction.  Currently the variable object must be created
 > > after initialisation, e.g.,
 > > 
 > > -var-create - * v
 > > ^done,name="var1",numchild="1",value="{...}",type="std::vector<int,std::allocator<int> >"
 > > (gdb) 
 > > -var-list-children --all-values var1
 > > ^done,numchild="4",children=[child={name="var1.0",exp="0",numchild="0",value="3",type="long"},child={name="var1.1",exp="1",numchild="0",value="0",type="int"},child={name="var1.2",exp="2",numchild="0",value="0",type="int"},child={name="var1.3",exp="3",numchild="0",value="0",type="int"}]
 > > 
 > > so that GDB doesn't find a ridiculous (uninitialised) number of children.
 > > Note there are four children.
 > 
 > Note that I didn't look at the details of the patch yet, so I may be missing
 > some info.  I noticed that in the var-create response of the example above,
 > the number of children is only 1 instead of 4.  Is that just a typo?

No, it's real output :-).  The patch doesn't check for STL containers until the
user tries to expand the watch expression (-var-list-children is issued)
although I guess, in the case of vectors, it would be quite easy to get the
number of children immediately.


-- 
Nick                                           http://www.inet.net.nz/~nickrob



More information about the Gdb-patches mailing list