summaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@loongson.cn>2022-05-30 20:08:30 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2022-06-14 22:21:43 +0800
commite5ab6af52d38ee068c1860ef113b7db4cc985cfb (patch)
tree8bad8cacb35f0635adbe82e3ed6837c0f5b9e3ef /gdb/arch
parent476288fa2bddecf0f0e13dee826a076309bf01fe (diff)
downloadbinutils-gdb-e5ab6af52d38ee068c1860ef113b7db4cc985cfb.tar.gz
gdbserver: Add LoongArch/Linux support
Implement LoongArch/Linux support, including XML target description handling based on features determined, GPR regset support, and software breakpoint handling. In the Linux kernel code of LoongArch, ptrace implements PTRACE_POKEUSR and PTRACE_PEEKUSR in the arch_ptrace function, so srv_linux_usrregs is set to yes. With this patch on LoongArch: $ make check-gdb TESTS="gdb.server/server-connect.exp" [...] # of expected passes 18 [...] Signed-off-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/loongarch.c12
-rw-r--r--gdb/arch/loongarch.h13
2 files changed, 24 insertions, 1 deletions
diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c
index 934f6e489c5..11310c1dd93 100644
--- a/gdb/arch/loongarch.c
+++ b/gdb/arch/loongarch.c
@@ -25,7 +25,13 @@
#include "../features/loongarch/base32.c"
#include "../features/loongarch/base64.c"
-static target_desc_up
+#ifndef GDBSERVER
+#define STATIC_IN_GDB static
+#else
+#define STATIC_IN_GDB
+#endif
+
+STATIC_IN_GDB target_desc_up
loongarch_create_target_description (const struct loongarch_gdbarch_features features)
{
/* Now we should create a new target description. */
@@ -51,6 +57,8 @@ loongarch_create_target_description (const struct loongarch_gdbarch_features fea
return tdesc;
}
+#ifndef GDBSERVER
+
/* Wrapper used by std::unordered_map to generate hash for feature set. */
struct loongarch_gdbarch_features_hasher
{
@@ -86,3 +94,5 @@ loongarch_lookup_target_description (const struct loongarch_gdbarch_features fea
loongarch_tdesc_cache.emplace (features, std::move (tdesc));
return ptr;
}
+
+#endif /* !GDBSERVER */
diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h
index 9e10df967d1..8194ea66c0a 100644
--- a/gdb/arch/loongarch.h
+++ b/gdb/arch/loongarch.h
@@ -60,6 +60,17 @@ struct loongarch_gdbarch_features
}
};
+#ifdef GDBSERVER
+
+/* Create and return a target description that is compatible with FEATURES.
+ This is only used directly from the gdbserver where the created target
+ description is modified after it is return. */
+
+target_desc_up loongarch_create_target_description
+ (const struct loongarch_gdbarch_features features);
+
+#else
+
/* Lookup an already existing target description matching FEATURES, or
create a new target description if this is the first time we have seen
FEATURES. For the same FEATURES the same target_desc is always
@@ -70,4 +81,6 @@ struct loongarch_gdbarch_features
const target_desc *loongarch_lookup_target_description
(const struct loongarch_gdbarch_features features);
+#endif /* GDBSERVER */
+
#endif /* ARCH_LOONGARCH_H */