int cpu_breakpoint_insert(CPUState *env, uint32_t pc);
int cpu_breakpoint_remove(CPUState *env, uint32_t pc);
+void cpu_single_step(CPUState *env, int enabled);
/* gdb stub API */
extern int gdbstub_fd;
tb_reset_jump_recursive2(tb, 1);
}
-/* add a breakpoint */
+/* add a breakpoint. EXCP_DEBUG is returned by the CPU loop if a
+ breakpoint is reached */
int cpu_breakpoint_insert(CPUState *env, uint32_t pc)
{
#if defined(TARGET_I386)
#endif
}
+/* enable or disable single step mode. EXCP_DEBUG is returned by the
+ CPU loop after each instruction */
+void cpu_single_step(CPUState *env, int enabled)
+{
+#if defined(TARGET_I386)
+ if (env->singlestep_enabled != enabled) {
+ env->singlestep_enabled = enabled;
+ /* must flush all the translated code to avoid inconsistancies */
+ tb_flush();
+ }
+#endif
+}
+
+
/* mask must never be zero */
void cpu_interrupt(CPUState *env, int mask)
{
snprintf(buf, sizeof(buf), "S%02x", ret);
put_packet(buf);
break;
+ case 's':
+ env = cpu_gdbstub_get_env(opaque);
+ if (*p != '\0') {
+ addr = strtoul(p, (char **)&p, 16);
+#if defined(TARGET_I386)
+ env->eip = addr;
+#endif
+ }
+ cpu_single_step(env, 1);
+ ret = main_loop(opaque);
+ cpu_single_step(env, 0);
+ if (ret == EXCP_DEBUG)
+ ret = SIGTRAP;
+ else
+ ret = 0;
+ snprintf(buf, sizeof(buf), "S%02x", ret);
+ put_packet(buf);
+ break;
case 'g':
env = cpu_gdbstub_get_env(opaque);
registers = (void *)mem_buf;