Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>,
	       Andreas Arnez <arnez@linux.vnet.ibm.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH] bitfield-parent-optimized-out: Fix struct definition
Date: Tue, 15 Nov 2016 18:12:00 -0000	[thread overview]
Message-ID: <8fb6af78-a990-f2ee-8844-2042639beea1@redhat.com> (raw)
In-Reply-To: <42361b5d-89ad-553d-ca60-534af299d2ce@codesourcery.com>

On 11/11/2016 11:26 PM, Luis Machado wrote:
> On 11/11/2016 01:37 PM, Andreas Arnez wrote:
>> The "struct S" type in bitfield-parent-optimized-out.exp is declared to
>> have a size of 4 bytes but to hold two 4-byte members: an int-based
>> bitfield and a 4-byte int.  Also, both members have the same
>> data_member_location 2, causing them to overlap and to reach 2 bytes
>> beyond the structure's boundary.
>>
>> This is fixed by increasing the structure size to 8 and setting the
>> first and second member's data_member_location to 0 and 4, respectively.
>>
>> gdb/testsuite/ChangeLog:
>>
>>     * gdb.dwarf2/bitfield-parent-optimized-out.exp: Fix DWARF code for
>>     the definition of struct S.
>> ---
>>  gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git
>> a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
>> b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
>> index 27d8044..b789970 100644
>> --- a/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
>> +++ b/gdb/testsuite/gdb.dwarf2/bitfield-parent-optimized-out.exp
>> @@ -43,19 +43,18 @@ Dwarf::assemble $asm_file {
>>
>>          struct_label: structure_type {
>>          {name S}
>> -        {byte_size 4 DW_FORM_sdata}
>> +        {byte_size 8 DW_FORM_sdata}
>>          } {
>>          member {
>>              {name bitfield}
>>              {type :$int_label}
>>              {bit_size 12 DW_FORM_sdata}
>>              {bit_offset 20 DW_FORM_sdata}
>> -            {data_member_location 2 DW_FORM_sdata}
>>          }
>>          member {
>>              {name intfield}
>>              {type :$int_label}
>> -            {data_member_location 2 DW_FORM_sdata}
>> +            {data_member_location 4 DW_FORM_sdata}
>>          }
>>          }
>>
>>
> 
> The patch looks good to me, but i'm wondering if Pedro meant for both
> members to overlap (a union) instead of being two separate members?

Possibly; I don't remember.  If the changed test would still trigger
the old GDB bug, then I'm fine with the change.

Thanks,
Pedro Alves


  reply	other threads:[~2016-11-15 18:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 19:37 Andreas Arnez
2016-11-11 23:27 ` Luis Machado
2016-11-15 18:12   ` Pedro Alves [this message]
2016-11-15 19:53     ` Andreas Arnez

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=8fb6af78-a990-f2ee-8844-2042639beea1@redhat.com \
    --to=palves@redhat.com \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.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