[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/13] gdbstub: Clarify what gdb_handlesig() is doing
From: |
Laurent Vivier |
Subject: |
[Qemu-devel] [PULL 13/13] gdbstub: Clarify what gdb_handlesig() is doing |
Date: |
Fri, 25 May 2018 10:17:54 +0200 |
From: Peter Maydell <address@hidden>
gdb_handlesig()'s behaviour is not entirely obvious at first
glance. Add a doc comment for it, and also add a comment
explaining why it's ok for gdb_do_syscallv() to ignore
gdb_handlesig()'s return value. (Coverity complains about
this: CID 1390850.)
Signed-off-by: Peter Maydell <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
---
gdbstub.c | 6 ++++++
include/exec/gdbstub.h | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/gdbstub.c b/gdbstub.c
index e4ece2f5bc..6081e719c5 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1558,6 +1558,12 @@ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const
char *fmt, va_list va)
*p = 0;
#ifdef CONFIG_USER_ONLY
put_packet(s, s->syscall_buf);
+ /* Return control to gdb for it to process the syscall request.
+ * Since the protocol requires that gdb hands control back to us
+ * using a "here are the results" F packet, we don't need to check
+ * gdb_handlesig's return value (which is the signal to deliver if
+ * execution was resumed via a continue packet).
+ */
gdb_handlesig(s->c_cpu, 0);
#else
/* In this case wait to send the syscall packet until notification that
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index 2e8a4b83b9..08363969c1 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -48,6 +48,21 @@ int use_gdb_syscalls(void);
void gdb_set_stop_cpu(CPUState *cpu);
void gdb_exit(CPUArchState *, int);
#ifdef CONFIG_USER_ONLY
+/**
+ * gdb_handlesig: yield control to gdb
+ * @cpu: CPU
+ * @sig: if non-zero, the signal number which caused us to stop
+ *
+ * This function yields control to gdb, when a user-mode-only target
+ * needs to stop execution. If @sig is non-zero, then we will send a
+ * stop packet to tell gdb that we have stopped because of this signal.
+ *
+ * This function will block (handling protocol requests from gdb)
+ * until gdb tells us to continue target execution. When it does
+ * return, the return value is a signal to deliver to the target,
+ * or 0 if no signal should be delivered, ie the signal that caused
+ * us to stop should be ignored.
+ */
int gdb_handlesig(CPUState *, int);
void gdb_signalled(CPUArchState *, int);
void gdbserver_fork(CPUState *);
--
2.14.3
- [Qemu-devel] [PULL 00/13] Linux user for 2.13 patches, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 09/13] linux-user: move ppc socket.h definitions to ppc/sockbits.h, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 04/13] linux-user: Fix payload size logic in host_to_target_cmsg(), Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 13/13] gdbstub: Clarify what gdb_handlesig() is doing,
Laurent Vivier <=
- [Qemu-devel] [PULL 01/13] linux-user: Assert on bad type in thunk_type_align() and thunk_type_size(), Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 05/13] linux-user: move mips socket.h definitions to mips/sockbits.h, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 12/13] linux-user: define TARGET_SO_REUSEPORT, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 03/13] linux-user: update comments to point to tcg_exec_init(), Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 06/13] linux-user: move alpha socket.h definitions to alpha/sockbits.h, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 08/13] linux-user: move socket.h generic definitions to generic/sockbits.h, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 02/13] linux-user: update netlink emulation, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 11/13] linux-user: copy sparc/sockbits.h definitions from linux, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 10/13] linux-user: update ARCH_HAS_SOCKET_TYPES use, Laurent Vivier, 2018/05/25
- [Qemu-devel] [PULL 07/13] linux-user: move sparc/sparc64 socket.h definitions to sparc/sockbits.h, Laurent Vivier, 2018/05/25