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: Patch: implement new dynamic varobj spec


Nick Roberts wrote:

>  > With a dynamic varobj you can tell if it has children by examining the
>  > has_more attribute.
> 
> The field has_more tells you if it _currently_ has children.  If you create a
> variable object of a STL container immediately after declaring an empty
> container, e.g. after
> 
>   map<string, int> m;
> 
> then has_more=0 yet the node for it would need to be expandable.  In Emacs
> this means there is a plus sign on the icon in the toolbar.  Clicking on
> it gives no immediate children but then as you proceed:
> 
>   l.push_back (1);
>   l.push_back (2);
> 
> the additional children appear.  With a string there are never any children
> so you would not want an expandable node.  AFAICS the only way the front end
> can discriminate is through the displayhint field.

Right, so for string you'll have numchildren=0, has_more=0, and no need to
make anything expandable. For vector that is initially empty, you'll have
the same, so it won't be expandable, but if things are pushed, -var-update
will report has_more=1. You can detect that, and make the item expandable
at this point.

- Volodya



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