[COMMIT] gdb_bytify sparc/sparc64

Mark Kettenis mark.kettenis@xs4all.nl
Sat May 14 16:17:00 GMT 2005


Committed,

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* sparc-tdep.c (sparc_fetch_instruction, sparc_fetch_wcookie): Use
	gdb_byte for buf.
	(sparc32_pseudo_register_read, sparc32_pseudo_register_write):
	Change type of last argument to `gdb_byte *'.  Remove casts that
	are no longer needed.
	(sparc32_push_dummy_code, sparc32_store_arguments): Use gdb_byte
	for buf.
	(sparc_breakpoint_from_pc): Change return type to `const gdb_byte
	*'.  Use gdb_byte for break_insn.
	(sparc32_extract_return_value, sparc32_store_return_value): Change
	type of last argument to `gdb_byte *'.  Use gdb_byte for buf.
	(sparc32_return_value): Change type of readbuf and writebuf
	arguments to `gdb_byte *'.
	(sparc_software_single_step): Use gdb_byte for npc_save and
	nnpc_save.
	(sparc_supply_rwindow, sparc_collect_rwindow): Use gdb_byte for
	buf.
	(sparc32_supply_gregset, sparc32_collect_gregset)
	(sparc32_supply_fpregset, sparc32_collect_fpregset): Use `gdb_byte
	*' for regs.
	* sparc64-tdep.c (sparc64_pseudo_register_read)
	(sparc64_pseudo_register_write): Change type of last argument to
	`gdb_byte *'.  Remove casts that are no longer needed.
	(sparc64_store_floating_fields, sparc64_extract_floating_fields):
	Change type of valbuf argument to `gfd_byte *'.
	(sparc64_store_arguments): Use `gdb_byte *' for valbuf.  use
	gdb_byte for buf.
	(sparc64_extract_return_value, sparc64_store_return_value): Change
	type of last argument to `gdb_byte *'.  Use gdb_byte for buf.
	(sparc64_return_value): Change type of readbuf and writebuf
	arguments to `gdb_byte *'.
	(sparc64_supply_gregset, sparc64_collect_gregset)
	(sparc64_supply_fpregset, sparc64_collect_fpregset): Use `gdb_byte
	*' for regs.

Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.162
diff -u -p -r1.162 sparc-tdep.c
--- sparc-tdep.c 28 Mar 2005 13:42:49 -0000 1.162
+++ sparc-tdep.c 14 May 2005 13:44:00 -0000
@@ -93,7 +93,7 @@ struct regset;
 unsigned long
 sparc_fetch_instruction (CORE_ADDR pc)
 {
-  unsigned char buf[4];
+  gdb_byte buf[4];
   unsigned long insn;
   int i;
 
@@ -154,7 +154,7 @@ ULONGEST
 sparc_fetch_wcookie (void)
 {
   struct target_ops *ops = &current_target;
-  char buf[8];
+  gdb_byte buf[8];
   int len;
 
   len = target_read_partial (ops, TARGET_OBJECT_WCOOKIE, NULL, buf, 0, 8);
@@ -318,25 +318,25 @@ sparc32_register_type (struct gdbarch *g
 static void
 sparc32_pseudo_register_read (struct gdbarch *gdbarch,
 			      struct regcache *regcache,
-			      int regnum, void *buf)
+			      int regnum, gdb_byte *buf)
 {
   gdb_assert (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM);
 
   regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC32_D0_REGNUM);
   regcache_raw_read (regcache, regnum, buf);
-  regcache_raw_read (regcache, regnum + 1, ((char *)buf) + 4);
+  regcache_raw_read (regcache, regnum + 1, buf + 4);
 }
 
 static void
 sparc32_pseudo_register_write (struct gdbarch *gdbarch,
 			       struct regcache *regcache,
-			       int regnum, const void *buf)
+			       int regnum, const gdb_byte *buf)
 {
   gdb_assert (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM);
 
   regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC32_D0_REGNUM);
   regcache_raw_write (regcache, regnum, buf);
-  regcache_raw_write (regcache, regnum + 1, ((const char *)buf) + 4);
+  regcache_raw_write (regcache, regnum + 1, buf + 4);
 }
 
 
@@ -352,7 +352,7 @@ sparc32_push_dummy_code (struct gdbarch 
 
   if (using_struct_return (value_type, using_gcc))
     {
-      char buf[4];
+      gdb_byte buf[4];
 
       /* This is an UNIMP instruction.  */
       store_unsigned_integer (buf, 4, TYPE_LENGTH (value_type) & 0x1fff);
@@ -447,7 +447,7 @@ sparc32_store_arguments (struct regcache
 
   if (struct_return)
     {
-      char buf[4];
+      gdb_byte buf[4];
 
       store_unsigned_integer (buf, 4, struct_addr);
       write_memory (sp, buf, 4);
@@ -490,10 +490,10 @@ sparc32_push_dummy_call (struct gdbarch 
    *LEN and optionally adjust *PC to point to the correct memory
    location for inserting the breakpoint.  */
    
-static const unsigned char *
+static const gdb_byte *
 sparc_breakpoint_from_pc (CORE_ADDR *pc, int *len)
 {
-  static unsigned char break_insn[] = { 0x91, 0xd0, 0x20, 0x01 };
+  static gdb_byte break_insn[] = { 0x91, 0xd0, 0x20, 0x01 };
 
   *len = sizeof (break_insn);
   return break_insn;
@@ -873,10 +873,10 @@ sparc_unwind_dummy_id (struct gdbarch *g
 
 static void
 sparc32_extract_return_value (struct type *type, struct regcache *regcache,
-			      void *valbuf)
+			      gdb_byte *valbuf)
 {
   int len = TYPE_LENGTH (type);
-  char buf[8];
+  gdb_byte buf[8];
 
   gdb_assert (!sparc_structure_or_union_p (type));
   gdb_assert (!(sparc_floating_p (type) && len == 16));
@@ -915,10 +915,10 @@ sparc32_extract_return_value (struct typ
 
 static void
 sparc32_store_return_value (struct type *type, struct regcache *regcache,
-			    const void *valbuf)
+			    const gdb_byte *valbuf)
 {
   int len = TYPE_LENGTH (type);
-  char buf[8];
+  gdb_byte buf[8];
 
   gdb_assert (!sparc_structure_or_union_p (type));
   gdb_assert (!(sparc_floating_p (type) && len == 16));
@@ -953,8 +953,8 @@ sparc32_store_return_value (struct type 
 
 static enum return_value_convention
 sparc32_return_value (struct gdbarch *gdbarch, struct type *type,
-		      struct regcache *regcache, void *readbuf,
-		      const void *writebuf)
+		      struct regcache *regcache, gdb_byte *readbuf,
+		      const gdb_byte *writebuf)
 {
   if (sparc_structure_or_union_p (type)
       || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16))
@@ -1082,7 +1082,7 @@ sparc_software_single_step (enum target_
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
   static CORE_ADDR npc, nnpc;
-  static char npc_save[4], nnpc_save[4];
+  static gdb_byte npc_save[4], nnpc_save[4];
 
   if (insert_breakpoints_p)
     {
@@ -1259,7 +1259,7 @@ void
 sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum)
 {
   int offset = 0;
-  char buf[8];
+  gdb_byte buf[8];
   int i;
 
   if (sp & 1)
@@ -1327,7 +1327,7 @@ sparc_collect_rwindow (const struct regc
 		       CORE_ADDR sp, int regnum)
 {
   int offset = 0;
-  char buf[8];
+  gdb_byte buf[8];
   int i;
 
   if (sp & 1)
@@ -1393,7 +1393,7 @@ sparc32_supply_gregset (const struct spa
 			struct regcache *regcache,
 			int regnum, const void *gregs)
 {
-  const char *regs = gregs;
+  const gdb_byte *regs = gregs;
   int i;
 
   if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
@@ -1457,7 +1457,7 @@ sparc32_collect_gregset (const struct sp
 			 const struct regcache *regcache,
 			 int regnum, void *gregs)
 {
-  char *regs = gregs;
+  gdb_byte *regs = gregs;
   int i;
 
   if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
@@ -1511,7 +1511,7 @@ void
 sparc32_supply_fpregset (struct regcache *regcache,
 			 int regnum, const void *fpregs)
 {
-  const char *regs = fpregs;
+  const gdb_byte *regs = fpregs;
   int i;
 
   for (i = 0; i < 32; i++)
@@ -1528,7 +1528,7 @@ void
 sparc32_collect_fpregset (const struct regcache *regcache,
 			  int regnum, void *fpregs)
 {
-  char *regs = fpregs;
+  gdb_byte *regs = fpregs;
   int i;
 
   for (i = 0; i < 32; i++)
Index: sparc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.22
diff -u -p -r1.22 sparc64-tdep.c
--- sparc64-tdep.c 23 Apr 2005 15:40:54 -0000 1.22
+++ sparc64-tdep.c 14 May 2005 13:44:01 -0000
@@ -331,7 +331,7 @@ sparc64_register_type (struct gdbarch *g
 static void
 sparc64_pseudo_register_read (struct gdbarch *gdbarch,
 			      struct regcache *regcache,
-			      int regnum, void *buf)
+			      int regnum, gdb_byte *buf)
 {
   gdb_assert (regnum >= SPARC64_NUM_REGS);
 
@@ -339,7 +339,7 @@ sparc64_pseudo_register_read (struct gdb
     {
       regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC64_D0_REGNUM);
       regcache_raw_read (regcache, regnum, buf);
-      regcache_raw_read (regcache, regnum + 1, ((char *)buf) + 4);
+      regcache_raw_read (regcache, regnum + 1, buf + 4);
     }
   else if (regnum >= SPARC64_D32_REGNUM && regnum <= SPARC64_D62_REGNUM)
     {
@@ -350,15 +350,15 @@ sparc64_pseudo_register_read (struct gdb
     {
       regnum = SPARC_F0_REGNUM + 4 * (regnum - SPARC64_Q0_REGNUM);
       regcache_raw_read (regcache, regnum, buf);
-      regcache_raw_read (regcache, regnum + 1, ((char *)buf) + 4);
-      regcache_raw_read (regcache, regnum + 2, ((char *)buf) + 8);
-      regcache_raw_read (regcache, regnum + 3, ((char *)buf) + 12);
+      regcache_raw_read (regcache, regnum + 1, buf + 4);
+      regcache_raw_read (regcache, regnum + 2, buf + 8);
+      regcache_raw_read (regcache, regnum + 3, buf + 12);
     }
   else if (regnum >= SPARC64_Q32_REGNUM && regnum <= SPARC64_Q60_REGNUM)
     {
       regnum = SPARC64_F32_REGNUM + 2 * (regnum - SPARC64_Q32_REGNUM);
       regcache_raw_read (regcache, regnum, buf);
-      regcache_raw_read (regcache, regnum + 1, ((char *)buf) + 8);
+      regcache_raw_read (regcache, regnum + 1, buf + 8);
     }
   else if (regnum == SPARC64_CWP_REGNUM
 	   || regnum == SPARC64_PSTATE_REGNUM
@@ -390,7 +390,7 @@ sparc64_pseudo_register_read (struct gdb
 static void
 sparc64_pseudo_register_write (struct gdbarch *gdbarch,
 			       struct regcache *regcache,
-			       int regnum, const void *buf)
+			       int regnum, const gdb_byte *buf)
 {
   gdb_assert (regnum >= SPARC64_NUM_REGS);
 
@@ -398,7 +398,7 @@ sparc64_pseudo_register_write (struct gd
     {
       regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC64_D0_REGNUM);
       regcache_raw_write (regcache, regnum, buf);
-      regcache_raw_write (regcache, regnum + 1, ((const char *)buf) + 4);
+      regcache_raw_write (regcache, regnum + 1, buf + 4);
     }
   else if (regnum >= SPARC64_D32_REGNUM && regnum <= SPARC64_D62_REGNUM)
     {
@@ -409,15 +409,15 @@ sparc64_pseudo_register_write (struct gd
     {
       regnum = SPARC_F0_REGNUM + 4 * (regnum - SPARC64_Q0_REGNUM);
       regcache_raw_write (regcache, regnum, buf);
-      regcache_raw_write (regcache, regnum + 1, ((const char *)buf) + 4);
-      regcache_raw_write (regcache, regnum + 2, ((const char *)buf) + 8);
-      regcache_raw_write (regcache, regnum + 3, ((const char *)buf) + 12);
+      regcache_raw_write (regcache, regnum + 1, buf + 4);
+      regcache_raw_write (regcache, regnum + 2, buf + 8);
+      regcache_raw_write (regcache, regnum + 3, buf + 12);
     }
   else if (regnum >= SPARC64_Q32_REGNUM && regnum <= SPARC64_Q60_REGNUM)
     {
       regnum = SPARC64_F32_REGNUM + 2 * (regnum - SPARC64_Q32_REGNUM);
       regcache_raw_write (regcache, regnum, buf);
-      regcache_raw_write (regcache, regnum + 1, ((const char *)buf) + 8);
+      regcache_raw_write (regcache, regnum + 1, buf + 8);
     }
   else if (regnum == SPARC64_CWP_REGNUM
 	   || regnum == SPARC64_PSTATE_REGNUM
@@ -639,7 +639,7 @@ sparc64_16_byte_align_p (struct type *ty
 
 static void
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
-			       const char *valbuf, int element, int bitpos)
+			       const gdb_byte *valbuf, int element, int bitpos)
 {
   gdb_assert (element < 16);
 
@@ -711,7 +711,7 @@ sparc64_store_floating_fields (struct re
 
 static void
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
-				 char *valbuf, int bitpos)
+				 gdb_byte *valbuf, int bitpos)
 {
   if (sparc64_floating_p (type))
     {
@@ -877,11 +877,11 @@ sparc64_store_arguments (struct regcache
 
   for (i = 0; i < nargs; i++)
     {
-      const char *valbuf = value_contents (args[i]);
+      const gdb_byte *valbuf = value_contents (args[i]);
       struct type *type = value_type (args[i]);
       int len = TYPE_LENGTH (type);
       int regnum = -1;
-      char buf[16];
+      gdb_byte buf[16];
 
       if (sparc64_structure_or_union_p (type))
 	{
@@ -1006,10 +1006,10 @@ sparc64_push_dummy_call (struct gdbarch 
 
 static void
 sparc64_extract_return_value (struct type *type, struct regcache *regcache,
-			      void *valbuf)
+			      gdb_byte *valbuf)
 {
   int len = TYPE_LENGTH (type);
-  char buf[32];
+  gdb_byte buf[32];
   int i;
 
   if (sparc64_structure_or_union_p (type))
@@ -1047,10 +1047,10 @@ sparc64_extract_return_value (struct typ
 
 static void
 sparc64_store_return_value (struct type *type, struct regcache *regcache,
-			    const void *valbuf)
+			    const gdb_byte *valbuf)
 {
   int len = TYPE_LENGTH (type);
-  char buf[16];
+  gdb_byte buf[16];
   int i;
 
   if (sparc64_structure_or_union_p (type))
@@ -1089,8 +1089,8 @@ sparc64_store_return_value (struct type 
 
 static enum return_value_convention
 sparc64_return_value (struct gdbarch *gdbarch, struct type *type,
-		      struct regcache *regcache, void *readbuf,
-		      const void *writebuf)
+		      struct regcache *regcache, gdb_byte *readbuf,
+		      const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (type) > 32)
     return RETURN_VALUE_STRUCT_CONVENTION;
@@ -1193,7 +1193,7 @@ sparc64_supply_gregset (const struct spa
 			int regnum, const void *gregs)
 {
   int sparc32 = (gdbarch_ptr_bit (current_gdbarch) == 32);
-  const char *regs = gregs;
+  const gdb_byte *regs = gregs;
   int i;
 
   if (sparc32)
@@ -1202,7 +1202,7 @@ sparc64_supply_gregset (const struct spa
 	{
 	  int offset = gregset->r_tstate_offset;
 	  ULONGEST tstate, psr;
-	  char buf[4];
+	  gdb_byte buf[4];
 
 	  tstate = extract_unsigned_integer (regs + offset, 8);
 	  psr = ((tstate & TSTATE_CWP) | PSR_S | ((tstate & TSTATE_ICC) >> 12)
@@ -1241,7 +1241,7 @@ sparc64_supply_gregset (const struct spa
 
       if (regnum == SPARC64_Y_REGNUM || regnum == -1)
 	{
-	  char buf[8];
+	  gdb_byte buf[8];
 
 	  memset (buf, 0, 8);
 	  memcpy (buf + 8 - gregset->r_y_size,
@@ -1307,7 +1307,7 @@ sparc64_collect_gregset (const struct sp
 			 int regnum, void *gregs)
 {
   int sparc32 = (gdbarch_ptr_bit (current_gdbarch) == 32);
-  char *regs = gregs;
+  gdb_byte *regs = gregs;
   int i;
 
   if (sparc32)
@@ -1316,7 +1316,7 @@ sparc64_collect_gregset (const struct sp
 	{
 	  int offset = gregset->r_tstate_offset;
 	  ULONGEST tstate, psr;
-	  char buf[8];
+	  gdb_byte buf[8];
 
 	  tstate = extract_unsigned_integer (regs + offset, 8);
 	  regcache_raw_collect (regcache, SPARC32_PSR_REGNUM, buf);
@@ -1358,7 +1358,7 @@ sparc64_collect_gregset (const struct sp
 
       if (regnum == SPARC64_Y_REGNUM || regnum == -1)
 	{
-	  char buf[8];
+	  gdb_byte buf[8];
 
 	  regcache_raw_collect (regcache, SPARC64_Y_REGNUM, buf);
 	  memcpy (regs + gregset->r_y_offset,
@@ -1414,7 +1414,7 @@ sparc64_supply_fpregset (struct regcache
 			 int regnum, const void *fpregs)
 {
   int sparc32 = (gdbarch_ptr_bit (current_gdbarch) == 32);
-  const char *regs = fpregs;
+  const gdb_byte *regs = fpregs;
   int i;
 
   for (i = 0; i < 32; i++)
@@ -1449,7 +1449,7 @@ sparc64_collect_fpregset (const struct r
 			  int regnum, void *fpregs)
 {
   int sparc32 = (gdbarch_ptr_bit (current_gdbarch) == 32);
-  char *regs = fpregs;
+  gdb_byte *regs = fpregs;
   int i;
 
   for (i = 0; i < 32; i++)



More information about the Gdb-patches mailing list