qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gdb: riscv: Add target description
@ 2020-12-23 16:28 Sylvain Pelissier
  2020-12-29  4:10 ` Bin Meng
  0 siblings, 1 reply; 6+ messages in thread
From: Sylvain Pelissier @ 2020-12-23 16:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Palmer Dabbelt, Alistair Francis, qemu-riscv, Sagar Karandikar,
	Bastian Koppelmann

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Target description is not currently implemented in RISC-V architecture.
Thus GDB won't set it properly when attached. The patch implements the
target description response.

Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com>
---
 target/riscv/cpu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 254cd83f8b..489d66038c 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -556,6 +556,15 @@ static Property riscv_cpu_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };

+static gchar *riscv_gdb_arch_name(CPUState *cs)
+{
+    #ifdef TARGET_RISCV64
+        return g_strdup("riscv:rv64");
+    #else
+        return g_strdup("riscv:rv32");
+    #endif
+}
+
 static void riscv_cpu_class_init(ObjectClass *c, void *data)
 {
     RISCVCPUClass *mcc = RISCV_CPU_CLASS(c);
@@ -591,6 +600,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void
*data)
     /* For now, mark unmigratable: */
     cc->vmsd = &vmstate_riscv_cpu;
 #endif
+    cc->gdb_arch_name = riscv_gdb_arch_name;
 #ifdef CONFIG_TCG
     cc->tcg_initialize = riscv_translate_init;
     cc->tlb_fill = riscv_cpu_tlb_fill;
-- 
2.25.1

[-- Attachment #2: Type: text/html, Size: 1493 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-30  7:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23 16:28 [PATCH] gdb: riscv: Add target description Sylvain Pelissier
2020-12-29  4:10 ` Bin Meng
2020-12-29 16:36   ` Sylvain Pelissier
2020-12-30  0:26     ` Bin Meng
2020-12-30  7:42       ` Sylvain Pelissier
2020-12-30  7:57         ` Bin Meng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).