This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Robustifying pretty-printers
On Friday 10 July 2009 Tom Tromey wrote:
> >>>>> "Vladimir" == Vladimir Prus <vladimir@codesourcery.com> writes:
>
> Tom> -var-set-child-range 10 20
> Tom> -var-list-children
>
> Vladimir> And what children with -var-update reevaluate? From 10 to
> Vladimir> 20? Or from 0 to 20? If the former, it's not very useful. If
> Vladimir> the latter, then it appears that low boundary is only used
> Vladimir> for -var-list-children.
>
> Right. There is a separation between what the varobj code does
> internally, and what MI reports to the FE.
>
> -var-set-child-range affects what is reported to the FE. Only
> children in that range are reported. I was assuming the same would be
> true even if this were done via arguments to -var-list-children.
>
> What happens in varobj is another matter. Currently we always fetch
> children starting at 0, because the pretty-printers have a simple,
> iterator-based design.
>
> Vladimir> Maybe, it's most useful to decouple setting the range for -var-update
> Vladimir> and getting specific children. So, if frontend wants more children
> Vladimir> now, it will do:
>
> Vladimir> -var-list-children 10 20
>
> Vladimir> and if it wishes for 20 children to be fetched from now on, it will
> Vladimir> explicitly do:
>
> Vladimir> -var-set-child-limit 20
>
> What is the difference between this and "-var-list-children 0 20"?
That frontend needs one command, not two. Let me try to explain this
in a different way. Suppose we don't have -var-update at all. Then,
we don't need any reason for varobj to remember a limit. FE will use
-var-list-children to get whatever children it wants to display.
With -var-update, we have two choices:
1. Either plugin emits -var-update for individual varobjs, with the
desired range, or
2. Varobj remembers the number of children to fetch.
1 is cumbersome. 2 requires that varobj remember the upper limit only.
That's why I am suggesting -var-set-child-limit with a single parameter.
If I'm not making myself clear yet, maybe we should talk on IRC, say on
Monday?
- Volodya