* regcache.c (regcache_raw_read): If the target didn't supply a
authorPedro Alves <palves@redhat.com>
Thu, 24 Mar 2011 11:22:03 +0000 (11:22 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 24 Mar 2011 11:22:03 +0000 (11:22 +0000)
given raw register, mark it as unavailable.

gdb/ChangeLog
gdb/regcache.c

index 8f259c1aa38aa969e4073a06b717280d03cdace7..e5600dcedeb7574932334369546f58127f82f8e2 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-23  Pedro Alves  <pedro@codesourcery.com>
+
+       * regcache.c (regcache_raw_read): If the target didn't supply a
+       given raw register, mark it as unavailable.
+
 2011-03-23  Kai Tietz  <ktietz@redhat.com>
 
        * breakpoint.c (clear_command): Use filename_cmp
index b984bc1400b08b3c1e92ef588ff64ee3a80885b8..fbdecccbb164309abf68175efab0472a2b0fd087 100644 (file)
@@ -586,25 +586,20 @@ regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
      to the current thread.  This switching shouldn't be necessary
      only there is still only one target side register cache.  Sigh!
      On the bright side, at least there is a regcache object.  */
-  if (!regcache->readonly_p)
+  if (!regcache->readonly_p
+      && regcache_register_status (regcache, regnum) == REG_UNKNOWN)
     {
-      if (regcache_register_status (regcache, regnum) == REG_UNKNOWN)
-       {
-         struct cleanup *old_chain = save_inferior_ptid ();
+      struct cleanup *old_chain = save_inferior_ptid ();
 
-         inferior_ptid = regcache->ptid;
-         target_fetch_registers (regcache, regnum);
-         do_cleanups (old_chain);
-       }
-#if 0
-      /* FIXME: cagney/2004-08-07: At present a number of targets
-        forget (or didn't know that they needed) to set this leading to
-        panics.  Also is the problem that targets need to indicate
-        that a register is in one of the possible states: valid,
-        undefined, unknown.  The last of which isn't yet
-        possible.  */
-      gdb_assert (regcache_register_status (regcache, regnum) == REG_VALID);
-#endif
+      inferior_ptid = regcache->ptid;
+      target_fetch_registers (regcache, regnum);
+      do_cleanups (old_chain);
+
+      /* A number of targets can't access the whole set of raw
+        registers (because the debug API provides no means to get at
+        them).  */
+      if (regcache->register_status[regnum] == REG_UNKNOWN)
+       regcache->register_status[regnum] = REG_UNAVAILABLE;
     }
 
   if (regcache->register_status[regnum] != REG_VALID)
This page took 0.046987 seconds and 4 git commands to generate.