From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Fix bug in quirk_rust_enum
Date: Fri, 19 Jun 2020 14:51:00 -0600 [thread overview]
Message-ID: <20200619205100.25400-1-tromey@adacore.com> (raw)
Tom de Vries pointed out that some Rust tests were failing after the
variant part rewrite. He sent an executable, which helped track down
this bug.
quirk_rust_enum was passing 1 to alloc_rust_variant in one case.
However, a comment earlier says:
/* We don't need a range entry for the discriminant, but we do
need one for every other field, as there is no default
variant. */
In this case, we must pass -1 for this parameter. That is what this
patch implements.
gdb/ChangeLog
2020-06-19 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (quirk_rust_enum): Correctly call
alloc_rust_variant for default-less enum.
---
gdb/ChangeLog | 5 +++++
gdb/dwarf2/read.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 4dc9ad6c99b..b097f624b6c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9691,7 +9691,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
}
/* Indicate that this is a variant type. */
- alloc_rust_variant (&objfile->objfile_obstack, type, 0, 1,
+ alloc_rust_variant (&objfile->objfile_obstack, type, 0, -1,
gdb::array_view<discriminant_range> (ranges,
n_fields - 1));
}
--
2.21.3
next reply other threads:[~2020-06-19 20:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 20:51 Tom Tromey [this message]
2020-06-30 13:57 ` 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=20200619205100.25400-1-tromey@adacore.com \
--to=tromey@adacore.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).