[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 15/49] include/exec: Move gdb_stat and gdb_timeval to gdbs
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 15/49] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h |
Date: |
Mon, 23 May 2022 13:42:07 +0100 |
On Sat, 21 May 2022 at 01:04, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> We have two copies of these structures, and require them
> in semihosting/ going forward.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> include/exec/gdbstub.h | 25 +++++++++++++++++++++++++
> target/m68k/m68k-semi.c | 30 +++---------------------------
> target/nios2/nios2-semi.c | 30 +++---------------------------
> 3 files changed, 31 insertions(+), 54 deletions(-)
>
> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
> index 2aaba9c723..33a262a5a3 100644
> --- a/include/exec/gdbstub.h
> +++ b/include/exec/gdbstub.h
> @@ -20,6 +20,31 @@
> #define GDB_O_TRUNC 0x400
> #define GDB_O_EXCL 0x800
>
> +/* For gdb file i/o stat/fstat. */
> +typedef uint32_t gdb_mode_t;
> +typedef uint32_t gdb_time_t;
> +
> +struct gdb_stat {
> + uint32_t gdb_st_dev; /* device */
> + uint32_t gdb_st_ino; /* inode */
> + gdb_mode_t gdb_st_mode; /* protection */
> + uint32_t gdb_st_nlink; /* number of hard links */
> + uint32_t gdb_st_uid; /* user ID of owner */
> + uint32_t gdb_st_gid; /* group ID of owner */
> + uint32_t gdb_st_rdev; /* device type (if inode device) */
> + uint64_t gdb_st_size; /* total size, in bytes */
> + uint64_t gdb_st_blksize; /* blocksize for filesystem I/O */
> + uint64_t gdb_st_blocks; /* number of blocks allocated */
> + gdb_time_t gdb_st_atime; /* time of last access */
> + gdb_time_t gdb_st_mtime; /* time of last modification */
> + gdb_time_t gdb_st_ctime; /* time of last change */
> +} QEMU_PACKED;
> +
> +struct gdb_timeval {
> + gdb_time_t tv_sec; /* second */
> + uint64_t tv_usec; /* microsecond */
> +} QEMU_PACKED;
As an aside,
https://sourceware.org/gdb/onlinedocs/gdb/struct-timeval.html#struct-timeval
says "this structure is of size 8 bytes", but looking at the gdb sources
our definition here is correct and it's 12 bytes (not 8 as the text says
and not 16 as you might expect from the C struct in the docs...)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- [PATCH v3 26/49] semihosting: Split out semihost_sys_write, (continued)
- [PATCH v3 26/49] semihosting: Split out semihost_sys_write, Richard Henderson, 2022/05/20
- [PATCH v3 39/49] semihosting: Expand qemu_semihosting_console_inc to read, Richard Henderson, 2022/05/20
- [PATCH v3 25/49] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/05/20
- [PATCH v3 38/49] semihosting: Pass CPUState to qemu_semihosting_console_inc, Richard Henderson, 2022/05/20
- [PATCH v3 32/49] semihosting: Split out semihost_sys_rename, Richard Henderson, 2022/05/20
- [PATCH v3 22/49] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/05/20
- [PATCH v3 30/49] semihosting: Split out semihost_sys_flen, Richard Henderson, 2022/05/20
- [PATCH v3 15/49] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/05/20
- Re: [PATCH v3 15/49] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h,
Peter Maydell <=
- [PATCH v3 37/49] semihosting: Fix docs comment for qemu_semihosting_console_inc, Richard Henderson, 2022/05/20
- [PATCH v3 29/49] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/05/20
- [PATCH v3 31/49] semihosting: Split out semihost_sys_remove, Richard Henderson, 2022/05/20
- [PATCH v3 17/49] semihosting: Use struct gdb_stat in common_semi_flen_cb, Richard Henderson, 2022/05/20
- [PATCH v3 21/49] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/05/20
- [PATCH v3 28/49] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/05/20