- 論壇徽章:
- 0
|
一個簡單的解決方法
通過對qemu的源代碼進行簡單的修改,找到了一個絕大部分時候可行的解決方法(我實驗時很少跟進中斷)──在gdb單步執(zhí)行的時候禁止所有的虛擬中斷。
修改的地方很少,我是對qemu-snapshot-2005-07-17_23版本在打了FreeBSD ports的補丁的基礎上修改的。0.8的版本應該差不多。
可是說修改很無關大局。
下面是修改
XXX============================XXXXXXX
--- /home/prime/gdbstub.c Wed Feb 22 21:15:05 2006
+++ gdbstub.c Sun Jul 3 04:59:33 2005
@@ -45,7 +45,7 @@
};
/* XXX: This is not thread safe. Do we care? */
static int gdbserver_fd = -1;
-int gdbstep;
+
typedef struct GDBState {
enum RSState state; /* parsing state */
int fd;
@@ -444,7 +444,6 @@
#ifdef DEBUG_GDB
printf("command='%s'\n", line_buf);
#endif
- gdbstep = 1;
p = line_buf;
ch = *p++;
switch(ch) {
@@ -470,7 +469,6 @@
#else
vm_start();
#endif
- gdbstep = 0;
return RS_IDLE;
case 's':
if (*p != '\0') {
@@ -721,7 +719,6 @@
qemu_del_fd_read_handler(s->fd);
qemu_free(s);
vm_start();
- gdbstep = 0;
} else {
for(i = 0; i < size; i++)
gdb_read_byte(s, cpu_single_env, buf[i]);
XXXXX=============================================XXXXXXX
--- /home/prime/gdbstub.h Wed Feb 22 21:15:05 2006
+++ gdbstub.h Wed Apr 27 04:42:36 2005
@@ -8,5 +8,5 @@
void gdb_exit(CPUState *, int);
#endif
int gdbserver_start(int);
-extern int gdbstep;
+
#endif
XXXX================================================XXXXXX
--- vl.c Wed Feb 22 21:14:14 2006
+++ /home/prime/vl.c Wed Feb 22 21:19:52 2006
@@ -871,9 +871,12 @@
last_clock = ti;
}
#endif
- if (qemu_timer_expired(active_timers[QEMU_TIMER_VIRTUAL],
- qemu_get_clock(vm_clock)) ||
- qemu_timer_expired(active_timers[QEMU_TIMER_REALTIME],
+ if ((qemu_timer_expired(active_timers[QEMU_TIMER_VIRTUAL],
+ qemu_get_clock(vm_clock))
+#ifdef CONFIG_GDBSTUB
+ &&(gdbstep == 0)
+#endif
+ )||qemu_timer_expired(active_timers[QEMU_TIMER_REALTIME],
qemu_get_clock(rt_clock))) {
/* stop the cpu because a timer occured */
cpu_interrupt(global_env, CPU_INTERRUPT_EXIT);
@@ -2818,6 +2821,9 @@
#endif
if (vm_running) {
+#ifdef CONFIG_GDBSTUB
+ if(gdbstep == 0)
+#endif
qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],
qemu_get_clock(vm_clock));
/* run dma transfers, if any */ |
|