This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 01/13] New regcache_raw_get_signed
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 14 Nov 2016 17:42:38 +0000
- Subject: [PATCH 01/13] New regcache_raw_get_signed
- Authentication-results: sourceware.org; auth=none
- References: <1479145370-11432-1-git-send-email-yao.qi@linaro.org>
This patch adds a new regcache api regcache_raw_get_signed.
gdb:
2016-11-14 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache_raw_get_signed): New function.
* regcache.h (regcache_raw_get_signed): Declare.
---
gdb/regcache.c | 13 +++++++++++++
gdb/regcache.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index a5c90a6..1fcf933 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -742,6 +742,19 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
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)
{
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 1bb0ce0..19ea976 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -66,6 +66,9 @@ extern void regcache_raw_write_signed (struct regcache *regcache,
extern void regcache_raw_write_unsigned (struct regcache *regcache,
int regnum, ULONGEST val);
+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
--
1.9.1