From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Handle bitfields inside inner structs for internalvars
Date: Sat, 09 Feb 2013 04:52:00 -0000 [thread overview]
Message-ID: <m31ucqjdgv.fsf@redhat.com> (raw)
In-Reply-To: <20130208204702.GA22467@host2.jankratochvil.net> (Jan Kratochvil's message of "Fri, 8 Feb 2013 21:47:02 +0100")
On Friday, February 08 2013, Jan Kratochvil wrote:
> On Wed, 06 Feb 2013 21:39:10 +0100, Sergio Durigan Junior wrote:
>> --- a/gdb/testsuite/gdb.base/bitfields.exp
>> +++ b/gdb/testsuite/gdb.base/bitfields.exp
>> @@ -245,6 +245,31 @@ proc bitfield_at_offset {} {
>> gdb_test "print container.two.u3" ".* = 3"
>> }
>>
>> +proc bitfield_internalvar {} {
>> + global gdb_prompt
>> +
>> + # First, we create an internal var holding an instance of
>> + # the struct (zeroed out).
>> + gdb_test "set \$myvar = \(struct internalvartest\) \{0\}" "" \
>
> Backslashes are excessive here, parentheses are not special characters for the
> TCL interpretation and this string is not regexp:
> gdb_test "set \$myvar = (struct internalvartest) \{0\}" "" \
Thanks for the review. These extra backslashes were added by me while
testing a failure that I was seeing, sorry for letting those sneak in.
>> --- a/gdb/valops.c
>> +++ b/gdb/valops.c
>> @@ -1233,11 +1233,18 @@ value_assign (struct value *toval, struct value *fromval)
>> VALUE_INTERNALVAR (toval));
>>
>> case lval_internalvar_component:
>> - set_internalvar_component (VALUE_INTERNALVAR (toval),
>> - value_offset (toval),
>> - value_bitpos (toval),
>> - value_bitsize (toval),
>> - fromval);
>> + {
>> + int offset = value_offset (toval);
>> +
>> + if (value_bitsize (toval))
>> + offset += value_offset (value_parent (toval));
>
> value_address rather tests for value_parent existence; although value_bitsize
> is right as value_parent is currently not used elsewhere.
>
> if (value_parent (toval))
Do you think it's clearer to use `value_parent' here instead of
`value_bitsize'?
> {
> /* VALUE_INTERNALVAR below corresponds to the parent value while
> offset is relative to the parent value. */
> gdb_assert (value_parent (value_parent (toval)) == NULL);
> offset += value_offset (value_parent (toval));
> }
>
> And it was not so clear to me on the first look so I have added this comment
> if you are OK with it.
Thanks, the comment is fine by me. I'll wait for your reply to the
question above, and then proceed.
--
Sergio
next prev parent reply other threads:[~2013-02-09 4:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-06 20:39 Sergio Durigan Junior
2013-02-08 20:47 ` Jan Kratochvil
2013-02-09 4:52 ` Sergio Durigan Junior [this message]
2013-02-09 7:39 ` Jan Kratochvil
2013-02-11 18:06 ` Sergio Durigan Junior
2013-02-11 18:11 ` Jan Kratochvil
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=m31ucqjdgv.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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