Index: qemu/cpu-all.h =================================================================== --- qemu.orig/cpu-all.h +++ qemu/cpu-all.h @@ -768,6 +768,7 @@ void cpu_reset_interrupt(CPUState *env, int cpu_breakpoint_insert(CPUState *env, target_ulong pc); int cpu_breakpoint_remove(CPUState *env, target_ulong pc); +int cpu_breakpoint_remove_all(CPUState *env); void cpu_single_step(CPUState *env, int enabled); void cpu_reset(CPUState *s); Index: qemu/gdbstub.c =================================================================== --- qemu.orig/gdbstub.c +++ qemu/gdbstub.c @@ -580,6 +580,8 @@ static int gdb_handle_packet(GDBState *s /* TODO: Make this return the correct value for user-mode. */ snprintf(buf, sizeof(buf), "S%02x", SIGTRAP); put_packet(s, buf); + /* Remove all the breakpoints when this query is issued. */ + cpu_breakpoint_remove_all(env); break; case 'c': if (*p != '\0') { @@ -603,6 +605,18 @@ static int gdb_handle_packet(GDBState *s vm_start(); #endif return RS_IDLE; + case 'k': + case 'D': + /* Detach packet */ + if (!cpu_breakpoint_remove_all(env)) { +#ifdef CONFIG_USER_ONLY + s->running_state = 1; +#else + vm_start(); +#endif + put_packet(s, "OK"); + break; + } case 's': if (*p != '\0') { addr = strtoul(p, (char **)&p, 16);