This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix regcache_restore() handling of unavailable regs.
- From: David Miller <davem at davemloft dot net>
- To: gdb-patches at sourceware dot org
- Date: Tue, 11 Oct 2011 02:40:27 -0400 (EDT)
- Subject: [PATCH] Fix regcache_restore() handling of unavailable regs.
Across inferior dummy calls, regcache entries which were "unavailable"
were restored incorrectly after such dummy calls. The problem is
incorrect interpretation of cooked_read()'s return value in
regcache_restore().
Ok to commit?
BTW, regcache_restore() seems to not be used outside of regcache.c
any more. We should probably mark it static and remove the extern
from regcache.h
gdb/
* regcache.c (regcache_restore): Do not write unavailable regs.
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 37092f8..3fb6811 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -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);
}
}