From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH] gdb/amdgpu: provide dummy implementation of gdbarch_return_value_as_value
Date: Mon, 6 Mar 2023 16:46:50 -0500 [thread overview]
Message-ID: <20230306214650.1744872-1-simon.marchi@polymtl.ca> (raw)
The AMD GPU support has been merged shortly after commit 4e1d2f5814b2
("Add new overload of gdbarch_return_value"), which made it mandatory
for architectures to provide either a return_value or
return_value_as_value implementation. Because of my failure to test
properly after rebasing and before pushing, we get this with the current
master:
$ gdb ./gdb -nx --data-directory=data-directory -q -ex "set arch amdgcn:gfx1010" -batch
/home/simark/src/binutils-gdb/gdb/gdbarch.c:517: internal-error: verify_gdbarch: the following are invalid ...
return_value_as_value
I started trying to change GDB to not force architectures to provide a
return_value or return_value_as_value implementation, but Andrew pointed
out that any serious port will have an implementation one day or
another, and it's easy to add a dummy implementation in the mean time.
So it's better to not complicate the core of GDB to know how to deal
with this.
There is an implementation of return_value in the downstream ROCgdb port
(which we'll need to convert to the new return_value_as_value), which
we'll contribute soon-ish. In the mean time, add a dummy implementation
of return_value_as_value to avoid the failed assertion.
Change-Id: I26edf441b511170aa64068fd248ab6201158bb63
---
gdb/amdgpu-tdep.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c
index 7f0e9dffab37..d681d9d6a504 100644
--- a/gdb/amdgpu-tdep.c
+++ b/gdb/amdgpu-tdep.c
@@ -51,6 +51,16 @@ get_amdgpu_gdbarch_tdep (gdbarch *arch)
return gdbarch_tdep<amdgpu_gdbarch_tdep> (arch);
}
+/* Dummy implementation of gdbarch_return_value_as_value. */
+
+static return_value_convention
+amdgpu_return_value_as_value (gdbarch *arch, value *function, type *valtype,
+ regcache *regcache, value **read_value,
+ const gdb_byte *writebuf)
+{
+ gdb_assert_not_reached ("not implemented");
+}
+
/* Return the name of register REGNUM. */
static const char *
@@ -1195,6 +1205,8 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, amdgpu_dwarf_reg_to_regnum);
+ set_gdbarch_return_value_as_value (gdbarch, amdgpu_return_value_as_value);
+
/* Register representation. */
set_gdbarch_register_name (gdbarch, amdgpu_register_name);
set_gdbarch_register_type (gdbarch, amdgpu_register_type);
base-commit: 1d6653fd3f4e0d7140e705733412fd75c40177b2
--
2.39.2
next reply other threads:[~2023-03-06 21:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 21:46 Simon Marchi [this message]
2023-03-07 10:45 ` Lancelot SIX
2023-03-07 14:47 ` Simon Marchi
2023-03-07 19:12 ` Lancelot SIX
2023-03-07 19:20 ` Tom Tromey
2023-03-07 20:32 ` Simon Marchi
2023-03-07 20:44 ` Tom Tromey
2023-03-07 20:33 ` Lancelot SIX
2023-03-07 20:44 ` 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=20230306214650.1744872-1-simon.marchi@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--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).