This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [commit] gdb_byte regcache.[hc]


Daniel Jacobowitz wrote:
On Thu, May 19, 2005 at 12:37:05PM -0400, Andrew Cagney wrote:

little by little.

These still contains void*s where an object, and not a buffer, is being passed.

I'll look in defs.h next, it contains some stray void* and char* parameters.


Didn't attach the patch?

2005-05-19  Andrew Cagney  <cagney@gnu.org>

	* regcache.h (regcache_raw_read, regcache_raw_write)
	(regcache_raw_read_part, regcache_raw_write_part)
	(regcache_cooked_read_part, regcache_cooked_write_part)
	(regcache_cooked_read, regcache_cooked_write)
	(regcache_raw_supply, regcache_raw_collect)
	(regcache_cooked_read_ftype, regcache_save, regcache_restore)
	(deprecated_read_register_gen, deprecated_write_register_gen)
	(deprecated_read_register_bytes, deprecated_write_register_bytes)
	(deprecated_grub_regcache_for_registers): Use gdb_byte for byte
	buffer parameters.
	* ia64-tdep.c (ia64_extract_return_value): Update.
	* frame.c (do_frame_register_read): Update.
	* regcache.c (deprecated_grub_regcache_for_registers) 
	(struct regcache, regcache_save, regcache_restore, regcache_cpy) 
	(do_cooked_read, regcache_xmalloc, register_buffer) 
	(deprecated_read_register_bytes, regcache_raw_read) 
	(regcache_raw_read_signed, regcache_raw_read_unsigned) 
	(deprecated_read_register_gen, regcache_cooked_read) 
	(regcache_cooked_read_signed, regcache_cooked_read_unsigned) 
	(deprecated_write_register_gen, regcache_cooked_write) 
	(deprecated_write_register_bytes, regcache_raw_read_part) 
	(regcache_raw_write_part, regcache_cooked_read_part) 
	(regcache_cooked_write_part, read_register, regcache_raw_supply): 

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.207
diff -p -u -r1.207 frame.c
--- frame.c	24 Feb 2005 13:51:31 -0000	1.207
+++ frame.c	19 May 2005 16:36:04 -0000
@@ -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;
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.131
diff -p -u -r1.131 ia64-tdep.c
--- ia64-tdep.c	1 May 2005 19:58:54 -0000	1.131
+++ ia64-tdep.c	19 May 2005 16:36:04 -0000
@@ -88,7 +88,6 @@ static gdbarch_register_name_ftype ia64_
 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, s
 }
 
 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;
 
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.135
diff -p -u -r1.135 regcache.c
--- regcache.c	9 May 2005 21:20:34 -0000	1.135
+++ regcache.c	19 May 2005 16:36:05 -0000
@@ -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 *gdbarc
   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
 
 /* 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, reg
 	       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, reg
 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 *regca
   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_s
 }
 
 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 *regc
 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 regc
 }
 
 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
 }
 
 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 r
 }
 
 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 *reg
 }
 
 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 regnu
 }
 
 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 *
    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 myr
       /* 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) (str
 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 *reg
 
 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 
 
 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
 
 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 regcac
 
 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_ADD
 /* 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 *re
 /* 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;
Index: regcache.h
===================================================================
RCS file: /cvs/src/src/gdb/regcache.h,v
retrieving revision 1.45
diff -p -u -r1.45 regcache.h
--- regcache.h	14 Nov 2004 01:11:07 -0000	1.45
+++ regcache.h	19 May 2005 16:36:05 -0000
@@ -39,9 +39,9 @@ extern struct gdbarch *get_regcache_arch
 /* 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 
    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_unsign
    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
    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 
    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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]