Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix regcache_restore() handling of unavailable regs.
@ 2011-10-11  6:40 David Miller
  2011-10-11 10:45 ` Pedro Alves
  2011-10-11 10:50 ` Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: David Miller @ 2011-10-11  6:40 UTC (permalink / raw)
  To: gdb-patches


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-11 18:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11  6:40 [PATCH] Fix regcache_restore() handling of unavailable regs David Miller
2011-10-11 10:45 ` Pedro Alves
2011-10-11 18:28   ` David Miller
2011-10-11 10:50 ` Pedro Alves
2011-10-11 18:28   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox