bool tcg_cpu_exec(void) { int ret = 0; if (next_cpu == NULL) next_cpu = first_cpu; for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) { CPUState *env = cur_cpu = next_cpu; qemu_clock_enable(vm_clock, (cur_cpu->singlestep_enabled & SSTEP_NOTIMER) == 0); if (qemu_alarm_pending()) break; if (cpu_can_run(env)) ret = qemu_cpu_exec(env); else if (env->stop) break; if (ret == EXCP_DEBUG) { gdb_set_stop_cpu(env); debug_requested = EXCP_DEBUG; break; } } return tcg_has_work(); }
static void cpu_handle_guest_debug(CPUArchState *env) { CPUState *cpu = ENV_GET_CPU(env); gdb_set_stop_cpu(env); qemu_system_debug_request(); cpu->stopped = true; }
static void cpu_handle_guest_debug(CPUState *env) { gdb_set_stop_cpu(env); qemu_system_debug_request(); #ifdef CONFIG_IOTHREAD env->stopped = 1; #endif }
void tcg_cpu_exec(void) { int ret = 0; if (next_cpu == NULL) next_cpu = first_cpu; for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) { CPUState *env = cur_cpu = next_cpu; if (!vm_running) break; if (qemu_timer_alarm_pending()) { break; } if (cpu_can_run(env)) ret = qemu_cpu_exec(env); if (ret == EXCP_DEBUG) { gdb_set_stop_cpu(env); debug_requested = 1; break; } } }
static void gdb_vm_state_change(void *opaque, int running, RunState state) { GDBState *s = gdbserver_state; CPUState *cpu = s->c_cpu; char buf[256]; const char *type; int ret; if (running || s->state == RS_INACTIVE) { return; } /* Is there a GDB syscall waiting to be sent? */ if (s->current_syscall_cb) { put_packet(s, s->syscall_buf); return; } switch (state) { case RUN_STATE_DEBUG: if (cpu->watchpoint_hit) { switch (cpu->watchpoint_hit->flags & BP_MEM_ACCESS) { case BP_MEM_READ: type = "r"; break; case BP_MEM_ACCESS: type = "a"; break; default: type = ""; break; } snprintf(buf, sizeof(buf), "T%02xthread:%02x;%swatch:" TARGET_FMT_lx ";", GDB_SIGNAL_TRAP, cpu_index(cpu), type, (target_ulong)cpu->watchpoint_hit->vaddr); cpu->watchpoint_hit = NULL; goto send_packet; } tb_flush(cpu); ret = GDB_SIGNAL_TRAP; break; case RUN_STATE_PAUSED: ret = GDB_SIGNAL_INT; break; case RUN_STATE_SHUTDOWN: ret = GDB_SIGNAL_QUIT; break; case RUN_STATE_IO_ERROR: ret = GDB_SIGNAL_IO; break; case RUN_STATE_WATCHDOG: ret = GDB_SIGNAL_ALRM; break; case RUN_STATE_INTERNAL_ERROR: ret = GDB_SIGNAL_ABRT; break; case RUN_STATE_SAVE_VM: case RUN_STATE_RESTORE_VM: return; case RUN_STATE_FINISH_MIGRATE: ret = GDB_SIGNAL_XCPU; break; default: ret = GDB_SIGNAL_UNKNOWN; break; } gdb_set_stop_cpu(cpu); snprintf(buf, sizeof(buf), "T%02xthread:%02x;", ret, cpu_index(cpu)); send_packet: put_packet(s, buf); /* disable single step if it was enabled */ cpu_single_step(cpu, 0); }
static void cpu_handle_guest_debug(CPUArchState *env) { gdb_set_stop_cpu(env); qemu_system_debug_request(); env->stopped = 1; }
static void cpu_handle_guest_debug(CPUState *cpu) { gdb_set_stop_cpu(cpu); qemu_system_debug_request(); cpu->stopped = true; }
static void cpu_debug_handler(CPUState *env) { gdb_set_stop_cpu(env); debug_requested = EXCP_DEBUG; vm_stop(EXCP_DEBUG); }