Revision 83f338f7
b/cpu-exec.c | ||
---|---|---|
196 | 196 |
return tb; |
197 | 197 |
} |
198 | 198 |
|
199 |
static CPUDebugExcpHandler *debug_excp_handler; |
|
200 |
|
|
201 |
CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler) |
|
202 |
{ |
|
203 |
CPUDebugExcpHandler *old_handler = debug_excp_handler; |
|
204 |
|
|
205 |
debug_excp_handler = handler; |
|
206 |
return old_handler; |
|
207 |
} |
|
208 |
|
|
209 |
static void cpu_handle_debug_exception(CPUState *env) |
|
210 |
{ |
|
211 |
CPUWatchpoint *wp; |
|
212 |
|
|
213 |
if (!env->watchpoint_hit) |
|
214 |
QTAILQ_FOREACH(wp, &env->watchpoints, entry) |
|
215 |
wp->flags &= ~BP_WATCHPOINT_HIT; |
|
216 |
|
|
217 |
if (debug_excp_handler) |
|
218 |
debug_excp_handler(env); |
|
219 |
} |
|
220 |
|
|
221 | 199 |
/* main execution loop */ |
222 | 200 |
|
223 | 201 |
volatile sig_atomic_t exit_request; |
... | ... | |
287 | 265 |
if (env->exception_index >= EXCP_INTERRUPT) { |
288 | 266 |
/* exit request from the cpu execution loop */ |
289 | 267 |
ret = env->exception_index; |
290 |
if (ret == EXCP_DEBUG) |
|
291 |
cpu_handle_debug_exception(env); |
|
292 | 268 |
break; |
293 | 269 |
} else { |
294 | 270 |
#if defined(CONFIG_USER_ONLY) |
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) { |
b/vl.c | ||
---|---|---|
1315 | 1315 |
void qemu_system_debug_request(void) |
1316 | 1316 |
{ |
1317 | 1317 |
debug_requested = 1; |
1318 |
vm_stop(VMSTOP_DEBUG);
|
|
1318 |
qemu_notify_event();
|
|
1319 | 1319 |
} |
1320 | 1320 |
|
1321 | 1321 |
void qemu_system_vmstop_request(int reason) |
Also available in: Unified diff