diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d42c30649..8035353069 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-05-15 Maciej W. Rozycki + + * mips-linux-nat.c (mips_linux_nat_target::fetch_registers): + Supply the MIPS_ZERO_REGNUM register. + 2018-05-15 Maciej W. Rozycki * mips-tdep.c (mask_address_var): Make variable static. diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 4e0c51bd2d..b1dbb79852 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -416,7 +416,13 @@ mips_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) /* If we know, or just found out, that PTRACE_GETREGS does not work, fall back to PTRACE_PEEKUSER. */ if (!have_ptrace_regsets) - linux_nat_trad_target::fetch_registers (regcache, regnum); + { + linux_nat_trad_target::fetch_registers (regcache, regnum); + + /* Fill the inaccessible zero register with zero. */ + if (regnum == MIPS_ZERO_REGNUM || regnum == -1) + regcache->raw_supply_zeroed (MIPS_ZERO_REGNUM); + } } /* Store REGNO (or all registers if REGNO == -1) to the target