From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Fix Ada value printing on PPC64
Date: Thu, 30 Apr 2020 07:18:51 -0600 [thread overview]
Message-ID: <20200430131851.30426-1-tromey@adacore.com> (raw)
The val_print removal patches introduced an Ada regression on PPC64
(probably any big-endian system).
The issue comes because value_field does not understand that Ada
wrapper fields can be bitfields that wrap a non-scalar type. In this
case the value is already left-justified, so the justification done
there does the wrong thing.
Perhaps it would be good, eventually, to change value_field to
understand this case. In the meantime this implements an Ada-specific
solution.
gdb/ChangeLog
2020-04-30 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_value_primitive_field): Now public.
* ada-lang.h (ada_value_primitive_field): Declare.
* ada-valprint.c (print_field_values): Use
ada_value_primitive_field for wrapper fields.
---
gdb/ChangeLog | 7 +++++++
gdb/ada-lang.c | 5 +----
gdb/ada-lang.h | 5 +++++
gdb/ada-valprint.c | 3 ++-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index bfbc69084ec..e25930fca21 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -204,9 +204,6 @@ static struct symbol *standard_lookup (const char *, const struct block *,
static struct value *ada_search_struct_field (const char *, struct value *, int,
struct type *);
-static struct value *ada_value_primitive_field (struct value *, int, int,
- struct type *);
-
static int find_struct_field (const char *, struct type *, int,
struct type **, int *, int *, int *, int *);
@@ -7125,7 +7122,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num)
fields. FIELDNO says which field. Differs from value_primitive_field
only in that it can handle packed values of arbitrary type. */
-static struct value *
+struct value *
ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
struct type *arg_type)
{
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index bb9e3c3027b..c0a71091e35 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -234,6 +234,11 @@ extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
extern int ada_scan_number (const char *, int, LONGEST *, int *);
+extern struct value *ada_value_primitive_field (struct value *arg1,
+ int offset,
+ int fieldno,
+ struct type *arg_type);
+
extern struct type *ada_parent_type (struct type *);
extern int ada_is_ignored_field (struct type *, int);
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 31f3a50b340..010446d70f8 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -609,7 +609,8 @@ print_field_values (struct value *value, struct value *outer_value,
if (ada_is_wrapper_field (type, i))
{
- struct value *field_val = value_field (value, i);
+ struct value *field_val = ada_value_primitive_field (value, 0,
+ i, type);
comma_needed =
print_field_values (field_val, field_val,
stream, recurse, options,
--
2.21.1
next reply other threads:[~2020-04-30 13:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 13:18 Tom Tromey [this message]
2020-05-11 20: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=20200430131851.30426-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).