From: Hugues de Lassus <hugues.delassus@sifive.com>
To: gdb-patches@sourceware.org
Subject: [PING^2] [PATCH] RISC-V: fix FRM register display mask value
Date: Wed, 21 Sep 2022 12:34:46 -0700 [thread overview]
Message-ID: <CAA0gXjn1QEPXZWwgxMaGK1Qe=gyp_7GYxw0JOjNnJUOM-RTYdw@mail.gmail.com> (raw)
Message-ID: <20220921193446.-j-QThWPO9giCsxGr2enk2t3g_CAZX4-okRnKteTY6g@z> (raw)
In-Reply-To: <CAA0gXjmOehaKTrw1W+miDZDs-SDCE88NWxR9+8epLYDU1DXU6g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2265 bytes --]
On Wed, Aug 3, 2022 at 11:45 AM Hugues de Lassus <hugues.delassus@sifive.com>
wrote:
> Ping.
>
> On Mon, Jul 11, 2022 at 10:58 AM Hugues de Lassus <
> hugues.delassus@sifive.com> wrote:
>
>> The FRM register is 3-bit long, but the top-most bit was masked off for
>> display, resulting in incorrectly displayed values and format strings
>> when FRM >= 4.
>>
>> Tested on riscv64-unknown-linux-gnu target, with FPU support.
>> ---
>> gdb/riscv-tdep.c | 2 +-
>> gdb/testsuite/gdb.base/float.exp | 4 +++-
>> 2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
>> index 69f2123dcdb..a3afab3b998 100644
>> --- a/gdb/riscv-tdep.c
>> +++ b/gdb/riscv-tdep.c
>> @@ -1185,7 +1185,7 @@ riscv_print_one_register_info (struct gdbarch
>> *gdbarch,
>> "dynamic rounding mode",
>> };
>> int frm = ((regnum == RISCV_CSR_FCSR_REGNUM)
>> - ? (d >> 5) : d) & 0x3;
>> + ? (d >> 5) : d) & 0x7;
>>
>> gdb_printf (file, "%sFRM:%i [%s]",
>> (regnum == RISCV_CSR_FCSR_REGNUM
>> diff --git a/gdb/testsuite/gdb.base/float.exp
>> b/gdb/testsuite/gdb.base/float.exp
>> index 62e8346928b..10c0692a976 100644
>> --- a/gdb/testsuite/gdb.base/float.exp
>> +++ b/gdb/testsuite/gdb.base/float.exp
>> @@ -112,14 +112,16 @@ if { [is_aarch64_target] } then {
>> gdb_test "info float" "f0.*f1.*f31.*d0.*d30.*" "info float"
>> } elseif [istarget "riscv*-*-*"] then {
>> # RISC-V may or may not have an FPU
>> + send_gdb "set \$frm = 7\n"
>> gdb_test_multiple "info float" "info float" {
>> - -re "ft0.*ft1.*ft11.*fflags.*frm.*fcsr.*$gdb_prompt $" {
>> + -re "ft0.*ft1.*ft11.*fflags.*frm.*0x7.*FRM:7.*fcsr.*$gdb_prompt
>> $" {
>> pass "info float (with FPU)"
>> }
>> -re "No floating.point info available for this
>> processor.*$gdb_prompt $" {
>> pass "info float (without FPU)"
>> }
>> }
>> + send_gdb "set \$frm = 0\n"
>> } else {
>> gdb_test "info float" "No floating.point info available for this
>> processor." "info float (unknown target)"
>> }
>> --
>> 2.35.1
>>
>>
next prev parent reply other threads:[~2022-09-21 19:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 17:57 Hugues de Lassus
2022-08-03 18:45 ` [PING] " Hugues de Lassus
2022-09-21 19:34 ` Hugues de Lassus [this message]
2022-09-21 19:34 ` [PING^2] " Hugues de Lassus
2022-09-21 19:52 ` Hugues de Lassus
2022-09-21 19:52 ` Hugues de Lassus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAA0gXjn1QEPXZWwgxMaGK1Qe=gyp_7GYxw0JOjNnJUOM-RTYdw@mail.gmail.com' \
--to=hugues.delassus@sifive.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).