Mark register unavailable when PTRACE_PEEKUSER fails
authorYao Qi <yao.qi@linaro.org>
Tue, 16 Jan 2018 09:05:39 +0000 (09:05 +0000)
committerYao Qi <yao.qi@linaro.org>
Tue, 16 Jan 2018 09:05:39 +0000 (09:05 +0000)
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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c

index 32a515728f327fd64e2a82c31a693ce93b8e0b8b..be8c48f0f79d656e908fccb0fe740be54a09eee5 100644 (file)
@@ -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>
 
index cfb2b56a08966fb80d6a49eaf853c1db4555f0b6..d8e122603cbbe9d6020ea472dce7272418e75936 100644 (file)
@@ -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)
This page took 0.036521 seconds and 4 git commands to generate.