Message ID | m3bmxlx0ya.fsf@oc1027705133.ibm.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 30800 invoked by alias); 11 Nov 2016 19:37:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 30783 invoked by uid 89); 11 Nov 2016 19:37:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Hx-languages-length:1483, 2.3.0, UD:dwarf2, gdb.dwarf2 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Nov 2016 19:37:29 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uABJXqnd014641 for <gdb-patches@sourceware.org>; Fri, 11 Nov 2016 14:37:28 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 26nju2pcaq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for <gdb-patches@sourceware.org>; Fri, 11 Nov 2016 14:37:28 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <gdb-patches@sourceware.org> from <arnez@linux.vnet.ibm.com>; Fri, 11 Nov 2016 19:37:26 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 11 Nov 2016 19:37:24 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2656C17D805A for <gdb-patches@sourceware.org>; Fri, 11 Nov 2016 19:39:46 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uABJbN5B16581006 for <gdb-patches@sourceware.org>; Fri, 11 Nov 2016 19:37:23 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uABJbN8b015083 for <gdb-patches@sourceware.org>; Fri, 11 Nov 2016 14:37:23 -0500 Received: from oc1027705133.ibm.com (dyn-9-152-212-182.boeblingen.de.ibm.com [9.152.212.182]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uABJbHT4015011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <gdb-patches@sourceware.org>; Fri, 11 Nov 2016 14:37:23 -0500 From: Andreas Arnez <arnez@linux.vnet.ibm.com> To: gdb-patches@sourceware.org Subject: [PATCH] bitfield-parent-optimized-out: Fix struct definition Date: Fri, 11 Nov 2016 20:37:17 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16111119-0028-0000-0000-00000249DE1E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16111119-0029-0000-0000-0000212F390B Message-Id: <m3bmxlx0ya.fsf@oc1027705133.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-11_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611110346 X-IsSubscribed: yes |
Commit Message
Andreas Arnez
Nov. 11, 2016, 7:37 p.m. UTC
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(-)
Comments
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?
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
On Tue, Nov 15 2016, Pedro Alves wrote: > On 11/11/2016 11:26 PM, Luis Machado wrote: >> 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. Yes, the bug is triggered both with the old and new version of bitfield-parent-optimized-out.exp: p var.bitfield ERROR: Process no longer exists UNRESOLVED: gdb.dwarf2/bitfield-parent-optimized-out.exp: p var.bitfield ERROR: Couldn't send p var.intfield to GDB. UNRESOLVED: gdb.dwarf2/bitfield-parent-optimized-out.exp: p var.intfield Thanks, pushed. -- Andreas
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} } }