diff options
| author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2023-10-09 17:40:53 +0100 |
|---|---|---|
| committer | Alex Bennée <alex.bennee@linaro.org> | 2023-10-11 08:46:33 +0100 |
| commit | a650683871ba728ebce3d320941f48bac91f0f6a (patch) | |
| tree | b6f989a58d18eac06cb18751d168a147936f502b /target/riscv/cpu.c | |
| parent | 48de6462809587a2165260b4daa8e6477fbd7b75 (diff) | |
| download | focaccia-qemu-a650683871ba728ebce3d320941f48bac91f0f6a.tar.gz focaccia-qemu-a650683871ba728ebce3d320941f48bac91f0f6a.zip | |
hw/core/cpu: Return static value with gdb_arch_name()
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 <akihiko.odaki@daynix.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20230912224107.29669-8-akihiko.odaki@daynix.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20231009164104.369749-15-alex.bennee@linaro.org>
Diffstat (limited to 'target/riscv/cpu.c')
| -rw-r--r-- | target/riscv/cpu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index ac2b94b6a6..f5572704de 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2004,17 +2004,17 @@ static Property riscv_cpu_properties[] = { DEFINE_PROP_END_OF_LIST(), }; -static gchar *riscv_gdb_arch_name(CPUState *cs) +static const gchar *riscv_gdb_arch_name(CPUState *cs) { RISCVCPU *cpu = RISCV_CPU(cs); CPURISCVState *env = &cpu->env; switch (riscv_cpu_mxl(env)) { case MXL_RV32: - return g_strdup("riscv:rv32"); + return "riscv:rv32"; case MXL_RV64: case MXL_RV128: - return g_strdup("riscv:rv64"); + return "riscv:rv64"; default: g_assert_not_reached(); } |