PTRACE_PEEKUSER can return -1, which is usually used to determine whether
a system call has reported an error, so errno must be used alone to
determine whether an error occurred. However errno isn't modified by a
successful system call so it must be reset to a known value (0) before the
syscall call.
Add the missing errno reset when reading the DSP_CONTROL register in the
native MIPS Linux backend and the MIPS gdbserver backend.
gdb/:
* mips-linux-nat.c (mips_linux_read_description): Reset errno to 0
prior to reading DSP_CONTROL with PTRACE_PEEKUSER ptrace call.
gdb/gdbserver/:
* linux-mips-low.c (mips_read_description): Reset errno to 0 prior
to reading DSP_CONTROL with PTRACE_PEEKUSER ptrace call.
+2014-09-03 James Hogan <james.hogan@imgtec.com>
+
+ * mips-linux-nat.c (mips_linux_read_description): Reset errno to 0
+ prior to reading DSP_CONTROL with PTRACE_PEEKUSER ptrace call.
+
2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com>
PR python/16699
+2014-09-03 James Hogan <james.hogan@imgtec.com>
+
+ * linux-mips-low.c (mips_read_description): Reset errno to 0 prior
+ to reading DSP_CONTROL with PTRACE_PEEKUSER ptrace call.
+
2014-09-03 Gary Benson <gbenson@redhat.com>
* linux-x86-low.c (x86_linux_prepare_to_resume): Use
{
int pid = lwpid_of (current_inferior);
+ errno = 0;
ptrace (PTRACE_PEEKUSER, pid, DSP_CONTROL, 0);
switch (errno)
{
if (tid == 0)
tid = ptid_get_pid (inferior_ptid);
+ errno = 0;
ptrace (PTRACE_PEEKUSER, tid, DSP_CONTROL, 0);
switch (errno)
{