summaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authoredgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-09 08:25:14 +0000
committeredgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-09 08:25:14 +0000
commit60897d369f10b464720d8a6de4553c47943ea927 (patch)
tree776af7d1e6636104314a1ef179ddd63ab89095fc /gdbstub.c
parentc58411661274631e2687deedd1597a34bfd38e2a (diff)
downloadqemu-60897d369f10b464720d8a6de4553c47943ea927.tar.gz
Debugger single step without interrupts (Jason Wessel).
This patch allows the qemu backend debugger to single step an instruction without running the hardware interrupts. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4391 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/gdbstub.c b/gdbstub.c
index cd42a9923a..64709e2e1a 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -73,6 +73,11 @@ typedef struct GDBState {
#endif
} GDBState;
+/* By default use no IRQs and no timers while single stepping so as to
+ * make single stepping like an ICE HW step.
+ */
+static int sstep_flags = SSTEP_ENABLE|SSTEP_NOIRQ|SSTEP_NOTIMER;
+
#ifdef CONFIG_USER_ONLY
/* XXX: This is not thread safe. Do we care? */
static int gdbserver_fd = -1;
@@ -1072,7 +1077,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
env->pc = addr;
#endif
}
- cpu_single_step(env, 1);
+ cpu_single_step(env, sstep_flags);
gdb_continue(s);
return RS_IDLE;
case 'F':
@@ -1179,9 +1184,34 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
goto breakpoint_error;
}
break;
-#ifdef CONFIG_LINUX_USER
case 'q':
- if (strncmp(p, "Offsets", 7) == 0) {
+ case 'Q':
+ /* parse any 'q' packets here */
+ if (!strcmp(p,"qemu.sstepbits")) {
+ /* Query Breakpoint bit definitions */
+ sprintf(buf,"ENABLE=%x,NOIRQ=%x,NOTIMER=%x",
+ SSTEP_ENABLE,
+ SSTEP_NOIRQ,
+ SSTEP_NOTIMER);
+ put_packet(s, buf);
+ break;
+ } else if (strncmp(p,"qemu.sstep",10) == 0) {
+ /* Display or change the sstep_flags */
+ p += 10;
+ if (*p != '=') {
+ /* Display current setting */
+ sprintf(buf,"0x%x", sstep_flags);
+ put_packet(s, buf);
+ break;
+ }
+ p++;
+ type = strtoul(p, (char **)&p, 16);
+ sstep_flags = type;
+ put_packet(s, "OK");
+ break;
+ }
+#ifdef CONFIG_LINUX_USER
+ else if (strncmp(p, "Offsets", 7) == 0) {
TaskState *ts = env->opaque;
sprintf(buf,
@@ -1193,10 +1223,9 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
put_packet(s, buf);
break;
}
- /* Fall through. */
#endif
+ /* Fall through. */
default:
- // unknown_command:
/* put empty packet */
buf[0] = '\0';
put_packet(s, buf);