mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-31 18:20:12 +08:00
Remove regcache_save and regcache_cpy
... instead we start to use regcache methods save and restore. It is quite straightforward to replace regcache_save with regcache->save. regcache_cpy has some asserts, some of them not necessary, like gdb_assert (src != dst); because we already assert !m_readonly_p and src->m_readonly_p, so src isn't dst. Some of the asserts are moved to ::restore. gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * frame.c (frame_save_as_regcache): Use regcache method save. (frame_pop): Use regcache method restore. * infrun.c (restore_infcall_suspend_state): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. * ppc-linux-tdep.c (ppu2spu_sniffer): User regcache method save. * regcache.c (regcache_save): Remove. (regcache::restore): More asserts. (regcache_cpy): Remove. * regcache.h (regcache_save): Remove the declaration. (regcache::restore): Move from private to public. Remove the friend declaration of regcache_cpy. (regcache_cpy): Remove declaration.
This commit is contained in:
@ -1023,7 +1023,7 @@ frame_save_as_regcache (struct frame_info *this_frame)
|
||||
std::unique_ptr<struct regcache> regcache
|
||||
(new struct regcache (get_frame_arch (this_frame)));
|
||||
|
||||
regcache_save (regcache.get (), do_frame_register_read, this_frame);
|
||||
regcache->save (do_frame_register_read, this_frame);
|
||||
return regcache;
|
||||
}
|
||||
|
||||
@ -1068,9 +1068,8 @@ frame_pop (struct frame_info *this_frame)
|
||||
Unfortunately, they don't implement it. Their lack of a formal
|
||||
definition can lead to targets writing back bogus values
|
||||
(arguably a bug in the target code mind). */
|
||||
/* Now copy those saved registers into the current regcache.
|
||||
Here, regcache_cpy() calls regcache_restore(). */
|
||||
regcache_cpy (get_current_regcache (), scratch.get ());
|
||||
/* Now copy those saved registers into the current regcache. */
|
||||
get_current_regcache ()->restore (scratch.get ());
|
||||
|
||||
/* We've made right mess of GDB's local state, just discard
|
||||
everything. */
|
||||
|
Reference in New Issue
Block a user