Re: Python: fetch value when building gdb.Value object

Paul Koning
2011-10-14T20:30:27Z

On Oct 14, 2011, at 4:03 PM, Tom Tromey wrote:

>>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> writes:
>
> Tom> I am not convinced that this is the right approach.
>
> Tom> I think it would probably be better to expose the laziness to the Python
> Tom> programmer -- via a new attribute and a new method to un-lazy the
> Tom> object.
>
> Tom> The reason is that eager fetching can be very expensive. E.g., you may
> Tom> construct an intermediate value that is a very large array, but intend
> Tom> only to reference a few elements. This can be done efficiently by gdb,
> Tom> but eager fetching will defeat that.
>
> Paul> I modeled what I did after the way the existing GDB code handles
> Paul> convenience variables.
>
> Convenience variables aren't really the best model. First, they are
> very old, probably predating anybody worrying about this stuff. Second,
> the CLI isn't really a fully-featured programming language.

That's fair.

At this point the change has been approved and committed (that happened before your comments arrived). So I guess we have a question of whether to change it back.

paul