From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kIofIGZfBmRSsgYAWB0awg (envelope-from ) for ; Mon, 06 Mar 2023 16:47:18 -0500 Received: by simark.ca (Postfix, from userid 112) id 818C01E223; Mon, 6 Mar 2023 16:47:18 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=QMHfEj3c; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3F6971E110 for ; Mon, 6 Mar 2023 16:47:18 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8065D385B531 for ; Mon, 6 Mar 2023 21:47:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8065D385B531 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678139237; bh=/fyYYAtgRdbe8QzXJNz4F5pUTORXNpYL7fa+K/MKda0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=QMHfEj3chCRkV3/coUjHyhpqTIisliiuMPg1ls2eKTnJAQi47hwA0P947Od4ceRqD dFD2J6GDNkNrUk7+izpn8pPoT25X+tqekNzkXTsHW44Bq/O5vbEw2M5K1ufjN1vcxb zFeepGjeuKco9ici/V79hs2mejDun9c556/o2LpI= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5D5283858C66 for ; Mon, 6 Mar 2023 21:46:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D5283858C66 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 326Lkow4021578 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 6 Mar 2023 16:46:55 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 326Lkow4021578 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 962031E110; Mon, 6 Mar 2023 16:46:50 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] gdb/amdgpu: provide dummy implementation of gdbarch_return_value_as_value Date: Mon, 6 Mar 2023 16:46:50 -0500 Message-Id: <20230306214650.1744872-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 6 Mar 2023 21:46:50 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 (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