public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 2/2] Set TYPE_NAME for Rust unions
Date: Thu, 12 Apr 2018 19:12:00 -0000	[thread overview]
Message-ID: <20180412190756.16052-3-tom@tromey.com> (raw)
In-Reply-To: <20180412190756.16052-1-tom@tromey.com>

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  <tom@tromey.com>

	* 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  <tom@tromey.com>
 
+	* dwarf2read.c (read_structure_type): Set TYPE_NAME for rust
+	unions.
+
+2018-04-12  Tom Tromey  <tom@tromey.com>
+
 	* 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
-- 
2.13.6

  parent reply	other threads:[~2018-04-12 19:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12 19:08 [RFA 0/2] Minor Rust-related DWARF reader fixes Tom Tromey
2018-04-12 19:08 ` [RFA 1/2] Conditionally drop the discriminant field in quirk_rust_enum Tom Tromey
2018-04-13  7:36   ` Joel Brobecker
2018-04-12 19:12 ` Tom Tromey [this message]
2018-04-13  7:41   ` [RFA 2/2] Set TYPE_NAME for Rust unions Joel Brobecker
2018-04-17 19:37     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180412190756.16052-3-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).