2002-11-13 Andrew Cagney <cagney@redhat.com>

* regcache.c (struct regcache): Replace passthough_p with
	readonly_p.
	(regcache_xmalloc): Initialize readonly_p.
	(build_regcache): Initialize readonly_p.
	(regcache_save): New function.
	(regcache_restore): New function.
	(regcache_cpy): Re-implement using regcache_save and
	regcache_restore.
	(regcache_raw_read): Update.
	(regcache_cooked_read): When a read-only cache, checked for cached
	pseudo register values.
	(regcache_raw_write): Assert that the cache is not read-only.
	Remove code handling a non-passthrough cache.
	* regcache.h (regcache_save): Declare.
	(regcache_restore): Declare.
This commit is contained in:
Andrew Cagney
2002-11-13 17:59:40 +00:00
parent 067df2e5b4
commit 2d28509afb
3 changed files with 108 additions and 46 deletions

View File

@@ -134,6 +134,16 @@ extern int max_register_size (struct gdbarch *gdbarch);
extern char *registers;
/* Save/restore a register cache. The registers saved/restored is
determined by the save_reggroup and restore_reggroup (although you
can't restore a register that wasn't saved as well :-). You can
only save to a read-only cache (default from regcache_xmalloc())
from a live cache and you can only restore from a read-only cache
to a live cache. */
extern void regcache_save (struct regcache *dst, struct regcache *src);
extern void regcache_restore (struct regcache *dst, struct regcache *src);
/* Copy/duplicate the contents of a register cache. By default, the
operation is pass-through. Writes to DST and reads from SRC will
go through to the target.