Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Timur <timurgol007@gmail.com>, gdb-patches@sourceware.org
Cc: guinevere@redhat.com, Timur <timurgol007@gmail.com>
Subject: Re: [PATCH v8] This commit adds record full support for rv64gc instruction set
Date: Thu, 10 Apr 2025 10:16:11 +0100	[thread overview]
Message-ID: <875xjce5r8.fsf@redhat.com> (raw)
In-Reply-To: <20250318184944.351874-1-timurgol007@gmail.com>


Hi Timur,

I think this is looking great now.  I do have a couple of minor follow
on questions/points, but I think this is almost done.  Thanks for all
your work getting this ready for merging.  Notes are inline below...

Timur <timurgol007@gmail.com> writes:

> It includes changes to the following files:
> - gdb/riscv-linux-tdep.c, gdb/riscv-linux-tdep.h: adds facilities to record
> syscalls.
> - gdb/riscv-tdep.c, gdb/riscv-tdep.h: adds facilities to record execution of
> rv64gc instructions.
> - gdb/configure.tgt: adds new files for compilation.
> - gdb/testsuite/lib/gdb.exp: enables testing of full record mode for RISC-V
> targets.
> - gdb/syscalls/riscv-canonicalize-syscall-gen.py: a script to generate
> function that canonicalizes RISC-V syscall. This script can simplify support
> for syscalls on rv32 and rv64 system (currently support only for rv64).  To
> use this script you need to pass a path to a file with syscalls description
> from riscv-glibc (example is in the help message). The script produces a

I guess riscv-glibc is a fork of glibc that is running ahead of the
upstream glibc project?

Is there any reason that this cannot work with the official glibc
project?  That would be preferable I think unless there's a compelling
reason, which ideally we'd document.

I tried running the script using current HEAD of glibc, the only
significant change is:

  diff --git i/gdb/riscv-canonicalize-syscall-gen.c w/gdb/riscv-canonicalize-syscall-gen.c
  index 3749fc32f33..03579984f4a 100644
  --- i/gdb/riscv-canonicalize-syscall-gen.c
  +++ w/gdb/riscv-canonicalize-syscall-gen.c
  @@ -270,7 +270,7 @@ riscv64_canonicalize_syscall (int syscall)
       case 239: return gdb_sys_move_pages;
       /* case 240: return gdb_sys_rt_tgsigqueueinfo;  */
       /* case 241: return gdb_sys_perf_event_open;  */
  -    /* case 242: return gdb_sys_accept4;  */
  +    case 242: return gdb_sys_accept4;
       /* case 243: return gdb_sys_recvmmsg;  */
       /* case 258: return gdb_sys_riscv_hwprobe;  */
       /* case 259: return gdb_sys_riscv_flush_icache;  */

There was also a bunch of new syscalls that are added, but commented
out.  I haven't tried to figure out if the change above is a bad thing
or not though, maybe you could advise.


> diff --git a/gdb/NEWS b/gdb/NEWS
> index 964183910dc..20fdb571047 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -9581,3 +9581,5 @@ GDB now handles cross debugging.  If you are remotely debugging between
>  two different machines, type ``./configure host -target=targ''.
>  Host is the machine where GDB will run; targ is the machine
>  where the program that you are debugging will run.
> +
> + * Add record full support for rv64gc architectures

This entry needs to move to the correct section of the NEWS file.  If
you look for the lines starting '***' you'll see that the first header
is '*** Changes since GDB 16', this is the section where you should
place your entry, probably just before the '* New commands' line.

> diff --git a/gdb/riscv-linux-tdep.h b/gdb/riscv-linux-tdep.h
> new file mode 100644
> index 00000000000..0f481b168d1
> --- /dev/null
> +++ b/gdb/riscv-linux-tdep.h
> @@ -0,0 +1,29 @@
> +/* Copyright (C) 2024-2025 Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef RISCV_LINUX_TDEP_H
> +#define RISCV_LINUX_TDEP_H

These include guards need to be renamed to GDB_RISCV_LINUX_TDEP_H.  You
can do this automatically if you like with:

  ./gdb/check-include-guards.py --update gdb/*.h

> +
> +#include "linux-record.h"
> +
> +/* riscv64_canonicalize_syscall maps from the native riscv Linux set
> +   of syscall ids into a canonical set of syscall ids used by
> +   process record.  */
> +
> +extern enum gdb_syscall riscv64_canonicalize_syscall (int syscall);
> +
> +#endif /* RISCV_LINUX_TDEP_H */

> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 410f99e3350..b048ac7078b 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -3718,7 +3718,8 @@ proc supports_reverse {} {
>           || [istarget "i\[34567\]86-*-linux*"]
>           || [istarget "aarch64*-*-linux*"]
>           || [istarget "powerpc*-*-linux*"]
> -         || [istarget "s390*-*-linux*"] } {
> +         || [istarget "s390*-*-linux*"]
> +         || [istarget "riscv*-*-*"] } {

I notice that every other entry in this list restricts the match to
Linux based targets.  Is RISC-V really different here?  Or should RISC-V
be similarly restricted?

Thanks,
Andrew


  parent reply	other threads:[~2025-04-10  9:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 22:26 [PATCH] gdb/riscv: Add record support for rv64gc instructions Timur
2024-11-18 19:46 ` Guinevere Larsen
2024-11-26 14:17   ` [PATCH v2] " Timur
2024-11-27 14:23     ` Guinevere Larsen
2024-12-03 18:30       ` [PATCH v3] " Timur
2024-12-13 18:10         ` Guinevere Larsen
2024-12-17  0:10           ` [PATCH v4] This commit adds record full support for rv64gc instruction set Timur
2024-12-17 14:23             ` Guinevere Larsen
2024-12-23 15:12               ` [PATCH v5] " Timur
2024-12-23 18:55                 ` Guinevere Larsen
2024-12-31 16:09                   ` [PATCH v6] " Timur
2025-01-10 18:12                     ` Guinevere Larsen
2025-01-16 15:48                       ` [PATCH v7] " Timur
2025-02-10 18:07                         ` [PING][PATCH v8] " Timur
2025-02-10 19:30                           ` Eli Zaretskii
2025-02-11 22:06                             ` [PATCH] " Timur
2025-02-26 11:14                               ` [PATCH][PING] " Timur
2025-03-13 10:38                                 ` Andrew Burgess
2025-03-13 15:03                               ` [PATCH] " Andrew Burgess
2025-03-18 18:49                                 ` [PATCH v8] " Timur
2025-03-31 17:50                                   ` [PING][PATCH] " Timur
2025-04-08 12:33                                     ` Timur Golubovich
2025-04-10  9:16                                       ` Andrew Burgess
2025-04-10  9:16                                   ` Andrew Burgess [this message]
2025-04-10 11:55                                     ` [PATCH v8] " Timur
2025-04-14  7:40                                       ` Andrew Burgess
2025-04-14  8:44                                         ` Timur Golubovich
2025-04-14 12:03                                           ` Guinevere Larsen
2025-04-22 17:36                                           ` Timur Golubovich
2025-04-23 12:13                                             ` Guinevere Larsen
2025-04-23 14:01                                               ` Aktemur, Tankut Baris
2025-04-23 14:13                                                 ` Guinevere Larsen
2025-04-23 14:39                                                   ` Timur Golubovich

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=875xjce5r8.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.com \
    --cc=timurgol007@gmail.com \
    /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