From 349d138559111de9e0ee57120e267005ac27cb6e Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 11 Oct 2011 18:35:26 +0000 Subject: Fix regcache_restore() handling of unavailable regs. * regcache.c (regcache_restore): Do not write unavailable regs, mark static. * regcache.h (regcache_restore): Remove declaration. --- gdb/regcache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gdb/regcache.c') diff --git a/gdb/regcache.c b/gdb/regcache.c index 37092f8..ea8189e 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -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); } } -- cgit v1.1