Message ID | CAPpQWtCg7zHBfvDrmJp7=nMEf9+kGH_0p-qYVKOPZFbEOsL-XQ@mail.gmail.com |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 <patchwork@sourceware.org>; 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 <gdb-patches@sourceware.org>; 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 <gdb-patches@sourceware.org>; 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> <c06d0f96-eb16-484f-92ba-8b92551c5850.yunyao.zxl@alibaba-inc.com> In-Reply-To: <c06d0f96-eb16-484f-92ba-8b92551c5850.yunyao.zxl@alibaba-inc.com> From: Nelson Chu <nelson@rivosinc.com> Date: Tue, 21 Mar 2023 15:12:42 +0800 Message-ID: <CAPpQWtCg7zHBfvDrmJp7=nMEf9+kGH_0p-qYVKOPZFbEOsL-XQ@mail.gmail.com> Subject: Fwd: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. To: gdb-patches@sourceware.org, Andrew Burgess <aburgess@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
[v2] RISC-V: Fix disassemble fetch fail return value.
|
|
Commit Message
Nelson Chu
March 21, 2023, 7:12 a.m. UTC
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 <yunyao.zxl@alibaba-inc.com>
Date: Mon, Mar 20, 2023 at 1:52 PM
Subject: Re: [PATCH v2] RISC-V: Fix disassemble fetch fail return value.
To: Jiawei <jiawei@iscas.ac.cn>, binutils <binutils@sourceware.org>
Cc: nelson <nelson@rivosinc.com>, palmer <palmer@dabbelt.com>,
christoph.muellner <christoph.muellner@vrull.eu>, wuwei2016
<wuwei2016@iscas.ac.cn>
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 <jiawei@iscas.ac.cn>
Send Time:2023年3月20日(星期一) 11:35
To:binutils <binutils@sourceware.org>
Cc:nelson <nelson@rivosinc.com>; palmer <palmer@dabbelt.com>;
christoph.muellner <christoph.muellner@vrull.eu>; 郑孝林(云矅)
<yunyao.zxl@alibaba-inc.com>; wuwei2016 <wuwei2016@iscas.ac.cn>;
Jiawei <jiawei@iscas.ac.cn>
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);
Comments
Nelson Chu <nelson@rivosinc.com> writes: > 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. This shouldn't cause any problems for GDB, so long as the returned value is negative then GDB will treat this as an error. Fine to commit as far as I'm concerned. Approved-By: Andrew Burgess <aburgess@redhat.com> Thanks, Andrew > > Thanks > Nelson > > ---------- Forwarded message --------- > From: Xiaolin Zheng <yunyao.zxl@alibaba-inc.com> > Date: Mon, Mar 20, 2023 at 1:52 PM > Subject: Re: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. > To: Jiawei <jiawei@iscas.ac.cn>, binutils <binutils@sourceware.org> > Cc: nelson <nelson@rivosinc.com>, palmer <palmer@dabbelt.com>, > christoph.muellner <christoph.muellner@vrull.eu>, wuwei2016 > <wuwei2016@iscas.ac.cn> > > > 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 <jiawei@iscas.ac.cn> > Send Time:2023年3月20日(星期一) 11:35 > To:binutils <binutils@sourceware.org> > Cc:nelson <nelson@rivosinc.com>; palmer <palmer@dabbelt.com>; > christoph.muellner <christoph.muellner@vrull.eu>; 郑孝林(云矅) > <yunyao.zxl@alibaba-inc.com>; wuwei2016 <wuwei2016@iscas.ac.cn>; > Jiawei <jiawei@iscas.ac.cn> > 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(-) > > 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); > 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); > > -- > 2.25.1
Thanks, committed. On Tue, Mar 21, 2023 at 5:22 PM Andrew Burgess <aburgess@redhat.com> wrote: > > Nelson Chu <nelson@rivosinc.com> writes: > > > 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. > > This shouldn't cause any problems for GDB, so long as the returned value > is negative then GDB will treat this as an error. > > Fine to commit as far as I'm concerned. > > Approved-By: Andrew Burgess <aburgess@redhat.com> > > Thanks, > Andrew > > > > > Thanks > > Nelson > > > > ---------- Forwarded message --------- > > From: Xiaolin Zheng <yunyao.zxl@alibaba-inc.com> > > Date: Mon, Mar 20, 2023 at 1:52 PM > > Subject: Re: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. > > To: Jiawei <jiawei@iscas.ac.cn>, binutils <binutils@sourceware.org> > > Cc: nelson <nelson@rivosinc.com>, palmer <palmer@dabbelt.com>, > > christoph.muellner <christoph.muellner@vrull.eu>, wuwei2016 > > <wuwei2016@iscas.ac.cn> > > > > > > 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 <jiawei@iscas.ac.cn> > > Send Time:2023年3月20日(星期一) 11:35 > > To:binutils <binutils@sourceware.org> > > Cc:nelson <nelson@rivosinc.com>; palmer <palmer@dabbelt.com>; > > christoph.muellner <christoph.muellner@vrull.eu>; 郑孝林(云矅) > > <yunyao.zxl@alibaba-inc.com>; wuwei2016 <wuwei2016@iscas.ac.cn>; > > Jiawei <jiawei@iscas.ac.cn> > > 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(-) > > > > 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); > > 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); > > > > -- > > 2.25.1 >
Thanks for the help, Jiawei and Nelson! Marked the issue [1] as closed. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=30184 <https://sourceware.org/bugzilla/show_bug.cgi?id=30184 > Best Regards, Xiaolin ------------------------------------------------------------------ From:Nelson Chu <nelson@rivosinc.com> Send Time:2023年3月21日(星期二) 17:55 To:Andrew Burgess <aburgess@redhat.com>; jiawei <jiawei@iscas.ac.cn>; 郑孝林(云矅) <yunyao.zxl@alibaba-inc.com> Cc:gdb-patches <gdb-patches@sourceware.org>; Binutils <binutils@sourceware.org> Subject:Re: Fwd: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. Thanks, committed. On Tue, Mar 21, 2023 at 5:22 PM Andrew Burgess <aburgess@redhat.com> wrote: > > Nelson Chu <nelson@rivosinc.com> writes: > > > 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. > > This shouldn't cause any problems for GDB, so long as the returned value > is negative then GDB will treat this as an error. > > Fine to commit as far as I'm concerned. > > Approved-By: Andrew Burgess <aburgess@redhat.com> > > Thanks, > Andrew > > > > > Thanks > > Nelson > > > > ---------- Forwarded message --------- > > From: Xiaolin Zheng <yunyao.zxl@alibaba-inc.com> > > Date: Mon, Mar 20, 2023 at 1:52 PM > > Subject: Re: [PATCH v2] RISC-V: Fix disassemble fetch fail return value. > > To: Jiawei <jiawei@iscas.ac.cn>, binutils <binutils@sourceware.org> > > Cc: nelson <nelson@rivosinc.com>, palmer <palmer@dabbelt.com>, > > christoph.muellner <christoph.muellner@vrull.eu>, wuwei2016 > > <wuwei2016@iscas.ac.cn> > > > > > > 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 <jiawei@iscas.ac.cn> > > Send Time:2023年3月20日(星期一) 11:35 > > To:binutils <binutils@sourceware.org> > > Cc:nelson <nelson@rivosinc.com>; palmer <palmer@dabbelt.com>; > > christoph.muellner <christoph.muellner@vrull.eu>; 郑孝林(云矅) > > <yunyao.zxl@alibaba-inc.com>; wuwei2016 <wuwei2016@iscas.ac.cn>; > > Jiawei <jiawei@iscas.ac.cn> > > 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(-) > > > > 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); > > 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); > > > > -- > > 2.25.1 >
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);