This is the mail archive of the gdb-patches@sourceware.org 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: [RFC] Variable objects for STL containers


Hi,

> 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?

Also I wanted to point out that with Eclipse, it may prove tricky to create
a variable object after initialization.  In eclipse, when starting a debugged program,
the user (most) often selects the "Stop at main" option; that means that the program
will start showing variables right at main().  Since the command
-stack-list-locals shows all locals, even if they have not been declared yet, we
don't know if that variable is initialized yet, and we'll do the var-create and
var-list-children right away.

Is there a way to know that a variable has not been declared yet?  Or maybe
we can add some support in GDB for this?

Marc


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