2
0
Эх сурвалжийг харах

gdbstub: Check for TCG before calling tb_flush()

Use the tcg_enabled() check so the compiler can elide
the call when TCG isn't available, allowing to remove
the tb_flush() stub.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250123234415.59850-4-philmd@linaro.org>
Philippe Mathieu-Daudé 7 сар өмнө
parent
commit
270dbee10c

+ 0 - 4
accel/stubs/tcg-stub.c

@@ -14,10 +14,6 @@
 #include "exec/tb-flush.h"
 #include "exec/tb-flush.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
 
 
-void tb_flush(CPUState *cpu)
-{
-}
-
 G_NORETURN void cpu_loop_exit(CPUState *cpu)
 G_NORETURN void cpu_loop_exit(CPUState *cpu)
 {
 {
     g_assert_not_reached();
     g_assert_not_reached();

+ 4 - 1
gdbstub/system.c

@@ -22,6 +22,7 @@
 #include "system/cpus.h"
 #include "system/cpus.h"
 #include "system/runstate.h"
 #include "system/runstate.h"
 #include "system/replay.h"
 #include "system/replay.h"
+#include "system/tcg.h"
 #include "hw/core/cpu.h"
 #include "hw/core/cpu.h"
 #include "hw/cpu/cluster.h"
 #include "hw/cpu/cluster.h"
 #include "hw/boards.h"
 #include "hw/boards.h"
@@ -171,7 +172,9 @@ static void gdb_vm_state_change(void *opaque, bool running, RunState state)
         } else {
         } else {
             trace_gdbstub_hit_break();
             trace_gdbstub_hit_break();
         }
         }
-        tb_flush(cpu);
+        if (tcg_enabled()) {
+            tb_flush(cpu);
+        }
         ret = GDB_SIGNAL_TRAP;
         ret = GDB_SIGNAL_TRAP;
         break;
         break;
     case RUN_STATE_PAUSED:
     case RUN_STATE_PAUSED: