/* The register buffers. A read-only register cache can hold the
full [0 .. NUM_REGS + NUM_PSEUDO_REGS) while a read/write
register cache can only hold [0 .. NUM_REGS). */
- char *registers;
- char *register_valid_p;
+ gdb_byte *registers;
+ gdb_byte *register_valid_p;
/* Is this a read-only cache? A read-only cache is used for saving
the target's register state (e.g, across an inferior function
call or just before forcing a function return). A read-only
regcache = XMALLOC (struct regcache);
regcache->descr = descr;
regcache->registers
- = XCALLOC (descr->sizeof_raw_registers, char);
+ = XCALLOC (descr->sizeof_raw_registers, gdb_byte);
regcache->register_valid_p
- = XCALLOC (descr->sizeof_raw_register_valid_p, char);
+ = XCALLOC (descr->sizeof_raw_register_valid_p, gdb_byte);
regcache->readonly_p = 1;
return regcache;
}
/* Return a pointer to register REGNUM's buffer cache. */
-static char *
+static gdb_byte *
register_buffer (const struct regcache *regcache, int regnum)
{
return regcache->registers + regcache->descr->register_offset[regnum];
void *src)
{
struct gdbarch *gdbarch = dst->descr->gdbarch;
- char buf[MAX_REGISTER_SIZE];
+ gdb_byte buf[MAX_REGISTER_SIZE];
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
void
regcache_restore (struct regcache *dst,
regcache_cooked_read_ftype *cooked_read,
- void *src)
+ void *cooked_read_context)
{
struct gdbarch *gdbarch = dst->descr->gdbarch;
- char buf[MAX_REGISTER_SIZE];
+ gdb_byte buf[MAX_REGISTER_SIZE];
int regnum;
/* The dst had better not be read-only. If it is, the `restore'
doesn't make much sense. */
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
{
- int valid = cooked_read (src, regnum, buf);
+ int valid = cooked_read (cooked_read_context, regnum, buf);
if (valid)
regcache_cooked_write (dst, regnum, buf);
}
}
static int
-do_cooked_read (void *src, int regnum, void *buf)
+do_cooked_read (void *src, int regnum, gdb_byte *buf)
{
struct regcache *regcache = src;
if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
regcache_cpy (struct regcache *dst, struct regcache *src)
{
int i;
- char *buf;
+ gdb_byte *buf;
gdb_assert (src != NULL && dst != NULL);
gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
gdb_assert (src != dst);
return regcache->register_valid_p[regnum];
}
-char *
+gdb_byte *
deprecated_grub_regcache_for_registers (struct regcache *regcache)
{
return regcache->registers;
into memory at MYADDR. */
void
-deprecated_read_register_bytes (int in_start, char *in_buf, int in_len)
+deprecated_read_register_bytes (int in_start, gdb_byte *in_buf, int in_len)
{
int in_end = in_start + in_len;
int regnum;
- char reg_buf[MAX_REGISTER_SIZE];
+ gdb_byte reg_buf[MAX_REGISTER_SIZE];
/* See if we are trying to read bytes from out-of-date registers. If so,
update just those registers. */
}
void
-regcache_raw_read (struct regcache *regcache, int regnum, void *buf)
+regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
gdb_assert (regcache != NULL && buf != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
void
regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
{
- char *buf;
+ gdb_byte *buf;
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val)
{
- char *buf;
+ gdb_byte *buf;
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
}
void
-deprecated_read_register_gen (int regnum, char *buf)
+deprecated_read_register_gen (int regnum, gdb_byte *buf)
{
gdb_assert (current_regcache != NULL);
gdb_assert (current_regcache->descr->gdbarch == current_gdbarch);
}
void
-regcache_cooked_read (struct regcache *regcache, int regnum, void *buf)
+regcache_cooked_read (struct regcache *regcache, int regnum, gdb_byte *buf)
{
gdb_assert (regnum >= 0);
gdb_assert (regnum < regcache->descr->nr_cooked_registers);
regcache_cooked_read_signed (struct regcache *regcache, int regnum,
LONGEST *val)
{
- char *buf;
+ gdb_byte *buf;
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val)
{
- char *buf;
+ gdb_byte *buf;
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
}
void
-regcache_raw_write (struct regcache *regcache, int regnum, const void *buf)
+regcache_raw_write (struct regcache *regcache, int regnum,
+ const gdb_byte *buf)
{
gdb_assert (regcache != NULL && buf != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
}
void
-deprecated_write_register_gen (int regnum, char *buf)
+deprecated_write_register_gen (int regnum, gdb_byte *buf)
{
gdb_assert (current_regcache != NULL);
gdb_assert (current_regcache->descr->gdbarch == current_gdbarch);
}
void
-regcache_cooked_write (struct regcache *regcache, int regnum, const void *buf)
+regcache_cooked_write (struct regcache *regcache, int regnum,
+ const gdb_byte *buf)
{
gdb_assert (regnum >= 0);
gdb_assert (regnum < regcache->descr->nr_cooked_registers);
into registers starting with the MYREGSTART'th byte of register data. */
void
-deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen)
+deprecated_write_register_bytes (int myregstart, gdb_byte *myaddr, int inlen)
{
int myregend = myregstart + inlen;
int regnum;
/* The register partially overlaps the range being written. */
else
{
- char regbuf[MAX_REGISTER_SIZE];
+ gdb_byte regbuf[MAX_REGISTER_SIZE];
/* What's the overlap between this register's bytes and
those the caller wants to write? */
int overlapstart = max (regstart, myregstart);
static void
regcache_xfer_part (struct regcache *regcache, int regnum,
int offset, int len, void *in, const void *out,
- regcache_read_ftype *read, regcache_write_ftype *write)
+ void (*read) (struct regcache *regcache, int regnum,
+ gdb_byte *buf),
+ void (*write) (struct regcache *regcache, int regnum,
+ const gdb_byte *buf))
{
struct regcache_descr *descr = regcache->descr;
gdb_byte reg[MAX_REGISTER_SIZE];
void
regcache_raw_read_part (struct regcache *regcache, int regnum,
- int offset, int len, void *buf)
+ int offset, int len, gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
void
regcache_raw_write_part (struct regcache *regcache, int regnum,
- int offset, int len, const void *buf)
+ int offset, int len, const gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
void
regcache_cooked_read_part (struct regcache *regcache, int regnum,
- int offset, int len, void *buf)
+ int offset, int len, gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
void
regcache_cooked_write_part (struct regcache *regcache, int regnum,
- int offset, int len, const void *buf)
+ int offset, int len, const gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
ULONGEST
read_register (int regnum)
{
- char *buf = alloca (register_size (current_gdbarch, regnum));
+ gdb_byte *buf = alloca (register_size (current_gdbarch, regnum));
deprecated_read_register_gen (regnum, buf);
return (extract_unsigned_integer (buf, register_size (current_gdbarch, regnum)));
}
/* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
void
-regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf)
+regcache_raw_supply (struct regcache *regcache, int regnum,
+ const gdb_byte *buf)
{
void *regbuf;
size_t size;
/* Collect register REGNUM from REGCACHE and store its contents in BUF. */
void
-regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
+regcache_raw_collect (const struct regcache *regcache, int regnum,
+ gdb_byte *buf)
{
const void *regbuf;
size_t size;
/* Transfer a raw register [0..NUM_REGS) between core-gdb and the
regcache. */
-void regcache_raw_read (struct regcache *regcache, int rawnum, void *buf);
+void regcache_raw_read (struct regcache *regcache, int rawnum, gdb_byte *buf);
void regcache_raw_write (struct regcache *regcache, int rawnum,
- const void *buf);
+ const gdb_byte *buf);
extern void regcache_raw_read_signed (struct regcache *regcache,
int regnum, LONGEST *val);
extern void regcache_raw_read_unsigned (struct regcache *regcache,
write style operations. */
void regcache_raw_read_part (struct regcache *regcache, int regnum,
- int offset, int len, void *buf);
+ int offset, int len, gdb_byte *buf);
void regcache_raw_write_part (struct regcache *regcache, int regnum,
- int offset, int len, const void *buf);
+ int offset, int len, const gdb_byte *buf);
int regcache_valid_p (struct regcache *regcache, int regnum);
/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */
-void regcache_cooked_read (struct regcache *regcache, int rawnum, void *buf);
+void regcache_cooked_read (struct regcache *regcache, int rawnum,
+ gdb_byte *buf);
void regcache_cooked_write (struct regcache *regcache, int rawnum,
- const void *buf);
+ const gdb_byte *buf);
/* NOTE: cagney/2002-08-13: At present GDB has no reliable mechanism
for indicating when a ``cooked'' register was constructed from
write style operations. */
void regcache_cooked_read_part (struct regcache *regcache, int regnum,
- int offset, int len, void *buf);
+ int offset, int len, gdb_byte *buf);
void regcache_cooked_write_part (struct regcache *regcache, int regnum,
- int offset, int len, const void *buf);
+ int offset, int len, const gdb_byte *buf);
/* Transfer a raw register [0..NUM_REGS) between the regcache and the
target. These functions are called by the target in response to a
target_fetch_registers() or target_store_registers(). */
extern void regcache_raw_supply (struct regcache *regcache,
- int regnum, const void *buf);
+ int regnum, const gdb_byte *buf);
extern void regcache_raw_collect (const struct regcache *regcache,
- int regnum, void *buf);
+ int regnum, gdb_byte *buf);
/* The register's ``offset''.
restore_reggroup respectively. COOKED_READ returns zero iff the
register's value can't be returned. */
-typedef int (regcache_cooked_read_ftype) (void *src, int regnum, void *buf);
+typedef int (regcache_cooked_read_ftype) (void *src, int regnum,
+ gdb_byte *buf);
extern void regcache_save (struct regcache *dst,
regcache_cooked_read_ftype *cooked_read,
- void *src);
+ void *cooked_read_context);
extern void regcache_restore (struct regcache *dst,
regcache_cooked_read_ftype *cooked_read,
- void *src);
+ void *cooked_read_context);
/* Copy/duplicate the contents of a register cache. By default, the
operation is pass-through. Writes to DST and reads from SRC will
method, there should already be a non-deprecated variant that is
parameterized with FRAME or REGCACHE. */
-extern char *deprecated_grub_regcache_for_registers (struct regcache *);
-extern void deprecated_read_register_gen (int regnum, char *myaddr);
-extern void deprecated_write_register_gen (int regnum, char *myaddr);
-extern void deprecated_read_register_bytes (int regbyte, char *myaddr,
+extern gdb_byte *deprecated_grub_regcache_for_registers (struct regcache *);
+extern void deprecated_read_register_gen (int regnum, gdb_byte *myaddr);
+extern void deprecated_write_register_gen (int regnum, gdb_byte *myaddr);
+extern void deprecated_read_register_bytes (int regbyte, gdb_byte *myaddr,
int len);
-extern void deprecated_write_register_bytes (int regbyte, char *myaddr,
+extern void deprecated_write_register_bytes (int regbyte, gdb_byte *myaddr,
int len);
/* NOTE: cagney/2002-11-05: This function has been superseeded by