diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index d30b53cd3b..7186c10cf0 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -159,6 +159,9 @@ static int tcg_init_machine(AccelState *as, MachineState *ms) */ as->gdbstub.sstep_flags |= SSTEP_NOIRQ | SSTEP_NOTIMER; } + if (replay_mode == REPLAY_MODE_PLAY) { + as->gdbstub.can_reverse = true; + } page_init(); tb_htable_init(); diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 6c4fa06563..0a328b0dd4 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -1376,7 +1376,7 @@ static void handle_step(GArray *params, void *user_ctx) static void handle_backward(GArray *params, void *user_ctx) { - if (!gdb_can_reverse()) { + if (!gdbserver_state.accel_config.can_reverse) { gdb_put_packet("E22"); return; } @@ -1684,7 +1684,7 @@ static void handle_query_supported(GArray *params, void *user_ctx) g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+"); } - if (gdb_can_reverse()) { + if (gdbserver_state.accel_config.can_reverse) { g_string_append(gdbserver_state.str_buf, ";ReverseStep+;ReverseContinue+"); } diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 0444dee224..0b74ea4000 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -154,7 +154,6 @@ CPUState *gdb_first_attached_cpu(void); void gdb_append_thread_id(CPUState *cpu, GString *buf); int gdb_get_cpu_index(CPUState *cpu); unsigned int gdb_get_max_cpus(void); /* both */ -bool gdb_can_reverse(void); /* system emulation, stub for user */ int gdb_target_sigtrap(void); /* user */ void gdb_create_default_process(GDBState *s); diff --git a/gdbstub/system.c b/gdbstub/system.c index 1179c82cb8..2e8c457097 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -479,11 +479,6 @@ unsigned int gdb_get_max_cpus(void) return ms->smp.max_cpus; } -bool gdb_can_reverse(void) -{ - return replay_mode == REPLAY_MODE_PLAY; -} - /* * Softmmu specific command helpers */ diff --git a/gdbstub/user.c b/gdbstub/user.c index f7bc4e63df..299388b9f7 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -786,12 +786,6 @@ unsigned int gdb_get_max_cpus(void) return max_cpus; } -/* replay not supported for user-mode */ -bool gdb_can_reverse(void) -{ - return false; -} - /* * Break/Watch point helpers */ diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 3b01d55741..8e0c3dfe08 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -77,9 +77,11 @@ void accel_cpu_common_unrealize(CPUState *cpu); * struct AccelGdbConfig - gdbstub configuration for an accelerator. * * @sstep_flags: Set SSTEP_* flags that accelerator supports for guest debug. + * @can_reverse: Whether reverse mode is supported. */ typedef struct AccelGdbConfig { unsigned sstep_flags; + bool can_reverse; } AccelGdbConfig; #endif /* QEMU_ACCEL_H */