Skip to contentSkip to conversation

gdbstub: allow killing QEMU via vKill command

PATCH In review Max Filippov 4 participants 4 messages Jan 30, 2019 – Feb 4, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gdbstub: allow killing QEMU via vKill command

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")

---
Changes v1->v2:
- terminate QEMU in the vKill packet handler regardless of whatever the PID is or how many processes are attached [Luc Michel]

 gdbstub.c | 4 ++++
 1 file changed, 4 insertions(+)
gdbstub.c +4 -0
index bfc7afb50968..96ffcd9d9d1d 100644
@@ -1383,6 +1383,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
 
             put_packet(s, buf);
             break;
+        } else if (strncmp(p, "Kill;", 5) == 0) {
+            /* Kill the target */
+            error_report("QEMU: Terminated via GDBstub");
+            exit(0);
         } else {
             goto unknown_command;
         }
Signature · 1 line
2.11.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Max Filippov

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")

Quoted 24 lines

---
Changes v1->v2:
- terminate QEMU in the vKill packet handler regardless of whatever the PID is or how many processes are attached [Luc Michel]

 gdbstub.c | 4 ++++
 1 file changed, 4 insertions(+)
gdbstub.c +4 -0
index bfc7afb50968..96ffcd9d9d1d 100644
@@ -1383,6 +1383,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
 
             put_packet(s, buf);
             break;
+        } else if (strncmp(p, "Kill;", 5) == 0) {
+            /* Kill the target */
+            error_report("QEMU: Terminated via GDBstub");
+            exit(0);
         } else {
             goto unknown_command;
         }
Reviewed-by Tested-by
#2 lore raw

Le 1/31/19 à 5:15 PM, Luc Michel a écrit :

Quoted 11 lines · Max Filippov
Quoted 9 lines

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")

Thanks!
Fred

Quoted 26 lines
Quoted 25 lines

---
Changes v1->v2:
- terminate QEMU in the vKill packet handler regardless of whatever the PID is or how many processes are attached [Luc Michel]

  gdbstub.c | 4 ++++
  1 file changed, 4 insertions(+)
gdbstub.c +4 -0
index bfc7afb50968..96ffcd9d9d1d 100644
@@ -1383,6 +1383,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
 
              put_packet(s, buf);
              break;
+        } else if (strncmp(p, "Kill;", 5) == 0) {
+            /* Kill the target */
+            error_report("QEMU: Terminated via GDBstub");
+            exit(0);
          } else {
              goto unknown_command;
          }
#3 lore raw
In reply to Max Filippov
Quoted 6 lines · Max Filippov

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
Quoted 9 lines

(f|s)ThreadInfo and ThreadExtraInfo")

---
Changes v1->v2:
- terminate QEMU in the vKill packet handler regardless of whatever the PID is or how many processes are attached [Luc Michel]

Thanks; I'll take this via target-arm.next since I took the multiprocess-support gdbstub patches.

-- PMM