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>
This commit is contained in:
Philippe Mathieu-Daudé
2026-07-03 10:51:39 +02:00
parent 5ba4a7d02b
commit e9c5654035
3 changed files with 16 additions and 6 deletions

View File

@@ -72,9 +72,9 @@ void gdb_init_gdbserver_state(void)
* By default try to use no IRQs and no timers while single
* stepping so as to make single stepping like a typical ICE HW step.
*/
gdbserver_state.supported_sstep_flags = accel_supported_gdbstub_sstep_flags();
gdbserver_state.accel_config.sstep_flags = accel_supported_gdbstub_sstep_flags();
gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
gdbserver_state.sstep_flags &= gdbserver_state.accel_config.sstep_flags;
}
/* writes 2*len+1 bytes in buf */
@@ -1537,12 +1537,12 @@ static void handle_query_qemu_sstepbits(GArray *params, void *user_ctx)
{
g_string_printf(gdbserver_state.str_buf, "ENABLE=%x", SSTEP_ENABLE);
if (gdbserver_state.supported_sstep_flags & SSTEP_NOIRQ) {
if (gdbserver_state.accel_config.sstep_flags & SSTEP_NOIRQ) {
g_string_append_printf(gdbserver_state.str_buf, ",NOIRQ=%x",
SSTEP_NOIRQ);
}
if (gdbserver_state.supported_sstep_flags & SSTEP_NOTIMER) {
if (gdbserver_state.accel_config.sstep_flags & SSTEP_NOTIMER) {
g_string_append_printf(gdbserver_state.str_buf, ",NOTIMER=%x",
SSTEP_NOTIMER);
}
@@ -1560,7 +1560,7 @@ static void handle_set_qemu_sstep(GArray *params, void *user_ctx)
new_sstep_flags = gdb_get_cmd_param(params, 0)->val_ul;
if (new_sstep_flags & ~gdbserver_state.supported_sstep_flags) {
if (new_sstep_flags & ~gdbserver_state.accel_config.sstep_flags) {
gdb_put_packet("E22");
return;
}

View File

@@ -9,6 +9,7 @@
#ifndef GDBSTUB_INTERNALS_H
#define GDBSTUB_INTERNALS_H
#include "qemu/accel.h"
#include "exec/cpu-common.h"
/*
@@ -83,8 +84,8 @@ typedef struct GDBState {
int process_num;
GString *str_buf;
GByteArray *mem_buf;
AccelGdbConfig accel_config;
int sstep_flags;
int supported_sstep_flags;
/*
* Whether we are allowed to send a stop reply packet at this moment.
* Must be set off after sending the stop reply itself.

View File

@@ -73,6 +73,15 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **errp);
*/
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.
*/
typedef struct AccelGdbConfig {
unsigned sstep_flags;
} AccelGdbConfig;
/**
* accel_supported_gdbstub_sstep_flags:
*