From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8200 invoked by alias); 25 Jan 2011 19:38:00 -0000 Received: (qmail 8136 invoked by uid 22791); 25 Jan 2011 19:37:58 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_GD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Jan 2011 19:37:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0PJbqqO026334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 25 Jan 2011 14:37:52 -0500 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0PJbo7E030628 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 25 Jan 2011 14:37:51 -0500 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p0PJbnuV025251 for ; Tue, 25 Jan 2011 20:37:49 +0100 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id p0PJbm3V025250 for gdb-patches@sourceware.org; Tue, 25 Jan 2011 20:37:48 +0100 Date: Tue, 25 Jan 2011 19:38:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix DWARF-3+ DW_AT_accessibility default assumption Message-ID: <20110125193748.GA25086@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2011-01/txt/msg00508.txt.bz2 Hi, GDB regresses on default compiler option -gdwarf-3 on gcc-4.6+ as this gcc started to omit DW_AT_accessibility for the default value case. Normal upstream gcc still has -gdwarf-2 default (Fedora uses -gdwarf-3 default). No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu. (There are other regressions to be fixed due to gcc45->gcc46.) I will check it in in some time. Thanks, Jan -FAIL: gdb.cp/casts.exp: dynamic_cast simple downcast -FAIL: gdb.cp/casts.exp: dynamic_cast simple downcast to intermediate class -FAIL: gdb.cp/casts.exp: dynamic_cast unique downcast -FAIL: gdb.cp/casts.exp: dynamic_cast to sibling -FAIL: gdb.cp/classes.exp: ptype class default_private_class // wrong access specifier for field: public -FAIL: gdb.cp/classes.exp: ptype class explicit_private_class // wrong access specifier for field: public -FAIL: gdb.cp/classes.exp: ptype class mixed_protection_class // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype A // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype B // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype a // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype b // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype pAa // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype pAe // wrong access specifier for field: public -FAIL: gdb.cp/virtfunc.exp: ptype pBe // wrong access specifier for field: public -FAIL: gdb.mi/gdb792.exp: list children of class A -FAIL: gdb.mi/gdb792.exp: list children of A.public -FAIL: gdb.mi/gdb792.exp: list children of A.private -FAIL: gdb.mi/gdb792.exp: list children of A.protected -FAIL: gdb.mi/gdb792.exp: list children of A.protected.b -FAIL: gdb.mi/gdb792.exp: list children of A.protected.b.public -FAIL: gdb.mi/gdb792.exp: list children of A.protected.b.private -FAIL: gdb.mi/gdb792.exp: list children of class C -FAIL: gdb.python/py-value.exp: python print bool(gdb.parse_and_eval('base').dynamic_cast(gdb.lookup_type('Derived').pointer())) gdb/ 2011-01-25 Jan Kratochvil Fix DWARF-3+ DW_AT_accessibility default assumption. * dwarf2read.c (dwarf2_add_field): Fix new_field->accessibility for cu->header.version >= 3. --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6186,13 +6186,25 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, } fip->nfields++; - /* Handle accessibility and virtuality of field. - The default accessibility for members is public, the default - accessibility for inheritance is private. */ - if (die->tag != DW_TAG_inheritance) - new_field->accessibility = DW_ACCESS_public; + if (cu->header.version < 3) + { + /* The default DWARF 2 accessibility for members is public, the default + accessibility for inheritance is private. */ + + if (die->tag != DW_TAG_inheritance) + new_field->accessibility = DW_ACCESS_public; + else + new_field->accessibility = DW_ACCESS_private; + } else - new_field->accessibility = DW_ACCESS_private; + { + /* DWARF 3 specifies the default accessibility explicitly. */ + + if (die->parent->tag == DW_TAG_class_type) + new_field->accessibility = DW_ACCESS_private; + else + new_field->accessibility = DW_ACCESS_public; + } new_field->virtuality = DW_VIRTUALITY_none; attr = dwarf2_attr (die, DW_AT_accessibility, cu);