This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]