]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: Support read-only regsets in linux-low.c
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Fri, 12 Dec 2014 13:14:21 +0000 (14:14 +0100)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Fri, 12 Dec 2014 13:15:07 +0000 (14:15 +0100)
For GNU/Linux targets using the regsets interface, this change
supports regsets that can be read but not written.  The S390 "last
break" regset is an example.  So far it had been defined with
regset->set_request == PTRACE_GETREGSET, such that the respective
ptrace call does not cause any harm.  Now we just skip the whole
read/modify/write sequence for regsets that do not define a
fill_function.

gdb/gdbserver/ChangeLog:

* linux-low.c (regsets_store_inferior_registers): Skip regsets
without a fill_function.
* linux-s390-low.c (s390_fill_last_break): Remove.
(s390_regsets): Set fill_function to NULL for NT_S390_LAST_BREAK.
(s390_arch_setup): Use regset's size instead of fill_function for
loop end condition.

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

index 54caa55ef12d4d8b0cf8d482f4d247942181f2a6..781879371ccf45d909c74e2c9ea7b80cfc06a913 100644 (file)
@@ -1,3 +1,12 @@
+2014-12-12  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * linux-low.c (regsets_store_inferior_registers): Skip regsets
+       without a fill_function.
+       * linux-s390-low.c (s390_fill_last_break): Remove.
+       (s390_regsets): Set fill_function to NULL for NT_S390_LAST_BREAK.
+       (s390_arch_setup): Use regset's size instead of fill_function for
+       loop end condition.
+
 2014-12-12  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * linux-low.c (regsets_fetch_inferior_registers): Do not invoke
index c1b53ff42d1e7c1347b47139bb5921d47e9e6a58..5f6201072213ca7fcd14a49fc0676f0f976349ed 100644 (file)
@@ -4293,7 +4293,8 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
       void *buf, *data;
       int nt_type, res;
 
-      if (regset->size == 0 || regset_disabled (regsets_info, regset))
+      if (regset->size == 0 || regset_disabled (regsets_info, regset)
+         || regset->fill_function == NULL)
        continue;
 
       buf = xmalloc (regset->size);
index 79fa6c03e35f77bfdb381aae9e330acc200a90f3..9f77f301396b3010a9347a6caf57261cf2bc3772 100644 (file)
@@ -289,12 +289,6 @@ s390_fill_gregset (struct regcache *regcache, void *buf)
 
 /* Fill and store functions for extended register sets.  */
 
-static void
-s390_fill_last_break (struct regcache *regcache, void *buf)
-{
-  /* Last break address is read-only.  */
-}
-
 static void
 s390_store_last_break (struct regcache *regcache, const void *buf)
 {
@@ -318,9 +312,9 @@ s390_store_system_call (struct regcache *regcache, const void *buf)
 
 static struct regset_info s390_regsets[] = {
   { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
-  /* Last break address is read-only; do not attempt PTRACE_SETREGSET.  */
-  { PTRACE_GETREGSET, PTRACE_GETREGSET, NT_S390_LAST_BREAK, 0,
-    EXTENDED_REGS, s390_fill_last_break, s390_store_last_break },
+  /* Last break address is read-only; no fill function.  */
+  { PTRACE_GETREGSET, -1, NT_S390_LAST_BREAK, 0, EXTENDED_REGS,
+    NULL, s390_store_last_break },
   { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_SYSTEM_CALL, 0,
     EXTENDED_REGS, s390_fill_system_call, s390_store_system_call },
   { 0, 0, 0, -1, -1, NULL, NULL }
@@ -485,7 +479,7 @@ s390_arch_setup (void)
 #endif
 
   /* Update target_regsets according to available register sets.  */
-  for (regset = s390_regsets; regset->fill_function != NULL; regset++)
+  for (regset = s390_regsets; regset->size >= 0; regset++)
     if (regset->get_request == PTRACE_GETREGSET)
       switch (regset->nt_type)
        {