From: Andrew Cagney Date: Thu, 19 May 2005 16:37:09 +0000 (+0000) Subject: 2005-05-19 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d522557c677ace94df79ac65934902099e6948e;p=binutils-gdb.git 2005-05-19 Andrew Cagney * regcache.h (regcache_raw_read, regcache_raw_write) (regcache_raw_read_part, regcache_raw_write_part) (regcache_cooked_read_part, regcache_cooked_write_part) (regcache_cooked_read, regcache_cooked_write) (regcache_raw_supply, regcache_raw_collect) (regcache_cooked_read_ftype, regcache_save, regcache_restore) (deprecated_read_register_gen, deprecated_write_register_gen) (deprecated_read_register_bytes, deprecated_write_register_bytes) (deprecated_grub_regcache_for_registers): Use gdb_byte for byte buffer parameters. * ia64-tdep.c (ia64_extract_return_value): Update. * frame.c (do_frame_register_read): Update. * regcache.c (deprecated_grub_regcache_for_registers) (struct regcache, regcache_save, regcache_restore, regcache_cpy) (do_cooked_read, regcache_xmalloc, register_buffer) (deprecated_read_register_bytes, regcache_raw_read) (regcache_raw_read_signed, regcache_raw_read_unsigned) (deprecated_read_register_gen, regcache_cooked_read) (regcache_cooked_read_signed, regcache_cooked_read_unsigned) (deprecated_write_register_gen, regcache_cooked_write) (deprecated_write_register_bytes, regcache_raw_read_part) (regcache_raw_write_part, regcache_cooked_read_part) (regcache_cooked_write_part, read_register, regcache_raw_supply): --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6d9c3e0b9a9..66e4c2e0d59 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2005-05-19 Andrew Cagney + + * regcache.h (regcache_raw_read, regcache_raw_write) + (regcache_raw_read_part, regcache_raw_write_part) + (regcache_cooked_read_part, regcache_cooked_write_part) + (regcache_cooked_read, regcache_cooked_write) + (regcache_raw_supply, regcache_raw_collect) + (regcache_cooked_read_ftype, regcache_save, regcache_restore) + (deprecated_read_register_gen, deprecated_write_register_gen) + (deprecated_read_register_bytes, deprecated_write_register_bytes) + (deprecated_grub_regcache_for_registers): Use gdb_byte for byte + buffer parameters. + * ia64-tdep.c (ia64_extract_return_value): Update. + * frame.c (do_frame_register_read): Update. + * regcache.c (deprecated_grub_regcache_for_registers) + (struct regcache, regcache_save, regcache_restore, regcache_cpy) + (do_cooked_read, regcache_xmalloc, register_buffer) + (deprecated_read_register_bytes, regcache_raw_read) + (regcache_raw_read_signed, regcache_raw_read_unsigned) + (deprecated_read_register_gen, regcache_cooked_read) + (regcache_cooked_read_signed, regcache_cooked_read_unsigned) + (deprecated_write_register_gen, regcache_cooked_write) + (deprecated_write_register_bytes, regcache_raw_read_part) + (regcache_raw_write_part, regcache_cooked_read_part) + (regcache_cooked_write_part, read_register, regcache_raw_supply): + 2005-05-17 Corinna Vinschen * MAINTAINERS: Undelete v850. diff --git a/gdb/frame.c b/gdb/frame.c index 2bcc93e8f3c..91cded19296 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -491,7 +491,7 @@ get_frame_func (struct frame_info *fi) } static int -do_frame_register_read (void *src, int regnum, void *buf) +do_frame_register_read (void *src, int regnum, gdb_byte *buf) { frame_register_read (src, regnum, buf); return 1; diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index e75569cc30c..a69343aa445 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -88,7 +88,6 @@ static gdbarch_register_name_ftype ia64_register_name; static gdbarch_register_type_ftype ia64_register_type; static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc; static gdbarch_skip_prologue_ftype ia64_skip_prologue; -static gdbarch_extract_return_value_ftype ia64_extract_return_value; static struct type *is_float_or_hfa_type (struct type *t); static CORE_ADDR ia64_find_global_pointer (CORE_ADDR faddr); @@ -2694,7 +2693,8 @@ ia64_use_struct_convention (int gcc_p, struct type *type) } void -ia64_extract_return_value (struct type *type, struct regcache *regcache, void *valbuf) +ia64_extract_return_value (struct type *type, struct regcache *regcache, + gdb_byte *valbuf) { struct type *float_elt_type; diff --git a/gdb/regcache.c b/gdb/regcache.c index 836f8a63ac9..0150223f9c0 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -185,8 +185,8 @@ struct regcache /* 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 @@ -206,9 +206,9 @@ regcache_xmalloc (struct gdbarch *gdbarch) 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; } @@ -245,7 +245,7 @@ get_regcache_arch (const struct regcache *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]; @@ -256,7 +256,7 @@ regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read, 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 @@ -287,10 +287,10 @@ regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read, 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. */ @@ -303,7 +303,7 @@ regcache_restore (struct regcache *dst, { 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); } @@ -311,7 +311,7 @@ regcache_restore (struct regcache *dst, } 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) @@ -328,7 +328,7 @@ void 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); @@ -384,7 +384,7 @@ regcache_valid_p (struct regcache *regcache, int regnum) return regcache->register_valid_p[regnum]; } -char * +gdb_byte * deprecated_grub_regcache_for_registers (struct regcache *regcache) { return regcache->registers; @@ -513,11 +513,11 @@ deprecated_registers_fetched (void) 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. */ @@ -570,7 +570,7 @@ deprecated_read_register_bytes (int in_start, char *in_buf, int in_len) } 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); @@ -606,7 +606,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf) 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]); @@ -619,7 +619,7 @@ void 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]); @@ -652,7 +652,7 @@ regcache_raw_write_unsigned (struct regcache *regcache, int 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); @@ -660,7 +660,7 @@ deprecated_read_register_gen (int regnum, char *buf) } 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); @@ -681,7 +681,7 @@ void 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]); @@ -694,7 +694,7 @@ void 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]); @@ -728,7 +728,8 @@ regcache_cooked_write_unsigned (struct regcache *regcache, int 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); @@ -762,7 +763,7 @@ regcache_raw_write (struct regcache *regcache, int regnum, const void *buf) } 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); @@ -770,7 +771,8 @@ deprecated_write_register_gen (int regnum, char *buf) } 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); @@ -785,7 +787,7 @@ regcache_cooked_write (struct regcache *regcache, int regnum, const void *buf) 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; @@ -815,7 +817,7 @@ deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen) /* 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); @@ -841,7 +843,10 @@ typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum, 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]; @@ -873,7 +878,7 @@ regcache_xfer_part (struct regcache *regcache, int regnum, 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); @@ -883,7 +888,7 @@ regcache_raw_read_part (struct regcache *regcache, int regnum, 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); @@ -893,7 +898,7 @@ regcache_raw_write_part (struct regcache *regcache, int regnum, 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); @@ -903,7 +908,7 @@ regcache_cooked_read_part (struct regcache *regcache, int regnum, 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); @@ -935,7 +940,7 @@ deprecated_register_bytes (void) 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))); } @@ -997,7 +1002,8 @@ write_register_pid (int regnum, CORE_ADDR val, ptid_t ptid) /* 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; @@ -1030,7 +1036,8 @@ regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf) /* 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; diff --git a/gdb/regcache.h b/gdb/regcache.h index e7962223df1..d02e4114b2d 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -39,9 +39,9 @@ extern struct gdbarch *get_regcache_arch (const struct regcache *regcache); /* 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, @@ -55,16 +55,17 @@ extern void regcache_raw_write_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 @@ -88,18 +89,18 @@ extern void regcache_cooked_write_unsigned (struct regcache *regcache, 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''. @@ -136,14 +137,15 @@ extern int register_size (struct gdbarch *gdbarch, int regnum); 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 @@ -173,12 +175,12 @@ extern void regcache_cpy_no_passthrough (struct regcache *dest, struct regcache 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