From: Paul Koning <paulkoning@comcast.net>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Python: fetch value when building gdb.Value object
Date: Tue, 04 Oct 2011 15:51:00 -0000 [thread overview]
Message-ID: <21467A42-84A3-4DFD-83A9-28FFFB0A5C7F@comcast.net> (raw)
In-Reply-To: <m3y5x0pxqg.fsf@fleche.redhat.com>
On Oct 4, 2011, at 11:44 AM, Tom Tromey wrote:
>>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> writes:
>
> Paul> GDB sometimes lazily evaluates operations on values, and
> Paul> py-value.c wasn't taking that into account. The result was that
> Paul> assigning a Value object to a Python variable could assign a lazy
> Paul> value, so that any errors in accessing the data would occur at a
> Paul> later time, and sometimes would not be handled right. (For
> Paul> example, the "nonzero" operation would fail without a Python
> Paul> traceback.) The attached patch cures this by fetching any lazy
> Paul> values when the gdb.Value object is built, and adds a test in the
> Paul> testcases to verify this.
>
> Paul> Ok to submit?
>
> I am not convinced that this is the right approach.
>
> I think it would probably be better to expose the laziness to the Python
> programmer -- via a new attribute and a new method to un-lazy the
> object.
>
> 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.
I modeled what I did after the way the existing GDB code handles convenience variables. It seemed logical that
set $foo = *ptr
and
python foo=gdb.eval ("*ptr")
should behave the same. With the patch, they do, because in both case the lazy evaluation is done.
paul
next prev parent reply other threads:[~2011-10-04 15:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 16:17 Paul Koning
2011-09-28 19:29 ` Phil Muldoon
2011-09-28 20:06 ` Paul Koning
2011-10-04 15:43 ` Tom Tromey
2011-09-28 20:42 ` Paul Koning
2011-10-01 9:05 ` Jan Kratochvil
2011-10-03 10:22 ` Phil Muldoon
2011-10-04 15:40 ` Tom Tromey
2011-10-01 9:29 ` Jan Kratochvil
2011-10-01 10:23 ` Pedro Alves
2011-10-01 11:03 ` Jan Kratochvil
2011-10-01 12:17 ` Python: fetch value when building gdb.Value object [rediff] Jan Kratochvil
2011-10-01 18:58 ` Paul Koning
2011-10-03 10:19 ` Phil Muldoon
2011-10-03 16:16 ` Paul Koning
2011-10-01 1:00 ` [PING] [RFA] Re: Python: fetch value when building gdb.Value object Paul Koning
2011-10-04 15:45 ` Tom Tromey
2011-10-04 15:51 ` Paul Koning [this message]
2011-10-14 20:03 ` Tom Tromey
2011-10-14 20:30 ` Paul Koning
2011-10-19 20:56 ` Tom Tromey
2011-10-19 20:58 ` Paul Koning
2011-10-20 15:09 ` Tom Tromey
2011-10-21 7:46 ` Paul Koning
2011-10-21 17:13 ` Tom Tromey
2011-10-14 23:36 ` Jim Blandy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21467A42-84A3-4DFD-83A9-28FFFB0A5C7F@comcast.net \
--to=paulkoning@comcast.net \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox