From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.145.87]) by sourceware.org (Postfix) with ESMTPS id 2A44A3876057 for ; Wed, 25 Mar 2020 20:07:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2A44A3876057 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway33.websitewelcome.com (Postfix) with ESMTP id C185F1791F1 for ; Wed, 25 Mar 2020 15:07:17 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id HCJ3jw0ZmAGTXHCJ3jKupN; Wed, 25 Mar 2020 15:07:17 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tez8f+cz33mHX66+/9NtYw1fpNhPf4dTRjuzxeiei80=; b=c2xaNsdY9TVMbCaN7Sq5CB2LDA nbDZ5Ny3MEd0guZOmPf9AKIvRAHhv/vItF9ra0arYG/LSWddRTydi1SVF9EajlWedqGYGzCzME+/E b9/WOSiYTvygtrUPzMgNlp6RO; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:38026 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jHCJ3-001VYp-I9; Wed, 25 Mar 2020 14:07:17 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 02/10] Move the rust "{" hack Date: Wed, 25 Mar 2020 14:07:07 -0600 Message-Id: <20200325200715.12947-3-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200325200715.12947-1-tom@tromey.com> References: <20200325200715.12947-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.117.21 X-Source-L: No X-Exim-ID: 1jHCJ3-001VYp-I9 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:38026 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-24.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2020 20:07:20 -0000 The DWARF reader has a special case to work around a bug in some versions of the Rust compiler -- it ignores mangled names that contain a "{" character. I noticed that this check should probably be in dw2_linkage_name rather than only in dwarf2_physname. The former is called in some cases that the latter is not. Also, I noticed that this work is not done for the partial DIE reader, so this patch adds the check there as well. gdb/ChangeLog 2020-03-25 Tom Tromey * dwarf2/read.c (dw2_linkage_name): Move Rust "{" hack here... (dwarf2_physname): ... from here. (partial_die_info::read): Add Rust "{" hack. --- gdb/ChangeLog | 6 ++++++ gdb/dwarf2/read.c | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 69ad352b6a7..d5cdd49a086 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10020,6 +10020,12 @@ dw2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) if (linkage_name == NULL) linkage_name = dwarf2_string_attr (die, DW_AT_MIPS_linkage_name, cu); + /* rustc emits invalid values for DW_AT_linkage_name. Ignore these. + See https://github.com/rust-lang/rust/issues/32925. */ + if (cu->language == language_rust && linkage_name != NULL + && strchr (linkage_name, '{') != NULL) + linkage_name = NULL; + return linkage_name; } @@ -10296,12 +10302,6 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) mangled = dw2_linkage_name (die, cu); - /* rustc emits invalid values for DW_AT_linkage_name. Ignore these. - See https://github.com/rust-lang/rust/issues/32925. */ - if (cu->language == language_rust && mangled != NULL - && strchr (mangled, '{') != NULL) - mangled = NULL; - /* DW_AT_linkage_name is missing in some cases - depend on what GDB has computed. */ gdb::unique_xmalloc_ptr demangled; @@ -18032,6 +18032,11 @@ partial_die_info::read (const struct die_reader_specs *reader, assume they will be the same, and we only store the last one we see. */ linkage_name = DW_STRING (&attr); + /* rustc emits invalid values for DW_AT_linkage_name. Ignore these. + See https://github.com/rust-lang/rust/issues/32925. */ + if (cu->language == language_rust && linkage_name != NULL + && strchr (linkage_name, '{') != NULL) + linkage_name = NULL; break; case DW_AT_low_pc: has_low_pc_attr = 1; -- 2.17.2