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 <lihui@loongson.cn>
Reviewed-By: Tom Tromey <tom@tromey.com>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
This commit is contained in:
Hui Li 2023-07-06 11:22:37 +08:00 committed by Tiezhu Yang
parent 6d30ada87b
commit fc07c81340

View file

@ -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) if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
perror_with_name (_("Couldn't get NT_PRSTATUS registers")); perror_with_name (_("Couldn't get NT_PRSTATUS registers"));
else else
loongarch_gregset.supply_regset (nullptr, regcache, regnum, loongarch_gregset.supply_regset (nullptr, regcache, -1,
&regset, sizeof (regset)); &regset, 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) if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (long) &iovec) < 0)
perror_with_name (_("Couldn't get NT_FPREGSET registers")); perror_with_name (_("Couldn't get NT_FPREGSET registers"));
else else
loongarch_fpregset.supply_regset (nullptr, regcache, regnum, loongarch_fpregset.supply_regset (nullptr, regcache, -1,
&regset, sizeof (regset)); &regset, sizeof (regset));
} }
} }