aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-06-11 10:09:30 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-06-11 10:09:30 +0100
commitf868386e72baad6f35d4288f433266e03ed2753d (patch)
treeb82c89d28fcca4f7e8fdcbc82acfae391f1222af /gdb/regcache.c
parent9c861883169cb9eec4581ab6db3a1b711e79ee10 (diff)
downloadgdb-f868386e72baad6f35d4288f433266e03ed2753d.zip
gdb-f868386e72baad6f35d4288f433266e03ed2753d.tar.gz
gdb-f868386e72baad6f35d4288f433266e03ed2753d.tar.bz2
Add regcache raw_compare method
gdb/ * common/common-regcache.h (raw_compare): New function. * regcache.c (regcache::raw_compare): Likewise. * regcache.h (regcache::raw_compare): New declaration. gdbserver/ * regcache.c (regcache::raw_compare): New function. * regcache.h (regcache::raw_compare): New declaration.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c10c588..750ea2a 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1079,6 +1079,20 @@ regcache::collect_regset (const struct regset *regset,
transfer_regset (regset, NULL, regnum, NULL, buf, size);
}
+/* See common/common-regcache.h. */
+
+bool
+reg_buffer::raw_compare (int regnum, const void *buf, int offset) const
+{
+ gdb_assert (buf != NULL);
+ assert_regnum (regnum);
+
+ const char *regbuf = (const char *) register_buffer (regnum);
+ size_t size = m_descr->sizeof_register[regnum];
+ gdb_assert (size >= offset);
+
+ return (memcmp (buf, regbuf + offset, size - offset) == 0);
+}
/* Special handling for register PC. */