[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] GDB serial protocol fixes (detach, kill, and initia
From: |
Jason Wessel |
Subject: |
[Qemu-devel] [PATCH] GDB serial protocol fixes (detach, kill, and initial status query) |
Date: |
Mon, 31 Jul 2006 11:24:58 -0500 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
I have occasionally found that I have killed off gdb, and had no way to
recover a debug session to QEMU. Also the detach/kill sequence does not
work correctly protocol wise in the QEMU gdb-stub. This patch addresses
these problems.
I implemented the serial protocol commands the same way as in KGDB.
? = Query state, but also clear the breakpoints.
- KGDB/gdb do the same thing so that in case you lose your
session or context, gdb always send the "?" command during the
connect sequence. This ensures that gdb has a clean slate
for breakpoints and run control.
D = Detach and clear all breakpoints with return "OK"
k = Do the same thing as D for now
In the future this can be used to kill the target
emulation. But for now it makes gdb and other gdb serial debugger
happy.
signed-off-by: address@hidden
Thanks,
Jason.
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] GDB serial protocol fixes (detach, kill, and initial status query),
Jason Wessel <=