From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84744 invoked by alias); 11 Nov 2016 23:27:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 84723 invoked by uid 89); 11 Nov 2016 23:27:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:dwarf2, gdb.dwarf2, UD:gdb.dwarf2, gdbdwarf2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Nov 2016 23:27:02 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1c5LDn-0007UK-LO from Luis_Gustavo@mentor.com ; Fri, 11 Nov 2016 15:26:59 -0800 Received: from [172.30.2.146] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 11 Nov 2016 15:26:57 -0800 Subject: Re: [PATCH] bitfield-parent-optimized-out: Fix struct definition References: To: Andreas Arnez , , Pedro Alves Reply-To: Luis Machado From: Luis Machado Message-ID: <42361b5d-89ad-553d-ca60-534af299d2ce@codesourcery.com> Date: Fri, 11 Nov 2016 23:27:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00301.txt.bz2 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?