From a650683871ba728ebce3d320941f48bac91f0f6a Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 9 Oct 2023 17:40:53 +0100 Subject: hw/core/cpu: Return static value with gdb_arch_name() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All implementations of gdb_arch_name() returns dynamic duplicates of static strings. It's also unlikely that there will be an implementation of gdb_arch_name() that returns a truly dynamic value due to the nature of the function returning a well-known identifiers. Qualify the value gdb_arch_name() with const and make all of its implementations return static strings. Signed-off-by: Akihiko Odaki Reviewed-by: Alex Bennée Reviewed-by: Alistair Francis Message-Id: <20230912224107.29669-8-akihiko.odaki@daynix.com> Signed-off-by: Alex Bennée Message-Id: <20231009164104.369749-15-alex.bennee@linaro.org> --- include/hw/core/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index e02bc59..7b8347e 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -165,7 +165,7 @@ struct CPUClass { vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr); const char *gdb_core_xml_file; - gchar * (*gdb_arch_name)(CPUState *cpu); + const gchar * (*gdb_arch_name)(CPUState *cpu); const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname); void (*disas_set_info)(CPUState *cpu, disassemble_info *info); -- cgit v1.1 From 73c392c26b0c96eb07272ea21cc0062ce534b6a3 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 9 Oct 2023 17:40:58 +0100 Subject: gdbstub: Replace gdb_regs with an array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An array is a more appropriate data structure than a list for gdb_regs since it is initialized only with append operation and read-only after initialization. Signed-off-by: Akihiko Odaki Reviewed-by: Alistair Francis Message-Id: <20230912224107.29669-13-akihiko.odaki@daynix.com> [AJB: fixed a checkpatch violation] Signed-off-by: Alex Bennée Message-Id: <20231009164104.369749-20-alex.bennee@linaro.org> --- include/hw/core/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/hw') diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 7b8347e..3968369 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -502,7 +502,7 @@ struct CPUState { CPUJumpCache *tb_jmp_cache; - struct GDBRegisterState *gdb_regs; + GArray *gdb_regs; int gdb_num_regs; int gdb_num_g_regs; QTAILQ_ENTRY(CPUState) node; -- cgit v1.1