Improve vm_stop reason declarations

Define and use dedicated constants for vm_stop reasons, they actually
have nothing to do with the EXCP_* defines used so far. At this chance,
specify more detailed reasons so that VM state change handlers can
evaluate them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Jan Kiszka 2011-02-09 16:29:40 +01:00 committed by Marcelo Tosatti
parent 0ab07c623c
commit e07bbac542
12 changed files with 33 additions and 22 deletions

View file

@ -2194,14 +2194,14 @@ static void gdb_vm_state_change(void *opaque, int running, int reason)
const char *type;
int ret;
if (running || (reason != EXCP_DEBUG && reason != EXCP_INTERRUPT) ||
s->state == RS_INACTIVE || s->state == RS_SYSCALL)
if (running || (reason != VMSTOP_DEBUG && reason != VMSTOP_USER) ||
s->state == RS_INACTIVE || s->state == RS_SYSCALL) {
return;
}
/* disable single step if it was enable */
cpu_single_step(env, 0);
if (reason == EXCP_DEBUG) {
if (reason == VMSTOP_DEBUG) {
if (env->watchpoint_hit) {
switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) {
case BP_MEM_READ:
@ -2252,7 +2252,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
gdb_current_syscall_cb = cb;
s->state = RS_SYSCALL;
#ifndef CONFIG_USER_ONLY
vm_stop(EXCP_DEBUG);
vm_stop(VMSTOP_DEBUG);
#endif
s->state = RS_IDLE;
va_start(va, fmt);
@ -2326,7 +2326,7 @@ static void gdb_read_byte(GDBState *s, int ch)
if (vm_running) {
/* when the CPU is running, we cannot do anything except stop
it when receiving a char */
vm_stop(EXCP_INTERRUPT);
vm_stop(VMSTOP_USER);
} else
#endif
{
@ -2588,7 +2588,7 @@ static void gdb_chr_event(void *opaque, int event)
{
switch (event) {
case CHR_EVENT_OPENED:
vm_stop(EXCP_INTERRUPT);
vm_stop(VMSTOP_USER);
gdb_has_xml = 0;
break;
default:
@ -2628,8 +2628,9 @@ static int gdb_monitor_write(CharDriverState *chr, const uint8_t *buf, int len)
#ifndef _WIN32
static void gdb_sigterm_handler(int signal)
{
if (vm_running)
vm_stop(EXCP_INTERRUPT);
if (vm_running) {
vm_stop(VMSTOP_USER);
}
}
#endif