From 3fadccb31d170305dfcf1fb0ee9b24eab9d79da3 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 20 Jun 2002 03:13:51 +0000 Subject: * regcache.h: Update copyright. (struct regcache, struct gdbarch): Add opaque declarations. (current_regcache): Declare global variable. (regcache_read, regcache_write): Add gdbarch parameter. (regcache_save, regcache_save_no_passthrough) (regcache_restore, regcache_restore_no_passthrough) (regcache_dup, regcache_dup_no_passthrough) (regcache_cpy, regcache_cpy_no_passthrough) (deprecated_grub_regcache_for_registers) (deprecated_grub_regcache_for_register_valid) (regcache_valid_p): Add function declarations. * regcache.c: Update copyright. (regcache_descr_handle): New global variable. (struct regcache_descr): Define. (init_legacy_regcache_descr, init_regcache_descr): New functions. (regcache_descr, xfree_regcache_descr): New functions. (struct regcache): Define. (regcache_xmalloc, regcache_xfree): New functions. (regcache_cpy, regcache_cpy_no_passthrough): New functions. (regcache_dup, regcache_dup_no_passthrough): New functions. (regcache_valid_p, regcache_read_as_address): New functions. (deprecated_grub_regcache_for_registers): New function. (deprecated_grub_regcache_for_register_valid): New function. (current_regcache): New global variable. (register_buffer): Add regcache parameter. Update calls. (regcache_read, regcache_write): Add regcache parameter. Rewrite. (read_register_gen, write_register_gen): Update register_buffer call. Test for legacy_p instead of gdbarch_register_read_p or gdbarch_register_write_p. (regcache_collect): Update register_buffer call. (build_regcache): Rewrite. Use deprecated grub functions. (regcache_save, regcache_save_no_passthrough): New functions. (regcache_restore, regcache_restore_no_passthrough): New functions. (_initialize_regcache): Create the regcache_data_handle. Swap current_regcache global variable. * sh-tdep.c (sh_pseudo_register_read): Add current_regcache parameter to regcache_read and regcache_write calls. (sh4_register_read): Ditto. (sh64_pseudo_register_read): Ditto. (sh64_register_read): Ditto. (sh_pseudo_register_write): Ditto. (sh4_register_write): Ditto. (sh64_pseudo_register_write): Ditto. (sh64_register_write): Ditto. * defs.h (XCALLOC): Define. --- gdb/regcache.h | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'gdb/regcache.h') diff --git a/gdb/regcache.h b/gdb/regcache.h index 4e854d3..4b564a8 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -1,6 +1,7 @@ /* Cache and manage the values of registers for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000, + 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -22,11 +23,21 @@ #ifndef REGCACHE_H #define REGCACHE_H +struct regcache; +struct gdbarch; + +extern struct regcache *current_regcache; + +void regcache_xfree (struct regcache *regcache); +struct regcache *regcache_xmalloc (struct gdbarch *gdbarch); + /* Transfer a raw register [0..NUM_REGS) between core-gdb and the regcache. */ -void regcache_read (int rawnum, char *buf); -void regcache_write (int rawnum, char *buf); +void regcache_read (struct regcache *regcache, int rawnum, char *buf); +void regcache_write (struct regcache *regcache, int rawnum, char *buf); +int regcache_valid_p (struct regcache *regcache, int regnum); +CORE_ADDR regcache_read_as_address (struct regcache *regcache, int rawnum); /* Transfer a raw register [0..NUM_REGS) between the regcache and the target. These functions are called by the target in response to a @@ -47,6 +58,25 @@ extern char *registers; extern signed char *register_valid; +/* Save/restore the register cache using the regbuf. The operation is + write through - it is strictly for code that needs to restore the + target's registers to a previous state. + + ``no passthrough'' versions do not go through to the target. They + only save values already in the cache. */ + +extern void regcache_save (struct regcache *regcache); +extern void regcache_restore (struct regcache *regcache); +extern struct regcache *regcache_dup (struct regcache *regcache); +extern void regcache_save_no_passthrough (struct regcache *regcache); +extern void regcache_restore_no_passthrough (struct regcache *regcache); +extern struct regcache *regcache_dup_no_passthrough (struct regcache *regcache); +extern void regcache_cpy (struct regcache *dest, struct regcache *src); +extern void regcache_cpy_no_passthrough (struct regcache *dest, struct regcache *src); + +extern char *deprecated_grub_regcache_for_registers (struct regcache *); +extern char *deprecated_grub_regcache_for_register_valid (struct regcache *); + extern int register_cached (int regnum); extern void set_register_cached (int regnum, int state); -- cgit v1.1