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.
This commit is contained in:
parent
ef79d9a3c6
commit
b421c83cb8
3 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2017-04-28 Yao Qi <yao.qi@linaro.org>
|
||||
|
||||
* regcache.c (struct regcache): Move to regcache.h
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,6 +373,9 @@ private:
|
|||
|
||||
friend void
|
||||
regcache_cpy (struct regcache *dst, struct regcache *src);
|
||||
|
||||
friend struct regcache *
|
||||
regcache_dup (struct regcache *src);
|
||||
};
|
||||
|
||||
/* Copy/duplicate the contents of a register cache. By default, the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue