[PATCH v2 0/3] gdbstub: Export helper to use GDB errno values

Yodel Eldar via posted 3 patches 3 weeks, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251017211149.163762-1-yodel.eldar@yodel.dev
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Laurent Vivier <laurent@vivier.eu>
gdbstub/syscalls.c         | 36 ++++++++++++++++++++++++++++++++++++
gdbstub/user-target.c      | 13 +++++++++----
include/gdbstub/syscalls.h | 11 +++++++++++
target/m68k/m68k-semi.c    | 29 -----------------------------
4 files changed, 56 insertions(+), 33 deletions(-)
[PATCH v2 0/3] gdbstub: Export helper to use GDB errno values
Posted by Yodel Eldar via 3 weeks, 6 days ago
Currently, F reply packets in gdbstub/user-target.c emit the host's
errno values [1], but to facilitate host<->target independence the GDB
File-I/O protocol defines its own set of supported errno values that
should be used in replies instead.

This series sees to that by:
Patch 2: Exporting a mapping helper function statically defined in
m68k-dependent code by declaring it in include/gdbstub/syscalls.h
with the GDB File-I/O errno values, and moving the definition to
gdbstub/syscalls.c.
Patch 3: Passing the host errnos to the newly global mapping function
before emitting the result in F reply packets. Please note that this
patch resolves the final task remaining in GitLab issue #2751.

Patch 1 adds two GDB File-I/O errno values that were previously
undocumented despite having support.

To Alex Bennée: Thanks for reviewing v1! I deliberately left out the
Reviewed-by git trailer, because the patch underwent nontrivial
changes, and I did not think I could include it in good faith. Your
comment about the existing File-I/O errno values led me to the helper
function in the target-dependent code.

Thanks!

Changes in v2:
- Split into multiple commits
- Use existing mapping function (host_to_gdb_errno) via exportation

Link to v1: https://lore.kernel.org/qemu-devel/20251015162520.15736-1-yodel.eldar@yodel.dev/

[1] https://gitlab.com/qemu-project/qemu/-/issues/2751

Yodel Eldar (3):
  include/gdbstub/syscalls: Add GDB_{EIO,ENOSYS} errno values
  gdbstub: Export host_to_gdb_errno File-I/O helper function
  gdbstub/user-target: Convert host errno to GDB File-I/O errno

 gdbstub/syscalls.c         | 36 ++++++++++++++++++++++++++++++++++++
 gdbstub/user-target.c      | 13 +++++++++----
 include/gdbstub/syscalls.h | 11 +++++++++++
 target/m68k/m68k-semi.c    | 29 -----------------------------
 4 files changed, 56 insertions(+), 33 deletions(-)

-- 
2.51.1.dirty


Re: [PATCH v2 0/3] gdbstub: Export helper to use GDB errno values
Posted by Yodel Eldar via 2 weeks, 4 days ago

On 17/10/2025 16:11, Yodel Eldar via wrote:
> Currently, F reply packets in gdbstub/user-target.c emit the host's
> errno values [1], but to facilitate host<->target independence the GDB
> File-I/O protocol defines its own set of supported errno values that
> should be used in replies instead.
> 
> This series sees to that by:
> Patch 2: Exporting a mapping helper function statically defined in
> m68k-dependent code by declaring it in include/gdbstub/syscalls.h
> with the GDB File-I/O errno values, and moving the definition to
> gdbstub/syscalls.c.
> Patch 3: Passing the host errnos to the newly global mapping function
> before emitting the result in F reply packets. Please note that this
> patch resolves the final task remaining in GitLab issue #2751.
> 
> Patch 1 adds two GDB File-I/O errno values that were previously
> undocumented despite having support.
> 
> To Alex Bennée: Thanks for reviewing v1! I deliberately left out the
> Reviewed-by git trailer, because the patch underwent nontrivial
> changes, and I did not think I could include it in good faith. Your
> comment about the existing File-I/O errno values led me to the helper
> function in the target-dependent code.
> 
> Thanks!
> 
> Changes in v2:
> - Split into multiple commits
> - Use existing mapping function (host_to_gdb_errno) via exportation
> 
> Link to v1: https://lore.kernel.org/qemu-devel/20251015162520.15736-1-yodel.eldar@yodel.dev/
> 
> [1] https://gitlab.com/qemu-project/qemu/-/issues/2751
> 
> Yodel Eldar (3):
>    include/gdbstub/syscalls: Add GDB_{EIO,ENOSYS} errno values
>    gdbstub: Export host_to_gdb_errno File-I/O helper function
>    gdbstub/user-target: Convert host errno to GDB File-I/O errno
> 
>   gdbstub/syscalls.c         | 36 ++++++++++++++++++++++++++++++++++++
>   gdbstub/user-target.c      | 13 +++++++++----
>   include/gdbstub/syscalls.h | 11 +++++++++++
>   target/m68k/m68k-semi.c    | 29 -----------------------------
>   4 files changed, 56 insertions(+), 33 deletions(-)
> 

Ping, please?

Thanks,
Yodel