Fix regcache_restore() handling of unavailable regs.

* regcache.c (regcache_restore): Do not write unavailable regs, mark
	static.
	* regcache.h (regcache_restore): Remove declaration.
This commit is contained in:
David S. Miller
2011-10-11 18:35:26 +00:00
parent bfb6c1ab1e
commit 349d138559
3 changed files with 10 additions and 6 deletions

View 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);
}
}