From: Hui Li Date: Thu, 6 Jul 2023 03:22:37 +0000 (+0800) Subject: gdb: LoongArch: Update status of the entire regset in regcache X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc07c81340b8e8fdd4fa225231d96a84cff77f19;p=binutils-gdb.git gdb: LoongArch: Update status of the entire regset in regcache In the current code, when a register is fetched, the entire regset are fetched via ptrace, but only this register status is updated in regcache, it needs to fetch the same regset through ptrace again if another register in this regset is fetched later, this is obviously unnecessary. It is proper to update the status of the entire regset in regcache when fetching a register via ptrace. Signed-off-by: Hui Li Reviewed-By: Tom Tromey Signed-off-by: Tiezhu Yang --- diff --git a/gdb/loongarch-linux-nat.c b/gdb/loongarch-linux-nat.c index 5eb32b0a52a..40231d5d753 100644 --- a/gdb/loongarch-linux-nat.c +++ b/gdb/loongarch-linux-nat.c @@ -65,7 +65,7 @@ fetch_gregs_from_thread (struct regcache *regcache, int regnum, pid_t tid) if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0) perror_with_name (_("Couldn't get NT_PRSTATUS registers")); else - loongarch_gregset.supply_regset (nullptr, regcache, regnum, + loongarch_gregset.supply_regset (nullptr, regcache, -1, ®set, sizeof (regset)); } } @@ -116,7 +116,7 @@ fetch_fpregs_from_thread (struct regcache *regcache, int regnum, pid_t tid) if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (long) &iovec) < 0) perror_with_name (_("Couldn't get NT_FPREGSET registers")); else - loongarch_fpregset.supply_regset (nullptr, regcache, regnum, + loongarch_fpregset.supply_regset (nullptr, regcache, -1, ®set, sizeof (regset)); } }