aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-mips-low.c
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2014-09-01 22:48:40 +0100
committerMaciej W. Rozycki <macro@codesourcery.com>2014-09-03 22:09:10 +0100
commitac740bc7a9103a561329ebf7aa05ff31bcab2267 (patch)
tree6b3243a23c0c7bddbfcfdbe9eeaa11ee97798f67 /gdb/gdbserver/linux-mips-low.c
parent7d793aa9f0986828d5dde8f3811a7adafc38b6b4 (diff)
downloadgdb-ac740bc7a9103a561329ebf7aa05ff31bcab2267.zip
gdb-ac740bc7a9103a561329ebf7aa05ff31bcab2267.tar.gz
gdb-ac740bc7a9103a561329ebf7aa05ff31bcab2267.tar.bz2
Reset errno before PTRACE_PEEKUSER for MIPS DSP_CONTROL
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.
Diffstat (limited to 'gdb/gdbserver/linux-mips-low.c')
-rw-r--r--gdb/gdbserver/linux-mips-low.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 1b2160b..377284b 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -128,6 +128,7 @@ mips_read_description (void)
{
int pid = lwpid_of (current_inferior);
+ errno = 0;
ptrace (PTRACE_PEEKUSER, pid, DSP_CONTROL, 0);
switch (errno)
{