[PATCH 0/2] Stronger typing for remote file i/o

Tom Tromey
2026-02-25T21:26:47Z

This short series adds stronger typing to the remote file i/o APIs, by
replacing some integers with enums. This prevents mixing host and
remote-protocol values, and also differentiates between host and
remote file descriptors.

Regression tested on x86-64 Fedora 43.

Note I could not test the solib-rocm.c changes. These are best
effort.

Signed-off-by: Tom Tromey <tromey@adacore.com>
---
Tom Tromey (2):
Use a newtype for remote file descriptor
Use enum types for remote fileio flags

gdb/gdb_bfd.c | 8 ++---
gdb/inf-child.c | 4 +--
gdb/inf-child.h | 4 +--
gdb/linux-nat.c | 4 +--
gdb/linux-nat.h | 4 +--
gdb/remote-fileio.c | 91 +++++++++-------------------------------------------
gdb/remote.c | 19 ++++++-----
gdb/solib-rocm.c | 30 ++++++++---------
gdb/sparc64-tdep.c | 23 ++++++-------
gdb/target.c | 76 +++++++++++++++++++++++--------------------
gdb/target.h | 32 +++++++++++-------
gdbserver/hostio.cc | 4 +--
gdbsupport/fileio.cc | 20 ++++++------
gdbsupport/fileio.h | 81 ++++++++++++++++++++++++++--------------------
14 files changed, 186 insertions(+), 214 deletions(-)
---
base-commit: adbc0c55421dd5e31bb1903512dfb8f5211ee5b0
change-id: 20260225-target-fd-newtype-b5c3e3ad31b7

Best regards,
--
Tom Tromey <tromey@adacore.com>