mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
gdbstub: Export host_to_gdb_errno File-I/O helper function
Move host_to_gdb_errno from target/m68k/m68k-semi.c to gdbstub/syscalls.c. Declare it in include/gdbstub/syscalls.h. Add both newly added GDB File-I/O supported errno values, EIO and ENOSYS, to the mapping. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260116014612.226183-3-yodel.eldar@yodel.dev> Message-ID: <20260203115201.2387721-9-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
@@ -145,6 +145,42 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
|
||||
gdb_syscall_handling(gdbserver_syscall_state.syscall_buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Map host error numbers to their GDB protocol counterparts.
|
||||
* For the list of GDB File-I/O supported error numbers, please consult:
|
||||
* https://sourceware.org/gdb/current/onlinedocs/gdb.html/Errno-Values.html
|
||||
*/
|
||||
int host_to_gdb_errno(int err)
|
||||
{
|
||||
#define E(X) case E##X: return GDB_E##X
|
||||
switch (err) {
|
||||
E(PERM);
|
||||
E(NOENT);
|
||||
E(INTR);
|
||||
E(IO);
|
||||
E(BADF);
|
||||
E(ACCES);
|
||||
E(FAULT);
|
||||
E(BUSY);
|
||||
E(EXIST);
|
||||
E(NODEV);
|
||||
E(NOTDIR);
|
||||
E(ISDIR);
|
||||
E(INVAL);
|
||||
E(NFILE);
|
||||
E(MFILE);
|
||||
E(FBIG);
|
||||
E(NOSPC);
|
||||
E(SPIPE);
|
||||
E(ROFS);
|
||||
E(NOSYS);
|
||||
E(NAMETOOLONG);
|
||||
default:
|
||||
return GDB_EUNKNOWN;
|
||||
}
|
||||
#undef E
|
||||
}
|
||||
|
||||
/*
|
||||
* GDB Command Handlers
|
||||
*/
|
||||
|
||||
@@ -102,6 +102,15 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
|
||||
*/
|
||||
int use_gdb_syscalls(void);
|
||||
|
||||
/**
|
||||
* host_to_gdb_errno: convert host errno to GDB errno value
|
||||
* @err: errno from host
|
||||
*
|
||||
* Given an error number from the host, this helper function returns
|
||||
* its GDB File-I/O specified representation.
|
||||
*/
|
||||
int host_to_gdb_errno(int err);
|
||||
|
||||
/**
|
||||
* gdb_exit: exit gdb session, reporting inferior status
|
||||
* @code: exit code reported
|
||||
|
||||
@@ -46,35 +46,6 @@
|
||||
#define HOSTED_ISATTY 12
|
||||
#define HOSTED_SYSTEM 13
|
||||
|
||||
static int host_to_gdb_errno(int err)
|
||||
{
|
||||
#define E(X) case E##X: return GDB_E##X
|
||||
switch (err) {
|
||||
E(PERM);
|
||||
E(NOENT);
|
||||
E(INTR);
|
||||
E(BADF);
|
||||
E(ACCES);
|
||||
E(FAULT);
|
||||
E(BUSY);
|
||||
E(EXIST);
|
||||
E(NODEV);
|
||||
E(NOTDIR);
|
||||
E(ISDIR);
|
||||
E(INVAL);
|
||||
E(NFILE);
|
||||
E(MFILE);
|
||||
E(FBIG);
|
||||
E(NOSPC);
|
||||
E(SPIPE);
|
||||
E(ROFS);
|
||||
E(NAMETOOLONG);
|
||||
default:
|
||||
return GDB_EUNKNOWN;
|
||||
}
|
||||
#undef E
|
||||
}
|
||||
|
||||
static void m68k_semi_u32_cb(CPUState *cs, uint64_t ret, int err)
|
||||
{
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
|
||||
Reference in New Issue
Block a user