Hi Alex,
On 3/7/24 7:33 PM, Alex Bennée wrote:
Richard Henderson <richard.hender...@linaro.org> writes:
On 3/7/24 08:26, Gustavo Romero wrote:
Save target's siginfo into gdbserver_state so it can be used later, for
example, in any stub that requires the target's si_signo and si_code.
This change affects only linux-user mode.
Signed-off-by: Gustavo Romero <gustavo.rom...@linaro.org>
Suggested-by: Richard Henderson <richard.hender...@linaro.org>
---
gdbstub/internals.h | 3 +++
gdbstub/user-target.c | 3 ++-
gdbstub/user.c | 14 ++++++++++----
include/gdbstub/user.h | 6 +++++-
linux-user/main.c | 2 +-
linux-user/signal.c | 5 ++++-
6 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index 56b7c13b75..a7cc69dab3 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -58,6 +58,9 @@ typedef struct GDBState {
int line_csum; /* checksum at the end of the packet */
GByteArray *last_packet;
int signal;
+#ifdef CONFIG_USER_ONLY
+ uint8_t siginfo[MAX_SIGINFO_LENGTH];
+#endif
If we this in GDBUserState in user.c -- no need for ifdefs then.
Although it does break on FreeBSD's user target:
FAILED: libqemu-arm-bsd-user.fa.p/gdbstub_user-target.c.o
cc -m64 -mcx16 -Ilibqemu-arm-bsd-user.fa.p -I. -I.. -Itarget/arm -I../target/arm
-I../common-user/host/x86_64 -I../bsd-user/include -Ibsd-user/freebsd -I../bsd-user/freebsd
-I../bsd-user/host/x86_64 -Ibsd-user -I../bsd-user -I../bsd-user/arm -Iqapi -Itrace -Iui
-Iui/shader -I/usr/local/include/capstone -I/usr/local/include/glib-2.0
-I/usr/local/lib/glib-2.0/include -I/usr/local/include -fdiagnostics-color=auto -Wall -Winvalid-pch
-Werror -std=gnu11 -O2 -g -fstack-protector-strong -Wempty-body -Wendif-labels
-Wexpansion-to-defined -Wformat-security -Wformat-y2k -Wignored-qualifiers -Winit-self
-Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-definition
-Wredundant-decls -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
-Wno-gnu-variable-sized-type-not-at-end -Wno-initializer-overrides -Wno-missing-include-dirs
-Wno-psabi -Wno-shift-negative-value -Wno-string-plus-int -Wno-tautological-type-limit-compare
-Wno-typedef-redefinition -Wthread-safety -iquote . -iquote /tmp/cirrus-ci-build -iquote
/tmp/cirrus-ci-build/include -iquote /tmp/cirrus-ci-build/host/include/x86_64 -iquote
/tmp/cirrus-ci-build/host/include/generic -iquote /tmp/cirrus-ci-build/tcg/i386 -pthread
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv
-ftrivial-auto-var-init=zero -fPIE -DNEED_CPU_H
'-DCONFIG_TARGET="arm-bsd-user-config-target.h"'
'-DCONFIG_DEVICES="arm-bsd-user-config-devices.h"' -MD -MQ
libqemu-arm-bsd-user.fa.p/gdbstub_user-target.c.o -MF
libqemu-arm-bsd-user.fa.p/gdbstub_user-target.c.o.d -o
libqemu-arm-bsd-user.fa.p/gdbstub_user-target.c.o -c ../gdbstub/user-target.c
In file included from ../gdbstub/user-target.c:18:
../gdbstub/internals.h:62:21: error: use of undeclared identifier
'MAX_SIGINFO_LENGTH'
62 | uint8_t siginfo[MAX_SIGINFO_LENGTH];
| ^
1 error generated.
[2084/6731] Compiling C object libqemu-arm
See: https://gitlab.com/stsquad/qemu/-/jobs/6345829419
argh, I've tested all targets for linux-user, but missed bsd-user. I've tried
once to build it but that requires a BSD-like host, which I don't have at the
moment, then I forgot about it... Let me setup one and review the change in
the light of the comments from you and Richard.
Thanks!
Cheers,
Gustavo