diff mbox series

[for-7.1,2/5] target/loongarch: add gdb_arch_name()

Message ID 20220804130213.1364164-3-gaosong@loongson.cn (mailing list archive)
State New, archived
Headers show
Series Fix gdb bugs and update gdb-xml | expand

Commit Message

gaosong Aug. 4, 2022, 1:02 p.m. UTC
LoongArch gdb_arch_name() is "Loongarch64", Dump from GDB.

GNU gdb (GDB) 13.0.50.20220519-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "loongarch64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) show architecture
The target architecture is set to "auto" (currently "Loongarch64").
(gdb)

Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 target/loongarch/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Richard Henderson Aug. 4, 2022, 4:02 p.m. UTC | #1
On 8/4/22 06:02, Song Gao wrote:
> LoongArch gdb_arch_name() is "Loongarch64", Dump from GDB.
> 
> GNU gdb (GDB) 13.0.50.20220519-git
> Copyright (C) 2022 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "loongarch64-unknown-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>      <http://www.gnu.org/software/gdb/documentation/>.
> 
> For help, type "help".
> Type "apropos word" to search for commands related to "word".
> (gdb) show architecture
> The target architecture is set to "auto" (currently "Loongarch64").
> (gdb)
> 
> Signed-off-by: Song Gao <gaosong@loongson.cn>

Matches bfd/cpu-loongarch.c, bfd_loongarch_arch.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

> ---
>   target/loongarch/cpu.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
> index d84ec38cf7..94d5617639 100644
> --- a/target/loongarch/cpu.c
> +++ b/target/loongarch/cpu.c
> @@ -661,6 +661,11 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = {
>   };
>   #endif
>   
> +static gchar *loongarch_gdb_arch_name(CPUState *cs)
> +{
> +    return g_strdup("Loongarch64");
> +}
> +
>   static void loongarch_cpu_class_init(ObjectClass *c, void *data)
>   {
>       LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c);
> @@ -686,6 +691,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
>       cc->gdb_num_core_regs = 35;
>       cc->gdb_core_xml_file = "loongarch-base64.xml";
>       cc->gdb_stop_before_watchpoint = true;
> +    cc->gdb_arch_name = loongarch_gdb_arch_name;
>   
>   #ifdef CONFIG_TCG
>       cc->tcg_ops = &loongarch_tcg_ops;
diff mbox series

Patch

diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index d84ec38cf7..94d5617639 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -661,6 +661,11 @@  static const struct SysemuCPUOps loongarch_sysemu_ops = {
 };
 #endif
 
+static gchar *loongarch_gdb_arch_name(CPUState *cs)
+{
+    return g_strdup("Loongarch64");
+}
+
 static void loongarch_cpu_class_init(ObjectClass *c, void *data)
 {
     LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c);
@@ -686,6 +691,7 @@  static void loongarch_cpu_class_init(ObjectClass *c, void *data)
     cc->gdb_num_core_regs = 35;
     cc->gdb_core_xml_file = "loongarch-base64.xml";
     cc->gdb_stop_before_watchpoint = true;
+    cc->gdb_arch_name = loongarch_gdb_arch_name;
 
 #ifdef CONFIG_TCG
     cc->tcg_ops = &loongarch_tcg_ops;