]> git.proxmox.com Git - mirror_qemu.git/commit
gdbstub: Fix client Ctrl-C handling
authorNicholas Piggin <npiggin@gmail.com>
Tue, 11 Jul 2023 08:59:03 +0000 (18:59 +1000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 31 Jul 2023 13:57:32 +0000 (14:57 +0100)
commit108e8180c6b0c315711aa54e914030a313505c17
tree3e7b9626396c5b45067036e07e0519253b2bee07
parentfe6bda58e083ec8ffa5c5166e3b1055501b6318a
gdbstub: Fix client Ctrl-C handling

The gdb remote protocol has a special interrupt character (0x03) that is
transmitted outside the regular packet processing, and represents a
Ctrl-C pressed in the client. Despite not being a regular packet, it
does expect a regular stop response if the stub successfully stops the
running program.

See: https://sourceware.org/gdb/onlinedocs/gdb/Interrupts.html

Inhibiting the stop reply packet can lead to gdb client hang. So permit
a stop response when receiving a character from gdb that stops the vm.
Additionally, add a warning if that was not a 0x03 character, because
the gdb session is likely to end up getting confused if this happens.

Cc: qemu-stable@nongnu.org
Fixes: 758370052fb ("gdbstub: only send stop-reply packets when allowed to")
Reported-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Tested-by: Joel Stanley <joel@jms.id.au>
Message-id: 20230711085903.304496-1-npiggin@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
gdbstub/gdbstub.c