diff options
author | edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-17 18:58:29 +0000 |
---|---|---|
committer | edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-17 18:58:29 +0000 |
commit | 7d03f82f81e0e6c106ca0d2445a0fc49dc9ddc7b (patch) | |
tree | 3196dcd426fcc063e4c7e42267e7f5be883434b9 /gdbstub.c | |
parent | BSR/BSF TCG conversion (diff) | |
download | qemu-kvm-7d03f82f81e0e6c106ca0d2445a0fc49dc9ddc7b.tar.gz qemu-kvm-7d03f82f81e0e6c106ca0d2445a0fc49dc9ddc7b.tar.bz2 qemu-kvm-7d03f82f81e0e6c106ca0d2445a0fc49dc9ddc7b.zip |
Add support for the 'k' (kill) and 'D' (detach) packets (Jason Wessel).
Implement the 'k' gdbserial packet which kills the qemu instance via
the debugger stub.
Implement the 'D' detach packet for the gdb stub such that you can
disconnect gdb with the "detach" command. This required implementing
a cpu_breakpoint_remove_all() and a cpu_watchpoint_remove_all()
function to cleanup all the breakpoints and watchpoints prior to
leaving the gdb stub else simulation can stop with no debugger
attached.
On a '?' packet remove all the breakpoints and watchpoints. This is
considered more of a safety net in case you force killed gdb or it
crashed and you are reconnecting. The identical behavior exists for
kgdb in the linux kernel.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4478 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'gdbstub.c')
-rw-r--r-- | gdbstub.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -962,6 +962,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) /* 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, + * because gdb is doing and initial connect and the state + * should be cleaned up. + */ + cpu_breakpoint_remove_all(env); + cpu_watchpoint_remove_all(env); break; case 'c': if (*p != '\0') { @@ -985,6 +991,17 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) } gdb_continue(s); return RS_IDLE; + case 'k': + /* Kill the target */ + fprintf(stderr, "\nQEMU: Terminated via GDBstub\n"); + exit(0); + case 'D': + /* Detach packet */ + cpu_breakpoint_remove_all(env); + cpu_watchpoint_remove_all(env); + gdb_continue(s); + put_packet(s, "OK"); + break; case 's': if (*p != '\0') { addr = strtoull(p, (char **)&p, 16); |