2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
/* Cache and manage the values of registers for GDB, the GNU debugger.
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
|
2005-12-17 23:34:03 +01:00
|
|
|
Copyright (C) 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000,
|
2004-02-12 01:17:53 +01:00
|
|
|
2001, 2002, 2004 Free Software Foundation, Inc.
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-12-17 23:34:03 +01:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "gdbarch.h"
|
2000-09-01 19:59:26 +02:00
|
|
|
#include "gdbcmd.h"
|
2001-03-01 02:39:22 +01:00
|
|
|
#include "regcache.h"
|
2002-11-02 16:13:34 +01:00
|
|
|
#include "reggroups.h"
|
2001-03-24 02:26:09 +01:00
|
|
|
#include "gdb_assert.h"
|
2002-08-02 22:51:21 +02:00
|
|
|
#include "gdb_string.h"
|
2002-08-10 02:36:46 +02:00
|
|
|
#include "gdbcmd.h" /* For maintenanceprintlist. */
|
2004-04-26 11:49:36 +02:00
|
|
|
#include "observer.h"
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DATA STRUCTURE
|
|
|
|
*
|
|
|
|
* Here is the actual register cache.
|
|
|
|
*/
|
|
|
|
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
/* Per-architecture object describing the layout of a register cache.
|
|
|
|
Computed once when the architecture is created */
|
|
|
|
|
|
|
|
struct gdbarch_data *regcache_descr_handle;
|
|
|
|
|
|
|
|
struct regcache_descr
|
|
|
|
{
|
|
|
|
/* The architecture this descriptor belongs to. */
|
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
|
2003-07-28 17:41:19 +02:00
|
|
|
/* The raw register cache. Each raw (or hard) register is supplied
|
|
|
|
by the target interface. The raw cache should not contain
|
|
|
|
redundant information - if the PC is constructed from two
|
2005-03-10 03:43:23 +01:00
|
|
|
registers then those registers and not the PC lives in the raw
|
2003-07-28 17:41:19 +02:00
|
|
|
cache. */
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
int nr_raw_registers;
|
|
|
|
long sizeof_raw_registers;
|
|
|
|
long sizeof_raw_register_valid_p;
|
|
|
|
|
2002-07-29 21:54:42 +02:00
|
|
|
/* The cooked register space. Each cooked register in the range
|
|
|
|
[0..NR_RAW_REGISTERS) is direct-mapped onto the corresponding raw
|
|
|
|
register. The remaining [NR_RAW_REGISTERS
|
2004-05-14 09:17:45 +02:00
|
|
|
.. NR_COOKED_REGISTERS) (a.k.a. pseudo registers) are mapped onto
|
2002-07-29 21:54:42 +02:00
|
|
|
both raw registers and memory by the architecture methods
|
2004-05-14 09:17:45 +02:00
|
|
|
gdbarch_pseudo_register_read and gdbarch_pseudo_register_write. */
|
2002-07-29 21:54:42 +02:00
|
|
|
int nr_cooked_registers;
|
2002-11-13 17:57:36 +01:00
|
|
|
long sizeof_cooked_registers;
|
|
|
|
long sizeof_cooked_register_valid_p;
|
2002-07-29 21:54:42 +02:00
|
|
|
|
|
|
|
/* Offset and size (in 8 bit bytes), of reach register in the
|
|
|
|
register cache. All registers (including those in the range
|
|
|
|
[NR_RAW_REGISTERS .. NR_COOKED_REGISTERS) are given an offset.
|
|
|
|
Assigning all registers an offset makes it possible to keep
|
|
|
|
legacy code, such as that found in read_register_bytes() and
|
|
|
|
write_register_bytes() working. */
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
long *register_offset;
|
|
|
|
long *sizeof_register;
|
|
|
|
|
2002-08-25 17:36:11 +02:00
|
|
|
/* Cached table containing the type of each register. */
|
|
|
|
struct type **register_type;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void *
|
|
|
|
init_regcache_descr (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct regcache_descr *descr;
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
|
2002-08-25 17:36:11 +02:00
|
|
|
/* Create an initial, zero filled, table. */
|
2003-08-04 23:12:46 +02:00
|
|
|
descr = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct regcache_descr);
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
descr->gdbarch = gdbarch;
|
|
|
|
|
2002-07-29 21:54:42 +02:00
|
|
|
/* Total size of the register space. The raw registers are mapped
|
|
|
|
directly onto the raw register cache while the pseudo's are
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
either mapped onto raw-registers or memory. */
|
2002-07-29 21:54:42 +02:00
|
|
|
descr->nr_cooked_registers = NUM_REGS + NUM_PSEUDO_REGS;
|
2002-11-13 17:57:36 +01:00
|
|
|
descr->sizeof_cooked_register_valid_p = NUM_REGS + NUM_PSEUDO_REGS;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
|
2002-08-25 17:36:11 +02:00
|
|
|
/* Fill in a table of register types. */
|
2003-08-04 23:12:46 +02:00
|
|
|
descr->register_type
|
|
|
|
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, struct type *);
|
2002-08-25 17:36:11 +02:00
|
|
|
for (i = 0; i < descr->nr_cooked_registers; i++)
|
2004-08-02 23:07:17 +02:00
|
|
|
descr->register_type[i] = gdbarch_register_type (gdbarch, i);
|
2002-08-25 17:36:11 +02:00
|
|
|
|
2003-07-28 17:41:19 +02:00
|
|
|
/* Construct a strictly RAW register cache. Don't allow pseudo's
|
|
|
|
into the register cache. */
|
|
|
|
descr->nr_raw_registers = NUM_REGS;
|
|
|
|
|
|
|
|
/* FIXME: cagney/2002-08-13: Overallocate the register_valid_p
|
|
|
|
array. This pretects GDB from erant code that accesses elements
|
|
|
|
of the global register_valid_p[] array in the range [NUM_REGS
|
|
|
|
.. NUM_REGS + NUM_PSEUDO_REGS). */
|
|
|
|
descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
|
|
|
|
|
2002-11-13 17:57:36 +01:00
|
|
|
/* Lay out the register cache.
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
|
2002-08-25 17:36:11 +02:00
|
|
|
NOTE: cagney/2002-05-22: Only register_type() is used when
|
|
|
|
constructing the register cache. It is assumed that the
|
|
|
|
register's raw size, virtual size and type length are all the
|
|
|
|
same. */
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
long offset = 0;
|
2003-08-04 23:12:46 +02:00
|
|
|
descr->sizeof_register
|
|
|
|
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
|
|
|
|
descr->register_offset
|
|
|
|
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
|
2002-07-29 21:54:42 +02:00
|
|
|
for (i = 0; i < descr->nr_cooked_registers; i++)
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
{
|
2002-08-25 17:36:11 +02:00
|
|
|
descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
descr->register_offset[i] = offset;
|
|
|
|
offset += descr->sizeof_register[i];
|
2003-05-08 Andrew Cagney <cagney@redhat.com>
* regcache.h (max_register_size): Delete declaration.
* regcache.c (max_register_size): Delete function.
(struct regcache_descr): Delete field "max_register_size".
(init_regcache_descr, init_legacy_regcache_descr): Assert that all
registers fit in MAX_REGISTER_SIZE.
(regcache_save): Replace max_register_size with MAX_REGISTER_SIZE.
(regcache_restore, regcache_xfer_part, regcache_dump): Ditto.
* thread-db.c: Replace max_register_size with MAX_REGISTER_SIZE.
* sh-tdep.c, rom68k-rom.c, remote-sim.c, remote-mips.c: Ditto.
* remote-e7000.c, monitor.c, mipsv4-nat.c, mips-nat.c: Ditto.
* m68klinux-nat.c, lynx-nat.c, irix4-nat.c: Ditto.
* hpux-thread.c, hppah-nat.c, hppab-nat.c, hppa-tdep.c: Ditto.
* dve3900-rom.c, hppa-tdep.c: Ditto.
2003-05-09 00:33:14 +02:00
|
|
|
gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
/* Set the real size of the register cache buffer. */
|
2002-11-13 17:57:36 +01:00
|
|
|
descr->sizeof_cooked_registers = offset;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
|
2002-11-13 17:57:36 +01:00
|
|
|
/* FIXME: cagney/2002-05-22: Should only need to allocate space for
|
Index: mi/ChangeLog
2003-10-24 Andrew Cagney <cagney@redhat.com>
* tui-out.c: Fix "fortunatly"[sic].
Index: doc/ChangeLog
2003-10-24 Andrew Cagney <cagney@redhat.com>
* annotate.texinfo: Fix "fortunatly"[sic].
2003-10-24 Andrew Cagney <cagney@redhat.com>
* osabi.c (gdbarch_init_osabi): Fix typos, and "fortunatly"[sic].
* PROBLEMS, arch-utils.c, cli-out.c, command.h: Ditto.
* complaints.c, cris-tdep.c, disasm.c, dwarf2-frame.c: Ditto.
* frame.c, frame.h, infcall.c, infcmd.c, infrun.c: Ditto.
* kod.c, mips-tdep.c, regcache.c, regcache.h, remote.c: Ditto.
2003-10-24 19:37:04 +02:00
|
|
|
the raw registers. Unfortunately some code still accesses the
|
2002-11-13 17:57:36 +01:00
|
|
|
register array directly using the global registers[]. Until that
|
|
|
|
code has been purged, play safe and over allocating the register
|
|
|
|
buffer. Ulgh! */
|
|
|
|
descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
|
|
|
|
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
return descr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct regcache_descr *
|
|
|
|
regcache_descr (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
return gdbarch_data (gdbarch, regcache_descr_handle);
|
|
|
|
}
|
|
|
|
|
2002-08-25 17:36:11 +02:00
|
|
|
/* Utility functions returning useful register attributes stored in
|
|
|
|
the regcache descr. */
|
|
|
|
|
|
|
|
struct type *
|
|
|
|
register_type (struct gdbarch *gdbarch, int regnum)
|
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache_descr (gdbarch);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
|
|
|
|
return descr->register_type[regnum];
|
|
|
|
}
|
|
|
|
|
2002-08-25 16:44:04 +02:00
|
|
|
/* Utility functions returning useful register attributes stored in
|
|
|
|
the regcache descr. */
|
|
|
|
|
2003-02-28 18:47:43 +01:00
|
|
|
int
|
|
|
|
register_size (struct gdbarch *gdbarch, int regnum)
|
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache_descr (gdbarch);
|
|
|
|
int size;
|
|
|
|
gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
|
|
|
|
size = descr->sizeof_register[regnum];
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
/* The register cache for storing raw register values. */
|
|
|
|
|
|
|
|
struct regcache
|
|
|
|
{
|
|
|
|
struct regcache_descr *descr;
|
2002-11-13 17:07:03 +01:00
|
|
|
/* The register buffers. A read-only register cache can hold the
|
|
|
|
full [0 .. NUM_REGS + NUM_PSEUDO_REGS) while a read/write
|
|
|
|
register cache can only hold [0 .. NUM_REGS). */
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *registers;
|
|
|
|
gdb_byte *register_valid_p;
|
2002-11-13 18:59:40 +01:00
|
|
|
/* Is this a read-only cache? A read-only cache is used for saving
|
|
|
|
the target's register state (e.g, across an inferior function
|
|
|
|
call or just before forcing a function return). A read-only
|
|
|
|
cache can only be updated via the methods regcache_dup() and
|
|
|
|
regcache_cpy(). The actual contents are determined by the
|
|
|
|
reggroup_save and reggroup_restore methods. */
|
|
|
|
int readonly_p;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct regcache *
|
|
|
|
regcache_xmalloc (struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
struct regcache_descr *descr;
|
|
|
|
struct regcache *regcache;
|
|
|
|
gdb_assert (gdbarch != NULL);
|
|
|
|
descr = regcache_descr (gdbarch);
|
|
|
|
regcache = XMALLOC (struct regcache);
|
|
|
|
regcache->descr = descr;
|
2002-11-13 17:07:03 +01:00
|
|
|
regcache->registers
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
= XCALLOC (descr->sizeof_raw_registers, gdb_byte);
|
2002-11-13 17:07:03 +01:00
|
|
|
regcache->register_valid_p
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
= XCALLOC (descr->sizeof_raw_register_valid_p, gdb_byte);
|
2002-11-13 18:59:40 +01:00
|
|
|
regcache->readonly_p = 1;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
return regcache;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_xfree (struct regcache *regcache)
|
|
|
|
{
|
|
|
|
if (regcache == NULL)
|
|
|
|
return;
|
2002-11-13 17:07:03 +01:00
|
|
|
xfree (regcache->registers);
|
|
|
|
xfree (regcache->register_valid_p);
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
xfree (regcache);
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
static void
|
2002-07-03 22:36:54 +02:00
|
|
|
do_regcache_xfree (void *data)
|
|
|
|
{
|
|
|
|
regcache_xfree (data);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct cleanup *
|
|
|
|
make_cleanup_regcache_xfree (struct regcache *regcache)
|
|
|
|
{
|
|
|
|
return make_cleanup (do_regcache_xfree, regcache);
|
|
|
|
}
|
|
|
|
|
2003-09-27 21:32:53 +02:00
|
|
|
/* Return REGCACHE's architecture. */
|
|
|
|
|
|
|
|
struct gdbarch *
|
|
|
|
get_regcache_arch (const struct regcache *regcache)
|
|
|
|
{
|
|
|
|
return regcache->descr->gdbarch;
|
|
|
|
}
|
|
|
|
|
2002-11-13 17:07:03 +01:00
|
|
|
/* Return a pointer to register REGNUM's buffer cache. */
|
|
|
|
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
static gdb_byte *
|
2003-08-29 11:59:28 +02:00
|
|
|
register_buffer (const struct regcache *regcache, int regnum)
|
2002-11-13 17:07:03 +01:00
|
|
|
{
|
|
|
|
return regcache->registers + regcache->descr->register_offset[regnum];
|
|
|
|
}
|
|
|
|
|
2002-11-13 18:59:40 +01:00
|
|
|
void
|
2003-03-10 20:08:47 +01:00
|
|
|
regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
|
|
|
|
void *src)
|
2002-11-13 18:59:40 +01:00
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = dst->descr->gdbarch;
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte buf[MAX_REGISTER_SIZE];
|
2002-11-13 18:59:40 +01:00
|
|
|
int regnum;
|
|
|
|
/* The DST should be `read-only', if it wasn't then the save would
|
2003-03-10 20:08:47 +01:00
|
|
|
end up trying to write the register values back out to the
|
2002-11-13 18:59:40 +01:00
|
|
|
target. */
|
|
|
|
gdb_assert (dst->readonly_p);
|
|
|
|
/* Clear the dest. */
|
|
|
|
memset (dst->registers, 0, dst->descr->sizeof_cooked_registers);
|
|
|
|
memset (dst->register_valid_p, 0, dst->descr->sizeof_cooked_register_valid_p);
|
|
|
|
/* Copy over any registers (identified by their membership in the
|
2003-03-10 20:08:47 +01:00
|
|
|
save_reggroup) and mark them as valid. The full [0 .. NUM_REGS +
|
|
|
|
NUM_PSEUDO_REGS) range is checked since some architectures need
|
|
|
|
to save/restore `cooked' registers that live in memory. */
|
2002-11-13 18:59:40 +01:00
|
|
|
for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
|
|
|
|
{
|
|
|
|
if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
|
|
|
|
{
|
2003-03-10 20:08:47 +01:00
|
|
|
int valid = cooked_read (src, regnum, buf);
|
|
|
|
if (valid)
|
|
|
|
{
|
|
|
|
memcpy (register_buffer (dst, regnum), buf,
|
|
|
|
register_size (gdbarch, regnum));
|
|
|
|
dst->register_valid_p[regnum] = 1;
|
|
|
|
}
|
2002-11-13 18:59:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-03-10 20:08:47 +01:00
|
|
|
regcache_restore (struct regcache *dst,
|
|
|
|
regcache_cooked_read_ftype *cooked_read,
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
void *cooked_read_context)
|
2002-11-13 18:59:40 +01:00
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = dst->descr->gdbarch;
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte buf[MAX_REGISTER_SIZE];
|
2002-11-13 18:59:40 +01:00
|
|
|
int regnum;
|
2003-03-10 20:08:47 +01:00
|
|
|
/* The dst had better not be read-only. If it is, the `restore'
|
|
|
|
doesn't make much sense. */
|
2002-11-13 18:59:40 +01:00
|
|
|
gdb_assert (!dst->readonly_p);
|
|
|
|
/* Copy over any registers, being careful to only restore those that
|
2003-03-10 20:08:47 +01:00
|
|
|
were both saved and need to be restored. The full [0 .. NUM_REGS
|
|
|
|
+ NUM_PSEUDO_REGS) range is checked since some architectures need
|
|
|
|
to save/restore `cooked' registers that live in memory. */
|
|
|
|
for (regnum = 0; regnum < dst->descr->nr_cooked_registers; regnum++)
|
2002-11-13 18:59:40 +01:00
|
|
|
{
|
2003-03-10 20:08:47 +01:00
|
|
|
if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
|
2002-11-13 18:59:40 +01:00
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
int valid = cooked_read (cooked_read_context, regnum, buf);
|
2003-03-10 20:08:47 +01:00
|
|
|
if (valid)
|
|
|
|
regcache_cooked_write (dst, regnum, buf);
|
2002-11-13 18:59:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-10 20:08:47 +01:00
|
|
|
static int
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
do_cooked_read (void *src, int regnum, gdb_byte *buf)
|
2003-03-10 20:08:47 +01:00
|
|
|
{
|
|
|
|
struct regcache *regcache = src;
|
2003-06-16 15:19:36 +02:00
|
|
|
if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
|
2003-03-10 20:08:47 +01:00
|
|
|
/* Don't even think about fetching a register from a read-only
|
|
|
|
cache when the register isn't yet valid. There isn't a target
|
|
|
|
from which the register value can be fetched. */
|
|
|
|
return 0;
|
|
|
|
regcache_cooked_read (regcache, regnum, buf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
void
|
|
|
|
regcache_cpy (struct regcache *dst, struct regcache *src)
|
|
|
|
{
|
|
|
|
int i;
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *buf;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
gdb_assert (src != NULL && dst != NULL);
|
|
|
|
gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
|
|
|
|
gdb_assert (src != dst);
|
2002-11-13 18:59:40 +01:00
|
|
|
gdb_assert (src->readonly_p || dst->readonly_p);
|
|
|
|
if (!src->readonly_p)
|
2003-03-10 20:08:47 +01:00
|
|
|
regcache_save (dst, do_cooked_read, src);
|
2002-11-13 18:59:40 +01:00
|
|
|
else if (!dst->readonly_p)
|
2003-03-10 20:08:47 +01:00
|
|
|
regcache_restore (dst, do_cooked_read, src);
|
2002-11-13 18:59:40 +01:00
|
|
|
else
|
|
|
|
regcache_cpy_no_passthrough (dst, src);
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
gdb_assert (src != NULL && dst != NULL);
|
|
|
|
gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
|
|
|
|
/* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough
|
|
|
|
move of data into the current_regcache(). Doing this would be
|
2004-02-12 01:17:53 +01:00
|
|
|
silly - it would mean that valid_p would be completely invalid. */
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
gdb_assert (dst != current_regcache);
|
2002-11-13 17:07:03 +01:00
|
|
|
memcpy (dst->registers, src->registers, dst->descr->sizeof_raw_registers);
|
|
|
|
memcpy (dst->register_valid_p, src->register_valid_p,
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
dst->descr->sizeof_raw_register_valid_p);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct regcache *
|
|
|
|
regcache_dup (struct regcache *src)
|
|
|
|
{
|
|
|
|
struct regcache *newbuf;
|
|
|
|
gdb_assert (current_regcache != NULL);
|
|
|
|
newbuf = regcache_xmalloc (src->descr->gdbarch);
|
|
|
|
regcache_cpy (newbuf, src);
|
|
|
|
return newbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct regcache *
|
|
|
|
regcache_dup_no_passthrough (struct regcache *src)
|
|
|
|
{
|
|
|
|
struct regcache *newbuf;
|
|
|
|
gdb_assert (current_regcache != NULL);
|
|
|
|
newbuf = regcache_xmalloc (src->descr->gdbarch);
|
|
|
|
regcache_cpy_no_passthrough (newbuf, src);
|
|
|
|
return newbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
regcache_valid_p (struct regcache *regcache, int regnum)
|
|
|
|
{
|
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
2002-11-13 17:07:03 +01:00
|
|
|
return regcache->register_valid_p[regnum];
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
deprecated_grub_regcache_for_registers (struct regcache *regcache)
|
|
|
|
{
|
2002-11-13 17:07:03 +01:00
|
|
|
return regcache->registers;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Global structure containing the current regcache. */
|
|
|
|
/* FIXME: cagney/2002-05-11: The two global arrays registers[] and
|
2002-11-07 03:40:28 +01:00
|
|
|
deprecated_register_valid[] currently point into this structure. */
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
struct regcache *current_regcache;
|
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
/* NOTE: this is a write-through cache. There is no "dirty" bit for
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
recording if the register values have been changed (eg. by the
|
|
|
|
user). Therefore all registers must be written back to the
|
|
|
|
target when appropriate. */
|
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
/* The thread/process associated with the current set of registers. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
static ptid_t registers_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTIONS:
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* REGISTER_CACHED()
|
|
|
|
|
|
|
|
Returns 0 if the value is not in the cache (needs fetch).
|
|
|
|
>0 if the value is in the cache.
|
|
|
|
<0 if the value is permanently unavailable (don't ask again). */
|
|
|
|
|
|
|
|
int
|
|
|
|
register_cached (int regnum)
|
|
|
|
{
|
2004-11-14 02:11:07 +01:00
|
|
|
return current_regcache->register_valid_p[regnum];
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
* regcache.c (set_register_cached, register_buffer,
real_register, pseudo_register fetch_register, store_register):
New functions.
(register_changed, read_relative_register_raw_bytes_for_frame,
registers_changed, registers_fetched, read_register_bytes,
read_register_gen, write_register_gen, read_register,
read_signed_register, write_register, supply_register): Replace
register_valid[] with register_cached() and
set_register_cached().
(read_register_bytes, read_register_gen, write_register_gen,
read_register, read_signed_register, write_register,
supply_register): Replace registers[] with register_buffer().
(read_register_bytes, read_register_gen, read_register,
read_signed_register): Call fetch_register().
(write_register_gen, write_register): Call real_register() and
store_register().
(write_register_bytes): Call store_register().
* value.h (set_register_cached, register_buffer): Prototype.
* remote.c (remote_fetch_registers): Allocate regs[] with a
run-time size. Replace register_valid[] with
set_register_cached().
(store_register_using_P, remote_store_registers): Replace
registers[] with register_buffer().
2001-01-09 01:12:48 +01:00
|
|
|
/* Record that REGNUM's value is cached if STATE is >0, uncached but
|
|
|
|
fetchable if STATE is 0, and uncached and unfetchable if STATE is <0. */
|
|
|
|
|
|
|
|
void
|
|
|
|
set_register_cached (int regnum, int state)
|
|
|
|
{
|
2002-08-14 01:06:40 +02:00
|
|
|
gdb_assert (regnum >= 0);
|
|
|
|
gdb_assert (regnum < current_regcache->descr->nr_raw_registers);
|
2002-11-13 17:07:03 +01:00
|
|
|
current_regcache->register_valid_p[regnum] = state;
|
* regcache.c (set_register_cached, register_buffer,
real_register, pseudo_register fetch_register, store_register):
New functions.
(register_changed, read_relative_register_raw_bytes_for_frame,
registers_changed, registers_fetched, read_register_bytes,
read_register_gen, write_register_gen, read_register,
read_signed_register, write_register, supply_register): Replace
register_valid[] with register_cached() and
set_register_cached().
(read_register_bytes, read_register_gen, write_register_gen,
read_register, read_signed_register, write_register,
supply_register): Replace registers[] with register_buffer().
(read_register_bytes, read_register_gen, read_register,
read_signed_register): Call fetch_register().
(write_register_gen, write_register): Call real_register() and
store_register().
(write_register_bytes): Call store_register().
* value.h (set_register_cached, register_buffer): Prototype.
* remote.c (remote_fetch_registers): Allocate regs[] with a
run-time size. Replace register_valid[] with
set_register_cached().
(store_register_using_P, remote_store_registers): Replace
registers[] with register_buffer().
2001-01-09 01:12:48 +01:00
|
|
|
}
|
|
|
|
|
2004-04-26 11:49:36 +02:00
|
|
|
/* Observer for the target_changed event. */
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_observer_target_changed (struct target_ops *target)
|
|
|
|
{
|
|
|
|
registers_changed ();
|
|
|
|
}
|
|
|
|
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
/* Low level examining and depositing of registers.
|
|
|
|
|
|
|
|
The caller is responsible for making sure that the inferior is
|
|
|
|
stopped before calling the fetching routines, or it will get
|
|
|
|
garbage. (a change from GDB version 3, in which the caller got the
|
|
|
|
value from the last stop). */
|
|
|
|
|
|
|
|
/* REGISTERS_CHANGED ()
|
|
|
|
|
|
|
|
Indicate that registers may have changed, so invalidate the cache. */
|
|
|
|
|
|
|
|
void
|
|
|
|
registers_changed (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
registers_ptid = pid_to_ptid (-1);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/* Force cleanup of any alloca areas if using C alloca instead of
|
|
|
|
a builtin alloca. This particular call is used to clean up
|
|
|
|
areas allocated by low level target code which may build up
|
|
|
|
during lengthy interactions between gdb and the target before
|
|
|
|
gdb gives control to the user (ie watchpoints). */
|
|
|
|
alloca (0);
|
|
|
|
|
2002-08-14 01:06:40 +02:00
|
|
|
for (i = 0; i < current_regcache->descr->nr_raw_registers; i++)
|
* regcache.c (set_register_cached, register_buffer,
real_register, pseudo_register fetch_register, store_register):
New functions.
(register_changed, read_relative_register_raw_bytes_for_frame,
registers_changed, registers_fetched, read_register_bytes,
read_register_gen, write_register_gen, read_register,
read_signed_register, write_register, supply_register): Replace
register_valid[] with register_cached() and
set_register_cached().
(read_register_bytes, read_register_gen, write_register_gen,
read_register, read_signed_register, write_register,
supply_register): Replace registers[] with register_buffer().
(read_register_bytes, read_register_gen, read_register,
read_signed_register): Call fetch_register().
(write_register_gen, write_register): Call real_register() and
store_register().
(write_register_bytes): Call store_register().
* value.h (set_register_cached, register_buffer): Prototype.
* remote.c (remote_fetch_registers): Allocate regs[] with a
run-time size. Replace register_valid[] with
set_register_cached().
(store_register_using_P, remote_store_registers): Replace
registers[] with register_buffer().
2001-01-09 01:12:48 +01:00
|
|
|
set_register_cached (i, 0);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2004-04-21 Andrew Cagney <cagney@redhat.com>
* annotate.h (deprecated_annotate_starting_hook)
(deprecated_annotate_stopped_hook)
(deprecated_annotate_exited_hook)
(deprecated_annotate_signal_hook)
(deprecated_annotate_signalled_hook): Deprecate.
* tracepoint.h (deprecated_create_tracepoint_hook)
(deprecated_delete_tracepoint_hook)
(deprecated_modify_tracepoint_hook)
(deprecated_trace_find_hook)
(deprecated_trace_start_stop_hook): Deprecate.
* target.h (deprecated_target_new_objfile_hook): Deprecate.
* remote.h (deprecated_target_resume_hook)
(deprecated_target_wait_loop_hook): Deprecate.
* gdbcore.h (deprecated_exec_file_display_hook)
(deprecated_file_changed_hook): Deprecate.
* frame.h (deprecated_selected_frame_level_changed_hook): Deprecate.
* defs.h (deprecated_modify_breakpoint_hook)
(deprecated_command_loop_hook, deprecated_show_load_progress)
(deprecated_print_frame_info_listing_hook)
(deprecated_query_hook, deprecated_warning_hook)
(deprecated_flush_hook, deprecated_create_breakpoint_hook)
(deprecated_delete_breakpoint_hook)
(deprecated_interactive_hook, deprecated_registers_changed_hook)
(deprecated_readline_begin_hook, deprecated_readline_hook)
(deprecated_readline_end_hook, deprecated_register_changed_hook)
(deprecated_memory_changed_hook, deprecated_init_ui_hook)
(deprecated_context_hook, deprecated_target_wait_hook)
(deprecated_attach_hook, deprecated_detach_hook)
(deprecated_call_command_hook, deprecated_set_hook)
(deprecated_error_hook, deprecated_error_begin_hook)
(deprecated_ui_load_progress_hook): Deprecate.
* valops.c, uw-thread.c, utils.c, tui/tui-io.c: Update.
* tui/tui-hooks.c, tracepoint.c, top.c, thread-db.c: Update.
* target.c, symfile.c, stack.c, sol-thread.c, rs6000-nat.c: Update.
* remote.c, remote-mips.c, regcache.c, mi/mi-interp.c: Update.
* main.c, interps.c, infcmd.c, hpux-thread.c, frame.c: Update.
* exec.c, dsrec.c, d10v-tdep.c, corefile.c, complaints.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, breakpoint.c: Update.
* annotate.c, aix-thread.c: Update.
2004-04-22 01:52:21 +02:00
|
|
|
if (deprecated_registers_changed_hook)
|
|
|
|
deprecated_registers_changed_hook ();
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
2002-11-07 16:31:31 +01:00
|
|
|
/* DEPRECATED_REGISTERS_FETCHED ()
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
Indicate that all registers have been fetched, so mark them all valid. */
|
|
|
|
|
2001-12-06 21:49:47 +01:00
|
|
|
/* FIXME: cagney/2001-12-04: This function is DEPRECATED. The target
|
|
|
|
code was blatting the registers[] array and then calling this.
|
2004-07-21 Andrew Cagney <cagney@gnu.org>
Use regcache_raw_supply instead of supply_register.
* regcache.h (supply_register): Delete declaration.
* regcache.c (supply_register): Delete function.
* wince.c (do_child_fetch_inferior_registers): Update.
* win32-nat.c (do_child_fetch_inferior_registers)
(fetch_elf_core_registers): Update.
* v850ice.c (v850ice_fetch_registers): Update.
* thread-db.c (thread_db_store_registers): Update.
* sol-thread.c (sol_thread_store_registers): Update.
* shnbsd-tdep.c (shnbsd_supply_reg): Update.
* rs6000-nat.c (fetch_register): Update.
* rom68k-rom.c (rom68k_supply_one_register): Update.
* remote.c (remote_wait, remote_async_wait): Update.
* remote-st.c (get_hex_regs): Update.
* remote-sim.c (gdbsim_fetch_register): Update.
* remote-sds.c (sds_fetch_registers): Update.
* remote-rdp.c (remote_rdp_fetch_register): Update.
* remote-rdi.c (arm_rdi_fetch_registers): Update.
* remote-mips.c (mips_wait, mips_fetch_registers): Update.
* remote-m32r-sdi.c (m32r_fetch_register): Update.
* remote-hms.c (init_hms_cmds): Update.
* remote-est.c (init_est_cmds): Update.
* remote-e7000.c (get_hex_regs, fetch_regs_from_dump)
(e7000_fetch_registers, sub2_from_pc, e7000_wait): Update.
* ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_supply_fpreg): Update.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, supply_vrregset)
(fetch_spe_registers): Update.
* ppc-bdm.c (bdm_ppc_fetch_registers): Update.
* monitor.c (monitor_supply_register): Update.
* mipsv4-nat.c (supply_gregset, supply_fpregset): Update.
* mipsnbsd-tdep.c (mipsnbsd_supply_reg)
(mipsnbsd_supply_fpreg): Update.
* mips-nat.c (fetch_inferior_registers)
(fetch_core_registers): Update.
* mips-linux-tdep.c (supply_32bit_reg, supply_gregset)
(supply_fpregset, mips64_supply_gregset)
(mips64_supply_fpregset): Update.
* m68klinux-nat.c (fetch_register, supply_gregset)
(supply_fpregset): Update.
* m68k-tdep.c (supply_gregset, supply_fpregset): Update.
* m32r-rom.c (init_m32r_cmds, init_mon2000_cmds): Update.
* lynx-nat.c (fetch_inferior_registers, fetch_core_registers): Update.
* irix5-nat.c (supply_gregset, supply_fpregset): Update.
* infptrace.c (fetch_register): Update.
* ia64-linux-nat.c (supply_gregset, supply_fpregset): Update.
* ia64-aix-nat.c (supply_gregset, supply_fpregset): Update.
* i386gnu-nat.c (fetch_fpregs, supply_gregset)
(gnu_fetch_registers, gnu_store_registers): Update.
* i386-nto-tdep.c (i386nto_supply_gregset): Update.
* i386-linux-nat.c (fetch_register, supply_gregset)
(dummy_sse_values): Update.
* hpux-thread.c (hpux_thread_fetch_registers): Update.
* hppah-nat.c (fetch_register): Update.
* hppa-linux-nat.c (fetch_register, supply_gregset)
(supply_fpregset): Update.
* go32-nat.c (fetch_register): Update.
* dve3900-rom.c (fetch_bitmapped_register)
(_initialize_r3900_rom): Update.
* cris-tdep.c (supply_gregset): Update.
* abug-rom.c (init_abug_cmds): Update.
* core-aout.c (fetch_core_registers): Update.
* armnbsd-nat.c (supply_gregset, supply_fparegset)
(fetch_register, fetch_fp_register): Update.
* arm-linux-nat.c (fetch_nwfpe_single, fetch_nwfpe_none)
(fetch_nwfpe_extended, fetch_fpregister, fetch_fpregs)
(fetch_register, fetch_regs, supply_gregset, supply_fpregset): Update.
* alphanbsd-tdep.c (fetch_core_registers): Update.
* alpha-tdep.c (alpha_supply_int_regs, alpha_supply_fp_regs): Update.
* alpha-nat.c (fetch_osf_core_registers)
(fetch_osf_core_registers, fetch_osf_core_registers): Update.
* aix-thread.c (supply_gprs64, supply_reg32, supply_fprs)
(supply_sprs64, supply_sprs32, fetch_regs_kernel_thread): Update.
2004-07-22 03:31:49 +02:00
|
|
|
Since targets should only be using regcache_raw_supply() the need for
|
2001-12-06 21:49:47 +01:00
|
|
|
this function/hack is eliminated. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
void
|
2002-11-07 16:31:31 +01:00
|
|
|
deprecated_registers_fetched (void)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2001-03-14 00:31:14 +01:00
|
|
|
for (i = 0; i < NUM_REGS; i++)
|
* regcache.c (set_register_cached, register_buffer,
real_register, pseudo_register fetch_register, store_register):
New functions.
(register_changed, read_relative_register_raw_bytes_for_frame,
registers_changed, registers_fetched, read_register_bytes,
read_register_gen, write_register_gen, read_register,
read_signed_register, write_register, supply_register): Replace
register_valid[] with register_cached() and
set_register_cached().
(read_register_bytes, read_register_gen, write_register_gen,
read_register, read_signed_register, write_register,
supply_register): Replace registers[] with register_buffer().
(read_register_bytes, read_register_gen, read_register,
read_signed_register): Call fetch_register().
(write_register_gen, write_register): Call real_register() and
store_register().
(write_register_bytes): Call store_register().
* value.h (set_register_cached, register_buffer): Prototype.
* remote.c (remote_fetch_registers): Allocate regs[] with a
run-time size. Replace register_valid[] with
set_register_cached().
(store_register_using_P, remote_store_registers): Replace
registers[] with register_buffer().
2001-01-09 01:12:48 +01:00
|
|
|
set_register_cached (i, 1);
|
2000-07-13 00:01:17 +02:00
|
|
|
/* Do not assume that the pseudo-regs have also been fetched.
|
2001-12-06 21:49:47 +01:00
|
|
|
Fetching all real regs NEVER accounts for pseudo-regs. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
2002-11-13 Andrew Cagney <cagney@redhat.com>
* regcache.h (deprecated_read_register_bytes): Rename
read_register_bytes.
(deprecated_write_register_bytes): Rename write_register_bytes.
* alpha-tdep.c, arm-tdep.c, cris-tdep.c, d10v-tdep.c: Update.
* dwarf2cfi.c, frv-tdep.c, hppa-tdep.c, ia64-tdep.c: Update.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, regcache.c, remote-sds.c, remote-vx.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh-tdep.c: Update.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c, x86-64-tdep.c: Update.
* xstormy16-tdep.c, z8k-tdep.c, config/nm-gnu.h: Update.
* config/nm-m3.h, config/h8500/tm-h8500.h: Update.
* config/i386/nm-ptx4.h, config/i386/nm-symmetry.h: Update.
* config/m32r/tm-m32r.h, config/m68k/nm-sun3.h: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-linux.h: Update.
* config/mn10200/tm-mn10200.h, config/pa/tm-hppa64.h: Update.
* config/sparc/nm-nbsd.h, config/sparc/nm-sun4os4.h: Update.
* config/sparc/nm-sun4sol2.h, config/sparc/tm-sparclet.h: Update.
2002-11-13 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Use
deprecated_write_register_bytes instead of write_register_bytes.
2002-11-14 01:25:05 +01:00
|
|
|
/* deprecated_read_register_bytes and deprecated_write_register_bytes
|
|
|
|
are generally a *BAD* idea. They are inefficient because they need
|
|
|
|
to check for partial updates, which can only be done by scanning
|
|
|
|
through all of the registers and seeing if the bytes that are being
|
|
|
|
read/written fall inside of an invalid register. [The main reason
|
|
|
|
this is necessary is that register sizes can vary, so a simple
|
|
|
|
index won't suffice.] It is far better to call read_register_gen
|
|
|
|
and write_register_gen if you want to get at the raw register
|
|
|
|
contents, as it only takes a regnum as an argument, and therefore
|
|
|
|
can't do a partial register update.
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
Prior to the recent fixes to check for partial updates, both read
|
2002-11-13 Andrew Cagney <cagney@redhat.com>
* regcache.h (deprecated_read_register_bytes): Rename
read_register_bytes.
(deprecated_write_register_bytes): Rename write_register_bytes.
* alpha-tdep.c, arm-tdep.c, cris-tdep.c, d10v-tdep.c: Update.
* dwarf2cfi.c, frv-tdep.c, hppa-tdep.c, ia64-tdep.c: Update.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, regcache.c, remote-sds.c, remote-vx.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh-tdep.c: Update.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c, x86-64-tdep.c: Update.
* xstormy16-tdep.c, z8k-tdep.c, config/nm-gnu.h: Update.
* config/nm-m3.h, config/h8500/tm-h8500.h: Update.
* config/i386/nm-ptx4.h, config/i386/nm-symmetry.h: Update.
* config/m32r/tm-m32r.h, config/m68k/nm-sun3.h: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-linux.h: Update.
* config/mn10200/tm-mn10200.h, config/pa/tm-hppa64.h: Update.
* config/sparc/nm-nbsd.h, config/sparc/nm-sun4os4.h: Update.
* config/sparc/nm-sun4sol2.h, config/sparc/tm-sparclet.h: Update.
2002-11-13 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Use
deprecated_write_register_bytes instead of write_register_bytes.
2002-11-14 01:25:05 +01:00
|
|
|
and deprecated_write_register_bytes always checked to see if any
|
|
|
|
registers were stale, and then called target_fetch_registers (-1)
|
|
|
|
to update the whole set. This caused really slowed things down for
|
|
|
|
remote targets. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/* Copy INLEN bytes of consecutive data from registers
|
|
|
|
starting with the INREGBYTE'th byte of register data
|
|
|
|
into memory at MYADDR. */
|
|
|
|
|
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
deprecated_read_register_bytes (int in_start, gdb_byte *in_buf, int in_len)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-03-24 02:26:09 +01:00
|
|
|
int in_end = in_start + in_len;
|
2001-01-09 01:11:28 +01:00
|
|
|
int regnum;
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte reg_buf[MAX_REGISTER_SIZE];
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/* See if we are trying to read bytes from out-of-date registers. If so,
|
|
|
|
update just those registers. */
|
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-03-24 02:26:09 +01:00
|
|
|
int reg_start;
|
|
|
|
int reg_end;
|
|
|
|
int reg_len;
|
|
|
|
int start;
|
|
|
|
int end;
|
|
|
|
int byte;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 16:24:31 +02:00
|
|
|
reg_start = DEPRECATED_REGISTER_BYTE (regnum);
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 02:57:27 +02:00
|
|
|
reg_len = register_size (current_gdbarch, regnum);
|
2001-03-24 02:26:09 +01:00
|
|
|
reg_end = reg_start + reg_len;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
if (reg_end <= in_start || in_end <= reg_start)
|
2001-01-09 01:11:28 +01:00
|
|
|
/* The range the user wants to read doesn't overlap with regnum. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
continue;
|
|
|
|
|
2001-08-24 07:11:07 +02:00
|
|
|
if (REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != '\0')
|
|
|
|
/* Force the cache to fetch the entire register. */
|
2002-11-02 15:59:10 +01:00
|
|
|
deprecated_read_register_gen (regnum, reg_buf);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
/* Legacy note: This function, for some reason, allows a NULL
|
|
|
|
input buffer. If the buffer is NULL, the registers are still
|
|
|
|
fetched, just the final transfer is skipped. */
|
|
|
|
if (in_buf == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* start = max (reg_start, in_start) */
|
|
|
|
if (reg_start > in_start)
|
|
|
|
start = reg_start;
|
|
|
|
else
|
|
|
|
start = in_start;
|
|
|
|
|
|
|
|
/* end = min (reg_end, in_end) */
|
|
|
|
if (reg_end < in_end)
|
|
|
|
end = reg_end;
|
|
|
|
else
|
|
|
|
end = in_end;
|
|
|
|
|
|
|
|
/* Transfer just the bytes common to both IN_BUF and REG_BUF */
|
|
|
|
for (byte = start; byte < end; byte++)
|
2000-11-17 02:30:53 +01:00
|
|
|
{
|
2001-03-24 02:26:09 +01:00
|
|
|
in_buf[byte - in_start] = reg_buf[byte - reg_start];
|
2000-11-17 02:30:53 +01:00
|
|
|
}
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
gdb_assert (regcache != NULL && buf != NULL);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
/* Make certain that the register cache is up-to-date with respect
|
|
|
|
to the current thread. This switching shouldn't be necessary
|
|
|
|
only there is still only one target side register cache. Sigh!
|
|
|
|
On the bright side, at least there is a regcache object. */
|
2002-11-13 18:59:40 +01:00
|
|
|
if (!regcache->readonly_p)
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
{
|
|
|
|
gdb_assert (regcache == current_regcache);
|
|
|
|
if (! ptid_equal (registers_ptid, inferior_ptid))
|
|
|
|
{
|
|
|
|
registers_changed ();
|
|
|
|
registers_ptid = inferior_ptid;
|
|
|
|
}
|
|
|
|
if (!register_cached (regnum))
|
2002-08-07 18:01:58 +02:00
|
|
|
target_fetch_registers (regnum);
|
2004-08-07 18:33:54 +02:00
|
|
|
#if 0
|
|
|
|
/* FIXME: cagney/2004-08-07: At present a number of targets
|
2004-10-11 18:35:28 +02:00
|
|
|
forget (or didn't know that they needed) to set this leading to
|
|
|
|
panics. Also is the problem that targets need to indicate
|
2004-08-07 18:33:54 +02:00
|
|
|
that a register is in one of the possible states: valid,
|
|
|
|
undefined, unknown. The last of which isn't yet
|
|
|
|
possible. */
|
2004-08-04 19:50:55 +02:00
|
|
|
gdb_assert (register_cached (regnum));
|
2004-08-07 18:33:54 +02:00
|
|
|
#endif
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
/* Copy the value directly into the register cache. */
|
2002-11-13 17:07:03 +01:00
|
|
|
memcpy (buf, register_buffer (regcache, regnum),
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
regcache->descr->sizeof_register[regnum]);
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
2002-08-13 16:32:28 +02:00
|
|
|
void
|
|
|
|
regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
|
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *buf;
|
2002-08-13 16:32:28 +02:00
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
regcache_raw_read (regcache, regnum, buf);
|
|
|
|
(*val) = extract_signed_integer (buf,
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
|
|
|
|
ULONGEST *val)
|
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *buf;
|
2002-08-13 16:32:28 +02:00
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
regcache_raw_read (regcache, regnum, buf);
|
|
|
|
(*val) = extract_unsigned_integer (buf,
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
|
|
|
}
|
|
|
|
|
2002-08-26 01:44:30 +02:00
|
|
|
void
|
|
|
|
regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
|
|
|
|
{
|
|
|
|
void *buf;
|
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
|
|
|
|
regcache_raw_write (regcache, regnum, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
|
|
|
|
ULONGEST val)
|
|
|
|
{
|
|
|
|
void *buf;
|
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
|
|
|
|
regcache_raw_write (regcache, regnum, buf);
|
|
|
|
}
|
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
deprecated_read_register_gen (int regnum, gdb_byte *buf)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
gdb_assert (current_regcache != NULL);
|
|
|
|
gdb_assert (current_regcache->descr->gdbarch == current_gdbarch);
|
2002-08-02 20:08:31 +02:00
|
|
|
regcache_cooked_read (current_regcache, regnum, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
|
2002-08-02 20:08:31 +02:00
|
|
|
{
|
2002-07-29 21:54:42 +02:00
|
|
|
gdb_assert (regnum >= 0);
|
2002-08-02 20:08:31 +02:00
|
|
|
gdb_assert (regnum < regcache->descr->nr_cooked_registers);
|
|
|
|
if (regnum < regcache->descr->nr_raw_registers)
|
|
|
|
regcache_raw_read (regcache, regnum, buf);
|
2002-11-13 18:59:40 +01:00
|
|
|
else if (regcache->readonly_p
|
|
|
|
&& regnum < regcache->descr->nr_cooked_registers
|
|
|
|
&& regcache->register_valid_p[regnum])
|
2004-07-10 03:17:53 +02:00
|
|
|
/* Read-only register cache, perhaps the cooked value was cached? */
|
2002-11-13 18:59:40 +01:00
|
|
|
memcpy (buf, register_buffer (regcache, regnum),
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
2002-07-29 21:54:42 +02:00
|
|
|
else
|
2002-08-02 20:08:31 +02:00
|
|
|
gdbarch_pseudo_register_read (regcache->descr->gdbarch, regcache,
|
|
|
|
regnum, buf);
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
2002-08-13 15:58:50 +02:00
|
|
|
void
|
|
|
|
regcache_cooked_read_signed (struct regcache *regcache, int regnum,
|
|
|
|
LONGEST *val)
|
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *buf;
|
2002-08-13 15:58:50 +02:00
|
|
|
gdb_assert (regcache != NULL);
|
2003-03-12 21:50:13 +01:00
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
|
2002-08-13 15:58:50 +02:00
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
regcache_cooked_read (regcache, regnum, buf);
|
|
|
|
(*val) = extract_signed_integer (buf,
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
|
|
|
|
ULONGEST *val)
|
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *buf;
|
2002-08-13 15:58:50 +02:00
|
|
|
gdb_assert (regcache != NULL);
|
2003-03-12 21:50:13 +01:00
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
|
2002-08-13 15:58:50 +02:00
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
regcache_cooked_read (regcache, regnum, buf);
|
|
|
|
(*val) = extract_unsigned_integer (buf,
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
|
|
|
}
|
|
|
|
|
2003-03-12 21:50:13 +01:00
|
|
|
void
|
|
|
|
regcache_cooked_write_signed (struct regcache *regcache, int regnum,
|
|
|
|
LONGEST val)
|
|
|
|
{
|
|
|
|
void *buf;
|
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
|
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
|
|
|
|
regcache_cooked_write (regcache, regnum, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
|
|
|
|
ULONGEST val)
|
|
|
|
{
|
|
|
|
void *buf;
|
|
|
|
gdb_assert (regcache != NULL);
|
|
|
|
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
|
|
|
|
buf = alloca (regcache->descr->sizeof_register[regnum]);
|
|
|
|
store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
|
|
|
|
regcache_cooked_write (regcache, regnum, buf);
|
|
|
|
}
|
|
|
|
|
2001-03-24 02:26:09 +01:00
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
regcache_raw_write (struct regcache *regcache, int regnum,
|
|
|
|
const gdb_byte *buf)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
gdb_assert (regcache != NULL && buf != NULL);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
2002-11-13 18:59:40 +01:00
|
|
|
gdb_assert (!regcache->readonly_p);
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
|
|
|
|
/* On the sparc, writing %g0 is a no-op, so we don't even want to
|
|
|
|
change the registers array if something writes to this register. */
|
|
|
|
if (CANNOT_STORE_REGISTER (regnum))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Make certain that the correct cache is selected. */
|
|
|
|
gdb_assert (regcache == current_regcache);
|
|
|
|
if (! ptid_equal (registers_ptid, inferior_ptid))
|
|
|
|
{
|
|
|
|
registers_changed ();
|
|
|
|
registers_ptid = inferior_ptid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we have a valid copy of the register, and new value == old
|
|
|
|
value, then don't bother doing the actual store. */
|
|
|
|
if (regcache_valid_p (regcache, regnum)
|
|
|
|
&& (memcmp (register_buffer (regcache, regnum), buf,
|
|
|
|
regcache->descr->sizeof_register[regnum]) == 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
target_prepare_to_store ();
|
|
|
|
memcpy (register_buffer (regcache, regnum), buf,
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
2002-11-13 17:07:03 +01:00
|
|
|
regcache->register_valid_p[regnum] = 1;
|
2002-08-07 18:01:58 +02:00
|
|
|
target_store_registers (regnum);
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
deprecated_write_register_gen (int regnum, gdb_byte *buf)
|
2001-03-24 02:26:09 +01:00
|
|
|
{
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
gdb_assert (current_regcache != NULL);
|
|
|
|
gdb_assert (current_regcache->descr->gdbarch == current_gdbarch);
|
2002-08-02 20:08:31 +02:00
|
|
|
regcache_cooked_write (current_regcache, regnum, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
regcache_cooked_write (struct regcache *regcache, int regnum,
|
|
|
|
const gdb_byte *buf)
|
2002-08-02 20:08:31 +02:00
|
|
|
{
|
2002-07-29 21:54:42 +02:00
|
|
|
gdb_assert (regnum >= 0);
|
2002-08-02 20:08:31 +02:00
|
|
|
gdb_assert (regnum < regcache->descr->nr_cooked_registers);
|
|
|
|
if (regnum < regcache->descr->nr_raw_registers)
|
|
|
|
regcache_raw_write (regcache, regnum, buf);
|
2002-07-29 21:54:42 +02:00
|
|
|
else
|
2002-08-02 20:08:31 +02:00
|
|
|
gdbarch_pseudo_register_write (regcache->descr->gdbarch, regcache,
|
2002-08-02 16:48:19 +02:00
|
|
|
regnum, buf);
|
2001-03-24 02:26:09 +01:00
|
|
|
}
|
|
|
|
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
/* Copy INLEN bytes of consecutive data from memory at MYADDR
|
|
|
|
into registers starting with the MYREGSTART'th byte of register data. */
|
|
|
|
|
|
|
|
void
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
deprecated_write_register_bytes (int myregstart, gdb_byte *myaddr, int inlen)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
|
|
|
int myregend = myregstart + inlen;
|
2001-01-09 01:11:28 +01:00
|
|
|
int regnum;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
target_prepare_to_store ();
|
|
|
|
|
|
|
|
/* Scan through the registers updating any that are covered by the
|
|
|
|
range myregstart<=>myregend using write_register_gen, which does
|
|
|
|
nice things like handling threads, and avoiding updates when the
|
|
|
|
new and old contents are the same. */
|
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
|
|
|
int regstart, regend;
|
|
|
|
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 16:24:31 +02:00
|
|
|
regstart = DEPRECATED_REGISTER_BYTE (regnum);
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 02:57:27 +02:00
|
|
|
regend = regstart + register_size (current_gdbarch, regnum);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/* Is this register completely outside the range the user is writing? */
|
|
|
|
if (myregend <= regstart || regend <= myregstart)
|
|
|
|
/* do nothing */ ;
|
|
|
|
|
|
|
|
/* Is this register completely within the range the user is writing? */
|
|
|
|
else if (myregstart <= regstart && regend <= myregend)
|
2002-11-02 15:59:10 +01:00
|
|
|
deprecated_write_register_gen (regnum, myaddr + (regstart - myregstart));
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
/* The register partially overlaps the range being written. */
|
|
|
|
else
|
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte regbuf[MAX_REGISTER_SIZE];
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
/* What's the overlap between this register's bytes and
|
|
|
|
those the caller wants to write? */
|
|
|
|
int overlapstart = max (regstart, myregstart);
|
|
|
|
int overlapend = min (regend, myregend);
|
|
|
|
|
|
|
|
/* We may be doing a partial update of an invalid register.
|
|
|
|
Update it from the target before scribbling on it. */
|
2002-11-02 15:59:10 +01:00
|
|
|
deprecated_read_register_gen (regnum, regbuf);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2002-08-07 18:01:58 +02:00
|
|
|
target_store_registers (regnum);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-19 02:43:41 +02:00
|
|
|
/* Perform a partial register transfer using a read, modify, write
|
|
|
|
operation. */
|
|
|
|
|
|
|
|
typedef void (regcache_read_ftype) (struct regcache *regcache, int regnum,
|
|
|
|
void *buf);
|
|
|
|
typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
|
|
|
|
const void *buf);
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
static void
|
2002-08-19 02:43:41 +02:00
|
|
|
regcache_xfer_part (struct regcache *regcache, int regnum,
|
|
|
|
int offset, int len, void *in, const void *out,
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
void (*read) (struct regcache *regcache, int regnum,
|
|
|
|
gdb_byte *buf),
|
|
|
|
void (*write) (struct regcache *regcache, int regnum,
|
|
|
|
const gdb_byte *buf))
|
2002-08-19 02:43:41 +02:00
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache->descr;
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 23:20:35 +02:00
|
|
|
gdb_byte reg[MAX_REGISTER_SIZE];
|
2002-08-19 02:43:41 +02:00
|
|
|
gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
|
|
|
|
gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
|
|
|
|
/* Something to do? */
|
|
|
|
if (offset + len == 0)
|
|
|
|
return;
|
|
|
|
/* Read (when needed) ... */
|
|
|
|
if (in != NULL
|
|
|
|
|| offset > 0
|
|
|
|
|| offset + len < descr->sizeof_register[regnum])
|
|
|
|
{
|
|
|
|
gdb_assert (read != NULL);
|
|
|
|
read (regcache, regnum, reg);
|
|
|
|
}
|
|
|
|
/* ... modify ... */
|
|
|
|
if (in != NULL)
|
|
|
|
memcpy (in, reg + offset, len);
|
|
|
|
if (out != NULL)
|
|
|
|
memcpy (reg + offset, out, len);
|
|
|
|
/* ... write (when needed). */
|
|
|
|
if (out != NULL)
|
|
|
|
{
|
|
|
|
gdb_assert (write != NULL);
|
|
|
|
write (regcache, regnum, reg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_raw_read_part (struct regcache *regcache, int regnum,
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
int offset, int len, gdb_byte *buf)
|
2002-08-19 02:43:41 +02:00
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache->descr;
|
|
|
|
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
|
|
|
|
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
|
|
|
|
regcache_raw_read, regcache_raw_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_raw_write_part (struct regcache *regcache, int regnum,
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
int offset, int len, const gdb_byte *buf)
|
2002-08-19 02:43:41 +02:00
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache->descr;
|
|
|
|
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
|
|
|
|
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
|
|
|
|
regcache_raw_read, regcache_raw_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_cooked_read_part (struct regcache *regcache, int regnum,
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
int offset, int len, gdb_byte *buf)
|
2002-08-19 02:43:41 +02:00
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache->descr;
|
|
|
|
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
|
|
|
|
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
|
|
|
|
regcache_cooked_read, regcache_cooked_write);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
regcache_cooked_write_part (struct regcache *regcache, int regnum,
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
int offset, int len, const gdb_byte *buf)
|
2002-08-19 02:43:41 +02:00
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache->descr;
|
|
|
|
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
|
|
|
|
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
|
|
|
|
regcache_cooked_read, regcache_cooked_write);
|
|
|
|
}
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2002-08-25 20:47:16 +02:00
|
|
|
/* Hack to keep code that view the register buffer as raw bytes
|
|
|
|
working. */
|
|
|
|
|
|
|
|
int
|
|
|
|
register_offset_hack (struct gdbarch *gdbarch, int regnum)
|
|
|
|
{
|
|
|
|
struct regcache_descr *descr = regcache_descr (gdbarch);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
|
|
|
|
return descr->register_offset[regnum];
|
|
|
|
}
|
|
|
|
|
2004-08-03 04:02:24 +02:00
|
|
|
/* Hack to keep code using register_bytes working. */
|
|
|
|
|
|
|
|
int
|
|
|
|
deprecated_register_bytes (void)
|
|
|
|
{
|
|
|
|
return current_regcache->descr->sizeof_raw_registers;
|
|
|
|
}
|
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
/* Return the contents of register REGNUM as an unsigned integer. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2000-07-11 07:42:25 +02:00
|
|
|
ULONGEST
|
2001-01-09 01:11:28 +01:00
|
|
|
read_register (int regnum)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2005-05-19 Andrew Cagney <cagney@gnu.org>
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)
(regcache_cooked_read, regcache_cooked_write)
(regcache_raw_supply, regcache_raw_collect)
(regcache_cooked_read_ftype, regcache_save, regcache_restore)
(deprecated_read_register_gen, deprecated_write_register_gen)
(deprecated_read_register_bytes, deprecated_write_register_bytes)
(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
buffer parameters.
* ia64-tdep.c (ia64_extract_return_value): Update.
* frame.c (do_frame_register_read): Update.
* regcache.c (deprecated_grub_regcache_for_registers)
(struct regcache, regcache_save, regcache_restore, regcache_cpy)
(do_cooked_read, regcache_xmalloc, register_buffer)
(deprecated_read_register_bytes, regcache_raw_read)
(regcache_raw_read_signed, regcache_raw_read_unsigned)
(deprecated_read_register_gen, regcache_cooked_read)
(regcache_cooked_read_signed, regcache_cooked_read_unsigned)
(deprecated_write_register_gen, regcache_cooked_write)
(deprecated_write_register_bytes, regcache_raw_read_part)
(regcache_raw_write_part, regcache_cooked_read_part)
(regcache_cooked_write_part, read_register, regcache_raw_supply):
2005-05-19 18:37:09 +02:00
|
|
|
gdb_byte *buf = alloca (register_size (current_gdbarch, regnum));
|
2002-11-02 15:59:10 +01:00
|
|
|
deprecated_read_register_gen (regnum, buf);
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 02:57:27 +02:00
|
|
|
return (extract_unsigned_integer (buf, register_size (current_gdbarch, regnum)));
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
2000-07-11 07:42:25 +02:00
|
|
|
ULONGEST
|
2001-05-04 06:15:33 +02:00
|
|
|
read_register_pid (int regnum, ptid_t ptid)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-05-04 06:15:33 +02:00
|
|
|
ptid_t save_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
int save_pid;
|
|
|
|
CORE_ADDR retval;
|
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
if (ptid_equal (ptid, inferior_ptid))
|
2001-01-09 01:11:28 +01:00
|
|
|
return read_register (regnum);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
save_ptid = inferior_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
inferior_ptid = ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
retval = read_register (regnum);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
inferior_ptid = save_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
/* Store VALUE into the raw contents of register number REGNUM. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
void
|
2001-01-09 01:11:28 +01:00
|
|
|
write_register (int regnum, LONGEST val)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-03-24 02:26:09 +01:00
|
|
|
void *buf;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
int size;
|
2004-08-02 Andrew Cagney <cagney@gnu.org>
Replace DEPRECATED_REGISTER_RAW_SIZE with register_size.
* rs6000-tdep.c (rs6000_push_dummy_call)
(rs6000_extract_return_value): Use register_size.
* xstormy16-tdep.c (xstormy16_get_saved_register)
(xstormy16_extract_return_value): Ditto.
* valops.c (value_assign): Ditto.
* v850ice.c (v850ice_fetch_registers, v850ice_store_registers):
* v850-tdep.c (v850_extract_return_value): Ditto.
* tracepoint.c (collect_symbol): Ditto.
* target.c (debug_print_register): Ditto.
* stack.c (frame_info): Ditto.
* rs6000-nat.c (ARCH64, fetch_register, store_register): Ditto.
* rom68k-rom.c (rom68k_supply_one_register): Ditto.
* remote.c (struct packet_reg, remote_wait, remote_async_wait)
(store_register_using_P): Ditto.
* remote-vxmips.c (vx_read_register, vx_write_register): Ditto.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump, sub2_from_pc): Ditto.
* regcache.c (deprecated_read_register_bytes)
(deprecated_write_register_bytes, read_register)
(write_register): Ditto.
* ppc-linux-nat.c (fetch_altivec_register, fetch_register)
(supply_vrregset, store_altivec_register, fill_vrregset): Ditto.
* monitor.c (monitor_supply_register, monitor_fetch_register)
(monitor_store_register): Ditto.
* mn10300-tdep.c (mn10300_pop_frame_regular)
(mn10300_print_register): Ditto.
* mipsv4-nat.c (fill_fpregset): Ditto.
* mips-linux-tdep.c (supply_32bit_reg, fill_fpregset)
(mips64_fill_fpregset): Ditto.
* mi/mi-main.c (register_changed_p, get_register)
(mi_cmd_data_write_register_values): Ditto.
* lynx-nat.c (fetch_inferior_registers, store_inferior_registers):
* irix5-nat.c (fill_gregset, fetch_core_registers):
* infrun.c (write_inferior_status_register): Ditto.
* infptrace.c (fetch_register, store_register): Ditto.
* infcmd.c (default_print_registers_info): Ditto.
* ia64-linux-nat.c (COPY_REG, fill_fpregset): Ditto.
* ia64-aix-nat.c (COPY_REG, fill_gregset): Ditto.
* i386gnu-nat.c (gnu_store_registers, fill): Ditto.
* hpux-thread.c (hpux_thread_fetch_registers)
(hpux_thread_store_registers): Ditto.
* hppah-nat.c (store_inferior_registers, fetch_register):
* findvar.c (value_from_register): Ditto.
* dve3900-rom.c (fetch_bitmapped_register):
* cris-tdep.c (cris_gdbarch_init): Ditto.
* alpha-tdep.h: Ditto.
* aix-thread.c (pd_enable, fill_sprs64, fill_sprs32): Ditto.
2004-08-03 02:57:27 +02:00
|
|
|
size = register_size (current_gdbarch, regnum);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
buf = alloca (size);
|
|
|
|
store_signed_integer (buf, size, (LONGEST) val);
|
2002-11-02 15:59:10 +01:00
|
|
|
deprecated_write_register_gen (regnum, buf);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-05-04 06:15:33 +02:00
|
|
|
write_register_pid (int regnum, CORE_ADDR val, ptid_t ptid)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-05-04 06:15:33 +02:00
|
|
|
ptid_t save_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
if (ptid_equal (ptid, inferior_ptid))
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-01-09 01:11:28 +01:00
|
|
|
write_register (regnum, val);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
save_ptid = inferior_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
inferior_ptid = ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-01-09 01:11:28 +01:00
|
|
|
write_register (regnum, val);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
inferior_ptid = save_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
2003-08-29 15:04:44 +02:00
|
|
|
/* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
|
2003-08-29 11:59:28 +02:00
|
|
|
|
|
|
|
void
|
2005-06-18 17:22:55 +02:00
|
|
|
regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf)
|
2003-08-29 11:59:28 +02:00
|
|
|
{
|
|
|
|
void *regbuf;
|
|
|
|
size_t size;
|
|
|
|
|
2003-08-29 15:04:44 +02:00
|
|
|
gdb_assert (regcache != NULL);
|
2003-08-29 11:59:28 +02:00
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
gdb_assert (!regcache->readonly_p);
|
|
|
|
|
|
|
|
/* FIXME: kettenis/20030828: It shouldn't be necessary to handle
|
|
|
|
CURRENT_REGCACHE specially here. */
|
|
|
|
if (regcache == current_regcache
|
|
|
|
&& !ptid_equal (registers_ptid, inferior_ptid))
|
|
|
|
{
|
|
|
|
registers_changed ();
|
|
|
|
registers_ptid = inferior_ptid;
|
|
|
|
}
|
|
|
|
|
|
|
|
regbuf = register_buffer (regcache, regnum);
|
|
|
|
size = regcache->descr->sizeof_register[regnum];
|
|
|
|
|
|
|
|
if (buf)
|
|
|
|
memcpy (regbuf, buf, size);
|
|
|
|
else
|
|
|
|
memset (regbuf, 0, size);
|
|
|
|
|
|
|
|
/* Mark the register as cached. */
|
|
|
|
regcache->register_valid_p[regnum] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Collect register REGNUM from REGCACHE and store its contents in BUF. */
|
|
|
|
|
|
|
|
void
|
2005-06-18 17:22:55 +02:00
|
|
|
regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
|
2003-08-29 11:59:28 +02:00
|
|
|
{
|
|
|
|
const void *regbuf;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
gdb_assert (regcache != NULL && buf != NULL);
|
|
|
|
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
|
|
|
|
|
|
|
|
regbuf = register_buffer (regcache, regnum);
|
|
|
|
size = regcache->descr->sizeof_register[regnum];
|
|
|
|
memcpy (buf, regbuf, size);
|
|
|
|
}
|
|
|
|
|
2001-11-15 07:43:10 +01:00
|
|
|
|
2004-08-05 16:12:40 +02:00
|
|
|
/* read_pc, write_pc, read_sp, etc. Special handling for registers
|
|
|
|
PC, SP, and FP. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2004-08-05 16:12:40 +02:00
|
|
|
/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc() and
|
|
|
|
read_sp(), will eventually be replaced by per-frame methods.
|
|
|
|
Instead of relying on the global INFERIOR_PTID, they will use the
|
|
|
|
contextual information provided by the FRAME. These functions do
|
|
|
|
not belong in the register cache. */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2003-06-07 18:23:12 +02:00
|
|
|
/* NOTE: cagney/2003-06-07: The functions generic_target_write_pc(),
|
2004-08-05 16:12:40 +02:00
|
|
|
write_pc_pid() and write_pc(), all need to be replaced by something
|
|
|
|
that does not rely on global state. But what? */
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
|
|
|
CORE_ADDR
|
2001-05-04 06:15:33 +02:00
|
|
|
read_pc_pid (ptid_t ptid)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-05-04 06:15:33 +02:00
|
|
|
ptid_t saved_inferior_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
CORE_ADDR pc_val;
|
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
/* In case ptid != inferior_ptid. */
|
|
|
|
saved_inferior_ptid = inferior_ptid;
|
|
|
|
inferior_ptid = ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2003-06-07 18:23:12 +02:00
|
|
|
if (TARGET_READ_PC_P ())
|
|
|
|
pc_val = TARGET_READ_PC (ptid);
|
|
|
|
/* Else use per-frame method on get_current_frame. */
|
|
|
|
else if (PC_REGNUM >= 0)
|
|
|
|
{
|
|
|
|
CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid);
|
2004-02-29 18:01:38 +01:00
|
|
|
pc_val = ADDR_BITS_REMOVE (raw_val);
|
2003-06-07 18:23:12 +02:00
|
|
|
}
|
|
|
|
else
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
internal_error (__FILE__, __LINE__, _("read_pc_pid: Unable to find PC"));
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
inferior_ptid = saved_inferior_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
return pc_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
read_pc (void)
|
|
|
|
{
|
2001-05-04 06:15:33 +02:00
|
|
|
return read_pc_pid (inferior_ptid);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-05-04 06:15:33 +02:00
|
|
|
generic_target_write_pc (CORE_ADDR pc, ptid_t ptid)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
|
|
|
if (PC_REGNUM >= 0)
|
2001-05-04 06:15:33 +02:00
|
|
|
write_register_pid (PC_REGNUM, pc, ptid);
|
2004-01-17 19:24:15 +01:00
|
|
|
else
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
_("generic_target_write_pc"));
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-05-04 06:15:33 +02:00
|
|
|
write_pc_pid (CORE_ADDR pc, ptid_t ptid)
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
{
|
2001-05-04 06:15:33 +02:00
|
|
|
ptid_t saved_inferior_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
/* In case ptid != inferior_ptid. */
|
|
|
|
saved_inferior_ptid = inferior_ptid;
|
|
|
|
inferior_ptid = ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
TARGET_WRITE_PC (pc, ptid);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
|
2001-05-04 06:15:33 +02:00
|
|
|
inferior_ptid = saved_inferior_ptid;
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
write_pc (CORE_ADDR pc)
|
|
|
|
{
|
2001-05-04 06:15:33 +02:00
|
|
|
write_pc_pid (pc, inferior_ptid);
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Cope with strage ways of getting to the stack and frame pointers */
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
read_sp (void)
|
|
|
|
{
|
2003-06-07 20:08:25 +02:00
|
|
|
if (TARGET_READ_SP_P ())
|
|
|
|
return TARGET_READ_SP ();
|
2003-06-09 03:02:07 +02:00
|
|
|
else if (gdbarch_unwind_sp_p (current_gdbarch))
|
|
|
|
return get_frame_sp (get_current_frame ());
|
2003-06-07 20:08:25 +02:00
|
|
|
else if (SP_REGNUM >= 0)
|
2003-06-09 03:02:07 +02:00
|
|
|
/* Try SP_REGNUM last: this makes all sorts of [wrong] assumptions
|
|
|
|
about the architecture so put it at the end. */
|
2003-06-07 20:08:25 +02:00
|
|
|
return read_register (SP_REGNUM);
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
internal_error (__FILE__, __LINE__, _("read_sp: Unable to find SP"));
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|
|
|
|
|
2000-09-01 19:59:26 +02:00
|
|
|
static void
|
|
|
|
reg_flush_command (char *command, int from_tty)
|
|
|
|
{
|
|
|
|
/* Force-flush the register cache. */
|
|
|
|
registers_changed ();
|
|
|
|
if (from_tty)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 01:39:24 +01:00
|
|
|
printf_filtered (_("Register cache flushed.\n"));
|
2000-09-01 19:59:26 +02:00
|
|
|
}
|
|
|
|
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
static void
|
|
|
|
build_regcache (void)
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
{
|
|
|
|
current_regcache = regcache_xmalloc (current_gdbarch);
|
2002-11-13 18:59:40 +01:00
|
|
|
current_regcache->readonly_p = 0;
|
* 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.
2002-06-20 05:13:51 +02:00
|
|
|
}
|
|
|
|
|
2002-08-10 02:36:46 +02:00
|
|
|
static void
|
|
|
|
dump_endian_bytes (struct ui_file *file, enum bfd_endian endian,
|
|
|
|
const unsigned char *buf, long len)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
switch (endian)
|
|
|
|
{
|
|
|
|
case BFD_ENDIAN_BIG:
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
fprintf_unfiltered (file, "%02x", buf[i]);
|
|
|
|
break;
|
|
|
|
case BFD_ENDIAN_LITTLE:
|
|
|
|
for (i = len - 1; i >= 0; i--)
|
|
|
|
fprintf_unfiltered (file, "%02x", buf[i]);
|
|
|
|
break;
|
|
|
|
default:
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
internal_error (__FILE__, __LINE__, _("Bad switch"));
|
2002-08-10 02:36:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum regcache_dump_what
|
|
|
|
{
|
2002-11-02 16:13:34 +01:00
|
|
|
regcache_dump_none, regcache_dump_raw, regcache_dump_cooked, regcache_dump_groups
|
2002-08-10 02:36:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
regcache_dump (struct regcache *regcache, struct ui_file *file,
|
|
|
|
enum regcache_dump_what what_to_dump)
|
|
|
|
{
|
|
|
|
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
2002-11-02 16:13:34 +01:00
|
|
|
struct gdbarch *gdbarch = regcache->descr->gdbarch;
|
2002-08-10 02:36:46 +02:00
|
|
|
int regnum;
|
|
|
|
int footnote_nr = 0;
|
|
|
|
int footnote_register_size = 0;
|
|
|
|
int footnote_register_offset = 0;
|
|
|
|
int footnote_register_type_name_null = 0;
|
|
|
|
long register_offset = 0;
|
2003-05-08 Andrew Cagney <cagney@redhat.com>
* regcache.h (max_register_size): Delete declaration.
* regcache.c (max_register_size): Delete function.
(struct regcache_descr): Delete field "max_register_size".
(init_regcache_descr, init_legacy_regcache_descr): Assert that all
registers fit in MAX_REGISTER_SIZE.
(regcache_save): Replace max_register_size with MAX_REGISTER_SIZE.
(regcache_restore, regcache_xfer_part, regcache_dump): Ditto.
* thread-db.c: Replace max_register_size with MAX_REGISTER_SIZE.
* sh-tdep.c, rom68k-rom.c, remote-sim.c, remote-mips.c: Ditto.
* remote-e7000.c, monitor.c, mipsv4-nat.c, mips-nat.c: Ditto.
* m68klinux-nat.c, lynx-nat.c, irix4-nat.c: Ditto.
* hpux-thread.c, hppah-nat.c, hppab-nat.c, hppa-tdep.c: Ditto.
* dve3900-rom.c, hppa-tdep.c: Ditto.
2003-05-09 00:33:14 +02:00
|
|
|
unsigned char buf[MAX_REGISTER_SIZE];
|
2002-08-10 02:36:46 +02:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
fprintf_unfiltered (file, "nr_raw_registers %d\n",
|
|
|
|
regcache->descr->nr_raw_registers);
|
|
|
|
fprintf_unfiltered (file, "nr_cooked_registers %d\n",
|
|
|
|
regcache->descr->nr_cooked_registers);
|
|
|
|
fprintf_unfiltered (file, "sizeof_raw_registers %ld\n",
|
|
|
|
regcache->descr->sizeof_raw_registers);
|
|
|
|
fprintf_unfiltered (file, "sizeof_raw_register_valid_p %ld\n",
|
|
|
|
regcache->descr->sizeof_raw_register_valid_p);
|
|
|
|
fprintf_unfiltered (file, "NUM_REGS %d\n", NUM_REGS);
|
|
|
|
fprintf_unfiltered (file, "NUM_PSEUDO_REGS %d\n", NUM_PSEUDO_REGS);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gdb_assert (regcache->descr->nr_cooked_registers
|
|
|
|
== (NUM_REGS + NUM_PSEUDO_REGS));
|
|
|
|
|
|
|
|
for (regnum = -1; regnum < regcache->descr->nr_cooked_registers; regnum++)
|
|
|
|
{
|
|
|
|
/* Name. */
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, " %-10s", "Name");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *p = REGISTER_NAME (regnum);
|
|
|
|
if (p == NULL)
|
|
|
|
p = "";
|
|
|
|
else if (p[0] == '\0')
|
|
|
|
p = "''";
|
|
|
|
fprintf_unfiltered (file, " %-10s", p);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Number. */
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, " %4s", "Nr");
|
|
|
|
else
|
|
|
|
fprintf_unfiltered (file, " %4d", regnum);
|
|
|
|
|
|
|
|
/* Relative number. */
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, " %4s", "Rel");
|
|
|
|
else if (regnum < NUM_REGS)
|
|
|
|
fprintf_unfiltered (file, " %4d", regnum);
|
|
|
|
else
|
|
|
|
fprintf_unfiltered (file, " %4d", (regnum - NUM_REGS));
|
|
|
|
|
|
|
|
/* Offset. */
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, " %6s ", "Offset");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fprintf_unfiltered (file, " %6ld",
|
|
|
|
regcache->descr->register_offset[regnum]);
|
2002-08-10 04:00:16 +02:00
|
|
|
if (register_offset != regcache->descr->register_offset[regnum]
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 16:24:31 +02:00
|
|
|
|| register_offset != DEPRECATED_REGISTER_BYTE (regnum)
|
2002-08-25 20:47:16 +02:00
|
|
|
|| (regnum > 0
|
|
|
|
&& (regcache->descr->register_offset[regnum]
|
|
|
|
!= (regcache->descr->register_offset[regnum - 1]
|
|
|
|
+ regcache->descr->sizeof_register[regnum - 1])))
|
|
|
|
)
|
2002-08-10 02:36:46 +02:00
|
|
|
{
|
|
|
|
if (!footnote_register_offset)
|
|
|
|
footnote_register_offset = ++footnote_nr;
|
|
|
|
fprintf_unfiltered (file, "*%d", footnote_register_offset);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fprintf_unfiltered (file, " ");
|
|
|
|
register_offset = (regcache->descr->register_offset[regnum]
|
|
|
|
+ regcache->descr->sizeof_register[regnum]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Size. */
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, " %5s ", "Size");
|
|
|
|
else
|
2004-08-02 23:58:44 +02:00
|
|
|
fprintf_unfiltered (file, " %5ld",
|
|
|
|
regcache->descr->sizeof_register[regnum]);
|
2002-08-10 02:36:46 +02:00
|
|
|
|
|
|
|
/* Type. */
|
2002-11-02 16:13:34 +01:00
|
|
|
{
|
|
|
|
const char *t;
|
|
|
|
if (regnum < 0)
|
|
|
|
t = "Type";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
static const char blt[] = "builtin_type";
|
|
|
|
t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum));
|
|
|
|
if (t == NULL)
|
|
|
|
{
|
|
|
|
char *n;
|
|
|
|
if (!footnote_register_type_name_null)
|
|
|
|
footnote_register_type_name_null = ++footnote_nr;
|
2004-06-29 01:59:29 +02:00
|
|
|
n = xstrprintf ("*%d", footnote_register_type_name_null);
|
2002-11-02 16:13:34 +01:00
|
|
|
make_cleanup (xfree, n);
|
|
|
|
t = n;
|
|
|
|
}
|
|
|
|
/* Chop a leading builtin_type. */
|
|
|
|
if (strncmp (t, blt, strlen (blt)) == 0)
|
|
|
|
t += strlen (blt);
|
|
|
|
}
|
|
|
|
fprintf_unfiltered (file, " %-15s", t);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Leading space always present. */
|
|
|
|
fprintf_unfiltered (file, " ");
|
2002-08-10 02:36:46 +02:00
|
|
|
|
|
|
|
/* Value, raw. */
|
|
|
|
if (what_to_dump == regcache_dump_raw)
|
|
|
|
{
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, "Raw value");
|
|
|
|
else if (regnum >= regcache->descr->nr_raw_registers)
|
|
|
|
fprintf_unfiltered (file, "<cooked>");
|
|
|
|
else if (!regcache_valid_p (regcache, regnum))
|
|
|
|
fprintf_unfiltered (file, "<invalid>");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
regcache_raw_read (regcache, regnum, buf);
|
|
|
|
fprintf_unfiltered (file, "0x");
|
|
|
|
dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
|
2004-08-02 23:58:44 +02:00
|
|
|
regcache->descr->sizeof_register[regnum]);
|
2002-08-10 02:36:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Value, cooked. */
|
|
|
|
if (what_to_dump == regcache_dump_cooked)
|
|
|
|
{
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, "Cooked value");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
regcache_cooked_read (regcache, regnum, buf);
|
|
|
|
fprintf_unfiltered (file, "0x");
|
|
|
|
dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
|
2004-08-02 23:58:44 +02:00
|
|
|
regcache->descr->sizeof_register[regnum]);
|
2002-08-10 02:36:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-02 16:13:34 +01:00
|
|
|
/* Group members. */
|
|
|
|
if (what_to_dump == regcache_dump_groups)
|
|
|
|
{
|
|
|
|
if (regnum < 0)
|
|
|
|
fprintf_unfiltered (file, "Groups");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *sep = "";
|
2003-08-04 22:34:10 +02:00
|
|
|
struct reggroup *group;
|
|
|
|
for (group = reggroup_next (gdbarch, NULL);
|
|
|
|
group != NULL;
|
|
|
|
group = reggroup_next (gdbarch, group))
|
2002-11-02 16:13:34 +01:00
|
|
|
{
|
2003-08-04 22:34:10 +02:00
|
|
|
if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
|
2002-11-02 16:13:34 +01:00
|
|
|
{
|
2003-08-04 22:34:10 +02:00
|
|
|
fprintf_unfiltered (file, "%s%s", sep, reggroup_name (group));
|
2002-11-02 16:13:34 +01:00
|
|
|
sep = ",";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-10 02:36:46 +02:00
|
|
|
fprintf_unfiltered (file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (footnote_register_size)
|
|
|
|
fprintf_unfiltered (file, "*%d: Inconsistent register sizes.\n",
|
|
|
|
footnote_register_size);
|
|
|
|
if (footnote_register_offset)
|
|
|
|
fprintf_unfiltered (file, "*%d: Inconsistent register offsets.\n",
|
|
|
|
footnote_register_offset);
|
|
|
|
if (footnote_register_type_name_null)
|
|
|
|
fprintf_unfiltered (file,
|
|
|
|
"*%d: Register type's name NULL.\n",
|
|
|
|
footnote_register_type_name_null);
|
|
|
|
do_cleanups (cleanups);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
regcache_print (char *args, enum regcache_dump_what what_to_dump)
|
|
|
|
{
|
|
|
|
if (args == NULL)
|
|
|
|
regcache_dump (current_regcache, gdb_stdout, what_to_dump);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct ui_file *file = gdb_fopen (args, "w");
|
|
|
|
if (file == NULL)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 19:13:55 +01:00
|
|
|
perror_with_name (_("maintenance print architecture"));
|
2002-08-10 02:36:46 +02:00
|
|
|
regcache_dump (current_regcache, file, what_to_dump);
|
|
|
|
ui_file_delete (file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
maintenance_print_registers (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
regcache_print (args, regcache_dump_none);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
maintenance_print_raw_registers (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
regcache_print (args, regcache_dump_raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
maintenance_print_cooked_registers (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
regcache_print (args, regcache_dump_cooked);
|
|
|
|
}
|
|
|
|
|
2002-11-02 16:13:34 +01:00
|
|
|
static void
|
|
|
|
maintenance_print_register_groups (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
regcache_print (args, regcache_dump_groups);
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 20:27:14 +02:00
|
|
|
extern initialize_file_ftype _initialize_regcache; /* -Wmissing-prototype */
|
|
|
|
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
void
|
|
|
|
_initialize_regcache (void)
|
|
|
|
{
|
2004-03-15 21:38:08 +01:00
|
|
|
regcache_descr_handle = gdbarch_data_register_post_init (init_regcache_descr);
|
2004-02-15 16:22:06 +01:00
|
|
|
DEPRECATED_REGISTER_GDBARCH_SWAP (current_regcache);
|
|
|
|
deprecated_register_gdbarch_swap (NULL, 0, build_regcache);
|
2000-09-01 19:59:26 +02:00
|
|
|
|
2004-04-26 11:49:36 +02:00
|
|
|
observer_attach_target_changed (regcache_observer_target_changed);
|
|
|
|
|
2000-09-01 19:59:26 +02:00
|
|
|
add_com ("flushregs", class_maintenance, reg_flush_command,
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 16:49:28 +01:00
|
|
|
_("Force gdb to flush its register cache (maintainer command)"));
|
2001-05-04 06:15:33 +02:00
|
|
|
|
|
|
|
/* Initialize the thread/process associated with the current set of
|
|
|
|
registers. For now, -1 is special, and means `no current process'. */
|
|
|
|
registers_ptid = pid_to_ptid (-1);
|
2002-08-10 02:36:46 +02:00
|
|
|
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 19:10:11 +01:00
|
|
|
add_cmd ("registers", class_maintenance, maintenance_print_registers, _("\
|
|
|
|
Print the internal register configuration.\n\
|
|
|
|
Takes an optional file parameter."), &maintenanceprintlist);
|
2002-08-10 02:36:46 +02:00
|
|
|
add_cmd ("raw-registers", class_maintenance,
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 19:10:11 +01:00
|
|
|
maintenance_print_raw_registers, _("\
|
|
|
|
Print the internal register configuration including raw values.\n\
|
|
|
|
Takes an optional file parameter."), &maintenanceprintlist);
|
2002-08-10 02:36:46 +02:00
|
|
|
add_cmd ("cooked-registers", class_maintenance,
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 19:10:11 +01:00
|
|
|
maintenance_print_cooked_registers, _("\
|
|
|
|
Print the internal register configuration including cooked values.\n\
|
|
|
|
Takes an optional file parameter."), &maintenanceprintlist);
|
2002-11-02 16:13:34 +01:00
|
|
|
add_cmd ("register-groups", class_maintenance,
|
2005-02-14 Andrew Cagney <cagney@gnu.org>
Mark up add_cmd.
* arch-utils.c, avr-tdep.c, breakpoint.c, corefile.c: Update.
* cp-abi.c, cp-namespace.c, cp-support.c, dummy-frame.c: Update.
* exec.c, gnu-nat.c, go32-nat.c, hppa-tdep.c, infcmd.c: Update.
* infrun.c, interps.c, macrocmd.c, maint.c, memattr.c: Update.
* mips-tdep.c, ocd.c, osabi.c, printcmd.c, regcache.c: Update.
* reggroups.c, remote-fileio.c, remote-rdi.c, remote.c: Update.
* sol-thread.c, source.c, stack.c, symfile-mem.c: Update.
* symfile.c, thread.c, tracepoint.c, valprint.c, value.c: Update.
* win32-nat.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-regs.c: Update.
2005-02-14 19:10:11 +01:00
|
|
|
maintenance_print_register_groups, _("\
|
|
|
|
Print the internal register configuration including each register's group.\n\
|
|
|
|
Takes an optional file parameter."),
|
2002-08-10 02:36:46 +02:00
|
|
|
&maintenanceprintlist);
|
|
|
|
|
2000-07-07 Michael Snyder <msnyder@cleaver.cygnus.com>
* findvar.c (_initialize_findvar, build_findvar, write_fp, read_fp,
generic_target_write_fp, generic_target_read_fp, write_sp, read_sp,
generic_target_write_sp, generic_target_read_sp, write_pc, read_pc,
generic_target_write_pc, generic_target_read_pc, write_pc_pid,
read_pc_pid, supply_register, write_register_pid, write_register,
read_register_pid, read_register, write_register_bytes,
read_register_bytes, write_register_gen, read_register_gen,
registers_fetched, registers_changed, find_saved_register,
read_relative_register_raw_bytes, default_get_saved_register,
read_relative_register_raw_bytes_for_frame, get_saved_register):
Move from this file into new file regcache.c.
(register_valid, registers_pid, registers): Ditto.
* regcache.c: New file to hold the register cache.
(register_cached): New function to read register_valid array.
* value.h (register_cached): Declare.
* defs.h (default_get_saved_register): Delete decl of static function.
* Makefile.in: Add regcache module.
2000-07-10 08:16:51 +02:00
|
|
|
}
|