From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10669 invoked by alias); 15 Nov 2016 18:12:10 -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 10658 invoked by uid 89); 15 Nov 2016 18:12:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Nov 2016 18:12:09 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 027033D945; Tue, 15 Nov 2016 18:12:08 +0000 (UTC) Received: from [127.0.0.1] (ovpn03.gateway.prod.ext.phx2.redhat.com [10.5.9.3]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAFIC6Om004820; Tue, 15 Nov 2016 13:12:06 -0500 Subject: Re: [PATCH] bitfield-parent-optimized-out: Fix struct definition To: Luis Machado , Andreas Arnez , gdb-patches@sourceware.org References: <42361b5d-89ad-553d-ca60-534af299d2ce@codesourcery.com> From: Pedro Alves Message-ID: <8fb6af78-a990-f2ee-8844-2042639beea1@redhat.com> Date: Tue, 15 Nov 2016 18:12: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: <42361b5d-89ad-553d-ca60-534af299d2ce@codesourcery.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-11/txt/msg00383.txt.bz2 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