From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 6EAE93858C53; Tue, 7 Mar 2023 22:46:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EAE93858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678229185; bh=w30yFgaJZ4Uxs13rAfjRyVvAEWLGmTaYaSHjptqo9/8=; h=From:To:Subject:Date:From; b=WvbbZ7gVJ5gzfv2J680ZdZZmIH9kVUt3kABjc0G8JbRNP6PsJ0uftUqPtEvahOgy6 Q2pfWCk7rutaUvkn89xCxn/bgDgbRn2A7RcPPSCa7xDKhjqBJZ9Ziodu6FpusrVb/C Yt/X2eAqf+vACALOmFbTMdQH+8JLJyWoIIp95/CE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/amdgpu: provide dummy implementation of gdbarch_return_value_as_value X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 21f6be77b97e1d606881966fd4e407fde459a639 X-Git-Newrev: 365aee2bdf90ac99fd749964e18e0c58d7a22383 Message-Id: <20230307224625.6EAE93858C53@sourceware.org> Date: Tue, 7 Mar 2023 22:46:25 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D365aee2bdf90= ac99fd749964e18e0c58d7a22383 commit 365aee2bdf90ac99fd749964e18e0c58d7a22383 Author: Simon Marchi Date: Mon Mar 6 16:46:50 2023 -0500 gdb/amdgpu: provide dummy implementation of gdbarch_return_value_as_val= ue =20 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: =20 $ gdb ./gdb -nx --data-directory=3Ddata-directory -q -ex "set arch = amdgcn:gfx1010" -batch /home/simark/src/binutils-gdb/gdb/gdbarch.c:517: internal-error: ve= rify_gdbarch: the following are invalid ... return_value_as_value =20 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. =20 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. =20 Change-Id: I26edf441b511170aa64068fd248ab6201158bb63 Reviewed-By: Lancelot SIX Diff: --- gdb/amdgpu-tdep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c index 7f0e9dffab3..d681d9d6a50 100644 --- a/gdb/amdgpu-tdep.c +++ b/gdb/amdgpu-tdep.c @@ -51,6 +51,16 @@ get_amdgpu_gdbarch_tdep (gdbarch *arch) return gdbarch_tdep (arch); } =20 +/* Dummy implementation of gdbarch_return_value_as_value. */ + +static return_value_convention +amdgpu_return_value_as_value (gdbarch *arch, value *function, type *valtyp= e, + regcache *regcache, value **read_value, + const gdb_byte *writebuf) +{ + gdb_assert_not_reached ("not implemented"); +} + /* Return the name of register REGNUM. */ =20 static const char * @@ -1195,6 +1205,8 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct= gdbarch_list *arches) =20 set_gdbarch_dwarf2_reg_to_regnum (gdbarch, amdgpu_dwarf_reg_to_regnum); =20 + 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);