With multiprocess extensions gdb uses 'vKill' packet instead of 'k' to
kill the inferior. Handle 'vKill' the same way 'k' was handled in the
presence of single process.
Fixes: 7cf48f6752e5 ("gdbstub: add multiprocess support to
(f|s)ThreadInfo and ThreadExtraInfo")
Cc: Luc Michel <address@hidden>
Signed-off-by: Max Filippov <address@hidden>
---
gdbstub.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gdbstub.c b/gdbstub.c
index bfc7afb50968..1ef31240c055 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1383,6 +1383,28 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
put_packet(s, buf);
break;
+ } else if (strncmp(p, "Kill;", 5) == 0) {
+ unsigned long pid;
+
+ p += 5;
+
+ if (qemu_strtoul(p, &p, 16, &pid)) {
+ put_packet(s, "E22");
+ break;
+ }
+ process = gdb_get_process(s, pid);
+
+ if (process == NULL) {
+ put_packet(s, "E22");
+ break;
+ }
+ if (s->process_num <= 1) {
+ /* Kill the target */
+ error_report("QEMU: Terminated via GDBstub");
+ exit(0);