Skip to contentSkip to conversation

gdbstub: Do not kill target in system emulation mode

PATCH Applied Jan Kiszka 2 participants 2 messages Mar 6, 2012 – Mar 11, 2012

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 gdbstub: Do not kill target in system emulation mode

Too many VM kittens were killed since 7d03f82f81. Another one just died under my fat fingers.

When you quit a kgdb session, does the Linux kernel power off? Or when you terminate gdb attached to a hardware debugger, does your board vanish in space? No.

So let's stop terminating QEMU when the gdbstub receives a kill commando in system emulation mode. Real termination can still be achieved via "monitor quit". We keep the behavior for user mode emulation which is arguably more like a gdbserver scenario.

---
 gdbstub.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
gdbstub.c +2 -0
index 7d470b6..ef95ac2 100644
@@ -2062,9 +2062,11 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             goto unknown_command;
         }
     case 'k':
+#ifdef CONFIG_USER_ONLY
         /* Kill the target */
         fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
         exit(0);
+#endif
     case 'D':
         /* Detach packet */
         gdb_breakpoint_remove_all();
Signature · 1 line
1.7.3.4
Applied
#1 lore raw

Thanks, applied. I've been an accidental killer myself countless times.

Quoted 36 lines · Jan Kiszka

Too many VM kittens were killed since 7d03f82f81. Another one just died under my fat fingers.

When you quit a kgdb session, does the Linux kernel power off? Or when you terminate gdb attached to a hardware debugger, does your board vanish in space? No.

So let's stop terminating QEMU when the gdbstub receives a kill commando in system emulation mode. Real termination can still be achieved via "monitor quit". We keep the behavior for user mode emulation which is arguably more like a gdbserver scenario.

---
 gdbstub.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
gdbstub.c +0 -0
index 7d470b6..ef95ac2 100644
@@ -2062,9 +2062,11 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
             goto unknown_command;
         }

    case 'k':
+#ifdef CONFIG_USER_ONLY
        /* Kill the target */
        fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); exit(0);
+#endif
    case 'D':
        /* Detach packet */ gdb_breakpoint_remove_all();
--
1.7.3.4