Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Abhay Kandpal <abhay@linux.ibm.com>
Cc: gdb-patches@sourceware.org, aburgess@redhat.com,
	Ulrich.Weigand@de.ibm.com, cel@linux.ibm.com, abhay.k@ibm.com
Subject: Re: [PATCH v3 2/2] gdb: add stat64 and fstat64 to the F-packet file-i/o protocol
Date: Wed, 14 Oct 2026 14:47:51 +0300	[thread overview]
Message-ID: <86h5ioec60.fsf@gnu.org> (raw)
In-Reply-To: <20261014092139.399322-3-abhay@linux.ibm.com> (message from Abhay Kandpal on Wed, 14 Oct 2026 04:21:39 -0500)

> From: Abhay Kandpal <abhay@linux.ibm.com>
> Cc: aburgess@redhat.com, Ulrich.Weigand@de.ibm.com, eliz@gnu.org,
>         cel@linux.ibm.com, abhay.k@ibm.com,
>         Abhay Kandpal <abhay@linux.ibm.com>
> Date: Wed, 14 Oct 2026 04:21:39 -0500
> 
> The previous patch widened the stat fields returned by the vFile
> packets, using a qSupported feature to keep old and new GDB and
> gdbserver compatible.  The F-packet file-i/o protocol has the same
> problem: the Fstat and Ffstat calls write struct fio_stat into target
> memory, in which st_dev, st_ino, st_nlink, st_rdev and the three
> timestamps are 4 bytes, so those values are truncated on a 64-bit
> host.
> 
> The F-packet calls cannot use qSupported, since the buffer is read
> directly by the target.  But each request names the call it wants, so
> add two new calls, Fstat64 and Ffstat64, which are identical to Fstat
> and Ffstat except that they write struct fio_stat_wide.  Existing
> targets keep using Fstat and Ffstat and see no change.  A GDB which
> does not know the new calls already replies with ENOSYS, so a target
> can try Fstat64 and fall back to Fstat.
> 
> The stat and fstat handlers become remote_fileio_do_stat and
> remote_fileio_do_fstat, with a flag selecting the layout, and share a
> new remote_fileio_write_stat helper.  The stat handler has always
> reported st_dev as zero; that is now done on the struct stat before
> packing, which gives the same result in either layout.
> 
> The console case in the fstat handler stored 1 into fst_dev, but that
> was then overwritten when the struct was packed, so the target always
> saw zero.  Drop the dead store; behaviour is unchanged.
> 
> gdb/
> 	* NEWS: Mention the Fstat64 and Ffstat64 calls.
> 	* doc/gdb.texinfo (List of Supported Calls): Add stat64/fstat64.
> 	(stat/fstat): Refer to stat64/fstat64.
> 	(stat64/fstat64): New node.
> 	(struct stat64): Mention the Fstat64 and Ffstat64 calls.
> 	* remote-fileio.c (remote_fileio_write_stat): New function.
> 	(remote_fileio_do_stat): Renamed from remote_fileio_func_stat.
> 	Add WIDE parameter.
> 	(remote_fileio_func_stat): Call remote_fileio_do_stat.
> 	(remote_fileio_func_stat64): New function.
> 	(remote_fileio_do_fstat): Renamed from remote_fileio_func_fstat.
> 	Add WIDE parameter.  Remove dead store to fst_dev.
> 	(remote_fileio_func_fstat): Call remote_fileio_do_fstat.
> 	(remote_fileio_func_fstat64): New function.
> 	(remote_fio_func_map): Add stat64 and fstat64.
> 
> gdbsupport/
> 	* fileio.h (struct fio_stat, struct fio_stat_wide): Update
> 	comments.
> 
> Tested on powerpc64le-linux, on an xfs filesystem with inode numbers
> above 2^32, using a fake remote stub which issues File-I/O requests
> and checks the buffer GDB writes into target memory.  Fstat64 and
> Ffstat64 return the full inode number; Fstat and Ffstat return the
> same truncated values as before.  An unpatched GDB answers Fstat64
> and Ffstat64 with ENOSYS.  gdb.server/fileio-packets.exp continues
> to pass.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34567
> Suggested-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
> ---
>  gdb/NEWS            |  9 ++++++
>  gdb/doc/gdb.texinfo | 52 +++++++++++++++++++++++++++++++++--
>  gdb/remote-fileio.c | 67 +++++++++++++++++++++++++++++++++++++--------
>  gdbsupport/fileio.h | 14 +++++-----
>  4 files changed, 120 insertions(+), 22 deletions(-)

Thanks, the documentation parts are approved.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

  reply	other threads:[~2026-10-14 11:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  9:21 [PATCH v3 0/2] Widen the stat fields in the remote protocol Abhay Kandpal
2026-10-14  9:21 ` [PATCH v3 1/2] gdbserver: widen the stat fields returned by the vFile packets Abhay Kandpal
2026-10-27 17:27   ` Ulrich Weigand
2026-10-27 22:16   ` Andrew Burgess
2026-10-14  9:21 ` [PATCH v3 2/2] gdb: add stat64 and fstat64 to the F-packet file-i/o protocol Abhay Kandpal
2026-10-14 11:47   ` Eli Zaretskii [this message]
2026-10-27 17:47   ` Ulrich Weigand
2026-10-28 10:42     ` Abhay Kandpal
2026-10-28 14:19       ` Ulrich Weigand

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=86h5ioec60.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=abhay.k@ibm.com \
    --cc=abhay@linux.ibm.com \
    --cc=aburgess@redhat.com \
    --cc=cel@linux.ibm.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