+2017-04-26 Alan Hayward <alan.hayward@arm.com>
+
+ * nds32-tdep.c (nds32_pseudo_register_read): Abort on errors.
+ (nds32_pseudo_register_write): Likewise.
+
2017-04-25 Yao Qi <yao.qi@linaro.org>
* regcache.c (struct regcache) <readonly_p>: Change its type
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
gdb_byte reg_buf[8];
int offset, fdr_regnum;
- enum register_status status = REG_UNKNOWN;
+ enum register_status status;
- /* Sanity check. */
- if (tdep->fpu_freg == -1 || tdep->use_pseudo_fsrs == 0)
- return status;
+ /* This function is registered in nds32_gdbarch_init only after these are
+ set. */
+ gdb_assert (tdep->fpu_freg != -1);
+ gdb_assert (tdep->use_pseudo_fsrs != 0);
regnum -= gdbarch_num_regs (gdbarch);
status = regcache_raw_read (regcache, fdr_regnum, reg_buf);
if (status == REG_VALID)
memcpy (buf, reg_buf + offset, 4);
+
+ return status;
}
- return status;
+ gdb_assert_not_reached ("invalid pseudo register number");
}
/* Implement the "pseudo_register_write" gdbarch method. */
gdb_byte reg_buf[8];
int offset, fdr_regnum;
- /* Sanity check. */
- if (tdep->fpu_freg == -1 || tdep->use_pseudo_fsrs == 0)
- return;
+ /* This function is registered in nds32_gdbarch_init only after these are
+ set. */
+ gdb_assert (tdep->fpu_freg != -1);
+ gdb_assert (tdep->use_pseudo_fsrs != 0);
regnum -= gdbarch_num_regs (gdbarch);
regcache_raw_read (regcache, fdr_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
regcache_raw_write (regcache, fdr_regnum, reg_buf);
+ return;
}
+
+ gdb_assert_not_reached ("invalid pseudo register number");
}
\f
/* Helper function for NDS32 ABI. Return true if FPRs can be used