From patchwork Tue Mar 21 07:12:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nelson Chu X-Patchwork-Id: 66666 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 17A293858288 for ; Tue, 21 Mar 2023 07:13:07 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by sourceware.org (Postfix) with ESMTPS id 968573858D37 for ; Tue, 21 Mar 2023 07:12:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 968573858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-17aeb49429eso15074819fac.6 for ; Tue, 21 Mar 2023 00:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1679382772; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bqdchZMrqUR+EYSjdm8ICE1UDTge+smA5lwKIB+ePcs=; b=xGpOlo3DWlmQLtoTiJjKiIG45s9aPENV5aOepQMp3ntWXtD7woBE0tuhK7ok1hucXR nY8kmXqKElBXqBGorT6TgUa9TgbwlzAF3E1T+mchAxOjRMF/YfveiK0cC4c2dGz078Lb FP4Eypp9yVzUTNxiAvIQtYxeJoVY4twneX9PQw6RsMpc2mJGR3AQPaS2WtX1L2NKE5xw Exj3xYP8mSr22FDUObL8ZyDqhE8zRbq/2smOrnDBm8uKE5sE/C7XlreLVbJCptHfRnUG fQYWSY0IJNb09SZCcH+4qHH7qksYkdHuTbWxEGyv6Esxa2FalSXwSBF6DcRfRO7VswAT +8Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679382772; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bqdchZMrqUR+EYSjdm8ICE1UDTge+smA5lwKIB+ePcs=; b=nFkasahwPNZK1CkFscXeU7hHjuwk969spUFJ5T14Ra1neSq0HZiGpJ18SLUJwl8e0v HqXDrbJzGdtj7zI9eu9A9ml0kCHsvvQO+diSYAZ6TkAfAE3mB29hfaIKhi5gEwYA5ihN ghr4OXKoyw7chl3S2HEGN7LMu6XyUAPEhikAx0z6fx+Xi81PL7XdYqif/BHz/Z189IHI sIopDBtJ608/QD0EE9EYJ6bGkjkWekdEtaiktPo/9ssdpEqNP2Rp24E8sGtWzPwSUV39 OF0Rxq2spwt0+KmFLiPZVad6bwqvA/5RTLD2CLa/uSmPxEzx30jdyW024JXNqPLlgT1/ zEiw== X-Gm-Message-State: AO0yUKU+nRg2HBTCZhow9yDRXq4Q5VRBvAn9aUpKGXzEKJyHsuvE8aGv qOCnDj6v3ZXFsKOaCWGNctco2ZGG9UF3UFq8mMjRykTkUdasyJq64BQ= X-Google-Smtp-Source: AK7set/XowEis+Dd5OUj38tIZW9FOlPjBWcd9pClzW9tJceusz9BBvGvwq7rsgOugFJllfSVPelTVdtzMlA/5YrI+D4= X-Received: by 2002:a05:6871:4907:b0:17e:4e9:7576 with SMTP id tw7-20020a056871490700b0017e04e97576mr328826oab.1.1679382772783; Tue, 21 Mar 2023 00:12:52 -0700 (PDT) MIME-Version: 1.0 References: <20230320033444.2819-1-jiawei@iscas.ac.cn> In-Reply-To: From: Nelson Chu Date: Tue, 21 Mar 2023 15:12:42 +0800 Message-ID: Subject: Fwd: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. To: gdb-patches@sourceware.org, Andrew Burgess X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Hey gdb, Hey Andrew, We plan to accept this patch in binutils upstream since it will fix the pr30184, but not really sure if that will cause problems for risc-v gdb dis-assembler, or other stuff. It would be great if you guys also think it's safe enough to commit. Thanks Nelson ---------- Forwarded message --------- From: Xiaolin Zheng Date: Mon, Mar 20, 2023 at 1:52 PM Subject: Re: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. To: Jiawei , binutils Cc: nelson , palmer , christoph.muellner , wuwei2016 Thank you Jiawei. this version LGTM though I am not a Binutils developer. Do Binutils reviewers have thoughts on this new version? Thanks in advance. ------------------------------------------------------------------ From:Jiawei Send Time:2023年3月20日(星期一) 11:35 To:binutils Cc:nelson ; palmer ; christoph.muellner ; 郑孝林(云矅) ; wuwei2016 ; Jiawei Subject:[PATCH v2] RISC-V: Fix disassemble fetch fail return value. This bug reported in https://sourceware.org/bugzilla/show_bug.cgi?id=30184 And discussed in https://sourceware.org/pipermail/binutils/2023-February/126213.html We also checked the implementation of return value in arm and mips. So this patch changes the return value to -1, that can fix bugs and maintain consistency with other architectures. opcodes/ChangeLog: * riscv-dis.c (print_insn_riscv):Change the return value. --- opcodes/riscv-dis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) dump_size = riscv_insn_length (insn); @@ -1071,7 +1071,7 @@ print_insn_riscv (bfd_vma memaddr, struct disassemble_info *info) if (status != 0) { (*info->memory_error_func) (status, memaddr, info); - return status; + return -1; } insn = (insn_t) bfd_get_bits (packet, dump_size * 8, false); diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 7baba054daa..f431124b423 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -1059,7 +1059,7 @@ print_insn_riscv (bfd_vma memaddr, struct disassemble_info *info) if (status != 0) { (*info->memory_error_func) (status, memaddr, info); - return status; + return -1; } insn = (insn_t) bfd_getl16 (packet);