From: Daniel Jacobowitz <drow@false.org>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: Vladimir Prus <ghost@cs.msu.su>, gdb-patches@sources.redhat.com
Subject: Re: [PATCH] -var-update
Date: Sun, 21 May 2006 05:22:00 -0000 [thread overview]
Message-ID: <20060521021243.GB9432@nevyn.them.org> (raw)
In-Reply-To: <17519.38740.887319.134411@kahikatea.snap.net.nz>
On Sun, May 21, 2006 at 10:25:24AM +1200, Nick Roberts wrote:
> Yes. Perhaps my summary isn't precise, but it didn't work. My patch uses
> value_at while coerce_ref uses value_at_lazy. The comment says:
>
> Call value_at only if the data needs to be fetched immediately;
> if we can be 'lazy' and defer the fetch, perhaps indefinately, call
> ^^^^^^^^^^^^
> value_at_lazy instead. value_at_lazy simply records the address of
> the data and sets the lazy-evaluation-required flag. The lazy flag
> is tested in the value_contents macro, which is used if and when
> the contents are actually required.
>
> value_contents is not a macro (VALUE_CONTENTS used to be one) but a function,
> and doesn't test the lazy flag.
No:
const gdb_byte *
value_contents (struct value *value)
{
return value_contents_writeable (value);
}
gdb_byte *
value_contents_writeable (struct value *value)
{
if (value->lazy)
value_fetch_lazy (value);
return value_contents_raw (value);
}
If you take a look at the code you're patching, there should be a
nearby call to value_fetch_lazy or gdb_value_fetch_lazy in each case.
You want to be calling coerce_ref before you do that. Also, see the
existing calls to release_value? If you change var->value after that,
you're going to leak memory.
Try calling coerce_ref in here:
if (gdb_evaluate_expression (var->root->exp, &var->value))
{
/* no error */
/* HERE */
release_value (var->value);
if (value_lazy (var->value))
gdb_value_fetch_lazy (var->value);
}
else
var->value = evaluate_type (var->root->exp);
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2006-05-21 2:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-20 6:21 Nick Roberts
2006-05-20 16:34 ` Daniel Jacobowitz
2006-05-21 2:04 ` Nick Roberts
2006-05-21 5:22 ` Daniel Jacobowitz [this message]
2006-05-21 23:04 ` Nick Roberts
2006-05-25 0:21 ` Nick Roberts
2006-05-25 0:26 ` [patch] Fixes problem setting breakpoint in dynamic loader PAUL GILLIAM
2006-05-25 0:29 ` PAUL GILLIAM
-- strict thread matches above, loose matches on Subject: below --
2006-05-03 23:05 Variable objects: references formatting Nick Roberts
2006-05-04 7:00 ` Vladimir Prus
2006-05-04 7:20 ` Nick Roberts
2006-05-04 12:10 ` Vladimir Prus
2006-05-08 12:41 ` [PATCH] -var-update [was Re: Variable objects: references formatting] Nick Roberts
2006-05-15 16:54 ` Daniel Jacobowitz
2006-05-17 0:45 ` Nick Roberts
2006-05-17 1:28 ` Daniel Jacobowitz
2006-05-17 1:43 ` Nick Roberts
2006-05-17 3:39 ` Daniel Jacobowitz
2006-05-19 7:41 ` [PATCH] -var-update Nick Roberts
2006-05-19 9:47 ` Vladimir Prus
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=20060521021243.GB9432@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=ghost@cs.msu.su \
--cc=nickrob@snap.net.nz \
/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