31 #include <forward_list> 186 : m_aspace (aspace_), m_readonly_p (readonly_p_)
370 gdb_assert (regnum < m_descr->nr_cooked_registers);
494 it = std::next (oit);
592 template<
typename T,
typename>
603 *val = extract_integer<T> (buf,
626 template<
typename T,
typename>
656 _(
"Register %d is not available"),
regnum);
670 gdb_assert (regnum < m_descr->nr_cooked_registers);
723 gdb_assert (regnum < m_descr->nr_cooked_registers);
729 struct value *result;
758 template<
typename T,
typename>
792 template<
typename T,
typename>
883 gdb_assert (regnum < m_descr->nr_cooked_registers);
901 const void *out,
bool is_raw)
1024 memcpy (regbuf, buf,
size);
1102 memcpy (buf, regbuf,
size);
1117 bool is_signed)
const 1135 int regnum,
const void *in_buf,
1136 void *out_buf,
size_t size)
const 1139 int offs = 0,
count;
1146 int slot_size = map->
size;
1153 && (regnum < regno || regnum >=
regno +
count)))
1154 offs +=
count * slot_size;
1159 if (offs + slot_size >
size)
1173 if (offs + slot_size >
size)
1251 _(
"regcache_read_pc: Unable to find PC"));
1267 _(
"regcache_write_pc: Unable to update PC"));
1300 for (
int i = 0; i <
size; i++)
1329 int footnote_nr = 0;
1330 int footnote_register_offset = 0;
1331 int footnote_register_type_name_null = 0;
1332 long register_offset = 0;
1349 else if (p[0] ==
'\0')
1383 if (!footnote_register_offset)
1384 footnote_register_offset = ++footnote_nr;
1408 static const char blt[] =
"builtin_type";
1413 if (!footnote_register_type_name_null)
1414 footnote_register_type_name_null = ++footnote_nr;
1416 footnote_register_type_name_null);
1417 t = name_holder.c_str ();
1504 const char *sep =
"";
1541 if (footnote_register_offset)
1543 footnote_register_offset);
1544 if (footnote_register_type_name_null)
1546 "*%d: Register type's name NULL.\n",
1547 footnote_register_type_name_null);
1561 if (!file.
open (args,
"w"))
1574 dummy_regs.
dump (out, what_to_dump);
1615 class regcache_access :
public regcache 1622 current_regcache_size ()
1630 current_regcache_test (
void)
1633 SELF_CHECK (regcache_access::current_regcache_size () == 0);
1635 ptid_t ptid1 (1), ptid2 (2), ptid3 (3);
1645 SELF_CHECK (regcache_access::current_regcache_size () == 1);
1654 SELF_CHECK (regcache_access::current_regcache_size () == 2);
1663 SELF_CHECK (regcache_access::current_regcache_size () == 3);
1672 SELF_CHECK (regcache_access::current_regcache_size () == 3);
1677 SELF_CHECK (regcache_access::current_regcache_size () == 2);
1685 test_target_xfer_partial (
struct target_ops *ops,
1687 const char *annex,
gdb_byte *readbuf,
1692 class target_ops_no_register :
public test_target_ops
1695 target_ops_no_register ()
1696 : test_target_ops {}
1698 to_fetch_registers = test_target_fetch_registers;
1699 to_store_registers = test_target_store_registers;
1700 to_xfer_partial = test_target_xfer_partial;
1707 fetch_registers_called = 0;
1708 store_registers_called = 0;
1709 xfer_partial_called = 0;
1712 unsigned int fetch_registers_called = 0;
1713 unsigned int store_registers_called = 0;
1714 unsigned int xfer_partial_called = 0;
1720 auto ops =
static_cast<target_ops_no_register *
> (
self->to_data);
1724 ops->fetch_registers_called++;
1730 auto ops =
static_cast<target_ops_no_register *
> (
self->to_data);
1732 ops->store_registers_called++;
1737 const char *annex,
gdb_byte *readbuf,
1741 auto ops =
static_cast<target_ops_no_register *
> (
self->to_data);
1743 ops->xfer_partial_called++;
1749 class readwrite_regcache :
public regcache 1766 error (
_(
"target already pushed"));
1771 target_ops_no_register mock_target;
1773 inferior mock_inferior (mock_ptid.pid ());
1775 mock_inferior.gdbarch =
gdbarch;
1776 mock_inferior.aspace = &mock_aspace;
1777 thread_info mock_thread (&mock_inferior, mock_ptid);
1820 readwrite_regcache readwrite (
gdbarch);
1823 readwrite.raw_read (
regnum, buf.data ());
1826 SELF_CHECK (mock_target.fetch_registers_called > 0);
1827 mock_target.reset ();
1832 readwrite.raw_update (i);
1834 mock_target.reset ();
1854 SELF_CHECK (mock_target.fetch_registers_called == 0);
1855 SELF_CHECK (mock_target.store_registers_called == 0);
1860 SELF_CHECK (mock_target.xfer_partial_called == 0);
1862 mock_target.reset ();
1869 mock_target.reset ();
1892 if (bfd_arch == bfd_arch_frv || bfd_arch == bfd_arch_h8300
1893 || bfd_arch == bfd_arch_m32c || bfd_arch == bfd_arch_sh
1894 || bfd_arch == bfd_arch_alpha || bfd_arch == bfd_arch_v850
1895 || bfd_arch == bfd_arch_msp430 || bfd_arch == bfd_arch_mep
1896 || bfd_arch == bfd_arch_mips || bfd_arch == bfd_arch_v850_rh850
1897 || bfd_arch == bfd_arch_tic6x || bfd_arch == bfd_arch_mn10300
1898 || bfd_arch == bfd_arch_rl78 || bfd_arch == bfd_arch_score)
1921 if (bfd_arch == bfd_arch_frv
1922 || bfd_arch == bfd_arch_m32c
1923 || bfd_arch == bfd_arch_mep
1924 || bfd_arch == bfd_arch_sh)
1926 else if (bfd_arch == bfd_arch_mips
1927 || bfd_arch == bfd_arch_h8300)
1934 SELF_CHECK (mock_target.fetch_registers_called == 0);
1935 SELF_CHECK (mock_target.store_registers_called == 0);
1936 SELF_CHECK (mock_target.xfer_partial_called == 0);
1938 mock_target.reset ();
1955 _(
"Force gdb to flush its register cache (maintainer command)"));
1958 _(
"Print the internal register configuration.\n" 1962 _(
"Print the internal register configuration " 1963 "including raw values.\n" 1967 _(
"Print the internal register configuration " 1968 "including cooked values.\n" 1972 _(
"Print the internal register configuration " 1973 "including each register's group.\n" 1974 "Takes an optional file parameter."),
1978 Print the internal register configuration including each register's\n\ 1979 remote register number and buffer offset in the g/G packets.\n\ 1980 Takes an optional file parameter."),
1987 selftests::cooked_read_test);
struct gdbarch * target_gdbarch(void)
static void maintenance_print_raw_registers(const char *args, int from_tty)
struct value * value_mark(void)
#define target_has_registers
int gdbarch_pseudo_register_read_value_p(struct gdbarch *gdbarch)
static void maintenance_print_registers(const char *args, int from_tty)
enum register_status cooked_read(int regnum, gdb_byte *buf)
int num_raw_registers() const
enum register_status raw_read(int regnum, gdb_byte *buf)
static void regcache_observer_target_changed(struct target_ops *target)
static struct regcache_descr * regcache_descr(struct gdbarch *gdbarch)
void cooked_write_part(int regnum, int offset, int len, const gdb_byte *buf)
void gdbarch_write_pc(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val)
long sizeof_raw_registers
struct regcache * get_thread_regcache(ptid_t ptid)
#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE)
struct value * cooked_read_value(int regnum)
static void regcache_thread_ptid_changed(ptid_t old_ptid, ptid_t new_ptid)
CORE_ADDR regcache_read_pc(struct regcache *regcache)
void supply_regset(const struct regset *regset, int regnum, const void *buf, size_t size)
regcache(gdbarch *gdbarch)
struct type ** register_type
#define TYPE_NAME(thistype)
regcache_invalidator(struct regcache *regcache, int regnum)
void push_target(struct target_ops *t)
char * plongest(LONGEST l)
void * gdbarch_data(struct gdbarch *gdbarch, struct gdbarch_data *data)
void regcache_cooked_write_signed(struct regcache *regcache, int regnum, LONGEST val)
std::vector< T, gdb::default_init_allocator< T > > def_vector
void mark_value_bytes_unavailable(struct value *value, LONGEST offset, LONGEST length)
ptid_t regcache_get_ptid(const struct regcache *regcache)
void raw_write(int regnum, const gdb_byte *buf)
void * memset(T *s, int c, size_t n)=delete
void internal_error(const char *file, int line, const char *fmt,...)
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
struct address_space * target_thread_address_space(ptid_t ptid)
void value_free(struct value *val)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void regcache_cooked_write_part(struct regcache *regcache, int regnum, int offset, int len, const gdb_byte *buf)
enum register_status raw_read_part(int regnum, int offset, int len, gdb_byte *buf)
int regcache_register_size(const struct regcache *regcache, int n)
void save(regcache_cooked_read_ftype *cooked_read, void *src)
gdb_byte * register_buffer(int regnum) const
void copy_integer_to_size(gdb_byte *dest, int dest_size, const gdb_byte *source, int source_size, bool is_signed, enum bfd_endian byte_order)
int gdbarch_write_pc_p(struct gdbarch *gdbarch)
struct reggroup *const restore_reggroup
int gdbarch_num_regs(struct gdbarch *gdbarch)
void target_fetch_registers(struct regcache *regcache, int regno)
void assert_regnum(int regnum) const
static void regcache_print(const char *args, enum regcache_dump_what what_to_dump)
void register_test_foreach_arch(const std::string &name, self_test_foreach_arch_function *function)
void regcache_save(struct regcache *regcache, regcache_cooked_read_ftype *cooked_read, void *src)
void regcache_write_pc(struct regcache *regcache, CORE_ADDR pc)
void set_ptid(const ptid_t ptid)
struct value * allocate_value(struct type *type)
struct regcache * get_current_regcache(void)
static constexpr readonly_t readonly
void printf_filtered(const char *format,...)
#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE)
void raw_supply_integer(int regnum, const gdb_byte *addr, int addr_len, bool is_signed)
struct regcache * regcache_dup(struct regcache *src)
struct regcache_descr * m_descr
void regcache_raw_write_signed(struct regcache *regcache, int regnum, LONGEST val)
enum register_status xfer_part(int regnum, int offset, int len, void *in, const void *out, bool is_raw)
int gdbarch_read_pc_p(struct gdbarch *gdbarch)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
int gdbarch_num_pseudo_regs(struct gdbarch *gdbarch)
void restore(struct regcache *src)
struct observer * observer_attach_target_changed(observer_target_changed_ftype *f)
void _initialize_regcache(void)
LONGEST regcache_raw_get_signed(struct regcache *regcache, int regnum)
CORE_ADDR gdbarch_read_pc(struct gdbarch *gdbarch, struct regcache *regcache)
void raw_collect(int regnum, void *buf) const
struct value::@186::@188 computed
enum register_status regcache_raw_read_part(struct regcache *regcache, int regnum, int offset, int len, gdb_byte *buf)
#define target_prepare_to_store(regcache)
void raw_supply(int regnum, const void *buf)
struct target_ops current_target
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
static void * init_regcache_descr(struct gdbarch *gdbarch)
void raw_write_part(int regnum, int offset, int len, const gdb_byte *buf)
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void print_hex_chars(struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order, bool zero_pad)
struct type * register_type(struct gdbarch *gdbarch, int regnum)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
int gdbarch_cannot_store_register(struct gdbarch *gdbarch, int regnum)
static void maintenance_print_cooked_registers(const char *args, int from_tty)
void regcache_raw_update(struct regcache *regcache, int regnum)
const gdb_byte * value_contents_all(struct value *value)
long sizeof_cooked_registers
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void transfer_regset(const struct regset *regset, struct regcache *out_regcache, int regnum, const void *in_buf, void *out_buf, size_t size) const
void raw_collect_integer(int regnum, gdb_byte *addr, int addr_len, bool is_signed) const
#define VALUE_REGNUM(val)
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
struct inferior * inferior_list
void regcache_cpy(struct regcache *dst, struct regcache *src)
void raw_set_cached_value(int regnum, const gdb_byte *buf)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static int startswith(const char *string, const char *pattern)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void raw_supply_zeroed(int regnum)
static enum register_status do_cooked_read(void *src, int regnum, gdb_byte *buf)
void collect_regset(const struct regset *regset, int regnum, void *buf, size_t size) const
struct value * gdbarch_pseudo_register_read_value(struct gdbarch *gdbarch, struct regcache *regcache, int cookednum)
struct observer * observer_attach_thread_ptid_changed(observer_thread_ptid_changed_ftype *f)
struct cmd_list_element * maintenanceprintlist
const address_space * aspace() const
static std::forward_list< regcache * > current_regcache
struct type * gdbarch_register_type(struct gdbarch *gdbarch, int reg_nr)
static void reg_flush_command(const char *command, int from_tty)
void regcache_invalidate(struct regcache *regcache, int regnum)
enum register_status get_register_status(int regnum) const
void regcache_raw_write_part(struct regcache *regcache, int regnum, int offset, int len, const gdb_byte *buf)
void store_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, T val)
int value_entirely_available(struct value *value)
void regcache_raw_set_cached_value(struct regcache *regcache, int regnum, const gdb_byte *buf)
int value_optimized_out(struct value *value)
static void maintenance_print_register_groups(const char *args, int from_tty)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
int gdbarch_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup)
struct value * regcache_cooked_read_value(struct regcache *regcache, int regnum)
enum register_status regcache_register_status(const struct regcache *regcache, int regnum)
enum register_status gdbarch_pseudo_register_read(struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf)
void registers_changed_ptid(ptid_t ptid)
enum register_status regcache_raw_read(struct regcache *regcache, int regnum, gdb_byte *buf)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
void debug_print_register(const char *func, int regno)
bool open(const char *name, const char *mode)
struct regcache * m_regcache
void registers_changed(void)
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
enum register_status cooked_read_part(int regnum, int offset, int len, gdb_byte *buf)
enum register_status regcache_cooked_read(struct regcache *regcache, int regnum, gdb_byte *buf)
struct regcache * get_thread_arch_aspace_regcache(ptid_t ptid, struct gdbarch *gdbarch, struct address_space *aspace)
void cooked_write(int regnum, const gdb_byte *buf)
enum register_status() regcache_cooked_read_ftype(void *src, int regnum, gdb_byte *buf)
std::string string_printf(const char *fmt,...)
void value_free_to_mark(const struct value *mark)
static struct gdbarch * current_thread_arch
struct thread_info * thread_list
void gdbarch_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf)
void dump(ui_file *file, enum regcache_dump_what what_to_dump)
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
int ptid_match(const ptid_t &ptid, const ptid_t &filter)
unsigned long long ULONGEST
void target_store_registers(struct regcache *regcache, int regno)
void release_value(struct value *val)
int register_size(struct gdbarch *gdbarch, int regnum)
struct type * value_type(const struct value *value)
enum register_status regcache_cooked_read_part(struct regcache *regcache, int regnum, int offset, int len, gdb_byte *buf)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
DISABLE_COPY_AND_ASSIGN(regcache_invalidator)
int remote_register_number_and_offset(struct gdbarch *gdbarch, int regnum, int *pnum, int *poffset)
gdb_byte * value_contents_raw(struct value *value)
struct reggroup * reggroup_next(struct gdbarch *gdbarch, struct reggroup *last)
struct reggroup *const save_reggroup
#define TYPE_LENGTH(thistype)
void raw_update(int regnum)
static ptid_t current_thread_ptid
void reinit_frame_cache(void)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
void() regcache_write_ftype(struct regcache *regcache, int regnum, const void *buf)
struct regcache * get_thread_regcache_for_ptid(ptid_t ptid)
#define target_thread_architecture(ptid)
signed char * m_register_status
void() regcache_read_ftype(struct regcache *regcache, int regnum, void *buf)
const char * core_addr_to_string_nz(const CORE_ADDR addr)
enum bfd_endian byte_order
void invalidate(int regnum)
void register_test(const std::string &name, selftest *test)
void pop_all_targets_at_and_above(enum strata stratum)
void error(const char *fmt,...)
struct gdbarch_data * gdbarch_data_register_post_init(gdbarch_data_post_init_ftype *post_init)
enum register_status regcache_cooked_read_signed(struct regcache *regcache, int regnum, LONGEST *val)
void set_current_inferior(struct inferior *inf)
void throw_error(enum errors error, const char *fmt,...)
const char * reggroup_name(struct reggroup *group)
static void maintenance_print_remote_registers(const char *args, int from_tty)
void regcache_cooked_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
struct regcache * get_thread_arch_regcache(ptid_t ptid, struct gdbarch *gdbarch)
#define SELF_CHECK(VALUE)
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
struct gdbarch_data * regcache_descr_handle
enum register_status regcache_raw_read_signed(struct regcache *regcache, int regnum, LONGEST *val)