aboutsummaryrefslogtreecommitdiff
path: root/gdb/features
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2022-07-05 19:30:12 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2022-07-05 22:26:45 +0800
commit736918239b16cc2ff57bfc64a982f2f0afc8c0f6 (patch)
tree72fee59d80679278fc650315af221377586512cb /gdb/features
parent4694a0e5fe233c5a33f0e4e4b99c9c92021b8c88 (diff)
downloadfsf-binutils-gdb-736918239b16cc2ff57bfc64a982f2f0afc8c0f6.zip
fsf-binutils-gdb-736918239b16cc2ff57bfc64a982f2f0afc8c0f6.tar.gz
fsf-binutils-gdb-736918239b16cc2ff57bfc64a982f2f0afc8c0f6.tar.bz2
gdb: LoongArch: add orig_a0 into register set
The basic support for LoongArch has been merged into the upstream Linux kernel since 5.19-rc1 on June 5, 2022. This commit adds orig_a0 which is added into struct user_pt_regs [1] to match the upstream kernel, and then the upstream GDB will work with the upstream kernel. Note that orig_a0 was added into struct user_pt_regs in the development cycle for merging LoongArch port into the upstream Linux kernel, so earlier kernels (notably, the product kernel with version 4.19 used in distros like UOS and Loongnix) don't have it. Inspect arch/loongarch/include/uapi/asm/ptrace.h in the kernel tree to make sure. To build upstream GDB for a kernel lacking orig_a0, it's necessary to revert this commit locally. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/uapi/asm/ptrace.h#n24 Signed-off-by: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Diffstat (limited to 'gdb/features')
-rw-r--r--gdb/features/loongarch/base32.c1
-rw-r--r--gdb/features/loongarch/base32.xml1
-rw-r--r--gdb/features/loongarch/base64.c1
-rw-r--r--gdb/features/loongarch/base64.xml1
4 files changed, 4 insertions, 0 deletions
diff --git a/gdb/features/loongarch/base32.c b/gdb/features/loongarch/base32.c
index 7105c15..3fb35ef 100644
--- a/gdb/features/loongarch/base32.c
+++ b/gdb/features/loongarch/base32.c
@@ -41,6 +41,7 @@ create_feature_loongarch_base32 (struct target_desc *result, long regnum)
tdesc_create_reg (feature, "r29", regnum++, 1, "general", 32, "uint32");
tdesc_create_reg (feature, "r30", regnum++, 1, "general", 32, "uint32");
tdesc_create_reg (feature, "r31", regnum++, 1, "general", 32, "uint32");
+ tdesc_create_reg (feature, "orig_a0", regnum++, 1, "general", 32, "uint32");
tdesc_create_reg (feature, "pc", regnum++, 1, "general", 32, "code_ptr");
tdesc_create_reg (feature, "badv", regnum++, 1, "general", 32, "code_ptr");
return regnum;
diff --git a/gdb/features/loongarch/base32.xml b/gdb/features/loongarch/base32.xml
index 5b00f8a..af47bbd 100644
--- a/gdb/features/loongarch/base32.xml
+++ b/gdb/features/loongarch/base32.xml
@@ -39,6 +39,7 @@
<reg name="r29" bitsize="32" type="uint32" group="general"/>
<reg name="r30" bitsize="32" type="uint32" group="general"/>
<reg name="r31" bitsize="32" type="uint32" group="general"/>
+ <reg name="orig_a0" bitsize="32" type="uint32" group="general"/>
<reg name="pc" bitsize="32" type="code_ptr" group="general"/>
<reg name="badv" bitsize="32" type="code_ptr" group="general"/>
</feature>
diff --git a/gdb/features/loongarch/base64.c b/gdb/features/loongarch/base64.c
index 63eee02..d84d425 100644
--- a/gdb/features/loongarch/base64.c
+++ b/gdb/features/loongarch/base64.c
@@ -41,6 +41,7 @@ create_feature_loongarch_base64 (struct target_desc *result, long regnum)
tdesc_create_reg (feature, "r29", regnum++, 1, "general", 64, "uint64");
tdesc_create_reg (feature, "r30", regnum++, 1, "general", 64, "uint64");
tdesc_create_reg (feature, "r31", regnum++, 1, "general", 64, "uint64");
+ tdesc_create_reg (feature, "orig_a0", regnum++, 1, "general", 64, "uint64");
tdesc_create_reg (feature, "pc", regnum++, 1, "general", 64, "code_ptr");
tdesc_create_reg (feature, "badv", regnum++, 1, "general", 64, "code_ptr");
return regnum;
diff --git a/gdb/features/loongarch/base64.xml b/gdb/features/loongarch/base64.xml
index bef91e5..2d8a1f6 100644
--- a/gdb/features/loongarch/base64.xml
+++ b/gdb/features/loongarch/base64.xml
@@ -39,6 +39,7 @@
<reg name="r29" bitsize="64" type="uint64" group="general"/>
<reg name="r30" bitsize="64" type="uint64" group="general"/>
<reg name="r31" bitsize="64" type="uint64" group="general"/>
+ <reg name="orig_a0" bitsize="64" type="uint64" group="general"/>
<reg name="pc" bitsize="64" type="code_ptr" group="general"/>
<reg name="badv" bitsize="64" type="code_ptr" group="general"/>
</feature>