aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-04-28 22:48:42 +0100
committerYao Qi <yao.qi@linaro.org>2017-04-28 22:48:42 +0100
commitb421c83cb866120ab347d60fda20fb0e2011be8c (patch)
tree858d03ddacad0b9a203a7a3de4f01bb450fad271 /gdb/regcache.c
parentef79d9a3c6ed1e3ccd466bae76956019a7c5d376 (diff)
downloadgdb-b421c83cb866120ab347d60fda20fb0e2011be8c.zip
gdb-b421c83cb866120ab347d60fda20fb0e2011be8c.tar.gz
gdb-b421c83cb866120ab347d60fda20fb0e2011be8c.tar.bz2
Simplify regcache_dup
regcache_dup, in fact, is to create a readonly regcache from a non-readonly regcache. This patch adds an assert that src is not readonly. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache_dup): Assert !src->m_readonly_p and call method save instead of regcache_cpy. * regcache.h (struct regcache): Make regcache_dup a friend.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 11f6a87..c30d1c7 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -422,8 +422,9 @@ regcache_dup (struct regcache *src)
{
struct regcache *newbuf;
+ gdb_assert (!src->m_readonly_p);
newbuf = regcache_xmalloc (src->arch (), get_regcache_aspace (src));
- regcache_cpy (newbuf, src);
+ newbuf->save (do_cooked_read, src);
return newbuf;
}