From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5787 invoked by alias); 22 Mar 2011 09:59:22 -0000 Received: (qmail 5718 invoked by uid 22791); 22 Mar 2011 09:59:20 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,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, 22 Mar 2011 09:59:09 +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.14.4/8.14.4) with ESMTP id p2M9x80r008011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Mar 2011 05:59:08 -0400 Received: from host1.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 p2M9x5hm005615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Mar 2011 05:59:07 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p2M9x5hZ030899 for ; Tue, 22 Mar 2011 10:59:05 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p2M9x5Om030898 for gdb-patches@sourceware.org; Tue, 22 Mar 2011 10:59:05 +0100 Date: Tue, 22 Mar 2011 10:06:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: revert+new [patch]: Re: [patch] DWARF-3+ DW_AT_accessibility defaults #2 (GCC PR debug/45124) Message-ID: <20110322095904.GA29625@host1.jankratochvil.net> References: <20110321154428.GA3761@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110321154428.GA3761@host1.jankratochvil.net> 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-03/txt/msg00986.txt.bz2 Hi, there has been a crash regression for: gdb.dwarf2/dw4-sig-types.exp The patch has been reverted: http://sourceware.org/ml/gdb-cvs/2011-03/msg00264.html Filed now GCC PR debug/48229: DW_TAG_type_unit has no DW_AT_producer http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48229 The problem is gcc-4.5.x has wrong DWARF output (GCC PR debug/45124) and it does not provide any DW_AT_producer. Therefore proposing GDB would assume gcc-4.5.x when it sees no DW_AT_producer. Hopefully GCC is the only DWARF-4 DW_TAG_type_unit producer out there (is it?) and finally hopefully it is the only DW_TAG_type_unit producer forgetting to output DW_AT_producer. It would be probably worth to wait on the resolution of GCC PR debug/48229 before assuming its implications. Not sure how I missed the regression, the baseline is a bit floating with various recent regressions. Sorry, Jan gdb/ 2011-03-22 Jan Kratochvil * dwarf2read.c (producer_is_gxx_lt_4_6): New function. (dwarf2_add_field): Fix new_field->accessibility for cu->header.version >= 3 while verifying also producer_is_gxx_lt_4_6. --- gdb/dwarf2read.c 22 Mar 2011 09:50:42 -0000 1.512 +++ gdb/dwarf2read.c 22 Mar 2011 09:52:44 -0000 @@ -6209,6 +6209,45 @@ dwarf2_record_block_ranges (struct die_i } } +/* Check for GCC PR debug/45124 fix which is not present in any G++ version up + to 4.5.any while it is present already in G++ 4.6.0 - the PR has been fixed + during 4.6.0 experimental. */ + +static int +producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu) +{ + int major, minor; + + if (cu->producer == NULL) + { + if (cu->per_cu->from_debug_types) + { + /* Workaround GCC PR debug/48229 where DW_TAG_type_unit had no + DW_AT_producer in G++ 4.5.x. G++ 4.4.any could not produce + DWARF-4 (and its DW_TAG_type_unit). G++ 4.6.0 already provides + DW_AT_producer for DW_TAG_type_unit. */ + + return 1; + } + + /* For unknown compilers expect their behavior is DWARF version + compliant. */ + + return 0; + } + + /* Whitespaces are ignored in both PRODUCER and the format string. */ + if (sscanf (cu->producer, "GNU C++ %d.%d", &major, &minor) != 2) + { + /* For non-GCC compilers expect their behavior is DWARF version + compliant. */ + + return 0; + } + + return major < 4 || (major == 4 && minor < 6); +} + /* Add an aggregate field to the field list. */ static void @@ -6239,13 +6278,28 @@ dwarf2_add_field (struct field_info *fip } 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 || producer_is_gxx_lt_4_6 (cu)) + { + /* 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+ defines the default accessibility a different way - see + below - than DWARF 2 has defined. The same rules apply now for + DW_TAG_inheritance as for the members and it only depends on the + container kind. */ + + 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);