binutils-gdb/gdb/regcache.c

1727 lines
46 KiB
C
Raw Normal View History

/* 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
Copyright (C) 1986-2017 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "inferior.h"
#include "target.h"
#include "gdbarch.h"
#include "gdbcmd.h"
#include "regcache.h"
#include "reggroups.h"
#include "observer.h"
#include "remote.h"
#include "valprint.h"
#include "regset.h"
#include <forward_list>
/*
* 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. */
* 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 gdbarch_data *regcache_descr_handle;
struct regcache_descr
{
/* The architecture this descriptor belongs to. */
struct gdbarch *gdbarch;
/* 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
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
long sizeof_raw_registers;
/* 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
.. NR_COOKED_REGISTERS) (a.k.a. pseudo registers) are mapped onto
both raw registers and memory by the architecture methods
gdbarch_pseudo_register_read and gdbarch_pseudo_register_write. */
int nr_cooked_registers;
long sizeof_cooked_registers;
/* Offset and size (in 8 bit bytes), of each register in the
register cache. All registers (including those in the range
[NR_RAW_REGISTERS .. NR_COOKED_REGISTERS) are given an
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
long *register_offset;
long *sizeof_register;
/* 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);
/* Create an initial, zero filled, table. */
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;
/* 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. */
descr->nr_cooked_registers = gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch);
* 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
/* Fill in a table of register types. */
descr->register_type
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers,
struct type *);
for (i = 0; i < descr->nr_cooked_registers; i++)
descr->register_type[i] = gdbarch_register_type (gdbarch, i);
/* Construct a strictly RAW register cache. Don't allow pseudo's
into the register cache. */
/* 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
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;
descr->sizeof_register
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
descr->register_offset
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
{
descr->sizeof_register[i] = TYPE_LENGTH (descr->register_type[i]);
descr->register_offset[i] = offset;
offset += descr->sizeof_register[i];
gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
}
/* Set the real size of the raw register cache buffer. */
descr->sizeof_raw_registers = offset;
for (; 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
{
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];
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 readonly register cache buffer. */
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
}
return descr;
}
static struct regcache_descr *
regcache_descr (struct gdbarch *gdbarch)
{
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
return (struct regcache_descr *) gdbarch_data (gdbarch,
regcache_descr_handle);
* 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
}
/* 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];
}
/* Utility functions returning useful register attributes stored in
the regcache descr. */
int
register_size (struct gdbarch *gdbarch, int regnum)
{
struct regcache_descr *descr = regcache_descr (gdbarch);
int size;
2007-05-31 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (NUM_REGS): Replace by gdbarch_num_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers) (inf_ptrace_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * i386-linux-nat.c (supply_gregset, fill_gregset) (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers): Likewise. * remote.c (init_remote_state,packet_reg_from_regnum) (packet_reg_from_pnum,process_g_packet,remote_fetch_registers) (remote_prepare_to_store,store_registers_using_G) (remote_store_registers,remote_arch_state): Likewise. * tracepoint.c (encode_actions): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * tui/tui-regs.c (tui_show_register_group) (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * xtensa-tdep.c (xtensa_register_name,xtensa_register_type) (xtensa_reg_to_regnum,xtensa_pseudo_register_read) (xtensa_pseudo_register_write,xtensa_register_reggroup_p): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers) (do_win32_store_inferior_registers,fetch_elf_core_registers * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target-descriptions.c (tdesc_use_registers): Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_do_pseudo_register,sh64_print_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * rs6000-nat.c (fetch_register,store_register): Likewise. * remote-sim.c (one2one_register_sim_regno,gdbsim_fetch_register) (gdbsim_fetch_register,gdbsim_store_register): Likewise. * remote-mips.c (mips_fetch_registers,mips_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers) (m32r_store_registers): Likewise. * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save) (regcache_restore,regcache_dump): Likewise. * monitor.c (monitor_fetch_registers,monitor_store_registers): Likewise. * mips-tdep.c (mips_xfer_register,mips_register_name) (mips_register_reggroup_p,mips_pseudo_register_read) (mips_pseudo_register_write,mips_convert_register_p,mips_register_type) (mips_unwind_pc,mips_unwind_sp,mips_unwind_dummy_id,set_reg_offset) (mips16_scan_prologue,mips_insn16_frame_cache,reset_saved_regs) (mips32_scan_prologue,mips_insn32_frame_cache,read_next_frame_reg) (mips_n32n64_return_value,mips_o32_return_value,mips_o64_return_value) (print_gp_register_row,mips_print_registers_info) (mips_stab_reg_to_regnum,mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_register_sim_regno): Likewise. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Likewise. * mips-linux-nat.c (mips_linux_register_addr) (mips64_linux_register_addr): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * mips64obsd-tdep.c (mips64obsd_sigframe_init): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache(: Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * ia64-linux-nat.c (ia64_register_addr,ia64_cannot_fetch_register) (ia64_cannot_store_register,ia64_linux_fetch_registers) (ia64_linux_store_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers) (hpux_thread_store_registers): Likewise. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM,E_PSEUDO_EXR_REGNUM) (h8300_init_frame_cache,h8300_frame_cache,h8300_frame_prev_register) (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache) (dwarf2_frame_state_alloc_regs): Likewise. * cris-tdep.c (cris_register_size,cris_cannot_fetch_register) (cris_cannot_store_register,crisv32_cannot_fetch_register) (crisv32_cannot_store_register,cris_register_name): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * arch-utils.c (legacy_register_sim_regno) (legacy_virtual_frame_pointer): Likewise. * arm-tdep.c (arm_make_prologue_cache,arm_register_sim_regno):Likewise. * arm-tdep.h: Likewise (comment). * frv-tdep.c (frv_register_sim_regno): Likewise. * m68klinux-nat.c (old_fetch_inferior_registers) (old_store_inferior_registers): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * irix5-nat.c (fetch_core_registers): Likewise. * hppa-tdep.c (hppa_frame_cache): Likewise. * hppa-linux-nat.c (hppa_linux_register_addr) (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_inferior_registers) (hppa_hpux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_native_gregset_reg_offset) (amd64_supply_native_gregset,amd64_collect_native_gregset): Likewise. * dbug-rom.c (dbug_regname): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache) (HARD_PAGE_REGNUM (comment)): Likewise. * gdbarch.sh (NUM_PSEUDO_REGS): Replace by gdbarch_num_pseudo_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate. * tui/tui-regs.c (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_print_register,sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save (regcache_restore,regcache_dump): Likewise. * mips-tdep.c (print_gp_register_row,mips_print_registers_info) (mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_stab_reg_to_regnum): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache): Likewise. * frame.h (SIZEOF_FRAME_SAVED_REGS): Likewise. * xtensa-tdep.c (xtensa_register_type,xtensa_reg_to_regnum) (xtensa_pseudo_register_read,xtensa_pseudo_register_write): Likewise. * parse.c: Remove comment. * gdbarch.c, gdbarch.h: Regenerate
2007-05-31 19:32:22 +02:00
gdb_assert (regnum >= 0
&& regnum < (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch)));
size = descr->sizeof_register[regnum];
return size;
}
aarch64 multi-arch part 6: HW breakpoint on unaligned address Nowadays, both aarch64 GDB and linux kernel assumes that address for setting breakpoint should be 4-byte aligned. However that is not true after we support multi-arch, because thumb instruction can be at 2-byte aligned address. Patch http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/375141.html to linux kernel is to teach kernel to handle 2-byte aligned address for HW breakpoint, while this patch is to teach aarch64 GDB handle 2-byte aligned address. First of all, we call gdbarch_breakpoint_from_pc to get the instruction length rather than using hard-coded 4. Secondly, in GDBserver, we set length back to 2 if it is 3, because GDB encode 3 in it to indicate it is a 32-bit thumb breakpoint. Then we relax the address alignment check from 4-byte aligned to 2-byte aligned. This patch enables some tests (such as gdb.base/break-idempotent.exp, gdb.base/cond-eval-mode.exp, gdb.base/watchpoint-reuse-slot.exp,) and fixes many fails (such as gdb.base/hbreak2.exp) when the program is compiled in thumb mode on aarch64. Regression tested on aarch64-linux, both native and gdbserver. This is the last patch of multi-arch work. gdb: 2015-10-15 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Call gdbarch_breakpoint_from_pc to instruction length. (aarch64_linux_remove_hw_breakpoint): Likewise. * common/common-regcache.h (regcache_register_size): Declare. * nat/aarch64-linux-hw-point.c: Include "common-regcache.h". (aarch64_point_is_aligned): Set alignment to 2 for breakpoint if the process is 32bit, otherwise set alignment to 4. (aarch64_handle_breakpoint): Update comments. * regcache.c (regcache_register_size): New function. gdb/gdbserver: 2015-10-15 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_insert_point): Set len to 2 if it is 3. (aarch64_remove_point): Likewise. * regcache.c (regcache_register_size): New function.
2015-10-15 16:05:10 +02:00
/* See common/common-regcache.h. */
int
regcache_register_size (const struct regcache *regcache, int n)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
return register_size (regcache->arch (), n);
aarch64 multi-arch part 6: HW breakpoint on unaligned address Nowadays, both aarch64 GDB and linux kernel assumes that address for setting breakpoint should be 4-byte aligned. However that is not true after we support multi-arch, because thumb instruction can be at 2-byte aligned address. Patch http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/375141.html to linux kernel is to teach kernel to handle 2-byte aligned address for HW breakpoint, while this patch is to teach aarch64 GDB handle 2-byte aligned address. First of all, we call gdbarch_breakpoint_from_pc to get the instruction length rather than using hard-coded 4. Secondly, in GDBserver, we set length back to 2 if it is 3, because GDB encode 3 in it to indicate it is a 32-bit thumb breakpoint. Then we relax the address alignment check from 4-byte aligned to 2-byte aligned. This patch enables some tests (such as gdb.base/break-idempotent.exp, gdb.base/cond-eval-mode.exp, gdb.base/watchpoint-reuse-slot.exp,) and fixes many fails (such as gdb.base/hbreak2.exp) when the program is compiled in thumb mode on aarch64. Regression tested on aarch64-linux, both native and gdbserver. This is the last patch of multi-arch work. gdb: 2015-10-15 Yao Qi <yao.qi@linaro.org> * aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Call gdbarch_breakpoint_from_pc to instruction length. (aarch64_linux_remove_hw_breakpoint): Likewise. * common/common-regcache.h (regcache_register_size): Declare. * nat/aarch64-linux-hw-point.c: Include "common-regcache.h". (aarch64_point_is_aligned): Set alignment to 2 for breakpoint if the process is 32bit, otherwise set alignment to 4. (aarch64_handle_breakpoint): Update comments. * regcache.c (regcache_register_size): New function. gdb/gdbserver: 2015-10-15 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (aarch64_insert_point): Set len to 2 if it is 3. (aarch64_remove_point): Likewise. * regcache.c (regcache_register_size): New function.
2015-10-15 16:05:10 +02:00
}
regcache::regcache (gdbarch *gdbarch, const address_space *aspace_,
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
bool readonly_p_)
: m_aspace (aspace_), m_readonly_p (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
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (gdbarch != NULL);
m_descr = regcache_descr (gdbarch);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (m_readonly_p)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_registers = XCNEWVEC (gdb_byte, m_descr->sizeof_cooked_registers);
m_register_status = XCNEWVEC (signed char,
m_descr->nr_cooked_registers);
}
else
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_registers = XCNEWVEC (gdb_byte, m_descr->sizeof_raw_registers);
m_register_status = XCNEWVEC (signed char, gdbarch_num_regs (gdbarch));
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_ptid = minus_one_ptid;
}
static enum register_status
do_cooked_read (void *src, int regnum, gdb_byte *buf)
{
struct regcache *regcache = (struct regcache *) src;
return regcache_cooked_read (regcache, regnum, buf);
}
regcache::regcache (readonly_t, const regcache &src)
: regcache (src.arch (), nullptr, true)
{
gdb_assert (!src.m_readonly_p);
save (do_cooked_read, (void *) &src);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdbarch *
regcache::arch () const
{
return m_descr->gdbarch;
}
* 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
/* See regcache.h. */
ptid_t
regcache_get_ptid (const struct regcache *regcache)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (!ptid_equal (regcache->ptid (), minus_one_ptid));
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return regcache->ptid ();
}
/* Cleanup class for invalidating a register. */
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
class regcache_invalidator
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
{
public:
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
regcache_invalidator (struct regcache *regcache, int regnum)
: m_regcache (regcache),
m_regnum (regnum)
{
}
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
~regcache_invalidator ()
{
if (m_regcache != nullptr)
regcache_invalidate (m_regcache, m_regnum);
}
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
DISABLE_COPY_AND_ASSIGN (regcache_invalidator);
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
void release ()
{
m_regcache = nullptr;
}
private:
struct regcache *m_regcache;
int m_regnum;
};
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
/* Return a pointer to register REGNUM's buffer cache. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_byte *
regcache::register_buffer (int regnum) const
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return m_registers + m_descr->register_offset[regnum];
}
void
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache_save (struct regcache *regcache,
regcache_cooked_read_ftype *cooked_read, void *src)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->save (cooked_read, src);
}
void
regcache::save (regcache_cooked_read_ftype *cooked_read,
void *src)
{
struct gdbarch *gdbarch = m_descr->gdbarch;
int regnum;
/* The DST should be `read-only', if it wasn't then the save would
end up trying to write the register values back out to the
target. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (m_readonly_p);
/* Clear the dest. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
memset (m_registers, 0, m_descr->sizeof_cooked_registers);
memset (m_register_status, 0, m_descr->nr_cooked_registers);
/* Copy over any registers (identified by their membership in the
2007-05-31 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (NUM_REGS): Replace by gdbarch_num_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers) (inf_ptrace_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * i386-linux-nat.c (supply_gregset, fill_gregset) (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers): Likewise. * remote.c (init_remote_state,packet_reg_from_regnum) (packet_reg_from_pnum,process_g_packet,remote_fetch_registers) (remote_prepare_to_store,store_registers_using_G) (remote_store_registers,remote_arch_state): Likewise. * tracepoint.c (encode_actions): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * tui/tui-regs.c (tui_show_register_group) (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * xtensa-tdep.c (xtensa_register_name,xtensa_register_type) (xtensa_reg_to_regnum,xtensa_pseudo_register_read) (xtensa_pseudo_register_write,xtensa_register_reggroup_p): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers) (do_win32_store_inferior_registers,fetch_elf_core_registers * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target-descriptions.c (tdesc_use_registers): Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_do_pseudo_register,sh64_print_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * rs6000-nat.c (fetch_register,store_register): Likewise. * remote-sim.c (one2one_register_sim_regno,gdbsim_fetch_register) (gdbsim_fetch_register,gdbsim_store_register): Likewise. * remote-mips.c (mips_fetch_registers,mips_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers) (m32r_store_registers): Likewise. * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save) (regcache_restore,regcache_dump): Likewise. * monitor.c (monitor_fetch_registers,monitor_store_registers): Likewise. * mips-tdep.c (mips_xfer_register,mips_register_name) (mips_register_reggroup_p,mips_pseudo_register_read) (mips_pseudo_register_write,mips_convert_register_p,mips_register_type) (mips_unwind_pc,mips_unwind_sp,mips_unwind_dummy_id,set_reg_offset) (mips16_scan_prologue,mips_insn16_frame_cache,reset_saved_regs) (mips32_scan_prologue,mips_insn32_frame_cache,read_next_frame_reg) (mips_n32n64_return_value,mips_o32_return_value,mips_o64_return_value) (print_gp_register_row,mips_print_registers_info) (mips_stab_reg_to_regnum,mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_register_sim_regno): Likewise. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Likewise. * mips-linux-nat.c (mips_linux_register_addr) (mips64_linux_register_addr): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * mips64obsd-tdep.c (mips64obsd_sigframe_init): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache(: Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * ia64-linux-nat.c (ia64_register_addr,ia64_cannot_fetch_register) (ia64_cannot_store_register,ia64_linux_fetch_registers) (ia64_linux_store_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers) (hpux_thread_store_registers): Likewise. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM,E_PSEUDO_EXR_REGNUM) (h8300_init_frame_cache,h8300_frame_cache,h8300_frame_prev_register) (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache) (dwarf2_frame_state_alloc_regs): Likewise. * cris-tdep.c (cris_register_size,cris_cannot_fetch_register) (cris_cannot_store_register,crisv32_cannot_fetch_register) (crisv32_cannot_store_register,cris_register_name): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * arch-utils.c (legacy_register_sim_regno) (legacy_virtual_frame_pointer): Likewise. * arm-tdep.c (arm_make_prologue_cache,arm_register_sim_regno):Likewise. * arm-tdep.h: Likewise (comment). * frv-tdep.c (frv_register_sim_regno): Likewise. * m68klinux-nat.c (old_fetch_inferior_registers) (old_store_inferior_registers): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * irix5-nat.c (fetch_core_registers): Likewise. * hppa-tdep.c (hppa_frame_cache): Likewise. * hppa-linux-nat.c (hppa_linux_register_addr) (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_inferior_registers) (hppa_hpux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_native_gregset_reg_offset) (amd64_supply_native_gregset,amd64_collect_native_gregset): Likewise. * dbug-rom.c (dbug_regname): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache) (HARD_PAGE_REGNUM (comment)): Likewise. * gdbarch.sh (NUM_PSEUDO_REGS): Replace by gdbarch_num_pseudo_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate. * tui/tui-regs.c (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_print_register,sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save (regcache_restore,regcache_dump): Likewise. * mips-tdep.c (print_gp_register_row,mips_print_registers_info) (mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_stab_reg_to_regnum): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache): Likewise. * frame.h (SIZEOF_FRAME_SAVED_REGS): Likewise. * xtensa-tdep.c (xtensa_register_type,xtensa_reg_to_regnum) (xtensa_pseudo_register_read,xtensa_pseudo_register_write): Likewise. * parse.c: Remove comment. * gdbarch.c, gdbarch.h: Regenerate
2007-05-31 19:32:22 +02:00
save_reggroup) and mark them as valid. The full [0 .. gdbarch_num_regs +
gdbarch_num_pseudo_regs) range is checked since some architectures need
to save/restore `cooked' registers that live in memory. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
for (regnum = 0; regnum < m_descr->nr_cooked_registers; regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
{
gdb_byte *dst_buf = register_buffer (regnum);
enum register_status status = cooked_read (src, regnum, dst_buf);
gdb_assert (status != REG_UNKNOWN);
if (status != REG_VALID)
memset (dst_buf, 0, register_size (gdbarch, regnum));
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_register_status[regnum] = status;
}
}
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
regcache::restore (struct regcache *src)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
struct gdbarch *gdbarch = m_descr->gdbarch;
int regnum;
/* The dst had better not be read-only. If it is, the `restore'
doesn't make much sense. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (!m_readonly_p);
gdb_assert (src->m_readonly_p);
/* Copy over any registers, being careful to only restore those that
2007-05-31 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (NUM_REGS): Replace by gdbarch_num_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers) (inf_ptrace_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * i386-linux-nat.c (supply_gregset, fill_gregset) (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers): Likewise. * remote.c (init_remote_state,packet_reg_from_regnum) (packet_reg_from_pnum,process_g_packet,remote_fetch_registers) (remote_prepare_to_store,store_registers_using_G) (remote_store_registers,remote_arch_state): Likewise. * tracepoint.c (encode_actions): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * tui/tui-regs.c (tui_show_register_group) (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * xtensa-tdep.c (xtensa_register_name,xtensa_register_type) (xtensa_reg_to_regnum,xtensa_pseudo_register_read) (xtensa_pseudo_register_write,xtensa_register_reggroup_p): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers) (do_win32_store_inferior_registers,fetch_elf_core_registers * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target-descriptions.c (tdesc_use_registers): Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_do_pseudo_register,sh64_print_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * rs6000-nat.c (fetch_register,store_register): Likewise. * remote-sim.c (one2one_register_sim_regno,gdbsim_fetch_register) (gdbsim_fetch_register,gdbsim_store_register): Likewise. * remote-mips.c (mips_fetch_registers,mips_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers) (m32r_store_registers): Likewise. * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save) (regcache_restore,regcache_dump): Likewise. * monitor.c (monitor_fetch_registers,monitor_store_registers): Likewise. * mips-tdep.c (mips_xfer_register,mips_register_name) (mips_register_reggroup_p,mips_pseudo_register_read) (mips_pseudo_register_write,mips_convert_register_p,mips_register_type) (mips_unwind_pc,mips_unwind_sp,mips_unwind_dummy_id,set_reg_offset) (mips16_scan_prologue,mips_insn16_frame_cache,reset_saved_regs) (mips32_scan_prologue,mips_insn32_frame_cache,read_next_frame_reg) (mips_n32n64_return_value,mips_o32_return_value,mips_o64_return_value) (print_gp_register_row,mips_print_registers_info) (mips_stab_reg_to_regnum,mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_register_sim_regno): Likewise. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Likewise. * mips-linux-nat.c (mips_linux_register_addr) (mips64_linux_register_addr): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * mips64obsd-tdep.c (mips64obsd_sigframe_init): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache(: Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * ia64-linux-nat.c (ia64_register_addr,ia64_cannot_fetch_register) (ia64_cannot_store_register,ia64_linux_fetch_registers) (ia64_linux_store_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers) (hpux_thread_store_registers): Likewise. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM,E_PSEUDO_EXR_REGNUM) (h8300_init_frame_cache,h8300_frame_cache,h8300_frame_prev_register) (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache) (dwarf2_frame_state_alloc_regs): Likewise. * cris-tdep.c (cris_register_size,cris_cannot_fetch_register) (cris_cannot_store_register,crisv32_cannot_fetch_register) (crisv32_cannot_store_register,cris_register_name): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * arch-utils.c (legacy_register_sim_regno) (legacy_virtual_frame_pointer): Likewise. * arm-tdep.c (arm_make_prologue_cache,arm_register_sim_regno):Likewise. * arm-tdep.h: Likewise (comment). * frv-tdep.c (frv_register_sim_regno): Likewise. * m68klinux-nat.c (old_fetch_inferior_registers) (old_store_inferior_registers): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * irix5-nat.c (fetch_core_registers): Likewise. * hppa-tdep.c (hppa_frame_cache): Likewise. * hppa-linux-nat.c (hppa_linux_register_addr) (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_inferior_registers) (hppa_hpux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_native_gregset_reg_offset) (amd64_supply_native_gregset,amd64_collect_native_gregset): Likewise. * dbug-rom.c (dbug_regname): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache) (HARD_PAGE_REGNUM (comment)): Likewise. * gdbarch.sh (NUM_PSEUDO_REGS): Replace by gdbarch_num_pseudo_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate. * tui/tui-regs.c (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_print_register,sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save (regcache_restore,regcache_dump): Likewise. * mips-tdep.c (print_gp_register_row,mips_print_registers_info) (mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_stab_reg_to_regnum): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache): Likewise. * frame.h (SIZEOF_FRAME_SAVED_REGS): Likewise. * xtensa-tdep.c (xtensa_register_type,xtensa_reg_to_regnum) (xtensa_pseudo_register_read,xtensa_pseudo_register_write): Likewise. * parse.c: Remove comment. * gdbarch.c, gdbarch.h: Regenerate
2007-05-31 19:32:22 +02:00
were both saved and need to be restored. The full [0 .. gdbarch_num_regs
+ gdbarch_num_pseudo_regs) range is checked since some architectures need
to save/restore `cooked' registers that live in memory. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
for (regnum = 0; regnum < m_descr->nr_cooked_registers; regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (src->m_register_status[regnum] == REG_VALID)
cooked_write (regnum, src->register_buffer (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
void
regcache_cpy (struct regcache *dst, struct regcache *src)
{
gdb_assert (src != NULL && dst != NULL);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (src->m_descr->gdbarch == dst->m_descr->gdbarch);
* 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 != dst);
gdb_assert (src->m_readonly_p && !dst->m_readonly_p);
2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> Add base multi-executable/process support to GDB. gdb/ * Makefile.in (SFILES): Add progspace.c. (COMMON_OBS): Add progspace.o. * progspace.h: New. * progspace.c: New. * breakpoint.h (struct bp_target_info) <placed_address_space>: New field. (struct bp_location) <pspace>: New field. (struct breakpoint) <pspace>: New field. (bpstat_stop_status, breakpoint_here_p) (moribund_breakpoint_here_p, breakpoint_inserted_here_p) (regular_breakpoint_inserted_here_p) (software_breakpoint_inserted_here_p, breakpoint_thread_match) (set_default_breakpoint): Adjust prototypes. (remove_breakpoints_pid, breakpoint_program_space_exit): Declare. (insert_single_step_breakpoint, deprecated_insert_raw_breakpoint): Adjust prototypes. * breakpoint.c (executing_startup): Delete. (default_breakpoint_sspace): New. (breakpoint_restore_shadows): Skip if the address space doesn't match. (update_watchpoint): Record the frame's program space in the breakpoint location. (insert_bp_location): Record the address space in target_info. Adjust to pass the symbol space to solib_name_from_address. (breakpoint_program_space_exit): New. (insert_breakpoint_locations): Switch the symbol space and thread when inserting breakpoints. Don't insert breakpoints in a vfork parent waiting for vfork done if we're not attached to the vfork child. (remove_breakpoints_pid): New. (reattach_breakpoints): Switch to a thread of PID. Ignore breakpoints of other symbol spaces. (create_internal_breakpoint): Store the symbol space in the sal. (create_longjmp_master_breakpoint): Iterate over all symbol spaces. (update_breakpoints_after_exec): Ignore breakpoints for other symbol spaces. (remove_breakpoint): Rename to ... (remove_breakpoint_1): ... this. Pass the breakpoints symbol space to solib_name_from_address. (remove_breakpoint): New. (mark_breakpoints_out): Ignore breakpoints from other symbol spaces. (breakpoint_init_inferior): Ditto. (breakpoint_here_p): Add an address space argument and adjust to use breakpoint_address_match. (moribund_breakpoint_here_p): Ditto. (regular_breakpoint_inserted_here_p): Ditto. (breakpoint_inserted_here_p): Ditto. (software_breakpoint_inserted_here_p): Ditto. (breakpoint_thread_match): Ditto. (bpstat_check_location): Ditto. (bpstat_stop_status): Ditto. (print_breakpoint_location): If there's a location to print, switch the current symbol space. (print_one_breakpoint_location): Add `allflag' argument. (print_one_breakpoint): Ditto. Adjust. (do_captured_breakpoint_query): Adjust. (breakpoint_1): Adjust. (breakpoint_has_pc): Also match the symbol space. (describe_other_breakpoints): Add a symbol space argument and adjust. (set_default_breakpoint): Add a symbol space argument. Set default_breakpoint_sspace. (breakpoint_address_match): New. (check_duplicates_for): Add an address space argument, and adjust. (set_raw_breakpoint): Record the symbol space in the location and in the breakpoint. (set_longjmp_breakpoint): Skip longjmp master breakpoints from other symbol spaces. (remove_thread_event_breakpoints, remove_solib_event_breakpoints) (disable_breakpoints_in_shlibs): Skip breakpoints from other symbol spaces. (disable_breakpoints_in_unloaded_shlib): Match symbol spaces. (create_catchpoint): Set the symbol space in the sal. (disable_breakpoints_before_startup): Skip breakpoints from other symbol spaces. Set executing_startup in the current symbol space. (enable_breakpoints_after_startup): Clear executing_startup in the current symbol space. Skip breakpoints from other symbol spaces. (clone_momentary_breakpoint): Also copy the symbol space. (add_location_to_breakpoint): Set the location's symbol space. (bp_loc_is_permanent): Switch thread and symbol space. (create_breakpoint): Adjust. (expand_line_sal_maybe): Expand comment to mention symbol spaces. Switch thread and symbol space when reading memory. (parse_breakpoint_sals): Set the symbol space in the sal. (break_command_really): Ditto. (skip_prologue_sal): Switch and space. (resolve_sal_pc): Ditto. (watch_command_1): Record the symbol space in the sal. (create_ada_exception_breakpoint): Adjust. (clear_command): Adjust. Match symbol spaces. (update_global_location_list): Use breakpoint_address_match. (breakpoint_re_set_one): Switch thread and space. (breakpoint_re_set): Save symbol space. (breakpoint_re_set_thread): Also reset the symbol space. (deprecated_insert_raw_breakpoint): Add an address space argument. Adjust. (insert_single_step_breakpoint): Ditto. (single_step_breakpoint_inserted_here_p): Ditto. (clear_syscall_counts): New. (_initialize_breakpoint): Install it as inferior_exit observer. * exec.h: Include "progspace.h". (exec_bfd, exec_bfd_mtime): New defines. (exec_close): Declare. * exec.c: Include "gdbthread.h" and "progspace.h". (exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete. (using_exec_ops): New. (exec_close_1): Rename to exec_close, and make public. (exec_close): Rename to exec_close_1, and adjust all callers. Add description. Remove target sections and close executables from all program spaces. (exec_file_attach): Add comment. (add_target_sections): Check on `using_exec_ops' to check if the target should be pushed. (remove_target_sections): Only unpush the target if there are no more target sections in any symbol space. * gdbcore.h: Include "exec.h". (exec_bfd, exec_bfd_mtime): Remove declarations. * frame.h (get_frame_program_space, get_frame_address_space) (frame_unwind_program_space): Declare. * frame.c (struct frame_info) <pspace, aspace>: New fields. (create_sentinel_frame): Add program space argument. Set the pspace and aspace fields of the frame object. (get_current_frame, create_new_frame): Adjust. (get_frame_program_space): New. (frame_unwind_program_space): New. (get_frame_address_space): New. * stack.c (print_frame_info): Adjust. (print_frame): Use the frame's program space. * gdbthread.h (any_live_thread_of_process): Declare. * thread.c (any_live_thread_of_process): New. (switch_to_thread): Switch the program space as well. (restore_selected_frame): Don't warn if trying to restore frame level 0. * inferior.h: Include "progspace.h". (detach_fork): Declare. (struct inferior) <removable, aspace, pspace> <vfork_parent, vfork_child, pending_detach> <waiting_for_vfork_done>: New fields. <terminal_info>: Remove field. <data, num_data>: New fields. (register_inferior_data, register_inferior_data_with_cleanup) (clear_inferior_data, set_inferior_data, inferior_data): Declare. (exit_inferior, exit_inferior_silent, exit_inferior_num_silent) (inferior_appeared): Declare. (find_inferior_pid): Typo. (find_inferior_id, find_inferior_for_program_space): Declare. (set_current_inferior, save_current_inferior, prune_inferiors) (number_of_inferiors): Declare. (inferior_list): Declare. * inferior.c: Include "gdbcore.h" and "symfile.h". (inferior_list): Make public. (delete_inferior_1): Always delete thread silently. (find_inferior_id): Make public. (current_inferior_): New. (current_inferior): Use it. (set_current_inferior): New. (restore_inferior): New. (save_current_inferior): New. (free_inferior): Free the per-inferior data. (add_inferior_silent): Allocate per-inferior data. Call inferior_appeared. (delete_threads_of_inferior): New. (delete_inferior_1): Adjust interface to take an inferior pointer. (delete_inferior): Adjust. (delete_inferior_silent): Adjust. (exit_inferior_1): New. (exit_inferior): New. (exit_inferior_silent): New. (exit_inferior_num_silent): New. (detach_inferior): Adjust. (inferior_appeared): New. (discard_all_inferiors): Adjust. (find_inferior_id): Make public. Assert pid is not zero. (find_inferior_for_program_space): New. (have_inferiors): Check if we have any inferior with pid not zero. (have_live_inferiors): Go over all pushed targets looking for process_stratum. (prune_inferiors): New. (number_of_inferiors): New. (print_inferior): Add executable column. Print vfork parent/child relationships. (inferior_command): Adjust to cope with not running inferiors. (remove_inferior_command): New. (add_inferior_command): New. (clone_inferior_command): New. (struct inferior_data): New. (struct inferior_data_registration): New. (struct inferior_data_registry): New. (inferior_data_registry): New. (register_inferior_data_with_cleanup): New. (register_inferior_data): New. (inferior_alloc_data): New. (inferior_free_data): New. (clear_inferior_data): New. (set_inferior_data): New. (inferior_data): New. (initialize_inferiors): New. (_initialize_inferiors): Register "add-inferior", "remove-inferior" and "clone-inferior" commands. * objfiles.h: Include "progspace.h". (struct objfile) <pspace>: New field. (symfile_objfile, object_files): Don't declare. (ALL_PSPACE_OBJFILES): New. (ALL_PSPACE_OBJFILES_SAFE): New. (ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust. (ALL_PSPACE_SYMTABS): New. (ALL_PRIMARY_SYMTABS): Adjust. (ALL_PSPACE_PRIMARY_SYMTABS): New. (ALL_PSYMTABS): Adjust. (ALL_PSPACE_PSYMTABS): New. * objfiles.c (object_files, symfile_objfile): Delete. (struct objfile_sspace_info): New. (objfiles_pspace_data): New. (objfiles_pspace_data_cleanup): New. (get_objfile_pspace_data): New. (objfiles_changed_p): Delete. (allocate_objfile): Set the objfile's program space. Adjust to reference objfiles_changed_p in pspace data. (free_objfile): Adjust to reference objfiles_changed_p in pspace data. (objfile_relocate): Ditto. (update_section_map): Add pspace argument. Adjust to iterate over objfiles in the passed in pspace. (find_pc_section): Delete sections and num_sections statics. Adjust to refer to program space's objfiles_changed_p. Adjust to refer to sections and num_sections store in the objfile's pspace data. (objfiles_changed): Adjust to reference objfiles_changed_p in pspace data. (_initialize_objfiles): New. * linespec.c (decode_all_digits, decode_dollar): Set the sal's program space. * source.c (current_source_pspace): New. (get_current_source_symtab_and_line): Set the sal's program space. (set_current_source_symtab_and_line): Set current_source_pspace. (select_source_symtab): Ditto. Use ALL_OBJFILES. (forget_cached_source_info): Iterate over all program spaces. * symfile.c (clear_symtab_users): Adjust. * symmisc.c (print_symbol_bcache_statistics): Iterate over all program spaces. (print_objfile_statistics): Ditto. (maintenance_print_msymbols): Ditto. (maintenance_print_objfiles): Ditto. (maintenance_info_symtabs): Ditto. (maintenance_info_psymtabs): Ditto. * symtab.h (SYMTAB_PSPACE): New. (struct symtab_and_line) <pspace>: New field. * symtab.c (init_sal): Clear the sal's program space. (find_pc_sect_symtab): Set the sal's program space. Switch thread and space. (append_expanded_sal): Add program space argument. Iterate over all program spaces. (expand_line_sal): Iterate over all program spaces. Switch program space. * target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New. (struct target_ops) <to_thread_address_space>: New field. (target_thread_address_space): Define. * target.c (target_detach): Only remove breakpoints from the inferior we're detaching. (target_thread_address_space): New. * defs.h (initialize_progspace): Declare. * top.c (gdb_init): Call it. * solist.h (struct so_list) <sspace>: New field. * solib.h (struct program_space): Forward declare. (solib_name_from_address): Adjust prototype. * solib.c (so_list_head): Replace with a macro referencing the program space. (update_solib_list): Set the so's program space. (solib_name_from_address): Add a program space argument and adjust. * solib-svr4.c (struct svr4_info) <pid>: Delete field. <interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low> <interp_plt_sect_high>: New fields. (svr4_info_p, svr4_info): Delete. (solib_svr4_sspace_data): New. (get_svr4_info): Rewrite. (svr4_sspace_data_cleanup): New. (open_symbol_file_object): Adjust. (svr4_default_sos): Adjust. (svr4_fetch_objfile_link_map): Adjust. (interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low) (interp_plt_sect_high): Delete. (svr4_in_dynsym_resolve_code): Adjust. (enable_break): Adjust. (svr4_clear_solib): Revert bit that removed the svr4_info here, and reinstate clearing debug_base, debug_loader_offset_p, debug_loader_offset and debug_loader_name. (_initialize_svr4_solib): Register solib_svr4_pspace_data. Don't install an inferior_exit observer anymore. * printcmd.c (struct display) <pspace>: New field. (display_command): Set the display's sspace. (do_one_display): Match the display's sspace. (display_uses_solib_p): Ditto. * linux-fork.c (detach_fork): Moved to infrun.c. (_initialize_linux_fork): Moved "detach-on-fork" command to infrun.c. * infrun.c (detach_fork): Moved from linux-fork.c. (proceed_after_vfork_done): New. (handle_vfork_child_exec_or_exit): New. (follow_exec_mode_replace, follow_exec_mode_keep) (follow_exec_mode_names, follow_exec_mode_string) (show_follow_exec_mode_string): New. (follow_exec): New. Reinstate the mark_breakpoints_out call. Remove shared libraries before attaching new executable. If user wants to keep the inferior, keep it. (displaced_step_fixup): Adjust to pass an address space to the breakpoints module. (resume): Ditto. (clear_proceed_status): In all-stop mode, always clear the proceed status of all threads. (prepare_to_proceed): Adjust to pass an address space to the breakpoints module. (proceed): Ditto. (adjust_pc_after_break): Ditto. (handle_inferior_event): When handling a process exit, switch the program space to the inferior's that had exited. Call handle_vfork_child_exec_or_exit. Adjust to pass an address space to the breakpoints module. In non-stop mode, when following a fork and detach-fork is off, also resume the other branch. Handle TARGET_WAITKIND_VFORK_DONE. Set the program space in sals. (normal_stop): Prune inferiors. (_initialize_infrun): Install the new "follow-exec-mode" command. "detach-on-fork" moved here. * regcache.h (get_regcache_aspace): Declare. * regcache.c (struct regcache) <aspace>: New field. (regcache_xmalloc): Clear the aspace. (get_regcache_aspace): New. (regcache_cpy): Copy the aspace field. (regcache_cpy_no_passthrough): Ditto. (get_thread_regcache): Fetch the thread's address space from the target, and store it in the regcache. * infcall.c (call_function_by_hand): Set the sal's pspace. * arch-utils.c (default_has_shared_address_space): New. * arch-utils.h (default_has_shared_address_space): Declare. * gdbarch.sh (has_shared_address_space): New. * gdbarch.h, gdbarch.c: Regenerate. * linux-tdep.c: Include auxv.h, target.h, elf/common.h. (linux_has_shared_address_space): New. (_initialize_linux_tdep): Declare. * arm-tdep.c (arm_software_single_step): Pass the frame's address space to insert_single_step_breakpoint. * arm-linux-tdep.c (arm_linux_software_single_step): Pass the frame's pspace to breakpoint functions. * cris-tdep.c (crisv32_single_step_through_delay): Ditto. (cris_software_single_step): Ditto. * mips-tdep.c (deal_with_atomic_sequence): Add frame argument. Pass the frame's pspace to breakpoint functions. (mips_software_single_step): Adjust. (mips_single_step_through_delay): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * solib-irix.c (enable_break): Adjust to pass the current frame's address space to breakpoint functions. * sparc-tdep.c (sparc_software_single_step): Ditto. * spu-tdep.c (spu_software_single_step): Ditto. * alpha-tdep.c (alpha_software_single_step): Ditto. * record.c (record_wait): Adjust to pass an address space to the breakpoints module. * fork-child.c (fork_inferior): Set the new inferior's program and address spaces. * inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program and address spaces. (inf_ptrace_attach): Set the inferior's program and address spaces. * linux-nat.c: Include "solib.h". (linux_child_follow_fork): Manage parent and child's program and address spaces. Clone the parent's program space if necessary. Don't wait for the vfork to be done here. Refuse to resume if following the vfork parent while leaving the child stopped. (resume_callback): Don't resume a vfork parent. (linux_nat_resume): Also check for pending events in the lp->waitstatus field. (linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE events to the core. (stop_wait_callback): Don't wait for SIGSTOP on vfork parents. (cancel_breakpoint): Adjust. * linux-thread-db.c (thread_db_wait): Don't remove thread event breakpoints here. (thread_db_mourn_inferior): Don't mark breakpoints out here. Remove thread event breakpoints after mourning. * corelow.c: Include progspace.h. (core_open): Set the inferior's program and address spaces. * remote.c (remote_add_inferior): Set the new inferior's program and address spaces. (remote_start_remote): Update address spaces. (extended_remote_create_inferior_1): Don't init the thread list if we already debugging other inferiors. * darwin-nat.c (darwin_attach): Set the new inferior's program and address spaces. * gnu-nat.c (gnu_attach): Ditto. * go32-nat.c (go32_create_inferior): Ditto. * inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto. * monitor.c (monitor_open): Ditto. * nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto. * procfs.c (do_attach): Ditto. * windows-nat.c (do_initial_windows_stuff): Ditto. * inflow.c (inferior_process_group) (terminal_init_inferior_with_pgrp, terminal_inferior, (terminal_ours_1, inflow_inferior_exit, copy_terminal_info) (child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust to use per-inferior data instead of inferior->terminal_info. (inflow_inferior_data): New. (inflow_new_inferior): Delete. (inflow_inferior_data_cleanup): New. (get_inflow_inferior_data): New. * mi/mi-interp.c (mi_new_inferior): Rename to... (mi_inferior_appeared): ... this. (mi_interpreter_init): Adjust. * tui/tui-disasm.c: Include "progspace.h". (tui_set_disassem_content): Pass an address space to breakpoint_here_p. * NEWS: Mention multi-program debugging support. Mention new commands "add-inferior", "clone-inferior", "remove-inferior", "maint info program-spaces", and new option "set follow-exec-mode". 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/doc/ * observer.texi (new_inferior): Rename to... (inferior_appeared): ... this. 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/testsuite/ * gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork". * gdb.base/foll-exec.exp: Adjust to expect a process id before "Executing new program". * gdb.base/foll-fork.exp: Adjust to spell out "follow-fork". * gdb.base/multi-forks.exp: Ditto. Adjust to the inferior being left listed after having been killed. * gdb.base/attach.exp: Adjust to spell out "symbol-file". * gdb.base/maint.exp: Adjust test. * Makefile.in (ALL_SUBDIRS): Add gdb.multi. * gdb.multi/Makefile.in: New. * gdb.multi/base.exp: New. * gdb.multi/goodbye.c: New. * gdb.multi/hangout.c: New. * gdb.multi/hello.c: New. * gdb.multi/bkpt-multi-exec.c: New. * gdb.multi/bkpt-multi-exec.exp: New. * gdb.multi/crashme.c: New. 2009-10-19 Pedro Alves <pedro@codesourcery.com> Stan Shebs <stan@codesourcery.com> gdb/doc/ * gdb.texinfo (Inferiors): Rename node to ... (Inferiors and Programs): ... this. Mention running multiple programs in the same debug session. <info inferiors>: Mention the new 'Executable' column if "info inferiors". Update examples. Document the "add-inferior", "clone-inferior", "remove-inferior" and "maint info program-spaces" commands. (Process): Rename node to... (Forks): ... this. Document "set|show follow-exec-mode".
2009-10-19 11:51:43 +02:00
dst->restore (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
}
struct regcache *
regcache_dup (struct regcache *src)
{
return new regcache (regcache::readonly, *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
}
enum register_status
regcache_register_status (const struct regcache *regcache, int 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
{
gdb_assert (regcache != NULL);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return regcache->get_register_status (regnum);
}
enum register_status
regcache::get_register_status (int regnum) const
{
gdb_assert (regnum >= 0);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (m_readonly_p)
gdb_assert (regnum < m_descr->nr_cooked_registers);
else
gdb_assert (regnum < num_raw_registers ());
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return (enum register_status) m_register_status[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
}
void
regcache_invalidate (struct regcache *regcache, int regnum)
{
gdb_assert (regcache != NULL);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->invalidate (regnum);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
regcache::invalidate (int regnum)
{
gdb_assert (!m_readonly_p);
assert_regnum (regnum);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_register_status[regnum] = REG_UNKNOWN;
}
void
regcache::assert_regnum (int regnum) const
{
gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (arch ()));
}
* 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. */
/* NOTE: this is a write-through cache. There is no "dirty" bit for
recording if the register values have been changed (eg. by the
user). Therefore all registers must be written back to the
target when appropriate. */
std::forward_list<regcache *> regcache::current_regcache;
struct regcache *
get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
struct address_space *aspace)
{
for (const auto &regcache : regcache::current_regcache)
if (ptid_equal (regcache->ptid (), ptid) && regcache->arch () == gdbarch)
return regcache;
* regcache.c (struct regcache): Add ptid_t member. (regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
2007-06-16 19:16:26 +02:00
regcache *new_regcache = new regcache (gdbarch, aspace, false);
* regcache.c (struct regcache): Add ptid_t member. (regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
2007-06-16 19:16:26 +02:00
regcache::current_regcache.push_front (new_regcache);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
new_regcache->set_ptid (ptid);
return new_regcache;
}
struct regcache *
get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
{
Reimplement support for "maint print registers" with no running inferior yet A following patch will change the default target_thread_architecture method, like this: struct gdbarch * default_thread_architecture (struct target_ops *ops, ptid_t ptid) { - return target_gdbarch (); + inferior *inf = find_inferior_ptid (ptid); + gdb_assert (inf != NULL); + return inf->gdbarch; } This is because target_gdbarch is really just current_inferior()->gdbarch, and it's wrong to return that architecture when the inferior of the passed in PTID is NOT the current inferior -- the inferior for PTID may be running a different architecture. E.g., a mix of 64-bit and 32-bit inferiors in the same debug session. Doing that change above however exposes a problem in "maint print registers", caught be the testsuite: -PASS: gdb.base/maint.exp: maint print registers +FAIL: gdb.base/maint.exp: maint print registers (GDB internal error) ... gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, The call stack looks like this: #0 0x000000000068b707 in internal_error(char const*, int, char const*, ...) (file=0xa9b958 "gdb/inferior.c", line=309, fmt=0xa9b8e0 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54 #1 0x00000000006e1c40 in find_inferior_pid(int) (pid=0) at gdb/inferior.c:309 #2 0x00000000006e1c8d in find_inferior_ptid(ptid_t) (ptid=...) at gdb/inferior.c:323 #3 0x00000000007c18dc in default_thread_architecture(target_ops*, ptid_t) (ops=0xf86d60 <dummy_target>, ptid=...) at gdb/target.c:3134 #4 0x00000000007b5414 in delegate_thread_architecture(target_ops*, ptid_t) (self=0xf86d60 <dummy_target>, arg1=...) at gdb/target-delegates.c:2527 #5 0x00000000007647b3 in get_thread_regcache(ptid_t) (ptid=...) at gdb/regcache.c:466 #6 0x00000000007647ff in get_current_regcache() () at gdb/regcache.c:475 #7 0x0000000000767495 in regcache_print(char const*, regcache_dump_what) (args=0x0, what_to_dump=regcache_dump_none) at gdb/regcache.c:1599 #8 0x0000000000767550 in maintenance_print_registers(char const*, int) (args=0x0, from_tty=1) at gdb/regcache.c:1613 I.e., the test does "maint print registers" while the inferior is not running yet. This is expected to work, and there's already a hack in get_thread_arch_regcache to make it work. Instead of pilling on hacks in the internal of regcache and target_ops, this commit moves the null_ptid special casing to where it belongs -- higher up in the call chain in the implementation of "maint print registers" & co directly. gdb/ChangeLog: 2017-10-04 Pedro Alves <palves@redhat.com> * regcache.c (get_thread_arch_regcache): Remove null_ptid special case. (regcache_print): Handle !target_has_registers here instead.
2017-10-04 19:21:10 +02:00
address_space *aspace = target_thread_address_space (ptid);
return get_thread_arch_aspace_regcache (ptid, gdbarch, aspace);
* regcache.c (struct regcache): Add ptid_t member. (regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
2007-06-16 19:16:26 +02:00
}
static ptid_t current_thread_ptid;
static struct gdbarch *current_thread_arch;
struct regcache *
get_thread_regcache (ptid_t ptid)
{
if (!current_thread_arch || !ptid_equal (current_thread_ptid, ptid))
{
current_thread_ptid = ptid;
current_thread_arch = target_thread_architecture (ptid);
}
return get_thread_arch_regcache (ptid, current_thread_arch);
}
struct regcache *
get_current_regcache (void)
* regcache.c (struct regcache): Add ptid_t member. (regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
2007-06-16 19:16:26 +02:00
{
return get_thread_regcache (inferior_ptid);
}
/* See common/common-regcache.h. */
struct regcache *
get_thread_regcache_for_ptid (ptid_t ptid)
{
return get_thread_regcache (ptid);
}
/* Observer for the target_changed event. */
2008-02-21 Pedro Alves <pedro@codesorcery.com> Silence a few -Wmissing-prototypes warnings. PR build/9877: * amd64-nat.c: Include "amd64-nat.h". * fork-child.c (_initialize_fork_child): Ditto. * gcore.c (_initialize_gcore): Ditto. * inf-ptrace.c: Include "inf-ptrace.h". (inf_ptrace_store_registers): Make it static. * linux-nat.c (linux_nat_terminal_ours): Make it static. (_initialize_linux_nat): Declare before definition. * linux-tdep.c: Include "linux-tdep.h". * linux-thread-db.c (_initialize_thread_db): Declare before definition. * proc-service.c (_initialize_proc_service): Ditto. * remote.c (remote_send_printf): Make it static. * solib.c: Include "solib.h". * symfile-mem.c (_initialize_symfile_mem): Declare before definition. * ada-lang.c (ada_la_decode, ada_match_name) (ada_suppress_symbol_printing, ada_is_array_type) (ada_value_ptr_subscript, ada_array_length) (ada_to_static_fixed_value): Make them static. (_initialize_ada_language): Declare before definition. * ada-tasks.c (ada_get_task_number, ada_get_environment_task) (ada_task_list_changed, ada_new_objfile_observer): Make them static. (_initialize_tasks): Declare before definition. * addrmap.c (_initialize_addrmap): Declare before definition. * auxv.c (default_auxv_parse): Make it static. * bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make them static. * breakpoint.c (remove_sal): Add line break. (expand_line_sal_maybe): Make it static. * cp-name-parser.y: Include "cp-support.h". * cp-valprint.c (cp_find_class_member): Make it static. * eval.c (value_f90_subarray): Ditto. * exceptions.c (print_any_exception): Ditto. * findcmd.c (_initialize_mem_search): Declare before definition. * frame.c (frame_observer_target_changed): Make it static. * gnu-v3-abi.c (gnuv3_find_method_in): Make it static. * inf-child.c: Include "inf-child.h". * inferior.h (valid_inferior_id): Rename to ... (valid_gdb_inferior_id): ... this. * infrun.c (infrun_thread_stop_requested, siginfo_make_value): Make them static. * jv-lang.c (java_language_arch_info): Make it static. * m2-typeprint.c (m2_get_discrete_bounds): Ditto. * osdata.c (info_osdata_command): Make it static. * regcache.c (regcache_observer_target_changed): Make it static. * reverse.c (_initialize_reverse): Declare before definition. * stabsread.c (cleanup_undefined_types_noname) (cleanup_undefined_types_1): Make them static. * symfile.c (place_section): Make it static. * symtab.c (find_pc_sect_psymtab_closer): Make it static. * target-descriptions.c (_initialize_target_descriptions): Declare before definition. * target.c (default_get_ada_task_ptid, find_default_can_async_p) (find_default_is_async_p, find_default_supports_non_stop): Make them static. (target_supports_non_stop): Add prototype. (dummy_pid_to_str): Make it static. * utils.c (_initialize_utils): Declare before definition. * ada-exp.y (_initialize_ada_exp): Declare before definition. * solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype. * target.h (struct target_ops): Add a prototype to the to_can_execute_reverse callback. * macroscope.c (_initialize_macroscope): Declare before definition. * cp-namespace.c (_initialize_cp_namespace): Declare before definition. * python/python.c (_initialize_python): Declare before definition. * tui/tui-command.c: Include "tui/tui-command.h". * tui/tui-data.c (init_content_element, init_win_info): Make them static. * tui/tui-disasm.c: Include "tui/tui-disasm.h". * tui/tui-interp.c (_initialize_tui_interp): Declare before definition. * tui/tui-layout.c: Include "tui/tui-layout.h". (_initialize_tui_layout): Declare before definition. * tui/tui-regs.c: Include "tui/tui-regs.h". (tui_display_reg_element_at_line): Make it static. (_initialize_tui_regs): Declare before definition. * tui/tui-stack.c (_initialize_tui_stack): Declare before definition. * tui/tui-win.c: Include "tui/tui-win.h". (_initialize_tui_win): Declare before definition. (tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH. * tui/tui-win.h (tui_sigwinch_handler): Delete declaration. (tui_get_cmd_list): Add a prototype. * tui/tui-windata.c: Include tui-windata.h. * tui/tui-wingeneral.c (box_win): Make it static. * cli/cli-logging.c (show_logging_command): Make it static. (_initialize_cli_logging): Declare before definition. * mi/mi-common.c (_initialize_gdb_mi_common): Declare before definition.
2009-02-21 17:14:50 +01:00
static void
regcache_observer_target_changed (struct target_ops *target)
{
registers_changed ();
}
/* Update global variables old ptids to hold NEW_PTID if they were
holding OLD_PTID. */
void
regcache::regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
{
for (auto &regcache : regcache::current_regcache)
{
if (ptid_equal (regcache->ptid (), old_ptid))
regcache->set_ptid (new_ptid);
}
}
/* 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_ptid (ptid_t ptid)
{
for (auto oit = regcache::current_regcache.before_begin (),
it = std::next (oit);
it != regcache::current_regcache.end ();
)
{
if (ptid_match ((*it)->ptid (), ptid))
{
delete *it;
it = regcache::current_regcache.erase_after (oit);
}
else
oit = it++;
}
if (ptid_match (current_thread_ptid, ptid))
{
current_thread_ptid = null_ptid;
current_thread_arch = NULL;
}
if (ptid_match (inferior_ptid, ptid))
{
/* We just deleted the regcache of the current thread. Need to
forget about any frames we have cached, too. */
reinit_frame_cache ();
}
}
void
registers_changed (void)
{
registers_changed_ptid (minus_one_ptid);
/* 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);
}
void
regcache_raw_update (struct regcache *regcache, int regnum)
{
gdb_assert (regcache != NULL);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->raw_update (regnum);
}
void
regcache::raw_update (int regnum)
{
assert_regnum (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
/* 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. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (!m_readonly_p && get_register_status (regnum) == REG_UNKNOWN)
* 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
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
target_fetch_registers (this, regnum);
/* A number of targets can't access the whole set of raw
registers (because the debug API provides no means to get at
them). */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (m_register_status[regnum] == REG_UNKNOWN)
m_register_status[regnum] = REG_UNAVAILABLE;
* 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
}
}
enum register_status
regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
return regcache->raw_read (regnum, buf);
}
enum register_status
regcache::raw_read (int regnum, gdb_byte *buf)
{
gdb_assert (buf != NULL);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
raw_update (regnum);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (m_register_status[regnum] != REG_VALID)
memset (buf, 0, m_descr->sizeof_register[regnum]);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
memcpy (buf, register_buffer (regnum),
m_descr->sizeof_register[regnum]);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return (enum register_status) m_register_status[regnum];
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
return regcache->raw_read (regnum, val);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
}
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
template<typename T, typename>
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
enum register_status
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache::raw_read (int regnum, T *val)
{
gdb_byte *buf;
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status status;
assert_regnum (regnum);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
status = raw_read (regnum, buf);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status == REG_VALID)
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
*val = extract_integer<T> (buf,
m_descr->sizeof_register[regnum],
gdbarch_byte_order (m_descr->gdbarch));
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
else
*val = 0;
return status;
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
return regcache->raw_read (regnum, val);
}
void
regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache->raw_write (regnum, val);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
}
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
template<typename T, typename>
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache::raw_write (int regnum, T val)
{
Change some void* to gdb_byte* There are a bunch of places where a void* is implicitely casted into a gdb_byte*. The auto-insert-casts script added explicit casts at those places. However, in many cases, it makes more sense to just change the void* to a gdb_byte*. gdb/ChangeLog: * aarch64-tdep.c (stack_item_t): Change type of data to gdb_byte*. * arm-tdep.c (struct stack_item): Likewise. (push_stack_item): Add gdb_byte* cast. * avr-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * cli/cli-dump.c (dump_memory_to_file): Change type of buf to gdb_byte* and add cast. * cris-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * gcore.c (gcore_copy_callback): Change type of memhunk to gdb_byte* and add cast. * gdbtypes.h (print_scalar_formatted): Change type of first parameter to gdb_byte*. * h8300-tdep.c (h8300_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (h8300h_extract_return_value): Likewise. (h8300_store_return_value): Change type of valbuf to gdb_byte*. (h8300h_store_return_value): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. * jit.c (jit_reader_try_read_symtab): Change type of gdb_mem to gdb_byte* and add cast. * m32r-tdep.c (m32r_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (m32r_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * mep-tdep.c (mep_pseudo_cr32_read): Change type of buf to gdb_byte*. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_csr_write): Likewise. (mep_pseudo_cr32_write): Likewise. (mep_pseudo_cr64_write): Likewise. * mi/mi-main.c (mi_cmd_data_write_memory): Change type of buffer to gdb_byte* and add cast. * moxie-tdep.c (moxie_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (moxie_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * p-valprint.c (print_scalar_formatted): Change type of valaddr to gdb_byte*. * printcmd.c (void): Likewise. * python/py-inferior.c (infpy_read_memory): Change type of buffer to gdb_byte* and add cast. (infpy_write_memory): Likewise. (infpy_search_memory): Likewise. * regcache.c (regcache_raw_write_signed): Change type of buf to gdb_byte* and add cast. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. * sh64-tdep.c (h64_extract_return_value): Change type of valbuf to gdb_byte*.
2015-10-09 16:08:23 +02:00
gdb_byte *buf;
assert_regnum (regnum);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
store_integer (buf, m_descr->sizeof_register[regnum],
gdbarch_byte_order (m_descr->gdbarch), val);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
raw_write (regnum, buf);
}
void
regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
ULONGEST val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache->raw_write (regnum, val);
}
LONGEST
regcache_raw_get_signed (struct regcache *regcache, int regnum)
{
LONGEST value;
enum register_status status;
status = regcache_raw_read_signed (regcache, regnum, &value);
if (status == REG_UNAVAILABLE)
throw_error (NOT_AVAILABLE_ERROR,
_("Register %d is not available"), regnum);
return value;
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
return regcache->cooked_read (regnum, buf);
}
enum register_status
regcache::cooked_read (int regnum, gdb_byte *buf)
2002-08-02 20:08:31 +02:00
{
gdb_assert (regnum >= 0);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (regnum < m_descr->nr_cooked_registers);
if (regnum < num_raw_registers ())
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return raw_read (regnum, buf);
else if (m_readonly_p
&& m_register_status[regnum] != REG_UNKNOWN)
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
{
/* Read-only register cache, perhaps the cooked value was
cached? */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (m_register_status[regnum] == REG_VALID)
memcpy (buf, register_buffer (regnum),
m_descr->sizeof_register[regnum]);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
memset (buf, 0, m_descr->sizeof_register[regnum]);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return (enum register_status) m_register_status[regnum];
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
else if (gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
{
struct value *mark, *computed;
enum register_status result = REG_VALID;
mark = value_mark ();
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch,
this, regnum);
if (value_entirely_available (computed))
memcpy (buf, value_contents_raw (computed),
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_descr->sizeof_register[regnum]);
else
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
memset (buf, 0, m_descr->sizeof_register[regnum]);
result = REG_UNAVAILABLE;
}
value_free_to_mark (mark);
return result;
}
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return gdbarch_pseudo_register_read (m_descr->gdbarch, this,
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
regnum, buf);
}
struct value *
regcache_cooked_read_value (struct regcache *regcache, int regnum)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
return regcache->cooked_read_value (regnum);
}
struct value *
regcache::cooked_read_value (int regnum)
{
gdb_assert (regnum >= 0);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (regnum < m_descr->nr_cooked_registers);
if (regnum < num_raw_registers ()
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
|| (m_readonly_p && m_register_status[regnum] != REG_UNKNOWN)
|| !gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
{
struct value *result;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
result = allocate_value (register_type (m_descr->gdbarch, regnum));
VALUE_LVAL (result) = lval_register;
VALUE_REGNUM (result) = regnum;
/* It is more efficient in general to do this delegation in this
direction than in the other one, even though the value-based
API is preferred. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (cooked_read (regnum,
value_contents_raw (result)) == REG_UNAVAILABLE)
mark_value_bytes_unavailable (result, 0,
TYPE_LENGTH (value_type (result)));
return result;
}
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return gdbarch_pseudo_register_read_value (m_descr->gdbarch,
this, regnum);
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_cooked_read_signed (struct regcache *regcache, int regnum,
LONGEST *val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
return regcache->cooked_read (regnum, val);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
}
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
template<typename T, typename>
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
enum register_status
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache::cooked_read (int regnum, T *val)
{
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status status;
gdb_byte *buf;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
status = cooked_read (regnum, buf);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status == REG_VALID)
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
*val = extract_integer<T> (buf, m_descr->sizeof_register[regnum],
gdbarch_byte_order (m_descr->gdbarch));
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
else
*val = 0;
return status;
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
return regcache->cooked_read (regnum, val);
}
void
regcache_cooked_write_signed (struct regcache *regcache, int regnum,
LONGEST val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache->cooked_write (regnum, val);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
}
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
template<typename T, typename>
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache::cooked_write (int regnum, T val)
{
Change some void* to gdb_byte* There are a bunch of places where a void* is implicitely casted into a gdb_byte*. The auto-insert-casts script added explicit casts at those places. However, in many cases, it makes more sense to just change the void* to a gdb_byte*. gdb/ChangeLog: * aarch64-tdep.c (stack_item_t): Change type of data to gdb_byte*. * arm-tdep.c (struct stack_item): Likewise. (push_stack_item): Add gdb_byte* cast. * avr-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * cli/cli-dump.c (dump_memory_to_file): Change type of buf to gdb_byte* and add cast. * cris-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * gcore.c (gcore_copy_callback): Change type of memhunk to gdb_byte* and add cast. * gdbtypes.h (print_scalar_formatted): Change type of first parameter to gdb_byte*. * h8300-tdep.c (h8300_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (h8300h_extract_return_value): Likewise. (h8300_store_return_value): Change type of valbuf to gdb_byte*. (h8300h_store_return_value): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. * jit.c (jit_reader_try_read_symtab): Change type of gdb_mem to gdb_byte* and add cast. * m32r-tdep.c (m32r_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (m32r_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * mep-tdep.c (mep_pseudo_cr32_read): Change type of buf to gdb_byte*. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_csr_write): Likewise. (mep_pseudo_cr32_write): Likewise. (mep_pseudo_cr64_write): Likewise. * mi/mi-main.c (mi_cmd_data_write_memory): Change type of buffer to gdb_byte* and add cast. * moxie-tdep.c (moxie_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (moxie_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * p-valprint.c (print_scalar_formatted): Change type of valaddr to gdb_byte*. * printcmd.c (void): Likewise. * python/py-inferior.c (infpy_read_memory): Change type of buffer to gdb_byte* and add cast. (infpy_write_memory): Likewise. (infpy_search_memory): Likewise. * regcache.c (regcache_raw_write_signed): Change type of buf to gdb_byte* and add cast. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. * sh64-tdep.c (h64_extract_return_value): Change type of valbuf to gdb_byte*.
2015-10-09 16:08:23 +02:00
gdb_byte *buf;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (regnum >=0 && regnum < m_descr->nr_cooked_registers);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
store_integer (buf, m_descr->sizeof_register[regnum],
gdbarch_byte_order (m_descr->gdbarch), val);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
cooked_write (regnum, buf);
}
void
regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
ULONGEST val)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
extract/store integer function template This patch converts functions extract_{unsigned,signed}_integer to a function template extract_integer, which has two instantiations. It also does the similar changes to store__{unsigned,signed}_integer, regcache::raw_read_{unsigned,signed}, regcache::raw_write_{unsigned,signed}, regcache::cooked_read_{unsigned,signed}, regcache::cooked_write_{unsigned,signed}. This patch was posted here https://sourceware.org/ml/gdb-patches/2017-05/msg00492.html but the problem was fixed in a different way. However, I think the patch is still useful to shorten the code. gdb: 2017-06-16 Alan Hayward <alan.hayward@arm.com> Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * defs.h (RequireLongest): New. (extract_integer): Declare function template. (extract_signed_integer): Remove the declaration, but define it static inline. (extract_unsigned_integer): Likewise. (store_integer): Declare function template. (store_signed_integer): Remove the declaration, but define it static inline. (store_unsigned_integer): Likewise. * findvar.c (extract_integer): New function template. (extract_signed_integer): Remove. (extract_unsigned_integer): Remove. (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit instantiations. (store_integer): New function template. (store_signed_integer): Remove. (store_unsigned_integer): Remove. (store_integer): Explicit instantiations. * regcache.c (regcache_raw_read_signed): Update. (regcache::raw_read): New function. (regcache::raw_read_signed): Remove. (regcache::raw_read_unsigned): Remove. (regcache_raw_read_unsigned): Update. (regcache_raw_write_unsigned): Update. (regcache::raw_write_signed): Remove. (regcache::raw_write): New function. (regcache_cooked_read_signed): Update. (regcache::raw_write_unsigned): Remove. (regcache::cooked_read_signed): Remove. (regcache_cooked_read_unsigned): Update. (regcache::cooked_read_unsigned): Remove. (regcache_cooked_write_signed): Update. (regcache_cooked_write_unsigned): Update. * regcache.h (regcache) <raw_read_signed>: Remove. <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove. <raw_read, raw_write>: New. <cooked_read_signed, cooked_write_signed>: Remove. <cooked_write_unsigned, cooked_read_unsigned>: Remove. <cooked_read, cooked_write>: New. * sh64-tdep.c (sh64_pseudo_register_read): Update. (sh64_pseudo_register_write): Update.
2017-06-16 16:38:42 +02:00
regcache->cooked_write (regnum, val);
}
Extend JIT-reader test and fix GDB problems that exposes The jit-reader.exp test isn't really exercising the jit-reader's unwinder API at all. This commit address that, and then fixes GDB problems exposed. - The custom JIT reader provided for the jit-reader.exp testcase always rejects the jitted function's frame... This is because the custom JIT reader in the testcase never ever sets state->code_begin/end, so the bounds check in gdb.base/jitreader.c:unwind_frame: if (this_ip >= state->code_end || this_ip < state->code_begin) return GDB_FAIL; tends to fail, unless you're "lucky" (because it references uninitialized data). The result is that GDB is always actually using a built-in unwinder for the jitted function. - The provided unwinder doesn't do anything that GDB's built-in unwinder can't do. IOW, we can't really tell whether the JIT reader's unwinder is working or not. I fixed that by making the jitted function mangle its own stack pointer with a xor, and then teaching the jit unwinder to demangle it back (another xor). So now "backtrace" with GDB's built-in unwinder fails while with the jit unwinder, it succeeds. - GDB crashes after unloading the JIT reader, and flushing frames... I made the testcase use the "flushregs" command after unloading the JIT reader, to force the JIT frames to be flushed. However, that crashes GDB... When reinit_frame_cache tears down a frame's cache, it calls its unwinder's dealloc_cache method, which for JIT frames ends up in jit.c:jit_dealloc_cache. This function calls each of the frame's gdb_reg_value's "free" pointer: for (i = 0; i < gdbarch_num_regs (frame_arch); i++) if (priv_data->registers[i] && priv_data->registers[i]->free) priv_data->registers[i]->free (priv_data->registers[i]); and the problem is these gdb_reg_value instances have been returned by the JIT reader that has been already unloaded, and their "free" function pointers likely point to functions in the DSO that has already been unloaded... A fix for that could be to call reinit_frame_cache in jit_reader_unload_command _before_ unloading the jit reader DSO so that the jit reader is given a chance to clean up the gdb_reg_values before it is unloaded. However, the fix for the point below makes this unnecessary, because it stops jit.c from keeping around gdb_reg_values in the first place. - However, it still makes sense to clear the frame cache when loading or unloading a JIT unwinder. This makes testing a JIT unwinder a bit simpler. - Not only the frame cache actually -- gdb is not unloading the jit-registered objfiles when the JIT reader is unloaded, and not loading the already-registered descriptors when a JIT reader is loaded. The new test exercises unloading the jit reader, loading it back again, and then making sure the JIT reader's unwinder works again. Without the unload/re-load of already-read descriptors, the newly loaded JIT would have no idea where the new function is, because it's stored at symbol read time. - I added a couple "info frame" calls to the test, and that crashes GDB... The problem is that jit_frame_prev_register assumes it'll only be called for raw registers, so when it gets a pseudo register number, the "priv->registers[reg]" access is really an out-of-bounds access. To fix that, I made jit_frame_prev_register use gdbarch_pseudo_register_read_value for reading the pseudo-registers. However, that works with a regcache and we don't have one. To fix that, I made the JIT unwinder store a regcache in its cache instead of an array of gdb_reg_value pointers. gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * jit.c (jit_reader_load_command): Call reinit_frame_cache and jit_inferior_created_hook. (jit_reader_unload_command): Call reinit_frame_cache and jit_inferior_exit_hook. * jit.c (struct jit_unwind_private) <registers>: Delete field. <regcache>: New field. (jit_unwind_reg_set_impl): Set the register's value in the regcache. Free the passed-in gdb_reg_value. (jit_dealloc_cache): Adjust to free the regcache. (jit_frame_sniffer): Allocate a regcache instead of an array of gdb_reg_value pointers. (jit_frame_this_id): Adjust. (jit_frame_prev_register): Read raw registers off of the regcache instead of from the gdb_reg_value pointer array. Use gdbarch_pseudo_register_read_value to read pseudo registers. * regcache.c (regcache_raw_set_cached_value): New function, factored out from ... (regcache_raw_write): ... here. * regcache.h (regcache_raw_set_cached_value): Declare. gdb/testsuite/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * gdb.base/jit-reader.exp (info_registers_current_frame): New procedure. (jit_reader_test): Test the jit reader's unwinder. * gdb.base/jithost.c (jit_function_00_code): New global. (main): Use memcpy to fill in the mmapped code, instead of poking bytes manually here. * gdb.base/jitreader.c (enum register_mapping) <AMD64_RBP>: New value. (read_debug_info): Save the function's range. (read_sp): New function. (unwind_frame): Use it. Also unwind RBP. (get_frame_id): Use read_sp. (gdb_init_reader): Use calloc instead of malloc. * lib/gdb.exp (get_hexadecimal_valueof): Add optional 'test' parameter. Use gdb_test_multiple.
2016-07-01 12:56:39 +02:00
/* See regcache.h. */
void
regcache_raw_set_cached_value (struct regcache *regcache, int regnum,
const gdb_byte *buf)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->raw_set_cached_value (regnum, buf);
}
void
regcache::raw_set_cached_value (int regnum, const gdb_byte *buf)
{
memcpy (register_buffer (regnum), buf,
m_descr->sizeof_register[regnum]);
m_register_status[regnum] = REG_VALID;
Extend JIT-reader test and fix GDB problems that exposes The jit-reader.exp test isn't really exercising the jit-reader's unwinder API at all. This commit address that, and then fixes GDB problems exposed. - The custom JIT reader provided for the jit-reader.exp testcase always rejects the jitted function's frame... This is because the custom JIT reader in the testcase never ever sets state->code_begin/end, so the bounds check in gdb.base/jitreader.c:unwind_frame: if (this_ip >= state->code_end || this_ip < state->code_begin) return GDB_FAIL; tends to fail, unless you're "lucky" (because it references uninitialized data). The result is that GDB is always actually using a built-in unwinder for the jitted function. - The provided unwinder doesn't do anything that GDB's built-in unwinder can't do. IOW, we can't really tell whether the JIT reader's unwinder is working or not. I fixed that by making the jitted function mangle its own stack pointer with a xor, and then teaching the jit unwinder to demangle it back (another xor). So now "backtrace" with GDB's built-in unwinder fails while with the jit unwinder, it succeeds. - GDB crashes after unloading the JIT reader, and flushing frames... I made the testcase use the "flushregs" command after unloading the JIT reader, to force the JIT frames to be flushed. However, that crashes GDB... When reinit_frame_cache tears down a frame's cache, it calls its unwinder's dealloc_cache method, which for JIT frames ends up in jit.c:jit_dealloc_cache. This function calls each of the frame's gdb_reg_value's "free" pointer: for (i = 0; i < gdbarch_num_regs (frame_arch); i++) if (priv_data->registers[i] && priv_data->registers[i]->free) priv_data->registers[i]->free (priv_data->registers[i]); and the problem is these gdb_reg_value instances have been returned by the JIT reader that has been already unloaded, and their "free" function pointers likely point to functions in the DSO that has already been unloaded... A fix for that could be to call reinit_frame_cache in jit_reader_unload_command _before_ unloading the jit reader DSO so that the jit reader is given a chance to clean up the gdb_reg_values before it is unloaded. However, the fix for the point below makes this unnecessary, because it stops jit.c from keeping around gdb_reg_values in the first place. - However, it still makes sense to clear the frame cache when loading or unloading a JIT unwinder. This makes testing a JIT unwinder a bit simpler. - Not only the frame cache actually -- gdb is not unloading the jit-registered objfiles when the JIT reader is unloaded, and not loading the already-registered descriptors when a JIT reader is loaded. The new test exercises unloading the jit reader, loading it back again, and then making sure the JIT reader's unwinder works again. Without the unload/re-load of already-read descriptors, the newly loaded JIT would have no idea where the new function is, because it's stored at symbol read time. - I added a couple "info frame" calls to the test, and that crashes GDB... The problem is that jit_frame_prev_register assumes it'll only be called for raw registers, so when it gets a pseudo register number, the "priv->registers[reg]" access is really an out-of-bounds access. To fix that, I made jit_frame_prev_register use gdbarch_pseudo_register_read_value for reading the pseudo-registers. However, that works with a regcache and we don't have one. To fix that, I made the JIT unwinder store a regcache in its cache instead of an array of gdb_reg_value pointers. gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * jit.c (jit_reader_load_command): Call reinit_frame_cache and jit_inferior_created_hook. (jit_reader_unload_command): Call reinit_frame_cache and jit_inferior_exit_hook. * jit.c (struct jit_unwind_private) <registers>: Delete field. <regcache>: New field. (jit_unwind_reg_set_impl): Set the register's value in the regcache. Free the passed-in gdb_reg_value. (jit_dealloc_cache): Adjust to free the regcache. (jit_frame_sniffer): Allocate a regcache instead of an array of gdb_reg_value pointers. (jit_frame_this_id): Adjust. (jit_frame_prev_register): Read raw registers off of the regcache instead of from the gdb_reg_value pointer array. Use gdbarch_pseudo_register_read_value to read pseudo registers. * regcache.c (regcache_raw_set_cached_value): New function, factored out from ... (regcache_raw_write): ... here. * regcache.h (regcache_raw_set_cached_value): Declare. gdb/testsuite/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * gdb.base/jit-reader.exp (info_registers_current_frame): New procedure. (jit_reader_test): Test the jit reader's unwinder. * gdb.base/jithost.c (jit_function_00_code): New global. (main): Use memcpy to fill in the mmapped code, instead of poking bytes manually here. * gdb.base/jitreader.c (enum register_mapping) <AMD64_RBP>: New value. (read_debug_info): Save the function's range. (read_sp): New function. (unwind_frame): Use it. Also unwind RBP. (get_frame_id): Use read_sp. (gdb_init_reader): Use calloc instead of malloc. * lib/gdb.exp (get_hexadecimal_valueof): Add optional 'test' parameter. Use gdb_test_multiple.
2016-07-01 12:56:39 +02:00
}
void
regcache_raw_write (struct regcache *regcache, int regnum,
const gdb_byte *buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL && buf != NULL);
regcache->raw_write (regnum, buf);
}
void
regcache::raw_write (int regnum, const gdb_byte *buf)
{
* regcache.c (struct regcache): Add ptid_t member. (regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
2007-06-16 19:16:26 +02:00
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (buf != NULL);
assert_regnum (regnum);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (!m_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. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (gdbarch_cannot_store_register (arch (), 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
return;
/* If we have a valid copy of the register, and new value == old
value, then don't bother doing the actual store. */
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (get_register_status (regnum) == REG_VALID
&& (memcmp (register_buffer (regnum), buf,
m_descr->sizeof_register[regnum]) == 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
return;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
target_prepare_to_store (this);
raw_set_cached_value (regnum, buf);
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
/* Invalidate the register after it is written, in case of a
failure. */
regcache_invalidator invalidator (this, regnum);
Invalidate a register in cache when a remote target failed to write it. As shown by the bug report, GDB crashes when the remote target was unable to write to a register (the program counter) with the 'P' packet. This was reported for AVR but can be reproduced on any architecture with a gdbserver that fails to handle a 'P' packet. Issue ===== This GDB session was done with a custom gdbserver patched to send an error packet when trying to set the program counter with a 'P' packet: ~~~ (gdb) file Debug/ATMega2560-simple-program.elf Reading symbols from Debug/ATMega2560-simple-program.elf...done. (gdb) target remote :51000 Remote debugging using :51000 0x00000000 in __vectors () (gdb) load Loading section .text, size 0x1fc lma 0x0 Start address 0x0, load size 508 Transfer rate: 248 KB/sec, 169 bytes/write. (gdb) b main Breakpoint 1 at 0x164: file .././ATMega2560-simple-program.c, line 39. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. main () at .././ATMega2560-simple-program.c:42 42 DDRD |= LED0_MASK;// | LED1_MASK; (gdb) info line 43 Line 43 of ".././ATMega2560-simple-program.c" is at address 0x178 <main+40> but contains no code. (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> (gdb) s ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) ../../unisrc-mainline/gdb/infrun.c:1978: internal-error: resume: Assertion `pc_in_thread_step_range (pc, tp)' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) ~~~ We can see that even though GDB reports that writing to the register failed, the register cache was updated: ~~~ (gdb) set $pc=0x178 Could not write register "PC2"; remote failure reply 'E00' (gdb) info registers pc pc 0x178 0x178 <main+40> ~~~ The root of the problem is of course in the gdbserver but I thought GDB should keep a register cache consistent with the hardware even in case of a failure. Changes ======= This patch adds routines to add a regcache_invalidate cleanup to the current chain. We can then register one before calling target_store_registers. This way if the target throws an error, the register we wanted to write to will be invalidated in cache. If target_store_registers succeeds, we can discard the new cleanup. 2014-06-12 Pierre Langlois <pierre.langlois@embecosm.com> * regcache.c (struct register_to_invalidate): New structure. (do_register_invalidate, make_cleanup_regcache_invalidate): New functions. (regcache_raw_write): Call make_cleanup_regcache_invalidate.
2014-05-20 16:13:20 +02:00
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
target_store_registers (this, regnum);
* regcache.c (struct regcache): Add ptid_t member. (regcache_xmalloc): Initialize it. (regcache_cpy_no_passthrough): Do not refer to current_regcache. (regcache_dup): Likewise. (regcache_dup_no_passthrough): Likewise. (current_regcache): Make static. (registers_ptid): Remove variable. (get_thread_regcache): New function. (get_current_regcache): New function. (registers_changed): Implement by freeing current regcache. (regcache_raw_read): Do not refer to current_regcache. Set inferior_ptid to regcache->ptid while calling target routines. (regcache_raw_write): Likewise. (regcache_raw_supply): Do not refer to current_regcache. (read_pc_pid): Use thread regcache. Do not modify inferior_ptid. (write_pc_pid): Likewise. (build_regcache): Remove. (_initialize_regcache): Do not call DEPRECATED_REGISTER_GDBARCH_SWAP or deprecated_register_gdbarch_swap. Do not initialize registers_ptid. * regcache.h (get_current_regcache): Add prototype. (get_thread_regcache): Likewise. (current_regcache): Remove declaration. * corelow.c (core_open): Replace current_regcache by get_current_regcache (). * frame.c (frame_pop): Likewise. (put_frame_register): Likewise. (get_current_frame, create_new_frame): Likewise. * mi/mi-main.c (mi_cmd_data_write_register_values): Likewise. * stack.c (return_command): Likewise. * infcall.c (call_function_by_hand): Likewise. * infrun.c (resume): Likewise. (save_inferior_status, restore_inferior_status): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. (fork_save_infrun_state): Likewise. * win32-nat.c (win32_resume): Likewise. * i386fbsd-nat.c (i386fbsd_resume): Likewise. * monitor.c (monitor_wait): Likewise. * remote.c (remote_wait): Likewise. * remote-mips.c (mips_wait): Likewise. * bsd-kvm.c (bsd_kvm_open): Likewise (bsd_kvm_proc_cmd, bsd_kvm_pcb_cmd): Likewise. * fbsd-nat.c (fbsd_make_corefile_notes): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. (ia64_linux_stopped_data_address): Likewise. * frv-tdep.c (frv_fdpic_loadmap_addresses): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * mep-tdep.c (current_me_module, current_options): Likewise. * mips-tdep.c (deprecated_mips_set_processor_regs_hack): Likewise. * linux-nat.c (linux_nat_do_thread_registers): Use thread regcache instead of current_regcache. Call target_fetch_registers. (linux_nat_corefile_thread_callback): Update call site. (linux_nat_do_registers): Likewise. * procfs.c (procfs_do_thread_registers): Use thread regcache instead of current_regcache. (procfs_make_note_section): Likewise. * proc-service.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise. * sol-thread.c (ps_lgetregs, ps_lsetregs): Likewise. (ps_lgetfpregs, ps_lsetfpregs): Likewise.
2007-06-16 19:16:26 +02:00
/* The target did not throw an error so we can discard invalidating
the register. */
invalidator.release ();
}
2002-08-02 20:08:31 +02:00
void
regcache_cooked_write (struct regcache *regcache, int regnum,
const gdb_byte *buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
regcache->cooked_write (regnum, buf);
}
void
regcache::cooked_write (int regnum, const gdb_byte *buf)
2002-08-02 20:08:31 +02:00
{
gdb_assert (regnum >= 0);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (regnum < m_descr->nr_cooked_registers);
if (regnum < num_raw_registers ())
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
raw_write (regnum, buf);
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdbarch_pseudo_register_write (m_descr->gdbarch, this,
regnum, buf);
}
/* 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);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
enum register_status
regcache::xfer_part (int regnum, int offset, int len, void *in,
const void *out, bool is_raw)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
struct gdbarch *gdbarch = arch ();
gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch, regnum));
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (offset >= 0 && offset <= m_descr->sizeof_register[regnum]);
gdb_assert (len >= 0 && offset + len <= m_descr->sizeof_register[regnum]);
/* Something to do? */
if (offset + len == 0)
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
return REG_VALID;
/* Read (when needed) ... */
if (in != NULL
|| offset > 0
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
|| offset + len < m_descr->sizeof_register[regnum])
{
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status status;
if (is_raw)
status = raw_read (regnum, reg);
else
status = cooked_read (regnum, reg);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status != REG_VALID)
return status;
}
/* ... modify ... */
if (in != NULL)
memcpy (in, reg + offset, len);
if (out != NULL)
memcpy (reg + offset, out, len);
/* ... write (when needed). */
if (out != NULL)
{
if (is_raw)
raw_write (regnum, reg);
else
cooked_write (regnum, reg);
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
return REG_VALID;
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_raw_read_part (struct regcache *regcache, int regnum,
int offset, int len, gdb_byte *buf)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return regcache->raw_read_part (regnum, offset, len, buf);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
enum register_status
regcache::raw_read_part (int regnum, int offset, int len, gdb_byte *buf)
{
assert_regnum (regnum);
return xfer_part (regnum, offset, len, buf, NULL, true);
}
void
regcache_raw_write_part (struct regcache *regcache, int regnum,
int offset, int len, const gdb_byte *buf)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->raw_write_part (regnum, offset, len, buf);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
regcache::raw_write_part (int regnum, int offset, int len,
const gdb_byte *buf)
{
assert_regnum (regnum);
xfer_part (regnum, offset, len, NULL, buf, true);
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status
regcache_cooked_read_part (struct regcache *regcache, int regnum,
int offset, int len, gdb_byte *buf)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
return regcache->cooked_read_part (regnum, offset, len, buf);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
enum register_status
regcache::cooked_read_part (int regnum, int offset, int len, gdb_byte *buf)
{
gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
return xfer_part (regnum, offset, len, buf, NULL, false);
}
void
regcache_cooked_write_part (struct regcache *regcache, int regnum,
int offset, int len, const gdb_byte *buf)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->cooked_write_part (regnum, offset, len, buf);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
regcache::cooked_write_part (int regnum, int offset, int len,
const gdb_byte *buf)
{
gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
xfer_part (regnum, offset, len, NULL, buf, false);
}
/* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
void
regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL);
regcache->raw_supply (regnum, buf);
}
void
regcache::raw_supply (int regnum, const void *buf)
{
void *regbuf;
size_t size;
assert_regnum (regnum);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (!m_readonly_p);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regbuf = register_buffer (regnum);
size = m_descr->sizeof_register[regnum];
if (buf)
{
memcpy (regbuf, buf, size);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_register_status[regnum] = REG_VALID;
}
else
{
/* This memset not strictly necessary, but better than garbage
in case the register value manages to escape somewhere (due
to a bug, no less). */
memset (regbuf, 0, size);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_register_status[regnum] = REG_UNAVAILABLE;
}
}
/* Supply register REGNUM to REGCACHE. Value to supply is an integer stored at
address ADDR, in target endian, with length ADDR_LEN and sign IS_SIGNED. If
the register size is greater than ADDR_LEN, then the integer will be sign or
zero extended. If the register size is smaller than the integer, then the
most significant bytes of the integer will be truncated. */
void
regcache::raw_supply_integer (int regnum, const gdb_byte *addr, int addr_len,
bool is_signed)
{
enum bfd_endian byte_order = gdbarch_byte_order (m_descr->gdbarch);
gdb_byte *regbuf;
size_t regsize;
assert_regnum (regnum);
gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
regsize = m_descr->sizeof_register[regnum];
copy_integer_to_size (regbuf, regsize, addr, addr_len, is_signed,
byte_order);
m_register_status[regnum] = REG_VALID;
}
/* Supply register REGNUM with zeroed value to REGCACHE. This is not the same
as calling raw_supply with NULL (which will set the state to
unavailable). */
void
regcache::raw_supply_zeroed (int regnum)
{
void *regbuf;
size_t size;
assert_regnum (regnum);
gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
size = m_descr->sizeof_register[regnum];
memset (regbuf, 0, size);
m_register_status[regnum] = REG_VALID;
}
/* Collect register REGNUM from REGCACHE and store its contents in BUF. */
void
regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
{
gdb_assert (regcache != NULL && buf != NULL);
regcache->raw_collect (regnum, buf);
}
void
regcache::raw_collect (int regnum, void *buf) const
{
const void *regbuf;
size_t size;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (buf != NULL);
assert_regnum (regnum);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regbuf = register_buffer (regnum);
size = m_descr->sizeof_register[regnum];
memcpy (buf, regbuf, size);
}
/* Transfer a single or all registers belonging to a certain register
set to or from a buffer. This is the main worker function for
regcache_supply_regset and regcache_collect_regset. */
/* Collect register REGNUM from REGCACHE. Store collected value as an integer
at address ADDR, in target endian, with length ADDR_LEN and sign IS_SIGNED.
If ADDR_LEN is greater than the register size, then the integer will be sign
or zero extended. If ADDR_LEN is smaller than the register size, then the
most significant bytes of the integer will be truncated. */
void
regcache::raw_collect_integer (int regnum, gdb_byte *addr, int addr_len,
bool is_signed) const
{
enum bfd_endian byte_order = gdbarch_byte_order (m_descr->gdbarch);
const gdb_byte *regbuf;
size_t regsize;
assert_regnum (regnum);
regbuf = register_buffer (regnum);
regsize = m_descr->sizeof_register[regnum];
copy_integer_to_size (addr, addr_len, regbuf, regsize, is_signed,
byte_order);
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
regcache::transfer_regset (const struct regset *regset,
struct regcache *out_regcache,
int regnum, const void *in_buf,
void *out_buf, size_t size) const
{
const struct regcache_map_entry *map;
int offs = 0, count;
Add some more casts (2/2) See previous patch's description. gdb/ChangeLog: * macrocmd.c (print_macro_callback): Add cast(s). * macrotab.c (macro_bcache_str): Likewise. (new_macro_definition): Likewise. * main.c (captured_main): Likewise. * maint.c (print_bfd_section_info): Likewise. * mdebugread.c (mdebug_build_psymtabs): Likewise. (basic_type): Likewise. * memattr.c (mem_region_cmp): Likewise. * memory-map.c (memory_map_start_memory): Likewise. (memory_map_end_memory): Likewise. (memory_map_start_property): Likewise. (memory_map_end_property): Likewise. (clear_result): Likewise. * memrange.c (compare_mem_ranges): Likewise. * mep-tdep.c (mep_analyze_frame_prologue): Likewise. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Likewise. * mi/mi-console.c (mi_console_file_delete): Likewise. (mi_console_file_fputs): Likewise. (mi_console_raw_packet): Likewise. (mi_console_file_flush): Likewise. (mi_console_set_raw): Likewise. * mi/mi-interp.c (mi_interpreter_resume): Likewise. (mi_new_thread): Likewise. (mi_thread_exit): Likewise. (mi_record_changed): Likewise. (mi_inferior_added): Likewise. (mi_inferior_appeared): Likewise. (mi_inferior_exit): Likewise. (mi_inferior_removed): Likewise. (mi_interp_data): Likewise. (mi_on_normal_stop): Likewise. (mi_traceframe_changed): Likewise. (mi_tsv_created): Likewise. (mi_tsv_deleted): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. (mi_output_running_pid): Likewise. (mi_inferior_count): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (report_initial_inferior): Likewise. (mi_ui_out): Likewise. (mi_set_logging): Likewise. * mi/mi-main.c (collect_cores): Likewise. (print_one_inferior): Likewise. (free_vector_of_ints): Likewise. (free_splay_tree): Likewise. (mi_execute_command): Likewise. * mi/mi-out.c (mi_table_body): Likewise. (mi_table_end): Likewise. (mi_table_header): Likewise. (mi_begin): Likewise. (mi_end): Likewise. (mi_field_int): Likewise. (mi_field_string): Likewise. (mi_field_fmt): Likewise. (mi_flush): Likewise. (mi_redirect): Likewise. (field_separator): Likewise. (mi_open): Likewise. (mi_close): Likewise. (mi_out_buffered): Likewise. (mi_out_rewind): Likewise. (mi_out_put): Likewise. (mi_version): Likewise. (mi_out_data_dtor): Likewise. * mi/mi-parse.c (mi_parse_cleanup): Likewise. * microblaze-tdep.c (microblaze_frame_cache): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. (lzma_close): Likewise. (lzma_stat): Likewise. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * mips-sde-tdep.c (mips_sde_frame_cache): Likewise. (mips_sde_elf_osabi_sniff_abi_tag_sections): Likewise. * mips-tdep.c (mips_insn16_frame_cache): Likewise. (mips_micro_frame_cache): Likewise. (mips_insn32_frame_cache): Likewise. (mips_stub_frame_cache): Likewise. (gdb_print_insn_mips): Likewise. (value_of_mips_user_reg): Likewise. (mips_gdbarch_init): Likewise. * mips64obsd-tdep.c (mips64obsd_supply_gregset): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Likewise. (am33_collect_gregset_method): Likewise. (am33_collect_fpregset_method): Likewise. * mn10300-tdep.c (mn10300_analyze_frame_prologue): Likewise. * moxie-tdep.c (moxie_frame_cache): Likewise. * msp430-tdep.c (msp430_get_opcode_byte): Likewise. (msp430_analyze_frame_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * nios2-linux-tdep.c (nios2_supply_gregset): Likewise. (nios2_collect_gregset): Likewise. * nios2-tdep.c (nios2_frame_unwind_cache): Likewise. (nios2_stub_frame_cache): Likewise. * objc-lang.c (find_methods): Likewise. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. (get_objfile_pspace_data): Likewise. (get_objfile_bfd_data): Likewise. (objfile_bfd_data_free): Likewise. (add_to_objfile_sections): Likewise. (do_free_objfile_cleanup): Likewise. (resume_section_map_updates_cleanup): Likewise. * opencl-lang.c (builtin_opencl_type): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * osdata.c (osdata_start_osdata): Likewise. (osdata_start_item): Likewise. (osdata_start_column): Likewise. (osdata_end_column): Likewise. (clear_parsing_data): Likewise. (osdata_free_cleanup): Likewise. * parse.c (type_stack_cleanup): Likewise. (exp_uses_objfile_iter): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppu2spu_prev_arch): Likewise. (ppu2spu_this_id): Likewise. (ppu2spu_prev_register): Likewise. (ppu2spu_unwind_register): Likewise. (ppu2spu_sniffer): Likewise. (ppu2spu_dealloc_cache): Likewise. (ppc_linux_init_abi): Likewise. * ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * progspace.c (restore_program_space): Likewise. * psymtab.c (find_pc_sect_psymtab): Likewise. (compare_psymbols): Likewise. (psymbol_bcache_full): Likewise. (allocate_psymtab): Likewise. (discard_psymtabs_upto): Likewise. * python/py-block.c (set_block): Likewise. (del_objfile_blocks): Likewise. * python/py-breakpoint.c (build_bp_list): Likewise. * python/py-inferior.c (inferior_to_inferior_object): Likewise. (build_inferior_list): Likewise. (py_free_inferior): Likewise. * python/py-objfile.c (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-prettyprint.c (py_restore_tstate): Likewise. * python/py-progspace.c (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-symbol.c (set_symbol): Likewise. (del_objfile_symbols): Likewise. * python/py-symtab.c (set_sal): Likewise. (set_symtab): Likewise. (del_objfile_symtab): Likewise. (del_objfile_sal): Likewise. * python/py-type.c (save_objfile_types): Likewise. (set_type): Likewise. * python/py-unwind.c (pyuw_prev_register): Likewise. (pyuw_on_new_gdbarch): Likewise. * python/py-utils.c (py_decref): Likewise. (py_xdecref): Likewise. (gdb_py_generic_dict): Likewise. * python/py-xmethods.c (gdbpy_free_xmethod_worker_data): Likewise. (gdbpy_clone_xmethod_worker_data): Likewise. (gdbpy_get_xmethod_arg_types): Likewise. (gdbpy_get_xmethod_result_type): Likewise. (gdbpy_invoke_xmethod): Likewise. * python/python.c (gdbpy_apply_type_printers): Likewise. (gdbpy_free_type_printers): Likewise. * record-btrace.c (record_btrace_disable_callback): Likewise. (bfcache_hash): Likewise. (bfcache_eq): Likewise. (btrace_get_frame_function): Likewise. (record_btrace_frame_unwind_stop_reason): Likewise. (record_btrace_frame_this_id): Likewise. (record_btrace_frame_prev_register): Likewise. (record_btrace_frame_dealloc_cache): Likewise. * record-full.c (record_full_message_wrapper): Likewise. (record_full_save_cleanups): Likewise. * regcache.c (regcache_descr): Likewise. (do_regcache_xfree): Likewise. (do_regcache_invalidate): Likewise. (do_cooked_read): Likewise. (regcache_transfer_regset): Likewise. * reggroups.c (reggroup_add): Likewise. (reggroup_next): Likewise. (reggroup_prev): Likewise. * remote-fileio.c (do_remote_fileio_request): Likewise. * remote-notif.c (remote_async_get_pending_events_handler): Likewise. (do_notif_event_xfree): Likewise. * remote.c (get_remote_arch_state): Likewise. (remote_pspace_data_cleanup): Likewise. (get_remote_exec_file): Likewise. (set_pspace_remote_exec_file): Likewise. (compare_pnums): Likewise. (clear_threads_listing_context): Likewise. (remote_newthread_step): Likewise. (start_thread): Likewise. (end_thread): Likewise. (remove_child_of_pending_fork): Likewise. (remove_stop_reply_for_inferior): Likewise. (remove_stop_reply_of_remote_state): Likewise. (remote_notif_remove_once_on_match): Likewise. (stop_reply_match_ptid_and_ws): Likewise. (kill_child_of_pending_fork): Likewise. (register_remote_g_packet_guess): Likewise. (remote_read_description_p): Likewise. (remote_read_description): Likewise. (free_actions_list_cleanup_wrapper): Likewise. (remote_async_serial_handler): Likewise. * rl78-tdep.c (rl78_get_opcode_byte): Likewise. (rl78_analyze_frame_prologue): Likewise. * rs6000-tdep.c (ppc_supply_gregset): Likewise. (ppc_supply_fpregset): Likewise. (ppc_supply_vsxregset): Likewise. (ppc_supply_vrregset): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (e500_move_ev_register): Likewise. (do_regcache_raw_write): Likewise. (rs6000_frame_cache): Likewise. (rs6000_epilogue_frame_cache): Likewise. (rs6000_gdbarch_init): Likewise. * rx-tdep.c (rx_get_opcode_byte): Likewise. (rx_analyze_frame_prologue): Likewise. (rx_frame_type): Likewise. (rx_frame_sniffer_common): Likewise. * s390-linux-tdep.c (s390_check_for_saved): Likewise. (s390_frame_unwind_cache): Likewise. (s390_stub_frame_unwind_cache): Likewise. (s390_sigtramp_frame_unwind_cache): Likewise. * score-tdep.c (score_make_prologue_cache): Likewise. * sentinel-frame.c (sentinel_frame_prev_register): Likewise. (sentinel_frame_prev_arch): Likewise. * ser-base.c (fd_event): Likewise. (push_event): Likewise. (ser_base_write): Likewise. * ser-pipe.c (pipe_close): Likewise. * serial.c (serial_write): Likewise. * sh-tdep.c (sh_frame_cache): Likewise. (sh_stub_this_id): Likewise. * sh64-tdep.c (sh64_frame_cache): Likewise. * solib-aix.c (get_solib_aix_inferior_data): Likewise. (library_list_start_library): Likewise. (library_list_start_list): Likewise. (solib_aix_free_library_list): Likewise. * solib-darwin.c (get_darwin_info): Likewise. * solib-dsbt.c (get_dsbt_info): Likewise. * solib-spu.c (append_ocl_sos): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. (get_svr4_info): Likewise. (library_list_start_library): Likewise. (svr4_library_list_start_list): Likewise. (hash_probe_and_action): Likewise. (equal_probe_and_action): Likewise. (svr4_update_solib_event_breakpoint): Likewise. (set_solib_svr4_fetch_link_map_offsets): Likewise. (svr4_fetch_link_map_offsets): Likewise. (svr4_have_link_map_offsets): Likewise. * solib-target.c (library_list_start_segment): Likewise. (library_list_start_section): Likewise. (library_list_start_library): Likewise. (library_list_end_library): Likewise. (library_list_start_list): Likewise. (solib_target_free_library_list): Likewise. * solib.c (solib_ops): Likewise. (set_solib_ops): Likewise. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise. * sparc-tdep.c (sparc_frame_cache): Likewise. (sparc32_frame_cache): Likewise. (sparc32_supply_gregset): Likewise. (sparc32_collect_gregset): Likewise. (sparc32_supply_fpregset): Likewise. (sparc32_collect_fpregset): Likewise. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise. * sparc64-tdep.c (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_cache): Likewise. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_cache): Likewise. * sparc64obsd-tdep.c (sparc64obsd_frame_cache): Likewise. (sparc64obsd_trapframe_cache): Likewise. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_cache): Likewise. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_cache): Likewise. * spu-multiarch.c (spu_gdbarch): Likewise. * spu-tdep.c (spu_frame_unwind_cache): Likewise. (spu2ppu_prev_arch): Likewise. (spu2ppu_this_id): Likewise. (spu2ppu_prev_register): Likewise. (spu2ppu_dealloc_cache): Likewise. (spu_dis_asm_print_address): Likewise. (gdb_print_insn_spu): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. * stack.c (do_print_variable_and_value): Likewise. * stap-probe.c (get_stap_base_address_1): Likewise. * symfile-debug.c (debug_qf_has_symbols): Likewise. (debug_qf_find_last_source_symtab): Likewise. (debug_qf_forget_cached_source_info): Likewise. (debug_qf_map_symtabs_matching_filename): Likewise. (debug_qf_lookup_symbol): Likewise. (debug_qf_print_stats): Likewise. (debug_qf_dump): Likewise. (debug_qf_relocate): Likewise. (debug_qf_expand_symtabs_for_function): Likewise. (debug_qf_expand_all_symtabs): Likewise. (debug_qf_expand_symtabs_with_fullname): Likewise. (debug_qf_map_matching_symbols): Likewise. (debug_qf_expand_symtabs_matching): Likewise. (debug_qf_find_pc_sect_compunit_symtab): Likewise. (debug_qf_map_symbol_filenames): Likewise. (debug_sym_get_probes): Likewise. (debug_sym_new_init): Likewise. (debug_sym_init): Likewise. (debug_sym_read): Likewise. (debug_sym_read_psymbols): Likewise. (debug_sym_finish): Likewise. (debug_sym_offsets): Likewise. (debug_sym_read_linetable): Likewise. (debug_sym_relocate): Likewise. (uninstall_symfile_debug_logging): Likewise. * symfile-mem.c (symbol_file_add_from_memory_wrapper): Likewise. * symfile.c (place_section): Likewise. (add_section_size_callback): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (clear_memory_write_data): Likewise. (allocate_symtab): Likewise. * symmisc.c (maintenance_expand_file_matcher): Likewise. * symtab.c (lookup_symtab_callback): Likewise. (hash_demangled_name_entry): Likewise. (eq_demangled_name_entry): Likewise. (get_symbol_cache): Likewise. (symbol_cache_cleanup): Likewise. (set_symbol_cache_size): Likewise. (symbol_cache_flush): Likewise. (maintenance_print_symbol_cache): Likewise. (maintenance_print_symbol_cache_statistics): Likewise. (delete_filename_seen_cache): Likewise. (output_partial_symbol_filename): Likewise. (search_symbols_file_matches): Likewise. (search_symbols_name_matches): Likewise. (do_free_completion_list): Likewise. (maybe_add_partial_symtab_filename): Likewise. (get_main_info): Likewise. (main_info_cleanup): Likewise. * target-dcache.c (target_dcache_cleanup): Likewise. (target_dcache_init_p): Likewise. (target_dcache_invalidate): Likewise. (target_dcache_get): Likewise. (target_dcache_get_or_init): Likewise. * target-descriptions.c (target_find_description): Likewise. (tdesc_find_type): Likewise. (tdesc_data_cleanup): Likewise. (tdesc_find_arch_register): Likewise. (tdesc_register_name): Likewise. (tdesc_register_type): Likewise. (tdesc_register_reggroup_p): Likewise. (set_tdesc_pseudo_register_name): Likewise. (set_tdesc_pseudo_register_type): Likewise. (set_tdesc_pseudo_register_reggroup_p): Likewise. (tdesc_use_registers): Likewise. (free_target_description): Likewise. * target-memory.c (compare_block_starting_address): Likewise. (cleanup_request_data): Likewise. (cleanup_write_requests_vector): Likewise. * target.c (open_target): Likewise. (cleanup_restore_target_terminal): Likewise. (free_memory_read_result_vector): Likewise. * thread.c (disable_thread_stack_temporaries): Likewise. (finish_thread_state_cleanup): Likewise. (do_restore_current_thread_cleanup): Likewise. (restore_current_thread_cleanup_dtor): Likewise. (set_thread_refcount): Likewise. (tp_array_compar): Likewise. (do_captured_thread_select): Likewise. * tic6x-tdep.c (tic6x_frame_unwind_cache): Likewise. (tic6x_stub_this_id): Likewise. * tilegx-tdep.c (tilegx_frame_cache): Likewise. * top.c (do_restore_instream_cleanup): Likewise. (gdb_readline_wrapper_cleanup): Likewise. (kill_or_detach): Likewise. (print_inferior_quit_action): Likewise. * tracefile-tfile.c (match_blocktype): Likewise. (build_traceframe_info): Likewise. * tracefile.c (trace_file_writer_xfree): Likewise. * tracepoint.c (memrange_cmp): Likewise. (do_collect_symbol): Likewise. (do_clear_collection_list): Likewise. (do_restore_current_traceframe_cleanup): Likewise. (restore_current_traceframe_cleanup_dtor): Likewise. (free_current_marker): Likewise. (traceframe_info_start_memory): Likewise. (traceframe_info_start_tvar): Likewise. (free_result): Likewise. * tramp-frame.c (tramp_frame_cache): Likewise. * tui/tui-file.c (tui_file_delete): Likewise. (tui_fileopen): Likewise. (tui_sfileopen): Likewise. (tui_file_isatty): Likewise. (tui_file_rewind): Likewise. (tui_file_put): Likewise. (tui_file_fputs): Likewise. (tui_file_get_strbuf): Likewise. (tui_file_adjust_strbuf): Likewise. (tui_file_flush): Likewise. * tui/tui-layout.c (make_command_window): Likewise. (make_data_window): Likewise. (show_source_disasm_command): Likewise. (show_data): Likewise. (make_source_or_disasm_window): Likewise. (show_source_or_disasm_and_command): Likewise. * tui/tui-out.c (tui_field_int): Likewise. (tui_field_string): Likewise. (tui_field_fmt): Likewise. (tui_text): Likewise. * typeprint.c (hash_typedef_field): Likewise. (eq_typedef_field): Likewise. (do_free_typedef_hash): Likewise. (copy_typedef_hash_element): Likewise. (do_free_global_table): Likewise. (find_global_typedef): Likewise. (find_typedef_in_hash): Likewise. * ui-file.c (ui_file_write_for_put): Likewise. (do_ui_file_xstrdup): Likewise. (mem_file_delete): Likewise. (mem_file_rewind): Likewise. (mem_file_put): Likewise. (mem_file_write): Likewise. (stdio_file_delete): Likewise. (stdio_file_flush): Likewise. (stdio_file_read): Likewise. (stdio_file_write): Likewise. (stdio_file_write_async_safe): Likewise. (stdio_file_fputs): Likewise. (stdio_file_isatty): Likewise. (stdio_file_fseek): Likewise. (tee_file_delete): Likewise. (tee_file_flush): Likewise. (tee_file_write): Likewise. (tee_file_fputs): Likewise. (tee_file_isatty): Likewise. * ui-out.c (do_cleanup_table_end): Likewise. (do_cleanup_end): Likewise. * user-regs.c (user_reg_add): Likewise. (user_reg_map_name_to_regnum): Likewise. (usernum_to_user_reg): Likewise. (maintenance_print_user_registers): Likewise. * utils.c (do_bfd_close_cleanup): Likewise. (do_fclose_cleanup): Likewise. (do_obstack_free): Likewise. (do_ui_file_delete): Likewise. (do_ui_out_redirect_pop): Likewise. (do_free_section_addr_info): Likewise. (restore_integer): Likewise. (do_unpush_target): Likewise. (do_htab_delete_cleanup): Likewise. (do_restore_ui_file): Likewise. (do_value_free): Likewise. (do_free_so): Likewise. (free_current_contents): Likewise. (do_regfree_cleanup): Likewise. (core_addr_hash): Likewise. (core_addr_eq): Likewise. (do_free_char_ptr_vec): Likewise. * v850-tdep.c (v850_frame_cache): Likewise. * varobj.c (do_free_variable_cleanup): Likewise. * vax-tdep.c (vax_supply_gregset): Likewise. (vax_frame_cache): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_cache): Likewise. * xml-support.c (gdb_xml_body_text): Likewise. (gdb_xml_values_cleanup): Likewise. (gdb_xml_start_element): Likewise. (gdb_xml_start_element_wrapper): Likewise. (gdb_xml_end_element): Likewise. (gdb_xml_end_element_wrapper): Likewise. (gdb_xml_cleanup): Likewise. (gdb_xml_fetch_external_entity): Likewise. (gdb_xml_parse_attr_enum): Likewise. (xinclude_start_include): Likewise. (xinclude_end_include): Likewise. (xml_xinclude_default): Likewise. (xml_xinclude_start_doctype): Likewise. (xml_xinclude_end_doctype): Likewise. (xml_xinclude_cleanup): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (free_syscalls_info): Likewise. (syscall_start_syscall): Likewise. * xml-tdesc.c (tdesc_end_arch): Likewise. (tdesc_end_osabi): Likewise. (tdesc_end_compatible): Likewise. (tdesc_start_target): Likewise. (tdesc_start_feature): Likewise. (tdesc_start_reg): Likewise. (tdesc_start_union): Likewise. (tdesc_start_struct): Likewise. (tdesc_start_flags): Likewise. (tdesc_start_field): Likewise. (tdesc_start_vector): Likewise. (fetch_available_features_from_target): Likewise. * xstormy16-tdep.c (xstormy16_frame_cache): Likewise. * xtensa-tdep.c (xtensa_supply_gregset): Likewise. (xtensa_frame_cache): Likewise. (xtensa_frame_prev_register): Likewise. (xtensa_extract_return_value): Likewise.
2015-09-25 20:08:07 +02:00
for (map = (const struct regcache_map_entry *) regset->regmap;
(count = map->count) != 0;
map++)
{
int regno = map->regno;
int slot_size = map->size;
if (slot_size == 0 && regno != REGCACHE_MAP_SKIP)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
slot_size = m_descr->sizeof_register[regno];
if (regno == REGCACHE_MAP_SKIP
|| (regnum != -1
&& (regnum < regno || regnum >= regno + count)))
offs += count * slot_size;
else if (regnum == -1)
for (; count--; regno++, offs += slot_size)
{
if (offs + slot_size > size)
break;
if (out_buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
raw_collect (regno, (gdb_byte *) out_buf + offs);
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
out_regcache->raw_supply (regno, in_buf
? (const gdb_byte *) in_buf + offs
: NULL);
}
else
{
/* Transfer a single register and return. */
offs += (regnum - regno) * slot_size;
if (offs + slot_size > size)
return;
if (out_buf)
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
raw_collect (regnum, (gdb_byte *) out_buf + offs);
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
out_regcache->raw_supply (regnum, in_buf
? (const gdb_byte *) in_buf + offs
: NULL);
return;
}
}
}
/* Supply register REGNUM from BUF to REGCACHE, using the register map
in REGSET. If REGNUM is -1, do this for all registers in REGSET.
If BUF is NULL, set the register(s) to "unavailable" status. */
void
regcache_supply_regset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *buf, size_t size)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->supply_regset (regset, regnum, buf, size);
}
void
regcache::supply_regset (const struct regset *regset,
int regnum, const void *buf, size_t size)
{
transfer_regset (regset, this, regnum, buf, NULL, size);
}
/* Collect register REGNUM from REGCACHE to BUF, using the register
map in REGSET. If REGNUM is -1, do this for all registers in
REGSET. */
void
regcache_collect_regset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *buf, size_t size)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache->collect_regset (regset, regnum, buf, size);
}
void
regcache::collect_regset (const struct regset *regset,
int regnum, void *buf, size_t size) const
{
transfer_regset (regset, NULL, regnum, NULL, buf, size);
}
/* Special handling for register PC. */
CORE_ADDR
regcache_read_pc (struct regcache *regcache)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
struct gdbarch *gdbarch = regcache->arch ();
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
CORE_ADDR pc_val;
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
if (gdbarch_read_pc_p (gdbarch))
pc_val = gdbarch_read_pc (gdbarch, regcache);
/* Else use per-frame method on get_current_frame. */
else if (gdbarch_pc_regnum (gdbarch) >= 0)
{
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
ULONGEST raw_val;
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (regcache_cooked_read_unsigned (regcache,
gdbarch_pc_regnum (gdbarch),
&raw_val) == REG_UNAVAILABLE)
throw_error (NOT_AVAILABLE_ERROR, _("PC register is not available"));
pc_val = gdbarch_addr_bits_remove (gdbarch, raw_val);
}
else
internal_error (__FILE__, __LINE__,
_("regcache_read_pc: Unable to find PC"));
return pc_val;
}
void
regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
struct gdbarch *gdbarch = regcache->arch ();
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
if (gdbarch_write_pc_p (gdbarch))
gdbarch_write_pc (gdbarch, regcache, pc);
else if (gdbarch_pc_regnum (gdbarch) >= 0)
2007-06-18 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (SP_REGNUM): Replace by gdbarch_sp_regnum. * v850-tdep.c (v850_unwind_sp): Likewise. * std-regs.c (value_of_builtin_frame_sp_reg): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh-tdep.c (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu) (sh_dwarf2_frame_init_reg, sh_frame_cache, sh_frame_prev_register) (sh_unwind_sp): Likewise. * sh64-tdep.c (sh64_push_dummy_call, sh64_frame_cache) (sh64_frame_prev_register, sh64_unwind_sp): Likewise. * rs6000-tdep.c (rs6000_push_dummy_call, rs6000_unwind_dummy_id) (rs6000_frame_cache): Likewise. * rs6000-nat.c (store_register): Likewise. * remote-mips.c (mips_wait): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call) (ppc64_sysv_abi_push_dummy_call): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise. * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise. * m32r-rom.c (m32r_supply_register): Likewise. * frame.c (frame_sp_unwind): Likewise. * mips-tdep.c (mips_insn16_frame_cache) (mips_insn32_frame_cache): Likewise (comment). * m68klinux-nat.c (supply_gregset): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * ia64-tdep.c (ia64_frame_prev_register): Likewise. * i386-tdep.c (i386_get_longjmp_target): Likewise. * dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise. * cris-tdep.c (cris_regnums, cris_sigcontext_addr) (cris_sigtramp_frame_unwind_cache, cris_push_dummy_call) (cris_scan_prologue, crisv32_scan_prologue, cris_unwind_sp) (cris_register_type, crisv32_register_type) (cris_dwarf2_frame_init_reg): Likewise. * arch-utils.c (legacy_virtual_frame_pointer): Likewise. * amd64-tdep.c (amd64_frame_prev_register): Likewise. * amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Likewise. * libunwind-frame.c (libunwind_frame_cache): Likewise. * gdbarch.sh (PC_REGNUM): Replace by gdbarch_pc_regnum. * regcache.c (read_pc_pid, generic_target_write_pc): Likewise. * xtensa-tdep.c (xtensa_register_type, xtensa_supply_gregset) (xtensa_unwind_pc, xtensa_frame_cache, xtensa_frame_prev_register) (xtensa_extract_return_value, xtensa_store_return_value): Likewise. * v850-tdep.c (v850_unwind_pc): Likewise. * stack.c (frame_info): Likewise. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs) (sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs) (sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs) (sh_dwarf2_frame_init_reg, sh_frame_prev_register, sh_unwind_pc) (sh_dsp_show_regs): Likewise. * shnbsd-tdep.c (shnbsd_supply_gregset) (shnbsd_collect_gregset): Likewise. * shnbsd-nat.c (GETREGS_SUPPLIES): Likewise. * sh64-tdep.c (sh64_compact_reg_base_num, sh64_show_media_regs) (sh64_frame_prev_register, sh64_unwind_pc): Likewise. * rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset) (6000_register_reggroup_p, rs6000_unwind_pc) (rs6000_frame_cache): Likewise. * rs6000-nat.c (regmap, rs6000_fetch_inferior_registers) (rs6000_store_inferior_registers): Likewise. * remote-mips.c (mips_wait, mips_load): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise. * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise. * ppcnbsd-nat.c (getregs_supplies, ppcnbsd_supply_pcb): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise. * ppc-linux-nat.c (ppc_register_u_addr, fetch_ppc_registers) (store_ppc_registers, fill_gregset): Likewise. * mips-tdep.c (mips_stub_frame_cache, mips_gdbarch_init): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_reg, mipsnbsd_fill_reg): Likewise. * mipsnbsd-nat.c (getregs_supplies): Likewise. * m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise. * m68klinux-nat.c (supply_gregset): Likewise. * irix5-nat.c (fill_gregset): Likewise. * i386-tdep.c (i386_unwind_pc): Likewise. * i386-linux-nat.c (i386_linux_resume): Likewise. * frame.c (get_prev_frame_1): Likewise. * dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise. * dbug-rom.c (dbug_supply_register): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache, cris_scan_prologue) (crisv32_scan_prologue, cris_unwind_pc, cris_register_size) (cris_register_type, crisv32_register_type, crisv32_register_name) (cris_dwarf2_frame_init_reg, find_step_target) (cris_software_single_step, cris_supply_gregset) (cris_regnums): Likewise. * alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise. * aix-thread.c (special_register_p, supply_sprs64, supply_sprs32) (fill_sprs64, fill_sprs32, store_regs_user_thread): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * gdbarch.sh (PS_REGNUM): Replace by gdbarch_ps_regnum. * dbug-rom.c (dbug_supply_register): Likewise. * xtensa-tdep.c (xtensa_supply_gregset, xtensa_frame_cache) (xtensa_frame_prev_register, xtensa_push_dummy_call): Likewise. * win32-nat.c (win32_resume): Likewise. * std-regs.c (value_of_builtin_frame_ps_reg) (value_of_builtin_frame_pc_reg): Likewise. * m68k-tdep.c (m68k_register_type): Likewise. * m68klinux-nat.c (supply_gregset): Likewise. * gdbarch.sh (FP0_REGNUM): Replace by gdbarch_fp0_regnum. * sh-tdep.c (sh_extract_return_value_fpu, sh_store_return_value_fpu) (sh2e_show_regs, sh2a_show_regs, sh3e_show_regs, sh4_show_regs) (sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_register_type) (fv_reg_base_num, dr_reg_base_num): Likewise. * sh64-tdep.c (sh64_fv_reg_base_num, sh64_dr_reg_base_num) (sh64_fpp_reg_base_num, sh64_compact_reg_base_num, sh64_push_dummy_call) (sh64_extract_return_value, sh64_store_return_value) (sh64_show_media_regs, sh64_show_compact_regs, sh64_register_type) (sh64_do_fp_register, sh64_media_print_registers_info): Likewise. * procfs.c (procfs_fetch_registers, procfs_store_registers) (invalidate_cache): Likewise. * ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise. * mipsnbsd-tdep.c (mipsnbsd_supply_fpreg) (mipsnbsd_fill_fpreg): Likewise. * mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers) (mipsnbsd_store_inferior_registers): Likewise. * mips-linux-tdep.c (mips_supply_fpregset, mips_fill_fpregset) (mips64_supply_fpregset, mips64_fill_fpregset): Likewise. * mips-linux-nat.c (mips64_linux_register_addr): Likewise. * m68k-tdep.c (m68k_register_type, m68k_convert_register_p): Likewise. * m68klinux-nat.c (getfpregs_supplies, supply_fpregset) (fill_fpregset): Likewise. * irix5-nat.c (supply_fpregset, fill_fpregset): Likewise. * i386-tdep.h (struct_return): Likewise (comment). * i386-nto-tdep.c (i386nto_register_area): Likewise. * go32-nat.c (fetch_register, go32_fetch_registers, store_register) (go32_store_registers): Likewise. * alpha-tdep.c (alpha_next_pc): Likewise. * alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise. * alphabsd-nat.c (alphabsd_fetch_inferior_registers) (alphabsd_store_inferior_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise. * gdbarch.c, gdbarch.h: Regenerate.
2007-06-18 19:45:26 +02:00
regcache_cooked_write_unsigned (regcache,
gdbarch_pc_regnum (gdbarch), pc);
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
else
internal_error (__FILE__, __LINE__,
_("regcache_write_pc: Unable to update PC"));
gdb/ * NEWS: Document inlined function support. * Makefile.in (SFILES): Add inline-frame.c. (COMMON_OBS): Add inline-frame.o. * block.c (contained_in): Rewrite to use lexical nesting. (block_linkage_function): Skip inlined function blocks. (block_inlined_p): New. * block.h (struct block): Update comment. (block_inlined_p): New prototype. * blockframe.c (get_frame_block): Handle inlined functions. (get_frame_function): Do not use block_linkage_function. (block_innermost_frame): Use get_frame_block and contained_in. * breakpoint.c (watchpoint_check): Remove extra reinit_frame_cache. Skip over inlined functions. Simplify epilogue check. (bpstat_check_breakpoint_conditions): Use get_stack_frame_id. Update comments. (set_momentary_breakpoint): Only accept non-inlined frames. (watch_command_1): Use frame_unwind_caller_pc and frame_unwind_caller_id instead of get_prev_frame. (until_break_command): Likewise. Use get_stack_frame_id. * buildsym.c (end_symtab): Set SYMBOL_SYMTAB for block functions. * dwarf2loc.c (dwarf_expr_frame_base): Use block_linkage_function. * dwarf2read.c (process_die): Handle DW_TAG_inlined_subroutine. (read_func_scope, new_symbol): Likewise. Handle arguments specially for inlined functions without call site information. (inherit_abstract_dies): Allow tag mismatch for inlined subroutines. (die_specification): Treat DW_AT_abstract_origin as a specification. (read_type_die): Handle DW_TAG_inlined_subroutine. * frame-unwind.c (frame_unwind_init): Add inline_frame_unwind. * frame.c (fprint_frame_id): Print inline depth. (fprint_frame_type): Handle INLINE_FRAME and SENTINEL_FRAME. (skip_inlined_frames, get_stack_frame_id): New. (frame_unwind_caller_id): Use skip_inlined_frames. (frame_id_inlined_p): New. (frame_id_eq): Make the logic match the comments. Add inline_depth check. (frame_id_inner): Handle inlined functions. (frame_unwind_pc): New function, copied from frame_unwind_caller_pc. (frame_unwind_caller_pc): Use skip_inlined_frames and frame_unwind_pc. (get_prev_frame_1): Check for inline frames. Split out frame allocation to get_prev_frame_raw. (get_prev_frame_raw): New function. (get_prev_frame): Handle inline frames. (get_frame_pc): Use frame_unwind_pc. (get_frame_address_in_block): Skip inlined frames on both sides. (pc_notcurrent): Delete. (find_frame_sal): Rewrite to handle inline call sites. Use get_frame_address_in_block. (deprecated_update_frame_pc_hack): Make static. * frame.h: Update comments. (struct frame_id): Add inline_depth. (enum frame_type): Add INLINE_FRAME. (frame_id_inlined_p, get_stack_frame_id): New prototypes. * gdbthread.h (struct thread_info): Add step_stack_frame_id field. * infcmd.c (set_step_frame): New function. (step_once): Use set_step_frame. Handle inlined functions. (until_next_command): Use set_step_frame. (finish_backward), finish_forward): Use get_stack_frame_id. (finish_command): Support inlined functions. * inferior.h (set_step_info): New prototype. * infrun.c (RESUME_ALL): Use minus_one_ptid. (clear_proceed_status): Clear step_stack_frame_id. (init_wait_for_inferior): Call clear_inline_frame_state. (init_execution_control_state): Make static. (set_step_info): New function. (init_thread_stepping_state): Do not set the symtab or line here. (stepped_in_from): New function. (handle_inferior_event): Handle inlined functions. Use set_step_info. (insert_step_resume_breakpoint_at_frame): Use get_stack_frame_id. (struct inferior_status): Add step_stack_frame_id. (save_inferior_status, restore_inferior_status): Save and restore step_stack_frame_id. * inline-frame.c, inline-frame.h: New files. * minsyms.c (prim_record_minimal_symbol_and_info): Use XCALLOC. * regcache.c (regcache_write_pc): Call reinit_frame_cache. * s390-tdep.c (s390_prologue_frame_unwind_cache): Handle INLINE_FRAME. * stack.c (frame_show_address): New. (print_frame_info, print_frame): Use it. (find_frame_funname): Use get_frame_function. Handle inlined blocks. (frame_info): Mark inlined functions. (backtrace_command_1): Use get_current_user_frame. (print_frame_local_vars, print_frame_label_vars): Update comments. (return_command): Refuse inlined functions. * symtab.c (lookup_symbol_aux_local): Stop at inlined function boundaries. (find_function_start_sal): Avoid inlined functions. (completion_list_add_fields): New function. (default_make_symbol_completion_list): Use it. Use block_static_block and block_global_block. Check for inlined functions. (skip_prologue_using_sal): Avoid line number comparison across inlining. * symtab.h (struct symbol): Add is_inlined. (SYMBOL_INLINED): New. * target.c (target_resume): Call clear_inline_frame_state. * valops.c (value_of_variable): Check block_inlined_p. gdb/doc/ * gdb.texinfo (Debugging Optimized Code): New chapter. (Compiling for Debugging): Reference it. Move some text to the new section. gdb/testsuite/ * gdb.base/break.exp: Add an XFAIL for gcc/36748. * gdb.cp/annota2.exp: Accept frames-invalid in more places. * gdb.opt/Makefile.in (EXECUTABLES): Update. * gdb.opt/clobbered-registers-O2.exp: Update to GPL v3. * gdb.opt/inline-bt.c, gdb.opt/inline-bt.exp, gdb.opt/inline-cmds.c, gdb.opt/inline-cmds.exp, gdb.opt/inline-locals.c, gdb.opt/inline-locals.exp, gdb.opt/inline-markers.c: New files. * lib/gdb.exp (skip_inline_frame_tests): New function. (skip_inline_var_tests): New function.
2009-06-28 02:20:24 +02:00
/* Writing the PC (for instance, from "load") invalidates the
current frame. */
reinit_frame_cache ();
}
int
regcache::num_raw_registers () const
{
return gdbarch_num_regs (arch ());
}
void
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
regcache::debug_print_register (const char *func, int regno)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
struct gdbarch *gdbarch = arch ();
fprintf_unfiltered (gdb_stdlog, "%s ", func);
if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)
&& gdbarch_register_name (gdbarch, regno) != NULL
&& gdbarch_register_name (gdbarch, regno)[0] != '\0')
fprintf_unfiltered (gdb_stdlog, "(%s)",
gdbarch_register_name (gdbarch, regno));
else
fprintf_unfiltered (gdb_stdlog, "(%d)", regno);
if (regno >= 0 && regno < gdbarch_num_regs (gdbarch))
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, regno);
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_byte *buf = register_buffer (regno);
fprintf_unfiltered (gdb_stdlog, " = ");
for (int i = 0; i < size; i++)
{
fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
}
if (size <= sizeof (LONGEST))
{
ULONGEST val = extract_unsigned_integer (buf, size, byte_order);
fprintf_unfiltered (gdb_stdlog, " %s %s",
core_addr_to_string_nz (val), plongest (val));
}
}
fprintf_unfiltered (gdb_stdlog, "\n");
}
static void
reg_flush_command (char *command, int from_tty)
{
/* Force-flush the register cache. */
registers_changed ();
if (from_tty)
printf_filtered (_("Register cache flushed.\n"));
}
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
void
regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
{
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
struct gdbarch *gdbarch = m_descr->gdbarch;
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;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
gdb_assert (m_descr->nr_cooked_registers
== (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch)));
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
for (regnum = -1; regnum < m_descr->nr_cooked_registers; regnum++)
{
/* Name. */
if (regnum < 0)
fprintf_unfiltered (file, " %-10s", "Name");
else
{
const char *p = gdbarch_register_name (gdbarch, 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 < gdbarch_num_regs (gdbarch))
fprintf_unfiltered (file, " %4d", regnum);
else
2007-05-31 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (NUM_REGS): Replace by gdbarch_num_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers) (inf_ptrace_store_registers): Likewise. * corelow.c (get_core_registers): Likewise. * i386-linux-nat.c (supply_gregset, fill_gregset) (i386_linux_fetch_inferior_registers) (i386_linux_store_inferior_registers): Likewise. * remote.c (init_remote_state,packet_reg_from_regnum) (packet_reg_from_pnum,process_g_packet,remote_fetch_registers) (remote_prepare_to_store,store_registers_using_G) (remote_store_registers,remote_arch_state): Likewise. * tracepoint.c (encode_actions): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * tui/tui-regs.c (tui_show_register_group) (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * xtensa-tdep.c (xtensa_register_name,xtensa_register_type) (xtensa_reg_to_regnum,xtensa_pseudo_register_read) (xtensa_pseudo_register_write,xtensa_register_reggroup_p): Likewise. * win32-nat.c (do_win32_fetch_inferior_registers) (do_win32_store_inferior_registers,fetch_elf_core_registers * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target-descriptions.c (tdesc_use_registers): Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_do_pseudo_register,sh64_print_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * rs6000-nat.c (fetch_register,store_register): Likewise. * remote-sim.c (one2one_register_sim_regno,gdbsim_fetch_register) (gdbsim_fetch_register,gdbsim_store_register): Likewise. * remote-mips.c (mips_fetch_registers,mips_store_registers): Likewise. * remote-m32r-sdi.c (m32r_fetch_registers) (m32r_store_registers): Likewise. * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save) (regcache_restore,regcache_dump): Likewise. * monitor.c (monitor_fetch_registers,monitor_store_registers): Likewise. * mips-tdep.c (mips_xfer_register,mips_register_name) (mips_register_reggroup_p,mips_pseudo_register_read) (mips_pseudo_register_write,mips_convert_register_p,mips_register_type) (mips_unwind_pc,mips_unwind_sp,mips_unwind_dummy_id,set_reg_offset) (mips16_scan_prologue,mips_insn16_frame_cache,reset_saved_regs) (mips32_scan_prologue,mips_insn32_frame_cache,read_next_frame_reg) (mips_n32n64_return_value,mips_o32_return_value,mips_o64_return_value) (print_gp_register_row,mips_print_registers_info) (mips_stab_reg_to_regnum,mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_register_sim_regno): Likewise. * mips-linux-tdep.c (mips_linux_o32_sigframe_init) (mips_linux_n32n64_sigframe_init): Likewise. * mips-linux-nat.c (mips_linux_register_addr) (mips64_linux_register_addr): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * mips64obsd-tdep.c (mips64obsd_sigframe_init): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache(: Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * ia64-linux-nat.c (ia64_register_addr,ia64_cannot_fetch_register) (ia64_cannot_store_register,ia64_linux_fetch_registers) (ia64_linux_store_registers): Likewise. * hpux-thread.c (hpux_thread_fetch_registers) (hpux_thread_store_registers): Likewise. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM,E_PSEUDO_EXR_REGNUM) (h8300_init_frame_cache,h8300_frame_cache,h8300_frame_prev_register) (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache) (dwarf2_frame_state_alloc_regs): Likewise. * cris-tdep.c (cris_register_size,cris_cannot_fetch_register) (cris_cannot_store_register,crisv32_cannot_fetch_register) (crisv32_cannot_store_register,cris_register_name): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * arch-utils.c (legacy_register_sim_regno) (legacy_virtual_frame_pointer): Likewise. * arm-tdep.c (arm_make_prologue_cache,arm_register_sim_regno):Likewise. * arm-tdep.h: Likewise (comment). * frv-tdep.c (frv_register_sim_regno): Likewise. * m68klinux-nat.c (old_fetch_inferior_registers) (old_store_inferior_registers): Likewise. * m32c-tdep.c (m32c_virtual_frame_pointer): Likewise. * irix5-nat.c (fetch_core_registers): Likewise. * hppa-tdep.c (hppa_frame_cache): Likewise. * hppa-linux-nat.c (hppa_linux_register_addr) (hppa_linux_fetch_inferior_registers) (hppa_linux_store_inferior_registers): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_inferior_registers) (hppa_hpux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_native_gregset_reg_offset) (amd64_supply_native_gregset,amd64_collect_native_gregset): Likewise. * dbug-rom.c (dbug_regname): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache) (HARD_PAGE_REGNUM (comment)): Likewise. * gdbarch.sh (NUM_PSEUDO_REGS): Replace by gdbarch_num_pseudo_regs. * i386-tdep.c (i386_dbx_reg_to_regnum) (i386_svr4_reg_to_regnum): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers,mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate. * tui/tui-regs.c (tui_show_register_group): Likewise. * xtensa-tdep.h (FP_ALIAS): Likewise. * user-regs.h: Likewise (comment). * user-regs.c (user_reg, user_reg_map_name_to_regnum): Likewise. * trad-frame.c (trad_frame_alloc_saved_regs): Likewise. * target-descriptions.h: Likewise (comment). * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * stabsread.c (define_symbol): Likewise. * sh64-tdep.c (sh64_print_register,sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_sim_regno): Likewise. * regcache.c (init_regcache_descr,register_size,regcache,regcache_save (regcache_restore,regcache_dump): Likewise. * mips-tdep.c (print_gp_register_row,mips_print_registers_info) (mips_dwarf_dwarf2_ecoff_reg_to_regnum) (mips_stab_reg_to_regnum): Likewise. * findvar.c (value_of_register): Likewise. * infcmd.c (default_print_registers_info,registers_info) (print_vector_info,print_float_info): Likewise. * m68k-tdep.c (m68k_dwarf_reg_to_regnum): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * dwarf2-frame.c (dwarf2_frame_cache): Likewise. * frame.h (SIZEOF_FRAME_SAVED_REGS): Likewise. * xtensa-tdep.c (xtensa_register_type,xtensa_reg_to_regnum) (xtensa_pseudo_register_read,xtensa_pseudo_register_write): Likewise. * parse.c: Remove comment. * gdbarch.c, gdbarch.h: Regenerate
2007-05-31 19:32:22 +02:00
fprintf_unfiltered (file, " %4d",
(regnum - gdbarch_num_regs (gdbarch)));
/* Offset. */
if (regnum < 0)
fprintf_unfiltered (file, " %6s ", "Offset");
else
{
fprintf_unfiltered (file, " %6ld",
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_descr->register_offset[regnum]);
if (register_offset != m_descr->register_offset[regnum]
|| (regnum > 0
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
&& (m_descr->register_offset[regnum]
!= (m_descr->register_offset[regnum - 1]
+ m_descr->sizeof_register[regnum - 1])))
)
{
if (!footnote_register_offset)
footnote_register_offset = ++footnote_nr;
fprintf_unfiltered (file, "*%d", footnote_register_offset);
}
else
fprintf_unfiltered (file, " ");
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
register_offset = (m_descr->register_offset[regnum]
+ m_descr->sizeof_register[regnum]);
}
/* Size. */
if (regnum < 0)
fprintf_unfiltered (file, " %5s ", "Size");
else
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
fprintf_unfiltered (file, " %5ld", m_descr->sizeof_register[regnum]);
/* Type. */
{
const char *t;
std::string name_holder;
if (regnum < 0)
t = "Type";
else
{
static const char blt[] = "builtin_type";
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
t = TYPE_NAME (register_type (arch (), regnum));
if (t == NULL)
{
if (!footnote_register_type_name_null)
footnote_register_type_name_null = ++footnote_nr;
name_holder = string_printf ("*%d",
footnote_register_type_name_null);
t = name_holder.c_str ();
}
/* Chop a leading builtin_type. */
if (startswith (t, blt))
t += strlen (blt);
}
fprintf_unfiltered (file, " %-15s", t);
}
/* Leading space always present. */
fprintf_unfiltered (file, " ");
/* Value, raw. */
if (what_to_dump == regcache_dump_raw)
{
if (regnum < 0)
fprintf_unfiltered (file, "Raw value");
else if (regnum >= num_raw_registers ())
fprintf_unfiltered (file, "<cooked>");
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
else if (get_register_status (regnum) == REG_UNKNOWN)
fprintf_unfiltered (file, "<invalid>");
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
else if (get_register_status (regnum) == REG_UNAVAILABLE)
fprintf_unfiltered (file, "<unavailable>");
else
{
raw_update (regnum);
print_hex_chars (file, register_buffer (regnum),
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_descr->sizeof_register[regnum],
gdbarch_byte_order (gdbarch), true);
}
}
/* Value, cooked. */
if (what_to_dump == regcache_dump_cooked)
{
if (regnum < 0)
fprintf_unfiltered (file, "Cooked value");
else
{
const gdb_byte *buf = NULL;
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status status;
struct value *value = NULL;
if (regnum < num_raw_registers ())
{
raw_update (regnum);
status = get_register_status (regnum);
buf = register_buffer (regnum);
}
else
{
value = cooked_read_value (regnum);
if (!value_optimized_out (value)
&& value_entirely_available (value))
{
status = REG_VALID;
buf = value_contents_all (value);
}
else
status = REG_UNAVAILABLE;
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status == REG_UNKNOWN)
fprintf_unfiltered (file, "<invalid>");
else if (status == REG_UNAVAILABLE)
fprintf_unfiltered (file, "<unavailable>");
else
print_hex_chars (file, buf,
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
m_descr->sizeof_register[regnum],
gdbarch_byte_order (gdbarch), true);
if (value != NULL)
{
release_value (value);
value_free (value);
}
}
}
/* Group members. */
if (what_to_dump == regcache_dump_groups)
{
if (regnum < 0)
fprintf_unfiltered (file, "Groups");
else
{
const char *sep = "";
struct reggroup *group;
for (group = reggroup_next (gdbarch, NULL);
group != NULL;
group = reggroup_next (gdbarch, group))
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
{
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
fprintf_unfiltered (file,
"%s%s", sep, reggroup_name (group));
sep = ",";
}
}
}
}
/* Remote packet configuration. */
if (what_to_dump == regcache_dump_remote)
{
if (regnum < 0)
{
fprintf_unfiltered (file, "Rmt Nr g/G Offset");
}
else if (regnum < num_raw_registers ())
{
int pnum, poffset;
Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi <yao.qi@linaro.org> * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise.
2017-04-28 23:48:42 +02:00
if (remote_register_number_and_offset (arch (), regnum,
&pnum, &poffset))
fprintf_unfiltered (file, "%7d %11d", pnum, poffset);
}
}
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);
}
static void
regcache_print (const char *args, enum regcache_dump_what what_to_dump)
{
Reimplement support for "maint print registers" with no running inferior yet A following patch will change the default target_thread_architecture method, like this: struct gdbarch * default_thread_architecture (struct target_ops *ops, ptid_t ptid) { - return target_gdbarch (); + inferior *inf = find_inferior_ptid (ptid); + gdb_assert (inf != NULL); + return inf->gdbarch; } This is because target_gdbarch is really just current_inferior()->gdbarch, and it's wrong to return that architecture when the inferior of the passed in PTID is NOT the current inferior -- the inferior for PTID may be running a different architecture. E.g., a mix of 64-bit and 32-bit inferiors in the same debug session. Doing that change above however exposes a problem in "maint print registers", caught be the testsuite: -PASS: gdb.base/maint.exp: maint print registers +FAIL: gdb.base/maint.exp: maint print registers (GDB internal error) ... gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, The call stack looks like this: #0 0x000000000068b707 in internal_error(char const*, int, char const*, ...) (file=0xa9b958 "gdb/inferior.c", line=309, fmt=0xa9b8e0 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54 #1 0x00000000006e1c40 in find_inferior_pid(int) (pid=0) at gdb/inferior.c:309 #2 0x00000000006e1c8d in find_inferior_ptid(ptid_t) (ptid=...) at gdb/inferior.c:323 #3 0x00000000007c18dc in default_thread_architecture(target_ops*, ptid_t) (ops=0xf86d60 <dummy_target>, ptid=...) at gdb/target.c:3134 #4 0x00000000007b5414 in delegate_thread_architecture(target_ops*, ptid_t) (self=0xf86d60 <dummy_target>, arg1=...) at gdb/target-delegates.c:2527 #5 0x00000000007647b3 in get_thread_regcache(ptid_t) (ptid=...) at gdb/regcache.c:466 #6 0x00000000007647ff in get_current_regcache() () at gdb/regcache.c:475 #7 0x0000000000767495 in regcache_print(char const*, regcache_dump_what) (args=0x0, what_to_dump=regcache_dump_none) at gdb/regcache.c:1599 #8 0x0000000000767550 in maintenance_print_registers(char const*, int) (args=0x0, from_tty=1) at gdb/regcache.c:1613 I.e., the test does "maint print registers" while the inferior is not running yet. This is expected to work, and there's already a hack in get_thread_arch_regcache to make it work. Instead of pilling on hacks in the internal of regcache and target_ops, this commit moves the null_ptid special casing to where it belongs -- higher up in the call chain in the implementation of "maint print registers" & co directly. gdb/ChangeLog: 2017-10-04 Pedro Alves <palves@redhat.com> * regcache.c (get_thread_arch_regcache): Remove null_ptid special case. (regcache_print): Handle !target_has_registers here instead.
2017-10-04 19:21:10 +02:00
/* Where to send output. */
stdio_file file;
ui_file *out;
if (args == NULL)
Reimplement support for "maint print registers" with no running inferior yet A following patch will change the default target_thread_architecture method, like this: struct gdbarch * default_thread_architecture (struct target_ops *ops, ptid_t ptid) { - return target_gdbarch (); + inferior *inf = find_inferior_ptid (ptid); + gdb_assert (inf != NULL); + return inf->gdbarch; } This is because target_gdbarch is really just current_inferior()->gdbarch, and it's wrong to return that architecture when the inferior of the passed in PTID is NOT the current inferior -- the inferior for PTID may be running a different architecture. E.g., a mix of 64-bit and 32-bit inferiors in the same debug session. Doing that change above however exposes a problem in "maint print registers", caught be the testsuite: -PASS: gdb.base/maint.exp: maint print registers +FAIL: gdb.base/maint.exp: maint print registers (GDB internal error) ... gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, The call stack looks like this: #0 0x000000000068b707 in internal_error(char const*, int, char const*, ...) (file=0xa9b958 "gdb/inferior.c", line=309, fmt=0xa9b8e0 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54 #1 0x00000000006e1c40 in find_inferior_pid(int) (pid=0) at gdb/inferior.c:309 #2 0x00000000006e1c8d in find_inferior_ptid(ptid_t) (ptid=...) at gdb/inferior.c:323 #3 0x00000000007c18dc in default_thread_architecture(target_ops*, ptid_t) (ops=0xf86d60 <dummy_target>, ptid=...) at gdb/target.c:3134 #4 0x00000000007b5414 in delegate_thread_architecture(target_ops*, ptid_t) (self=0xf86d60 <dummy_target>, arg1=...) at gdb/target-delegates.c:2527 #5 0x00000000007647b3 in get_thread_regcache(ptid_t) (ptid=...) at gdb/regcache.c:466 #6 0x00000000007647ff in get_current_regcache() () at gdb/regcache.c:475 #7 0x0000000000767495 in regcache_print(char const*, regcache_dump_what) (args=0x0, what_to_dump=regcache_dump_none) at gdb/regcache.c:1599 #8 0x0000000000767550 in maintenance_print_registers(char const*, int) (args=0x0, from_tty=1) at gdb/regcache.c:1613 I.e., the test does "maint print registers" while the inferior is not running yet. This is expected to work, and there's already a hack in get_thread_arch_regcache to make it work. Instead of pilling on hacks in the internal of regcache and target_ops, this commit moves the null_ptid special casing to where it belongs -- higher up in the call chain in the implementation of "maint print registers" & co directly. gdb/ChangeLog: 2017-10-04 Pedro Alves <palves@redhat.com> * regcache.c (get_thread_arch_regcache): Remove null_ptid special case. (regcache_print): Handle !target_has_registers here instead.
2017-10-04 19:21:10 +02:00
out = gdb_stdout;
else
{
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy This patch starts from the desire to eliminate make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file & friends a real C++ class hierarchy, and switches temporary ui_file-like objects to stack-based allocation. - mem_fileopen -> string_file mem_fileopen is replaced with a new string_file class that is treated as a value class created on the stack. This alone eliminates most make_cleanup_ui_file_delete calls, and, simplifies code a whole lot (diffstat shows around 1k loc dropped.) string_file's internal buffer is a std::string, thus the "string" in the name. This simplifies the implementation much, compared to mem_fileopen, which managed growing its internal buffer manually. - ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone The new string_file class has a string() method that provides direct writable access to the internal std::string buffer. This replaced ui_file_as_string, which forced a copy of the same data the stream had inside. With direct access via a writable reference, we can instead move the string out of the string_stream, avoiding deep string copying. Related, ui_file_xstrdup calls are replaced with xstrdup'ping the stream's string, and ui_file_obsavestring is replaced by obstack_copy0. With all those out of the way, getting rid of the weird ui_file_put mechanism was possible. - New ui_file::printf, ui_file::puts, etc. methods These simplify / clarify client code. I considered splitting client-code changes, like these, e.g.: - stb = mem_fileopen (); - fprintf_unfiltered (stb, "%s%s%s", - _("The valid values are:\n"), - regdesc, - _("The default is \"std\".")); + string_file stb; + stb.printf ("%s%s%s", + _("The valid values are:\n"), + regdesc, + _("The default is \"std\".")); In two steps, with the first step leaving fprintf_unfiltered (etc.) calls in place, and only afterwards do a pass to change all those to call stb.printf etc.. I didn't do that split, because (when I tried), it turned out to be pointless make-work: the first pass would have to touch the fprintf_unfiltered line anyway, to replace "stb" with "&stb". - gdb_fopen replaced with stack-based objects This avoids the need for cleanups or unique_ptr's. I.e., this: struct ui_file *file = gdb_fopen (filename, "w"); if (filename == NULL) perror_with_name (filename); cleanups = make_cleanup_ui_file_delete (file); // use file. do_cleanups (cleanups); is replaced with this: stdio_file file; if (!file.open (filename, "w")) perror_with_name (filename); // use file. - odd contorsions in null_file_write / null_file_fputs around when to call to_fputs / to_write eliminated. - Global null_stream object A few places that were allocating a ui_file in order to print to "nowhere" are adjusted to instead refer to a new 'null_stream' global stream. - TUI's tui_sfileopen eliminated. TUI's ui_file much simplified The TUI's ui_file was serving a dual purpose. It supported being used as string buffer, and supported being backed by a stdio FILE. The string buffer part is gone, replaced by using of string_file. The 'FILE *' support is now much simplified, by making the TUI's ui_file inherit from stdio_file. gdb/ChangeLog: 2017-02-02 Pedro Alves <palves@redhat.com> * ada-lang.c (type_as_string): Use string_file. * ada-valprint.c (ada_print_floating): Use string_file. * ada-varobj.c (ada_varobj_scalar_image) (ada_varobj_get_value_image): Use string_file. * aix-thread.c (aix_thread_extra_thread_info): Use string_file. * arm-tdep.c (_initialize_arm_tdep): Use string_printf. * breakpoint.c (update_inserted_breakpoint_locations) (insert_breakpoint_locations, reattach_breakpoints) (print_breakpoint_location, print_one_detail_ranged_breakpoint) (print_it_watchpoint): Use string_file. (save_breakpoints): Use stdio_file. * c-exp.y (oper): Use string_file. * cli/cli-logging.c (set_logging_redirect): Use ui_file_up and tee_file. (pop_output_files): Use delete. (handle_redirections): Use stdio_file and tee_file. * cli/cli-setshow.c (do_show_command): Use string_file. * compile/compile-c-support.c (c_compute_program): Use string_file. * compile/compile-c-symbols.c (generate_vla_size): Take a 'string_file &' instead of a 'ui_file *'. (generate_c_for_for_one_variable): Take a 'string_file &' instead of a 'ui_file *'. Use string_file. (generate_c_for_variable_locations): Take a 'string_file &' instead of a 'ui_file *'. * compile/compile-internal.h (generate_c_for_for_one_variable): Take a 'string_file &' instead of a 'ui_file *'. * compile/compile-loc2c.c (push, pushf, unary, binary) (print_label, pushf_register_address, pushf_register) (do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * compile/compile.c (compile_to_object): Use string_file. * compile/compile.h (compile_dwarf_expr_to_c) (compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a 'ui_file *'. * cp-support.c (inspect_type): Use string_file and obstack_copy0. (replace_typedefs_qualified_name): Use string_file and obstack_copy0. * disasm.c (gdb_pretty_print_insn): Use string_file. (gdb_disassembly): Adjust reference the null_stream global. (do_ui_file_delete): Delete. (gdb_insn_length): Use null_stream. * dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file. * dwarf2loc.c (dwarf2_compile_property_to_c) (locexpr_generate_c_location, loclist_generate_c_location): Take a 'string_file &' instead of a 'ui_file *'. * dwarf2loc.h (dwarf2_compile_property_to_c): Likewise. * dwarf2read.c (do_ui_file_peek_last): Delete. (dwarf2_compute_name): Use string_file. * event-top.c (gdb_setup_readline): Use stdio_file. * gdbarch.sh (verify_gdbarch): Use string_file. * gdbtypes.c (safe_parse_type): Use null_stream. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use string_file. * guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a 'string_file *' instead of a 'ui_file *'. (gdbscm_arch_disassemble): Use string_file. * guile/scm-frame.c (frscm_print_frame_smob): Use string_file. * guile/scm-ports.c (class ioscm_file_port): Now a class that inherits from ui_file. (ioscm_file_port_delete, ioscm_file_port_rewind) (ioscm_file_port_put): Delete. (ioscm_file_port_write): Rename to ... (ioscm_file_port::write): ... this. Remove file_port_magic checks. (ioscm_file_port_new): Delete. (ioscm_with_output_to_port_worker): Use ioscm_file_port and ui_file_up. * guile/scm-type.c (tyscm_type_name): Use string_file. * guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print): Use string_file. * infcmd.c (print_return_value_1): Use string_file. * infrun.c (print_target_wait_results): Use string_file. * language.c (add_language): Use string_file. * location.c (explicit_to_string_internal): Use string_file. * main.c (captured_main_1): Use null_file. * maint.c (maintenance_print_architecture): Use stdio_file. * mi/mi-cmd-stack.c (list_arg_or_local): Use string_file. * mi/mi-common.h (struct mi_interp) <out, err, log, targ, event_channel>: Change type to mi_console_file pointer. * mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush) (mi_console_file_delete): Delete. (struct mi_console_file): Delete. (mi_console_file_magic): Delete. (mi_console_file_new): Delete. (mi_console_file::mi_console_file): New. (mi_console_file_delete): Delete. (mi_console_file_fputs): Delete. (mi_console_file::write): New. (mi_console_raw_packet): Delete. (mi_console_file::flush): New. (mi_console_file_flush): Delete. (mi_console_set_raw): Rename to ... (mi_console_file::set_raw): ... this. * mi/mi-console.h (class mi_console_file): New class. (mi_console_file_new, mi_console_set_raw): Delete. * mi/mi-interp.c (mi_interpreter_init): Use mi_console_file. (mi_set_logging): Use delete and tee_file. Adjust. * mi/mi-main.c (output_register): Use string_file. (mi_cmd_data_evaluate_expression): Use string_file. (mi_cmd_data_read_memory): Use string_file. (mi_cmd_execute, print_variable_or_computed): Use string_file. * mi/mi-out.c (mi_ui_out::main_stream): New. (mi_ui_out::rewind): Use main_stream and string_file. (mi_ui_out::put): Use main_stream and string_file. (mi_ui_out::mi_ui_out): Remove 'stream' parameter. Allocate a 'string_file' instead. (mi_out_new): Don't allocate a mem_fileopen stream here. * mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter. (mi_ui_out::main_stream): Declare method. * printcmd.c (eval_command): Use string_file. * psymtab.c (maintenance_print_psymbols): Use stdio_file. * python/py-arch.c (archpy_disassemble): Use string_file. * python/py-breakpoint.c (bppy_get_commands): Use string_file. * python/py-frame.c (frapy_str): Use string_file. * python/py-framefilter.c (py_print_type, py_print_single_arg): Use string_file. * python/py-type.c (typy_str): Use string_file. * python/py-unwind.c (unwind_infopy_str): Use string_file. * python/py-value.c (valpy_str): Use string_file. * record-btrace.c (btrace_insn_history): Use string_file. * regcache.c (regcache_print): Use stdio_file. * reggroups.c (maintenance_print_reggroups): Use stdio_file. * remote.c (escape_buffer): Use string_file. * rust-lang.c (rust_get_disr_info): Use string_file. * serial.c (serial_open_ops_1): Use stdio_file. (do_serial_close): Use delete. * stack.c (print_frame_arg): Use string_file. (print_frame_args): Remove local mem_fileopen stream, not used. (print_frame): Use string_file. * symmisc.c (maintenance_print_symbols): Use stdio_file. * symtab.h (struct symbol_computed_ops) <generate_c_location>: Take a 'string_file *' instead of a 'ui_file *'. * top.c (new_ui): Use stdio_file and stderr_file. (free_ui): Use delete. (execute_command_to_string): Use string_file. (quit_confirm): Use string_file. * tracepoint.c (collection_list::append_exp): Use string_file. * tui/tui-disasm.c (tui_disassemble): Use string_file. * tui/tui-file.c: Don't include "ui-file.h". (enum streamtype, struct tui_stream): Delete. (tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen) (tui_file_isatty, tui_file_rewind, tui_file_put): Delete. (tui_file::tui_file): New method. (tui_file_fputs): Delete. (tui_file_get_strbuf): Delete. (tui_file::puts): New method. (tui_file_adjust_strbuf): Delete. (tui_file_flush): Delete. (tui_file::flush): New method. * tui/tui-file.h: Tweak intro comment. Include ui-file.h. (tui_fileopen, tui_sfileopen, tui_file_get_strbuf) (tui_file_adjust_strbuf): Delete declarations. (class tui_file): New class. * tui/tui-io.c (tui_initialize_io): Use tui_file. * tui/tui-regs.c (tui_restore_gdbout): Use delete. (tui_register_format): Use string_stream. * tui/tui-stack.c (tui_make_status_line): Use string_file. (tui_get_function_from_frame): Use string_file. * typeprint.c (type_to_string): Use string_file. * ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete. (null_stream): New global. (ui_file_delete): Delete. (ui_file::ui_file): New. (null_file_isatty): Delete. (ui_file::~ui_file): New. (null_file_rewind): Delete. (ui_file::printf): New. (null_file_put): Delete. (null_file_flush): Delete. (ui_file::putstr): New. (null_file_write): Delete. (ui_file::putstrn): New. (null_file_read): Delete. (ui_file::putc): New. (null_file_fputs): Delete. (null_file_write_async_safe): Delete. (ui_file::vprintf): New. (null_file_delete): Delete. (null_file::write): New. (null_file_fseek): Delete. (null_file::puts): New. (ui_file_data): Delete. (null_file::write_async_safe): New. (gdb_flush, ui_file_isatty): Adjust. (ui_file_put, ui_file_rewind): Delete. (ui_file_write): Adjust. (ui_file_write_for_put): Delete. (ui_file_write_async_safe, ui_file_read): Adjust. (ui_file_fseek): Delete. (fputs_unfiltered): Adjust. (set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind) (set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe) (set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek) (set_ui_file_data): Delete. (string_file::~string_file, string_file::write) (struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup) (do_ui_file_as_string, ui_file_as_string): Delete. (do_ui_file_obsavestring, ui_file_obsavestring): Delete. (struct mem_file): Delete. (mem_file_new): Delete. (stdio_file::stdio_file): New. (mem_file_delete): Delete. (stdio_file::stdio_file): New. (mem_fileopen): Delete. (stdio_file::~stdio_file): New. (mem_file_rewind): Delete. (stdio_file::set_stream): New. (mem_file_put): Delete. (stdio_file::open): New. (mem_file_write): Delete. (stdio_file_magic, struct stdio_file): Delete. (stdio_file_new, stdio_file_delete, stdio_file_flush): Delete. (stdio_file::flush): New. (stdio_file_read): Rename to ... (stdio_file::read): ... this. Adjust. (stdio_file_write): Rename to ... (stdio_file::write): ... this. Adjust. (stdio_file_write_async_safe): Rename to ... (stdio_file::write_async_safe) ... this. Adjust. (stdio_file_fputs): Rename to ... (stdio_file::puts) ... this. Adjust. (stdio_file_isatty): Delete. (stdio_file_fseek): Delete. (stdio_file::isatty): New. (stderr_file_write): Rename to ... (stderr_file::write) ... this. Adjust. (stderr_file_fputs): Rename to ... (stderr_file::puts) ... this. Adjust. (stderr_fileopen, stdio_fileopen, gdb_fopen): Delete. (stderr_file::stderr_file): New. (tee_file_magic): Delete. (struct tee_file): Delete. (tee_file::tee_file): New. (tee_file_new): Delete. (tee_file::~tee_file): New. (tee_file_delete): Delete. (tee_file_flush): Rename to ... (tee_file::flush): ... this. Adjust. (tee_file_write): Rename to ... (tee_file::write): ... this. Adjust. (tee_file::write_async_safe): New. (tee_file_fputs): Rename to ... (tee_file::puts): ... this. Adjust. (tee_file_isatty): Rename to ... (tee_file::isatty): ... this. Adjust. * ui-file.h (struct obstack, struct ui_file): Don't forward-declare. (ui_file_new, ui_file_flush_ftype, set_ui_file_flush) (ui_file_write_ftype) (set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs) (ui_file_write_async_safe_ftype, set_ui_file_write_async_safe) (ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype) (set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind) (ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put) (ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype) (set_ui_file_fseek): Delete. (ui_file_data, ui_file_delete, ui_file_rewind) (struct ui_file): New. (ui_file_up): New. (class null_file): New. (null_stream): Declare. (ui_file_write_for_put, ui_file_put): Delete. (ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring): Delete. (ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen) (gdb_fopen, tee_file_new): Delete. (struct string_file): New. (struct stdio_file): New. (stdio_file_up): New. (struct stderr_file): New. (class tee_file): New. * ui-out.c (ui_out::field_stream): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * ui-out.h (class ui_out) <field_stream>: Likewise. * utils.c (do_ui_file_delete, make_cleanup_ui_file_delete) (null_stream): Delete. (error_stream): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * utils.h (struct ui_file): Delete forward declaration.. (make_cleanup_ui_file_delete, null_stream): Delete declarations. (error_stream): Take a 'string_file &' instead of a 'ui_file *'. * varobj.c (varobj_value_get_print_value): Use string_file. * xtensa-tdep.c (xtensa_verify_config): Use string_file. * gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
if (!file.open (args, "w"))
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"));
Reimplement support for "maint print registers" with no running inferior yet A following patch will change the default target_thread_architecture method, like this: struct gdbarch * default_thread_architecture (struct target_ops *ops, ptid_t ptid) { - return target_gdbarch (); + inferior *inf = find_inferior_ptid (ptid); + gdb_assert (inf != NULL); + return inf->gdbarch; } This is because target_gdbarch is really just current_inferior()->gdbarch, and it's wrong to return that architecture when the inferior of the passed in PTID is NOT the current inferior -- the inferior for PTID may be running a different architecture. E.g., a mix of 64-bit and 32-bit inferiors in the same debug session. Doing that change above however exposes a problem in "maint print registers", caught be the testsuite: -PASS: gdb.base/maint.exp: maint print registers +FAIL: gdb.base/maint.exp: maint print registers (GDB internal error) ... gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, The call stack looks like this: #0 0x000000000068b707 in internal_error(char const*, int, char const*, ...) (file=0xa9b958 "gdb/inferior.c", line=309, fmt=0xa9b8e0 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54 #1 0x00000000006e1c40 in find_inferior_pid(int) (pid=0) at gdb/inferior.c:309 #2 0x00000000006e1c8d in find_inferior_ptid(ptid_t) (ptid=...) at gdb/inferior.c:323 #3 0x00000000007c18dc in default_thread_architecture(target_ops*, ptid_t) (ops=0xf86d60 <dummy_target>, ptid=...) at gdb/target.c:3134 #4 0x00000000007b5414 in delegate_thread_architecture(target_ops*, ptid_t) (self=0xf86d60 <dummy_target>, arg1=...) at gdb/target-delegates.c:2527 #5 0x00000000007647b3 in get_thread_regcache(ptid_t) (ptid=...) at gdb/regcache.c:466 #6 0x00000000007647ff in get_current_regcache() () at gdb/regcache.c:475 #7 0x0000000000767495 in regcache_print(char const*, regcache_dump_what) (args=0x0, what_to_dump=regcache_dump_none) at gdb/regcache.c:1599 #8 0x0000000000767550 in maintenance_print_registers(char const*, int) (args=0x0, from_tty=1) at gdb/regcache.c:1613 I.e., the test does "maint print registers" while the inferior is not running yet. This is expected to work, and there's already a hack in get_thread_arch_regcache to make it work. Instead of pilling on hacks in the internal of regcache and target_ops, this commit moves the null_ptid special casing to where it belongs -- higher up in the call chain in the implementation of "maint print registers" & co directly. gdb/ChangeLog: 2017-10-04 Pedro Alves <palves@redhat.com> * regcache.c (get_thread_arch_regcache): Remove null_ptid special case. (regcache_print): Handle !target_has_registers here instead.
2017-10-04 19:21:10 +02:00
out = &file;
}
if (target_has_registers)
get_current_regcache ()->dump (out, what_to_dump);
else
{
/* For the benefit of "maint print registers" & co when
debugging an executable, allow dumping a regcache even when
there is no thread selected / no registers. */
regcache dummy_regs (target_gdbarch ());
Reimplement support for "maint print registers" with no running inferior yet A following patch will change the default target_thread_architecture method, like this: struct gdbarch * default_thread_architecture (struct target_ops *ops, ptid_t ptid) { - return target_gdbarch (); + inferior *inf = find_inferior_ptid (ptid); + gdb_assert (inf != NULL); + return inf->gdbarch; } This is because target_gdbarch is really just current_inferior()->gdbarch, and it's wrong to return that architecture when the inferior of the passed in PTID is NOT the current inferior -- the inferior for PTID may be running a different architecture. E.g., a mix of 64-bit and 32-bit inferiors in the same debug session. Doing that change above however exposes a problem in "maint print registers", caught be the testsuite: -PASS: gdb.base/maint.exp: maint print registers +FAIL: gdb.base/maint.exp: maint print registers (GDB internal error) ... gdb/inferior.c:309: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed. A problem internal to GDB has been detected, The call stack looks like this: #0 0x000000000068b707 in internal_error(char const*, int, char const*, ...) (file=0xa9b958 "gdb/inferior.c", line=309, fmt=0xa9b8e0 "%s: Assertion `%s' failed.") at gdb/common/errors.c:54 #1 0x00000000006e1c40 in find_inferior_pid(int) (pid=0) at gdb/inferior.c:309 #2 0x00000000006e1c8d in find_inferior_ptid(ptid_t) (ptid=...) at gdb/inferior.c:323 #3 0x00000000007c18dc in default_thread_architecture(target_ops*, ptid_t) (ops=0xf86d60 <dummy_target>, ptid=...) at gdb/target.c:3134 #4 0x00000000007b5414 in delegate_thread_architecture(target_ops*, ptid_t) (self=0xf86d60 <dummy_target>, arg1=...) at gdb/target-delegates.c:2527 #5 0x00000000007647b3 in get_thread_regcache(ptid_t) (ptid=...) at gdb/regcache.c:466 #6 0x00000000007647ff in get_current_regcache() () at gdb/regcache.c:475 #7 0x0000000000767495 in regcache_print(char const*, regcache_dump_what) (args=0x0, what_to_dump=regcache_dump_none) at gdb/regcache.c:1599 #8 0x0000000000767550 in maintenance_print_registers(char const*, int) (args=0x0, from_tty=1) at gdb/regcache.c:1613 I.e., the test does "maint print registers" while the inferior is not running yet. This is expected to work, and there's already a hack in get_thread_arch_regcache to make it work. Instead of pilling on hacks in the internal of regcache and target_ops, this commit moves the null_ptid special casing to where it belongs -- higher up in the call chain in the implementation of "maint print registers" & co directly. gdb/ChangeLog: 2017-10-04 Pedro Alves <palves@redhat.com> * regcache.c (get_thread_arch_regcache): Remove null_ptid special case. (regcache_print): Handle !target_has_registers here instead.
2017-10-04 19:21:10 +02:00
dummy_regs.dump (out, what_to_dump);
}
}
static void
maintenance_print_registers (const char *args, int from_tty)
{
regcache_print (args, regcache_dump_none);
}
static void
maintenance_print_raw_registers (const char *args, int from_tty)
{
regcache_print (args, regcache_dump_raw);
}
static void
maintenance_print_cooked_registers (const char *args, int from_tty)
{
regcache_print (args, regcache_dump_cooked);
}
static void
maintenance_print_register_groups (const char *args, int from_tty)
{
regcache_print (args, regcache_dump_groups);
}
static void
maintenance_print_remote_registers (const char *args, int from_tty)
{
regcache_print (args, regcache_dump_remote);
}
#if GDB_SELF_TEST
#include "selftest.h"
namespace selftests {
class regcache_access : public regcache
{
public:
/* Return the number of elements in current_regcache. */
static size_t
current_regcache_size ()
{
return std::distance (regcache::current_regcache.begin (),
regcache::current_regcache.end ());
}
};
static void
current_regcache_test (void)
{
/* It is empty at the start. */
SELF_CHECK (regcache_access::current_regcache_size () == 0);
ptid_t ptid1 (1), ptid2 (2), ptid3 (3);
/* Get regcache from ptid1, a new regcache is added to
current_regcache. */
regcache *regcache = get_thread_arch_aspace_regcache (ptid1,
target_gdbarch (),
NULL);
SELF_CHECK (regcache != NULL);
SELF_CHECK (regcache->ptid () == ptid1);
SELF_CHECK (regcache_access::current_regcache_size () == 1);
/* Get regcache from ptid2, a new regcache is added to
current_regcache. */
regcache = get_thread_arch_aspace_regcache (ptid2,
target_gdbarch (),
NULL);
SELF_CHECK (regcache != NULL);
SELF_CHECK (regcache->ptid () == ptid2);
SELF_CHECK (regcache_access::current_regcache_size () == 2);
/* Get regcache from ptid3, a new regcache is added to
current_regcache. */
regcache = get_thread_arch_aspace_regcache (ptid3,
target_gdbarch (),
NULL);
SELF_CHECK (regcache != NULL);
SELF_CHECK (regcache->ptid () == ptid3);
SELF_CHECK (regcache_access::current_regcache_size () == 3);
/* Get regcache from ptid2 again, nothing is added to
current_regcache. */
regcache = get_thread_arch_aspace_regcache (ptid2,
target_gdbarch (),
NULL);
SELF_CHECK (regcache != NULL);
SELF_CHECK (regcache->ptid () == ptid2);
SELF_CHECK (regcache_access::current_regcache_size () == 3);
/* Mark ptid2 is changed, so regcache of ptid2 should be removed from
current_regcache. */
registers_changed_ptid (ptid2);
SELF_CHECK (regcache_access::current_regcache_size () == 2);
}
} // namespace selftests
#endif /* GDB_SELF_TEST */
void
_initialize_regcache (void)
{
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
regcache_descr_handle
= gdbarch_data_register_post_init (init_regcache_descr);
observer_attach_target_changed (regcache_observer_target_changed);
observer_attach_thread_ptid_changed (regcache::regcache_thread_ptid_changed);
add_com ("flushregs", class_maintenance, reg_flush_command,
_("Force gdb to flush its register cache (maintainer command)"));
2001-05-04 06:15:33 +02:00
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
add_cmd ("registers", class_maintenance, maintenance_print_registers,
_("Print the internal register configuration.\n"
"Takes an optional file parameter."), &maintenanceprintlist);
add_cmd ("raw-registers", class_maintenance,
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
maintenance_print_raw_registers,
_("Print the internal register configuration "
"including raw values.\n"
"Takes an optional file parameter."), &maintenanceprintlist);
add_cmd ("cooked-registers", class_maintenance,
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
maintenance_print_cooked_registers,
_("Print the internal register configuration "
"including cooked values.\n"
"Takes an optional file parameter."), &maintenanceprintlist);
add_cmd ("register-groups", class_maintenance,
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 23:22:53 +01:00
maintenance_print_register_groups,
_("Print the internal register configuration "
"including each register's group.\n"
"Takes an optional file parameter."),
&maintenanceprintlist);
add_cmd ("remote-registers", class_maintenance,
maintenance_print_remote_registers, _("\
Print the internal register configuration including each register's\n\
remote register number and buffer offset in the g/G packets.\n\
Takes an optional file parameter."),
&maintenanceprintlist);
Add selftests run filtering With the growing number of selftests, I think it would be useful to be able to run only a subset of the tests. This patch associates a name to each registered selftest. It then allows doing something like: (gdb) maintenance selftest aarch64 Running self-tests. Running selftest aarch64-analyze-prologue. Running selftest aarch64-process-record. Ran 2 unit tests, 0 failed or with gdbserver: ./gdbserver --selftest=aarch64 In both cases, only the tests that contain "aarch64" in their name are ran. To help validate that the tests you want to run were actually ran, it also prints a message with the test name before running each test. Right now, all the arch-dependent tests are registered as a single test of the selftests. To be able to filter those too, I made them "first-class citizen" selftests. The selftest type is an interface, with different implementations for "simple selftests" and "arch selftests". The run_tests function simply iterates on that an invokes operator() on each test. I changed the tests data structure from a vector to a map, because - it allows iterating in a stable (alphabetical) order - it allows to easily verify if a test with a given name has been registered, to avoid duplicates There's also a new command "maintenance info selftests" that lists the registered selftests. gdb/ChangeLog: * common/selftest.h (selftest): New struct/interface. (register_test): Add name parameter, add new overload. (run_tests): Add filter parameter. (for_each_selftest_ftype): New typedef. (for_each_selftest): New declaration. * common/selftest.c (tests): Change type to map<string, unique_ptr<selftest>>. (simple_selftest): New struct. (register_test): New function. (register_test): Add name parameter and use it. (run_tests): Add filter parameter and use it. Add prints. Adjust to vector -> map change. * aarch64-tdep.c (_initialize_aarch64_tdep): Add names when registering selftests. * arm-tdep.c (_initialize_arm_tdep): Likewise. * disasm-selftests.c (_initialize_disasm_selftests): Likewise. * dwarf2-frame.c (_initialize_dwarf2_frame): Likewise. * dwarf2loc.c (_initialize_dwarf2loc): Likewise. * findvar.c (_initialize_findvar): Likewise. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Likewise. * maint.c (maintenance_selftest): Update call to run_tests. (maintenance_info_selftests): New function. (_initialize_maint_cmds): Register "maintenance info selftests" command. Update "maintenance selftest" doc. * regcache.c (_initialize_regcache): Add names when registering selftests. * rust-exp.y (_initialize_rust_exp): Likewise. * selftest-arch.c (gdbarch_selftest): New struct. (gdbarch_tests): Remove. (register_test_foreach_arch): Add name parameter. Call register_test. (tests_with_arch): Remove, move most content to gdbarch_selftest::operator(). (_initialize_selftests_foreach_arch): Remove. * selftest-arch.h (register_test_foreach_arch): Add name parameter. (run_tests_with_arch): New declaration. * utils-selftests.c (_initialize_utils_selftests): Add names when registering selftests. * utils.c (_initialize_utils): Likewise. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Likewise. * unittests/environ-selftests.c (_initialize_environ_selftests): Likewise. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Likewise. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Likewise. * unittests/optional-selftests.c (_initialize_optional_selftests): Likewise. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Likewise. * NEWS: Document "maintenance selftest" and "maint info selftests". gdb/gdbserver/ChangeLog: * server.c (captured_main): Accept argument for --selftest. Update run_tests call. * linux-x86-tdesc-selftest.c (initialize_low_tdesc): Add names when registering selftests. gdb/doc/ChangeLog: * gdb.texinfo (Maintenance Commands): Document filter parameter of "maint selftest". Document "maint info selftests" command.
2017-09-16 14:06:03 +02:00
#if GDB_SELF_TEST
Add selftests run filtering With the growing number of selftests, I think it would be useful to be able to run only a subset of the tests. This patch associates a name to each registered selftest. It then allows doing something like: (gdb) maintenance selftest aarch64 Running self-tests. Running selftest aarch64-analyze-prologue. Running selftest aarch64-process-record. Ran 2 unit tests, 0 failed or with gdbserver: ./gdbserver --selftest=aarch64 In both cases, only the tests that contain "aarch64" in their name are ran. To help validate that the tests you want to run were actually ran, it also prints a message with the test name before running each test. Right now, all the arch-dependent tests are registered as a single test of the selftests. To be able to filter those too, I made them "first-class citizen" selftests. The selftest type is an interface, with different implementations for "simple selftests" and "arch selftests". The run_tests function simply iterates on that an invokes operator() on each test. I changed the tests data structure from a vector to a map, because - it allows iterating in a stable (alphabetical) order - it allows to easily verify if a test with a given name has been registered, to avoid duplicates There's also a new command "maintenance info selftests" that lists the registered selftests. gdb/ChangeLog: * common/selftest.h (selftest): New struct/interface. (register_test): Add name parameter, add new overload. (run_tests): Add filter parameter. (for_each_selftest_ftype): New typedef. (for_each_selftest): New declaration. * common/selftest.c (tests): Change type to map<string, unique_ptr<selftest>>. (simple_selftest): New struct. (register_test): New function. (register_test): Add name parameter and use it. (run_tests): Add filter parameter and use it. Add prints. Adjust to vector -> map change. * aarch64-tdep.c (_initialize_aarch64_tdep): Add names when registering selftests. * arm-tdep.c (_initialize_arm_tdep): Likewise. * disasm-selftests.c (_initialize_disasm_selftests): Likewise. * dwarf2-frame.c (_initialize_dwarf2_frame): Likewise. * dwarf2loc.c (_initialize_dwarf2loc): Likewise. * findvar.c (_initialize_findvar): Likewise. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Likewise. * maint.c (maintenance_selftest): Update call to run_tests. (maintenance_info_selftests): New function. (_initialize_maint_cmds): Register "maintenance info selftests" command. Update "maintenance selftest" doc. * regcache.c (_initialize_regcache): Add names when registering selftests. * rust-exp.y (_initialize_rust_exp): Likewise. * selftest-arch.c (gdbarch_selftest): New struct. (gdbarch_tests): Remove. (register_test_foreach_arch): Add name parameter. Call register_test. (tests_with_arch): Remove, move most content to gdbarch_selftest::operator(). (_initialize_selftests_foreach_arch): Remove. * selftest-arch.h (register_test_foreach_arch): Add name parameter. (run_tests_with_arch): New declaration. * utils-selftests.c (_initialize_utils_selftests): Add names when registering selftests. * utils.c (_initialize_utils): Likewise. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Likewise. * unittests/environ-selftests.c (_initialize_environ_selftests): Likewise. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Likewise. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Likewise. * unittests/optional-selftests.c (_initialize_optional_selftests): Likewise. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Likewise. * NEWS: Document "maintenance selftest" and "maint info selftests". gdb/gdbserver/ChangeLog: * server.c (captured_main): Accept argument for --selftest. Update run_tests call. * linux-x86-tdesc-selftest.c (initialize_low_tdesc): Add names when registering selftests. gdb/doc/ChangeLog: * gdb.texinfo (Maintenance Commands): Document filter parameter of "maint selftest". Document "maint info selftests" command.
2017-09-16 14:06:03 +02:00
selftests::register_test ("current_regcache", selftests::current_regcache_test);
#endif
}