[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 15/18] gdbstub: Add vCont support
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH v5 15/18] gdbstub: Add vCont support |
Date: |
Mon, 17 Nov 2008 17:18:59 +0100 |
User-agent: |
StGIT/0.14.2 |
In order to set the thread (CPU) for the next single-step command, you
need gdb 6.8 or better - and this patch. It introduces vCont support
which gdb uses to switch the debugging focus for single-stepping
multi-threaded targets.
Signed-off-by: Jan Kiszka <address@hidden>
---
gdbstub.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index b522a89..11c54eb 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1285,6 +1285,62 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
s->signal = strtoul(p, (char **)&p, 16);
gdb_continue(s);
return RS_IDLE;
+ case 'v':
+ if (strncmp(p, "Cont", 4) == 0) {
+ int res_signal, res_thread;
+
+ p += 4;
+ if (*p == '?') {
+ put_packet(s, "vCont;c;C;s;S");
+ break;
+ }
+ res = 0;
+ res_signal = 0;
+ res_thread = 0;
+ while (*p) {
+ int action, signal;
+
+ if (*p++ != ';') {
+ res = 0;
+ break;
+ }
+ action = *p++;
+ signal = 0;
+ if (action == 'C' || action == 'S')
+ signal = strtoul(p, (char **)&p, 16);
+ else if (action != 'c' && action != 's') {
+ res = 0;
+ break;
+ }
+ thread = 0;
+ if (*p == ':')
+ thread = strtoull(p+1, (char **)&p, 16);
+
+ action = tolower(action);
+ if (res == 0 || (res == 'c' && action == 's')) {
+ res = action;
+ res_signal = signal;
+ res_thread = thread;
+ }
+ }
+ if (res) {
+ if (res_thread != -1 && res_thread != 0) {
+ for (env = first_cpu; env != NULL; env = env->next_cpu)
+ if (env->cpu_index + 1 == res_thread)
+ break;
+ if (env == NULL) {
+ put_packet(s, "E22");
+ break;
+ }
+ s->c_cpu = env;
+ }
+ if (res == 's')
+ cpu_single_step(s->c_cpu, sstep_flags);
+ gdb_continue(s);
+ return RS_IDLE;
+ }
+ break;
+ }
case 'k':
/* Kill the target */
fprintf(stderr, "\nQEMU: Terminated via GDBstub\n");
- [Qemu-devel] [PATCH v5 00/18] Enhance debugging support, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 05/18] Set mem_io_vaddr on io_read, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 12/18] Introduce BP_CPU as a breakpoint type, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 03/18] gdbstub: Return appropriate watch message to gdb, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 13/18] x86: Debug register emulation, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 04/18] Refactor and enhance break/watchpoint API, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 15/18] gdbstub: Add vCont support,
Jan Kiszka <=
- [Qemu-devel] [PATCH v5 17/18] gdbstub: x86: Support for setting segment registers, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 01/18] Convert CPU_PC_FROM_TB to static inline, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 06/18] Respect length of watchpoints, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 14/18] x86: Dump debug registers, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 11/18] Add debug exception hook, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 10/18] Introduce BP_WATCHPOINT_HIT flag, Jan Kiszka, 2008/11/17
- [Qemu-devel] [PATCH v5 18/18] gdbstub: x86: Switch 64/32 bit registers dynamically, Jan Kiszka, 2008/11/17