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

Tom Tromey
2011-10-14T20:03:24Z

>>>>> "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.

Tom