]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/xtensa-tdep.c
gdb/
[thirdparty/binutils-gdb.git] / gdb / xtensa-tdep.c
index 1bb97ba1730f6a19fc7a8586d80a0afc492f5235..316a8cf5194a87b237de217d0eaa17492069c5e2 100644 (file)
@@ -453,7 +453,7 @@ xtensa_register_write_masked (struct regcache *regcache,
 /* Read a tie state or mapped registers.  Read the masked areas
    of the registers and assemble them into a single value.  */
 
-static void
+static enum register_status
 xtensa_register_read_masked (struct regcache *regcache,
                             xtensa_register_t *reg, gdb_byte *buffer)
 {
@@ -479,8 +479,12 @@ xtensa_register_read_masked (struct regcache *regcache,
       int r = mask->mask[i].reg_num;
       if (r >= 0)
        {
+         enum register_status status;
          ULONGEST val;
-         regcache_cooked_read_unsigned (regcache, r, &val);
+
+         status = regcache_cooked_read_unsigned (regcache, r, &val);
+         if (status != REG_VALID)
+           return status;
          regval = (unsigned int) val;
        }
       else
@@ -535,12 +539,14 @@ xtensa_register_read_masked (struct regcache *regcache,
        buffer[i] = mem & 0xff;
        mem >>= 8;
       }
+
+  return REG_VALID;
 }
 
 
 /* Read pseudo registers.  */
 
-static void
+static enum register_status
 xtensa_pseudo_register_read (struct gdbarch *gdbarch,
                             struct regcache *regcache,
                             int regnum,
@@ -561,16 +567,20 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       && (regnum <= gdbarch_tdep (gdbarch)->a0_base + 15))
     {
       gdb_byte *buf = (gdb_byte *) alloca (MAX_REGISTER_SIZE);
+      enum register_status status;
 
-      regcache_raw_read (regcache, gdbarch_tdep (gdbarch)->wb_regnum, buf);
+      status = regcache_raw_read (regcache,
+                                 gdbarch_tdep (gdbarch)->wb_regnum,
+                                 buf);
+      if (status != REG_VALID)
+       return status;
       regnum = arreg_number (gdbarch, regnum,
                             extract_unsigned_integer (buf, 4, byte_order));
     }
 
   /* We can always read non-pseudo registers.  */
   if (regnum >= 0 && regnum < gdbarch_num_regs (gdbarch))
-    regcache_raw_read (regcache, regnum, buffer);
-
+    return regcache_raw_read (regcache, regnum, buffer);
 
   /* We have to find out how to deal with priveleged registers.
      Let's treat them as pseudo-registers, but we cannot read/write them.  */
@@ -581,6 +591,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
       buffer[1] = (gdb_byte)0;
       buffer[2] = (gdb_byte)0;
       buffer[3] = (gdb_byte)0;
+      return REG_VALID;
     }
   /* Pseudo registers.  */
   else if (regnum >= 0
@@ -598,7 +609,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
            {
              warning (_("cannot read register %s"),
                       xtensa_register_name (gdbarch, regnum));
-             return;
+             return REG_VALID;
            }
        }
 
@@ -609,26 +620,23 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
          if (flags & xtTargetFlagsUseFetchStore)
            {
              warning (_("cannot read register"));
-             return;
+             return REG_VALID;
            }
 
          /* On some targets (esp. simulators), we can always read the reg.  */
          else if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
            {
              warning (_("cannot read register"));
-             return;
+             return REG_VALID;
            }
        }
 
       /* We can always read mapped registers.  */
       else if (type == xtRegisterTypeMapped || type == xtRegisterTypeTieState)
-        {
-         xtensa_register_read_masked (regcache, reg, buffer);
-         return;
-       }
+       return xtensa_register_read_masked (regcache, reg, buffer);
 
       /* Assume that we can read the register.  */
-      regcache_raw_read (regcache, regnum, buffer);
+      return regcache_raw_read (regcache, regnum, buffer);
     }
   else
     internal_error (__FILE__, __LINE__,