diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-07-29 14:26:33 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2011-09-15 16:39:32 -0300 |
commit | 1dfb4dd993f7122353fb2894f09dfcba894cd7d5 (patch) | |
tree | 72559b694b482e5b0dc1f77faf96aa31d3678f64 /gdbstub.c | |
parent | bff046f86b4f8970c722c3bc3e32173b8000e716 (diff) | |
download | qemu-1dfb4dd993f7122353fb2894f09dfcba894cd7d5.zip qemu-1dfb4dd993f7122353fb2894f09dfcba894cd7d5.tar.gz qemu-1dfb4dd993f7122353fb2894f09dfcba894cd7d5.tar.bz2 |
Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is.
One example to demonstrate this problem is that vm_start() calls
vm_state_notify() with reason=0, which turns out to be VMSTOP_USER.
This commit fixes that by replacing the VMSTOP macros with a proper
state type called RunState.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'gdbstub.c')
-rw-r--r-- | gdbstub.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -2373,7 +2373,7 @@ void gdb_set_stop_cpu(CPUState *env) } #ifndef CONFIG_USER_ONLY -static void gdb_vm_state_change(void *opaque, int running, int reason) +static void gdb_vm_state_change(void *opaque, int running, RunState state) { GDBState *s = gdbserver_state; CPUState *env = s->c_cpu; @@ -2384,8 +2384,8 @@ static void gdb_vm_state_change(void *opaque, int running, int reason) if (running || s->state == RS_INACTIVE || s->state == RS_SYSCALL) { return; } - switch (reason) { - case VMSTOP_DEBUG: + switch (state) { + case RSTATE_DEBUG: if (env->watchpoint_hit) { switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) { case BP_MEM_READ: @@ -2408,25 +2408,25 @@ static void gdb_vm_state_change(void *opaque, int running, int reason) tb_flush(env); ret = GDB_SIGNAL_TRAP; break; - case VMSTOP_USER: + case RSTATE_PAUSED: ret = GDB_SIGNAL_INT; break; - case VMSTOP_SHUTDOWN: + case RSTATE_SHUTDOWN: ret = GDB_SIGNAL_QUIT; break; - case VMSTOP_DISKFULL: + case RSTATE_IO_ERROR: ret = GDB_SIGNAL_IO; break; - case VMSTOP_WATCHDOG: + case RSTATE_WATCHDOG: ret = GDB_SIGNAL_ALRM; break; - case VMSTOP_PANIC: + case RSTATE_PANICKED: ret = GDB_SIGNAL_ABRT; break; - case VMSTOP_SAVEVM: - case VMSTOP_LOADVM: + case RSTATE_SAVEVM: + case RSTATE_RESTORE: return; - case VMSTOP_MIGRATE: + case RSTATE_PRE_MIGRATE: ret = GDB_SIGNAL_XCPU; break; default: @@ -2463,7 +2463,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(VMSTOP_DEBUG); + vm_stop(RSTATE_DEBUG); #endif s->state = RS_IDLE; va_start(va, fmt); @@ -2537,7 +2537,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(VMSTOP_USER); + vm_stop(RSTATE_PAUSED); } else #endif { @@ -2799,7 +2799,7 @@ static void gdb_chr_event(void *opaque, int event) { switch (event) { case CHR_EVENT_OPENED: - vm_stop(VMSTOP_USER); + vm_stop(RSTATE_PAUSED); gdb_has_xml = 0; break; default: @@ -2840,7 +2840,7 @@ static int gdb_monitor_write(CharDriverState *chr, const uint8_t *buf, int len) static void gdb_sigterm_handler(int signal) { if (vm_running) { - vm_stop(VMSTOP_USER); + vm_stop(RSTATE_PAUSED); } } #endif |