mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
gdbstub: Simplify gdb_init_cpu() logic
Ensure we either set gdb_num_core_regs or have a XML file. We shouldn't modify CPUClass content, so mark it const. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Link: https://lore.kernel.org/qemu-devel/20260310232045.58440-7-philmd@linaro.org Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
This commit is contained in:
committed by
Pierrick Bouvier
parent
29e30df3f3
commit
3b6cf87d42
@@ -582,22 +582,20 @@ static const char *gdb_get_core_xml_file(CPUState *cpu)
|
||||
|
||||
void gdb_init_cpu(CPUState *cpu)
|
||||
{
|
||||
CPUClass *cc = cpu->cc;
|
||||
const CPUClass *cc = cpu->cc;
|
||||
const GDBFeature *feature;
|
||||
const char *xmlfile = gdb_get_core_xml_file(cpu);
|
||||
|
||||
cpu->gdb_regs = g_array_new(false, false, sizeof(GDBRegisterState));
|
||||
|
||||
if (xmlfile) {
|
||||
assert(!cc->gdb_num_core_regs);
|
||||
feature = gdb_find_static_feature(xmlfile);
|
||||
gdb_register_feature(cpu, 0,
|
||||
cc->gdb_read_register, cc->gdb_write_register,
|
||||
feature);
|
||||
assert(!cc->gdb_num_core_regs);
|
||||
cpu->gdb_num_regs = cpu->gdb_num_g_regs = feature->num_regs;
|
||||
}
|
||||
|
||||
if (cc->gdb_num_core_regs) {
|
||||
} else {
|
||||
cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user