Revision 83f338f7 cpus.c
b/cpus.c | ||
---|---|---|
165 | 165 |
return true; |
166 | 166 |
} |
167 | 167 |
|
168 |
static void cpu_debug_handler(CPUState *env) |
|
168 |
static CPUDebugExcpHandler *debug_excp_handler; |
|
169 |
|
|
170 |
CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler) |
|
171 |
{ |
|
172 |
CPUDebugExcpHandler *old_handler = debug_excp_handler; |
|
173 |
|
|
174 |
debug_excp_handler = handler; |
|
175 |
return old_handler; |
|
176 |
} |
|
177 |
|
|
178 |
static void cpu_handle_debug_exception(CPUState *env) |
|
169 | 179 |
{ |
180 |
CPUWatchpoint *wp; |
|
181 |
|
|
182 |
if (!env->watchpoint_hit) { |
|
183 |
QTAILQ_FOREACH(wp, &env->watchpoints, entry) { |
|
184 |
wp->flags &= ~BP_WATCHPOINT_HIT; |
|
185 |
} |
|
186 |
} |
|
187 |
if (debug_excp_handler) { |
|
188 |
debug_excp_handler(env); |
|
189 |
} |
|
190 |
|
|
170 | 191 |
gdb_set_stop_cpu(env); |
171 | 192 |
qemu_system_debug_request(); |
193 |
#ifdef CONFIG_IOTHREAD |
|
194 |
env->stopped = 1; |
|
195 |
#endif |
|
172 | 196 |
} |
173 | 197 |
|
174 | 198 |
#ifdef CONFIG_LINUX |
... | ... | |
479 | 503 |
return ret; |
480 | 504 |
} |
481 | 505 |
#endif |
482 |
cpu_set_debug_excp_handler(cpu_debug_handler); |
|
483 | 506 |
|
484 | 507 |
qemu_init_sigbus(); |
485 | 508 |
|
... | ... | |
653 | 676 |
int ret; |
654 | 677 |
sigset_t blocked_signals; |
655 | 678 |
|
656 |
cpu_set_debug_excp_handler(cpu_debug_handler); |
|
657 |
|
|
658 | 679 |
qemu_init_sigbus(); |
659 | 680 |
|
660 | 681 |
blocked_signals = block_io_signals(); |
... | ... | |
808 | 829 |
|
809 | 830 |
while (1) { |
810 | 831 |
if (cpu_can_run(env)) { |
811 |
qemu_cpu_exec(env); |
|
832 |
r = qemu_cpu_exec(env); |
|
833 |
if (r == EXCP_DEBUG) { |
|
834 |
cpu_handle_debug_exception(env); |
|
835 |
} |
|
812 | 836 |
} |
813 | 837 |
qemu_kvm_wait_io_event(env); |
814 | 838 |
} |
... | ... | |
1076 | 1100 |
qemu_kvm_eat_signals(env); |
1077 | 1101 |
} |
1078 | 1102 |
if (r == EXCP_DEBUG) { |
1103 |
cpu_handle_debug_exception(env); |
|
1079 | 1104 |
break; |
1080 | 1105 |
} |
1081 | 1106 |
} else if (env->stop) { |
Also available in: Unified diff