aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2018-01-16 09:05:39 +0000
committerYao Qi <yao.qi@linaro.org>2018-01-16 09:05:39 +0000
commit9a70f35c8d872bb5542e98e34b8b044228dcb844 (patch)
treed900716170178ddf74ebc25b7308aa5a998063ff
parent46a7082471545e05e7161737fa3b6f597e150b72 (diff)
downloadgdb-9a70f35c8d872bb5542e98e34b8b044228dcb844.zip
gdb-9a70f35c8d872bb5542e98e34b8b044228dcb844.tar.gz
gdb-9a70f35c8d872bb5542e98e34b8b044228dcb844.tar.bz2
Mark register unavailable when PTRACE_PEEKUSER fails
As described in PR 18749, GDB/GDBserver may get an error on accessing memory or register because the thread may disappear. However, some path doesn't expect the error. This patch fixes this problem by marking the register unavailable when PTRACE_PEEKUSER fails instead of throwing error. gdb/gdbserver: 2018-01-16 Yao Qi <yao.qi@linaro.org> PR gdb/18749 * linux-low.c (fetch_register): Call supply_register instead of error.
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/linux-low.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 32a5157..be8c48f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-16 Yao Qi <yao.qi@linaro.org>
+
+ PR gdb/18749
+ * linux-low.c (fetch_register): Call supply_register instead of
+ error.
+
2018-01-08 Yao Qi <yao.qi@linaro.org>
Simon Marchi <simon.marchi@ericsson.com>
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index cfb2b56..d8e1226 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5555,7 +5555,11 @@ fetch_register (const struct usrregs_info *usrregs,
(PTRACE_TYPE_ARG3) (uintptr_t) regaddr, (PTRACE_TYPE_ARG4) 0);
regaddr += sizeof (PTRACE_XFER_TYPE);
if (errno != 0)
- error ("reading register %d: %s", regno, strerror (errno));
+ {
+ /* Mark register REGNO unavailable. */
+ supply_register (regcache, regno, NULL);
+ return;
+ }
}
if (the_low_target.supply_ptrace_register)