From patchwork Mon Mar 6 21:46:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 66055 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21F2D385B514 for ; Mon, 6 Mar 2023 21:47:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21F2D385B514 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678139241; 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=mxkG1gDV/p1GM94CyO07D/uhFFiOjJQC279Z/eFWp/fyGfHoINz710WD2UJ2AfPHH rwFK2ye7DfJRdyLwvxLi70ytfjTqTCJ1WddJt6GB3++5cAGD10Kus9WOxzm1lXbY+/ ZBx/Byhaj8ABz6VfUvoyYUNH4kDIU1l5q7lxQYH0= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 6 Mar 2023 21:46:50 +0000 X-Spam-Status: No, score=-3189.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@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 Reviewed-By: Lancelot SIX --- gdb/amdgpu-tdep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) base-commit: 1d6653fd3f4e0d7140e705733412fd75c40177b2 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);