]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel: Hold @can_reverse information in AccelGdbConfig
authorPhilippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Fri, 26 Jun 2026 10:41:49 +0000 (12:41 +0200)
committerPhilippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Mon, 6 Jul 2026 13:42:18 +0000 (15:42 +0200)
Hold @can_reverse in AccelGdbConfig, set it when initializing
AccelState in AccelClass::init_machine handlers (only TCG sets
it). Remove gdb_can_reverse() as now unused.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-ID: <20260705215729.62196-17-philmd@oss.qualcomm.com>

accel/tcg/tcg-all.c
gdbstub/gdbstub.c
gdbstub/internals.h
gdbstub/system.c
gdbstub/user.c
include/qemu/accel.h

index d30b53cd3b7a239aea9dcef21306729f0c5c0c61..7186c10cf02248dc5d20a23fddeb66906ce1ba59 100644 (file)
@@ -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();
index 6c4fa065638f0880447274d5300647e56f99bb3f..0a328b0dd4886ff7a278bbed1bd726c2eb740196 100644 (file)
@@ -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+");
     }
index 0444dee22463f004ecb922c77e0217dbe26d3ce5..0b74ea4000ffa6e59a9945472ea045968a0a200a 100644 (file)
@@ -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);
index 1179c82cb8695ae8fffdc71f0f09260624939093..2e8c457097b4157080a835aedbd89220dc6fbd5d 100644 (file)
@@ -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
  */
index f7bc4e63dfddde9fbfab977e1f60cc733feb2774..299388b9f71fa0f7e2fe776eb4da44dea4b7d182 100644 (file)
@@ -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
  */
index 3b01d55741bff8ed62293f374628768330d30680..8e0c3dfe088aaa7395be5161fb8ef9a61cbcee0a 100644 (file)
@@ -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 */