aboutsummaryrefslogtreecommitdiff
path: root/gdb/loongarch-tdep.c
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2022-06-25 09:21:16 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2022-06-25 10:12:55 +0800
commitaf6e3f77e939ecf85e18720925a4d8f355f90ee1 (patch)
treed773780616d692f0fe28dbd40839354f544531b4 /gdb/loongarch-tdep.c
parent0757a50396e3638434f806aec2ee8c8f79a7026c (diff)
downloadgdb-af6e3f77e939ecf85e18720925a4d8f355f90ee1.zip
gdb-af6e3f77e939ecf85e18720925a4d8f355f90ee1.tar.gz
gdb-af6e3f77e939ecf85e18720925a4d8f355f90ee1.tar.bz2
gdb: LoongArch: Implement loongarch_linux_syscall_next_pc()
When FRAME is at a syscall instruction, return the PC of the next instruction to be executed. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Diffstat (limited to 'gdb/loongarch-tdep.c')
-rw-r--r--gdb/loongarch-tdep.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index 3c02449..f2f4e3b 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -224,6 +224,8 @@ loongarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static CORE_ADDR
loongarch_next_pc (struct regcache *regcache, CORE_ADDR cur_pc)
{
+ struct gdbarch *gdbarch = regcache->arch ();
+ loongarch_gdbarch_tdep *tdep = (loongarch_gdbarch_tdep *) gdbarch_tdep (gdbarch);
insn_t insn = loongarch_fetch_instruction (cur_pc);
size_t insn_len = loongarch_insn_length (insn);
CORE_ADDR next_pc = cur_pc + insn_len;
@@ -307,6 +309,11 @@ loongarch_next_pc (struct regcache *regcache, CORE_ADDR cur_pc)
if (rj != 0)
next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
}
+ else if ((insn & 0xffff8000) == 0x002b0000) /* syscall */
+ {
+ if (tdep->syscall_next_pc != nullptr)
+ next_pc = tdep->syscall_next_pc (get_current_frame ());
+ }
return next_pc;
}