OSDN Git Service

Fix regcache_restore() handling of unavailable regs.
authordavem <davem>
Tue, 11 Oct 2011 18:35:25 +0000 (18:35 +0000)
committerdavem <davem>
Tue, 11 Oct 2011 18:35:25 +0000 (18:35 +0000)
* regcache.c (regcache_restore): Do not write unavailable regs, mark
static.
* regcache.h (regcache_restore): Remove declaration.

gdb/ChangeLog
gdb/regcache.c
gdb/regcache.h

index ccd0530..e871fb1 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-11  David S. Miller  <davem@davemloft.net>
+
+       * regcache.c (regcache_restore): Do not write unavailable regs, mark
+       static.
+       * regcache.h (regcache_restore): Remove declaration.
+
 2011-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Revert this part of:
index 37092f8..ea8189e 100644 (file)
@@ -331,7 +331,7 @@ regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
     }
 }
 
-void
+static void
 regcache_restore (struct regcache *dst,
                  regcache_cooked_read_ftype *cooked_read,
                  void *cooked_read_context)
@@ -351,9 +351,10 @@ regcache_restore (struct regcache *dst,
     {
       if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
        {
-         int valid = cooked_read (cooked_read_context, regnum, buf);
+         enum register_status status;
 
-         if (valid)
+         status = cooked_read (cooked_read_context, regnum, buf);
+         if (status == REG_VALID)
            regcache_cooked_write (dst, regnum, buf);
        }
     }
index 5531f39..440fbe6 100644 (file)
@@ -174,9 +174,6 @@ typedef enum register_status (regcache_cooked_read_ftype) (void *src,
 extern void regcache_save (struct regcache *dst,
                           regcache_cooked_read_ftype *cooked_read,
                           void *cooked_read_context);
-extern void regcache_restore (struct regcache *dst,
-                             regcache_cooked_read_ftype *cooked_read,
-                             void *cooked_read_context);
 
 /* Copy/duplicate the contents of a register cache.  By default, the
    operation is pass-through.  Writes to DST and reads from SRC will