This patch adds a new regcache api regcache_raw_get_signed.
gdb:
2016-11-22 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache_raw_get_signed): New function.
* regcache.h (regcache_raw_get_signed): Declare.
+2016-11-22 Yao Qi <yao.qi@linaro.org>
+
+ * regcache.c (regcache_raw_get_signed): New function.
+ * regcache.h (regcache_raw_get_signed): Declare.
+
2016-11-22 Yao Qi <yao.qi@linaro.org>
* value.c (value_from_component): Use VALUE_NEXT_FRAME_ID
regcache_raw_write (regcache, regnum, buf);
}
+LONGEST
+regcache_raw_get_signed (struct regcache *regcache, int regnum)
+{
+ LONGEST value;
+ enum register_status status;
+
+ status = regcache_raw_read_signed (regcache, regnum, &value);
+ if (status == REG_UNAVAILABLE)
+ throw_error (NOT_AVAILABLE_ERROR,
+ _("Register %d is not available"), regnum);
+ return value;
+}
+
enum register_status
regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
extern void regcache_raw_write_unsigned (struct regcache *regcache,
int regnum, ULONGEST val);
+/* Return the register's value in signed or throw if it's not
+ available. */
+
+extern LONGEST regcache_raw_get_signed (struct regcache *regcache,
+ int regnum);
+
/* Set a raw register's value in the regcache's buffer. Unlike
regcache_raw_write, this is not write-through. The intention is
allowing to change the buffer contents of a read-only regcache