This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Python: fetch value when building gdb.Value object
- From: Jim Blandy <jimb at red-bean dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Paul Koning <paulkoning at comcast dot net>, gdb-patches at sourceware dot org
- Date: Fri, 14 Oct 2011 16:36:18 -0700
- Subject: Re: Python: fetch value when building gdb.Value object
- References: <36B29E9D-F2B3-446F-AF8A-97254A3AAEE2@comcast.net> <m3y5x0pxqg.fsf@fleche.redhat.com>
On Tue, Oct 4, 2011 at 8:44 AM, Tom Tromey <tromey@redhat.com> wrote:
> The reason is that eager fetching can be very expensive. ?E.g., you may
> construct an intermediate value that is a very large array, but intend
> only to reference a few elements. ?This can be done efficiently by gdb,
> but eager fetching will defeat that.
Yeah, this worried me, too. In C, array values are automatically
converted to pointers to their first element, but GDB doesn't (last I
checked) do this; instead, it relies on the lazy value fetching to get
the same effect. Unfortunately, this means that unlazying values can
have drastic effects on memory consumption that one would not expect
if one knows the C semantics.