From: Peter Maydell <peter.mayd...@linaro.org> Instead of having the TYPE_AARCH64_CPU subclass set CPUClass:gdb_core_xml_file to a different value from that that TYPE_ARM_CPU uses, implement the gdb_get_core_xml_file method in the TYPE_ARM_CPU class to return either the AArch64 or AArch32 XML file name.
Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org> Message-ID: <20250317142819.900029-5-peter.mayd...@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- target/arm/cpu.c | 16 +++++++++++++++- target/arm/cpu64.c | 1 - target/arm/tcg/cpu-v7m.c | 1 - 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index bed0e58f3c0..5e951675c60 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2658,6 +2658,20 @@ static const gchar *arm_gdb_arch_name(CPUState *cs) return "arm"; } +static const char *arm_gdb_get_core_xml_file(CPUState *cs) +{ + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; + + if (arm_gdbstub_is_aarch64(cpu)) { + return "aarch64-core.xml"; + } + if (arm_feature(env, ARM_FEATURE_M)) { + return "arm-m-profile.xml"; + } + return "arm-core.xml"; +} + #ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" @@ -2727,6 +2741,7 @@ static void arm_cpu_class_init(ObjectClass *oc, const void *data) cc->sysemu_ops = &arm_sysemu_ops; #endif cc->gdb_arch_name = arm_gdb_arch_name; + cc->gdb_get_core_xml_file = arm_gdb_get_core_xml_file; cc->gdb_stop_before_watchpoint = true; cc->disas_set_info = arm_disas_set_info; @@ -2749,7 +2764,6 @@ static void cpu_register_class_init(ObjectClass *oc, const void *data) CPUClass *cc = CPU_CLASS(acc); acc->info = data; - cc->gdb_core_xml_file = "arm-core.xml"; if (acc->info->deprecation_note) { cc->deprecation_note = acc->info->deprecation_note; } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index fbb7e7b3d64..5135ef63cb2 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -819,7 +819,6 @@ static void aarch64_cpu_class_init(ObjectClass *oc, const void *data) cc->gdb_read_register = aarch64_cpu_gdb_read_register; cc->gdb_write_register = aarch64_cpu_gdb_write_register; - cc->gdb_core_xml_file = "aarch64-core.xml"; object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64, aarch64_cpu_set_aarch64); diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 7426aac0dc4..b34b6578574 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -266,7 +266,6 @@ static void arm_v7m_class_init(ObjectClass *oc, const void *data) acc->info = data; cc->tcg_ops = &arm_v7m_tcg_ops; - cc->gdb_core_xml_file = "arm-m-profile.xml"; } static const ARMCPUInfo arm_v7m_cpus[] = { -- 2.47.1