From patchwork Thu Apr 12 19:07:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 26702 Received: (qmail 114066 invoked by alias); 12 Apr 2018 19:12:14 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 114056 invoked by uid 89); 12 Apr 2018 19:12:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Apr 2018 19:12:11 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 4FC7C14BAE for ; Thu, 12 Apr 2018 14:07:59 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 6hZffpMXaT47D6hZffRWOz; Thu, 12 Apr 2018 14:07:59 -0500 Received: from 75-166-37-45.hlrn.qwest.net ([75.166.37.45]:55312 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1f6hZf-001aZT-2P; Thu, 12 Apr 2018 14:07:59 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/2] Set TYPE_NAME for Rust unions Date: Thu, 12 Apr 2018 13:07:56 -0600 Message-Id: <20180412190756.16052-3-tom@tromey.com> In-Reply-To: <20180412190756.16052-1-tom@tromey.com> References: <20180412190756.16052-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1f6hZf-001aZT-2P X-Source-Sender: 75-166-37-45.hlrn.qwest.net (pokyo.Home) [75.166.37.45]:55312 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes I noticed that read_structure_type sets TYPE_NAME to TYPE_TAG_NAME for some things, but not for unions. For Rust, I think we want to do this for all types, so this patch adds the needed code. I think that TYPE_TAG_NAME is confusing and should probably be removed. I am working on a patch to do this, but in the meantime this seemed like a reasonable change to apply. I suspect this change would be ok for C++ as well, but I do not know about D. 2018-04-12 Tom Tromey * dwarf2read.c (read_structure_type): Set TYPE_NAME for rust unions. --- gdb/ChangeLog | 5 +++++ gdb/dwarf2read.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ceaa5f92ab..f2bb3d0af3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2018-04-12 Tom Tromey + * dwarf2read.c (read_structure_type): Set TYPE_NAME for rust + unions. + +2018-04-12 Tom Tromey + * dwarf2read.c (quirk_rust_enum): Conditionally drop the discriminant field. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4207e4c531..e3f544a6a4 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -15631,7 +15631,9 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) TYPE_TAG_NAME (type) = full_name; if (die->tag == DW_TAG_structure_type - || die->tag == DW_TAG_class_type) + || die->tag == DW_TAG_class_type + || (cu->language == language_rust + && die->tag == DW_TAG_union_type)) TYPE_NAME (type) = TYPE_TAG_NAME (type); } else