From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: Re: Variable objects laziness
Date: Wed, 15 Nov 2006 16:25:00 -0000 [thread overview]
Message-ID: <20061115162454.GA29310@nevyn.them.org> (raw)
In-Reply-To: <ejel69$j6g$1@sea.gmane.org>
On Wed, Nov 15, 2006 at 12:04:08PM +0300, Vladimir Prus wrote:
> > Neither before nor after this patch do I really understand what
> > "type_changeable" means so I'll trust you've got it right :-)
>
> Do you want to me add a comment to that function?
Since you seem to know what it's used for and why it relates to
fetching things, yes please.
> > Will we do eight reads from the target for this?
> >
> > struct x {
> > unsigned char a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1;
> > };
>
> No. Look at value_primitive_field. For bitfeilds, it calls
> unpack_field_as_long, passing value_contents (args1) to it. The
> value_contents function will read entire structure from memory on the first
> time. For the second bitfield, the already-read data will be used.
Oh. So non-bitfield members will be read lazily, but bitfield members
will cause a read of their immediate container. That's a little
strange, but since I think it's exactly what we want to happen right
now, let's leave it alone :-)
> I think I can address this issue by making install_new_value always fetch
> values of unions.
>
> Or I can do nothing, because in CLI, if your program is:
>
> struct S
> {
> union {
> int i;
> int j;
> };
> };
>
> int main()
> {
> S s;
> .....
>
> And you do:
>
> print s.i
> print s.j
>
> it will generate two reads of memory too.
Right - but only one read for "print s". If you think fetching the
value of unions is reasonable, let's do that.
> What do you mean? The second line is indented 6 spaces, so it can use tab
> for indentation.
Sorry, you're right!
When you're ready, please repost. Might want to finish talking with
Nick first.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2006-11-15 16:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-14 13:43 Vladimir Prus
2006-11-14 20:47 ` Daniel Jacobowitz
2006-11-15 9:04 ` Vladimir Prus
2006-11-15 16:25 ` Daniel Jacobowitz [this message]
2006-11-17 9:23 ` Vladimir Prus
2006-11-17 10:40 ` Mark Kettenis
2006-11-17 10:45 ` Vladimir Prus
2006-11-17 14:22 ` Daniel Jacobowitz
2006-11-17 15:01 ` Vladimir Prus
2006-11-17 17:19 ` Vladimir Prus
2006-11-17 18:12 ` Daniel Jacobowitz
2006-11-18 9:48 ` Vladimir Prus
2006-11-28 17:09 ` Daniel Jacobowitz
2006-12-04 19:27 ` Vladimir Prus
2006-11-15 2:45 Nick Roberts
2006-11-15 9:22 ` Vladimir Prus
2006-11-29 8:59 Nick Roberts
2006-11-29 2:08 ` Nick Roberts
2006-11-29 2:55 ` Daniel Jacobowitz
2006-11-29 4:14 ` Nick Roberts
2006-11-29 7:25 ` Vladimir Prus
2006-11-29 13:45 ` Daniel Jacobowitz
2006-11-29 13:56 ` Vladimir Prus
2006-11-29 20:25 ` Nick Roberts
2006-11-29 9:09 ` 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=20061115162454.GA29310@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
/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