@samitouri / QOSamiQemu / commits / e9c5654035

gdbstub: Move supported_sstep_flags in AccelGdbConfig structure

supported_sstep_flags are per-accelerators. Move them to a new AccelGdbConfig structure, still in GDBState. Suggested-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260705215729.62196-14-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Jul 3, 2026 at 10:51 UTC e9c5654035834eb5b8f8ae53cb01376f6d8dd222
3 files changed +16 -6
gdbstub/gdbstub.c
+5 -5
@@ -72,9 +72,9 @@ void gdb_init_gdbserver_state(void)
72 * By default try to use no IRQs and no timers while single
73 * stepping so as to make single stepping like a typical ICE HW step.
74 */
75 - gdbserver_state.supported_sstep_flags = accel_supported_gdbstub_sstep_flags();
75 + gdbserver_state.accel_config.sstep_flags = accel_supported_gdbstub_sstep_flags();
76 gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
77 - gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
77 + gdbserver_state.sstep_flags &= gdbserver_state.accel_config.sstep_flags;
78 }
79
80 /* writes 2*len+1 bytes in buf */
@@ -1537,12 +1537,12 @@ static void handle_query_qemu_sstepbits(GArray *params, void *user_ctx)
1537 {
1538 g_string_printf(gdbserver_state.str_buf, "ENABLE=%x", SSTEP_ENABLE);
1539
1540 - if (gdbserver_state.supported_sstep_flags & SSTEP_NOIRQ) {
1540 + if (gdbserver_state.accel_config.sstep_flags & SSTEP_NOIRQ) {
1541 g_string_append_printf(gdbserver_state.str_buf, ",NOIRQ=%x",
1542 SSTEP_NOIRQ);
1543 }
1544
1545 - if (gdbserver_state.supported_sstep_flags & SSTEP_NOTIMER) {
1545 + if (gdbserver_state.accel_config.sstep_flags & SSTEP_NOTIMER) {
1546 g_string_append_printf(gdbserver_state.str_buf, ",NOTIMER=%x",
1547 SSTEP_NOTIMER);
1548 }
@@ -1560,7 +1560,7 @@ static void handle_set_qemu_sstep(GArray *params, void *user_ctx)
1560
1561 new_sstep_flags = gdb_get_cmd_param(params, 0)->val_ul;
1562
1563 - if (new_sstep_flags & ~gdbserver_state.supported_sstep_flags) {
1563 + if (new_sstep_flags & ~gdbserver_state.accel_config.sstep_flags) {
1564 gdb_put_packet("E22");
1565 return;
1566 }
gdbstub/internals.h
+2 -1
@@ -9,6 +9,7 @@
9 #ifndef GDBSTUB_INTERNALS_H
10 #define GDBSTUB_INTERNALS_H
11
12 +#include "qemu/accel.h"
13 #include "exec/cpu-common.h"
14
15 /*
@@ -83,8 +84,8 @@ typedef struct GDBState {
84 int process_num;
85 GString *str_buf;
86 GByteArray *mem_buf;
87 + AccelGdbConfig accel_config;
88 int sstep_flags;
87 - int supported_sstep_flags;
89 /*
90 * Whether we are allowed to send a stop reply packet at this moment.
91 * Must be set off after sending the stop reply itself.
include/qemu/accel.h
+9
@@ -73,6 +73,15 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp);
73 */
74 void accel_cpu_common_unrealize(CPUState *cpu);
75
76 +/**
77 + * struct AccelGdbConfig - gdbstub configuration for an accelerator.
78 + *
79 + * @sstep_flags: Set SSTEP_* flags that accelerator supports for guest debug.
80 + */
81 +typedef struct AccelGdbConfig {
82 + unsigned sstep_flags;
83 +} AccelGdbConfig;
84 +
85 /**
86 * accel_supported_gdbstub_sstep_flags:
87 *