This is the mail archive of the gdb-patches@sourceware.org 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]

[PATCH] deprecated_xfer_memory cleanup


Hi,
at the moment, the deprecated_xfer_memory target method has a attrib parameter 
that's passed around by a lot of code, but never actually used. This patch 
removes that parameter completely.

Comments?

- Volodya

2006-06-29  Vladimir Prus  <vladimir@codesourcery.com>

	* target.t (struct target_ops): Remove the 'attrib'
	parameter of the deprecated_xfer_memory method. Update all
	callers.
--- aix-thread.c	(revision 31)
+++ aix-thread.c	(local)
@@ -1609,15 +1609,14 @@ aix_thread_store_registers (int regno)
 
 static int
 aix_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		      struct mem_attrib *attrib,
-		      struct target_ops *target)
+                        struct target_ops *target)
 {
   int n;
   struct cleanup *cleanup = save_inferior_ptid ();
 
   inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
   n = base_target.deprecated_xfer_memory (memaddr, myaddr, len, 
-					  write, attrib, &base_target);
+					  write, &base_target);
   do_cleanups (cleanup);
 
   return n;
--- corelow.c	(revision 31)
+++ corelow.c	(local)
@@ -518,10 +518,10 @@ core_xfer_partial (struct target_ops *op
     case TARGET_OBJECT_MEMORY:
       if (readbuf)
 	return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-					       0/*write*/, NULL, ops);
+					       0/*write*/, ops);
       if (writebuf)
 	return (*ops->deprecated_xfer_memory) (offset, readbuf, len,
-					       1/*write*/, NULL, ops);
+					       1/*write*/, ops);
       return -1;
 
     case TARGET_OBJECT_AUXV:
--- dcache.c	(revision 31)
+++ dcache.c	(local)
@@ -304,8 +304,7 @@ dcache_write_line (DCACHE *dcache, struc
 	  dirty_len = e - s;
 	  while (dirty_len > 0)
 	    {
-	      res = do_xfer_memory(memaddr, myaddr, dirty_len, 1,
-				   &region->attrib);
+	      res = do_xfer_memory(memaddr, myaddr, dirty_len, 1);
 	      if (res <= 0)
 		return 0;
 
@@ -363,8 +362,7 @@ dcache_read_line (DCACHE *dcache, struct
       
       while (reg_len > 0)
 	{
-	  res = do_xfer_memory (memaddr, myaddr, reg_len, 0,
-				&region->attrib);
+	  res = do_xfer_memory (memaddr, myaddr, reg_len, 0);
 	  if (res <= 0)
 	    return 0;
 
--- exec.c	(revision 31)
+++ exec.c	(local)
@@ -449,7 +449,7 @@ map_vmap (bfd *abfd, bfd *arch)
 
 int
 xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
-	     struct mem_attrib *attrib, struct target_ops *target)
+             struct target_ops *target)
 {
   int res;
   struct section_table *p;
--- gnu-nat.c	(revision 31)
+++ gnu-nat.c	(local)
@@ -2446,7 +2446,6 @@ out:
    is ignored. */
 static int
 gnu_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		 struct mem_attrib *attrib,
 		 struct target_ops *target)
 {
   task_t task = (current_inferior
--- go32-nat.c	(revision 31)
+++ go32-nat.c	(local)
@@ -180,7 +180,6 @@ static void go32_store_registers (int re
 static void go32_prepare_to_store (void);
 static int go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
 			     int write,
-			     struct mem_attrib *attrib,
 			     struct target_ops *target);
 static void go32_files_info (struct target_ops *target);
 static void go32_stop (void);
@@ -525,7 +524,7 @@ go32_prepare_to_store (void)
 
 static int
 go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		  struct mem_attrib *attrib, struct target_ops *target)
+                  struct target_ops *target)
 {
   if (write)
     {
--- hpux-thread.c	(revision 31)
+++ hpux-thread.c	(local)
@@ -397,7 +397,7 @@ hpux_thread_prepare_to_store (void)
 
 static int
 hpux_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
-			 int dowrite, struct mem_attrib *attribs,
+			 int dowrite,
 			 struct target_ops *target)
 {
   int retval;
@@ -408,7 +408,7 @@ hpux_thread_xfer_memory (CORE_ADDR memad
   inferior_ptid = main_ptid;
 
   retval = 
-    deprecated_child_ops.deprecated_xfer_memory (memaddr, myaddr, len, dowrite, attribs, target);
+    deprecated_child_ops.deprecated_xfer_memory (memaddr, myaddr, len, dowrite, target);
 
   do_cleanups (old_chain);
 
--- infptrace.c	(revision 31)
+++ infptrace.c	(local)
@@ -333,7 +333,7 @@ store_inferior_registers (int regnum)
 
 int
 child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
-		   struct mem_attrib *attrib, struct target_ops *target)
+                   struct target_ops *target)
 {
   int i;
   /* Round starting address down to longword boundary.  */
--- monitor.c	(revision 31)
+++ monitor.c	(local)
@@ -82,7 +82,6 @@ static void monitor_store_registers (int
 static void monitor_prepare_to_store (void);
 static int monitor_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
 				int write, 
-				struct mem_attrib *attrib,
 				struct target_ops *target);
 static void monitor_files_info (struct target_ops *ops);
 static void monitor_kill (void);
@@ -1981,7 +1980,7 @@ monitor_read_memory (CORE_ADDR memaddr, 
 
 static int
 monitor_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
-		     struct mem_attrib *attrib, struct target_ops *target)
+                     struct target_ops *target)
 {
   int res;
 
--- nto-procfs.c	(revision 31)
+++ nto-procfs.c	(local)
@@ -63,7 +63,6 @@ static int procfs_can_run (void);
 static ptid_t procfs_wait (ptid_t, struct target_waitstatus *);
 
 static int procfs_xfer_memory (CORE_ADDR, char *, int, int,
-			       struct mem_attrib *attrib,
 			       struct target_ops *);
 
 static void procfs_fetch_registers (int);
@@ -745,7 +744,7 @@ procfs_fetch_registers (int regno)
    anyway.  */
 static int
 procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
-		    struct mem_attrib *attrib, struct target_ops *target)
+                    struct target_ops *target)
 {
   int nbytes = 0;
 
--- ocd.c	(revision 31)
+++ ocd.c	(local)
@@ -711,7 +711,7 @@ ocd_read_bytes (CORE_ADDR memaddr, char 
 
 int
 ocd_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
-		 struct mem_attrib *attrib, struct target_ops *target)
+                 struct target_ops *target)
 {
   int res;
 
--- ocd.h	(revision 31)
+++ ocd.h	(local)
@@ -107,7 +107,6 @@ void ocd_files_info (struct target_ops *
 
 int ocd_xfer_memory (CORE_ADDR memaddr, char *myaddr,
 		     int len, int should_write,
-		     struct mem_attrib *attrib,
 		     struct target_ops *target);
 
 void ocd_mourn (void);
--- procfs.c	(revision 31)
+++ procfs.c	(local)
@@ -128,7 +128,6 @@ static void procfs_mourn_inferior (void)
 static void procfs_create_inferior (char *, char *, char **, int);
 static ptid_t procfs_wait (ptid_t, struct target_waitstatus *);
 static int procfs_xfer_memory (CORE_ADDR, char *, int, int,
-			       struct mem_attrib *attrib,
 			       struct target_ops *);
 static LONGEST procfs_xfer_partial (struct target_ops *ops,
 				    enum target_object object,
@@ -4341,7 +4340,7 @@ procfs_xfer_partial (struct target_ops *
 
 static int
 procfs_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
-		    struct mem_attrib *attrib, struct target_ops *target)
+                    struct target_ops *target)
 {
   procinfo *pi;
   int nbytes = 0;
--- remote-e7000.c	(revision 31)
+++ remote-e7000.c	(local)
@@ -1479,8 +1479,7 @@ fast_but_for_the_pause_e7000_read_inferi
 
 static int
 e7000_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-			    int write, struct mem_attrib *attrib,
-			    struct target_ops *target)
+			    int write, struct target_ops *target)
 {
   if (write)
     return e7000_write_inferior_memory (memaddr, myaddr, len);
--- remote-m32r-sdi.c	(revision 31)
+++ remote-m32r-sdi.c	(local)
@@ -1037,8 +1037,7 @@ m32r_files_info (struct target_ops *targ
 /* Read/Write memory.  */
 static int
 m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-		  int write,
-		  struct mem_attrib *attrib, struct target_ops *target)
+		  int write, struct target_ops *target)
 {
   unsigned long taddr;
   unsigned char buf[0x2000];
--- remote-mips.c	(revision 31)
+++ remote-mips.c	(local)
@@ -110,7 +110,6 @@ static int mips_store_word (CORE_ADDR ad
 
 static int mips_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
 			     int write, 
-			     struct mem_attrib *attrib,
 			     struct target_ops *target);
 
 static void mips_files_info (struct target_ops *ignore);
@@ -2030,7 +2029,7 @@ static int mask_address_p = 1;
 
 static int
 mips_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-		  struct mem_attrib *attrib, struct target_ops *target)
+                  struct target_ops *target)
 {
   int i;
   CORE_ADDR addr;
--- remote-sds.c	(revision 31)
+++ remote-sds.c	(local)
@@ -55,7 +55,7 @@ static int sds_read_bytes (CORE_ADDR, ch
 static void sds_files_info (struct target_ops *ignore);
 
 static int sds_xfer_memory (CORE_ADDR, char *, int, int, 
-			    struct mem_attrib *, struct target_ops *);
+                            struct target_ops *);
 
 static void sds_prepare_to_store (void);
 
@@ -636,7 +636,7 @@ sds_read_bytes (CORE_ADDR memaddr, char 
 
 static int
 sds_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int should_write,
-		 struct mem_attrib *attrib, struct target_ops *target)
+                 struct target_ops *target)
 {
   int res;
 
--- remote-sim.c	(revision 31)
+++ remote-sim.c	(local)
@@ -744,8 +744,7 @@ gdbsim_prepare_to_store (void)
 
 static int
 gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-			     int write, struct mem_attrib *attrib,
-			     struct target_ops *target)
+			     int write, struct target_ops *target)
 {
   if (!program_loaded)
     error (_("No program loaded."));
--- remote-st.c	(revision 31)
+++ remote-st.c	(local)
@@ -564,8 +564,7 @@ st2000_read_inferior_memory (CORE_ADDR m
 
 static int
 st2000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
-			     int write, struct mem_attrib *attrib,
-			     struct target_ops *target)
+			     int write, struct target_ops *target)
 {
   if (write)
     return st2000_write_inferior_memory (memaddr, myaddr, len);
--- remote.c	(revision 31)
+++ remote.c	(local)
@@ -4094,8 +4094,7 @@ remote_read_bytes (CORE_ADDR memaddr, gd
 
 static int
 remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
-		    int should_write, struct mem_attrib *attrib,
-		    struct target_ops *target)
+		    int should_write, struct target_ops *target)
 {
   CORE_ADDR targ_addr;
   int targ_len;
@@ -5255,11 +5254,11 @@ remote_xfer_partial (struct target_ops *
 	  void *buffer = xmalloc (len);
 	  struct cleanup *cleanup = make_cleanup (xfree, buffer);
 	  memcpy (buffer, writebuf, len);
-	  xfered = remote_xfer_memory (offset, buffer, len, 1, NULL, ops);
+	  xfered = remote_xfer_memory (offset, buffer, len, 1, ops);
 	  do_cleanups (cleanup);
 	}
       else
-	xfered = remote_xfer_memory (offset, readbuf, len, 0, NULL, ops);
+	xfered = remote_xfer_memory (offset, readbuf, len, 0, ops);
 
       if (xfered > 0)
 	return xfered;
--- rs6000-nat.c	(revision 31)
+++ rs6000-nat.c	(local)
@@ -450,8 +450,7 @@ read_word (CORE_ADDR from, int *to, int 
 
 int
 child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-		   int write, struct mem_attrib *attrib,
-		   struct target_ops *target)
+		   int write, struct target_ops *target)
 {
   /* Round starting address down to 32-bit word boundary. */
   int mask = sizeof (int) - 1;
--- sol-thread.c	(revision 31)
+++ sol-thread.c	(local)
@@ -662,8 +662,7 @@ sol_thread_prepare_to_store (void)
 
 static int
 sol_thread_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-			int dowrite, struct mem_attrib *attrib,
-			struct target_ops *target)
+			int dowrite, struct target_ops *target)
 {
   int retval;
   struct cleanup *old_chain;
--- target.c	(revision 31)
+++ target.c	(local)
@@ -498,7 +498,7 @@ update_current_target (void)
 	    (void (*) (void)) 
 	    noprocess);
   de_fault (deprecated_xfer_memory, 
-	    (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *)) 
+	    (int (*) (CORE_ADDR, gdb_byte *, int, int, struct target_ops *)) 
 	    nomemory);
   de_fault (to_files_info, 
 	    (void (*) (struct target_ops *)) 
@@ -1046,8 +1046,7 @@ Mode for reading from readonly sections 
    Result is -1 on error, or the number of bytes transfered.  */
 
 int
-do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
-		struct mem_attrib *attrib)
+do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write)
 {
   int res;
   int done = 0;
@@ -1071,12 +1070,12 @@ do_xfer_memory (CORE_ADDR memaddr, gdb_b
       if (secp != NULL
 	  && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
 	      & SEC_READONLY))
-	return xfer_memory (memaddr, myaddr, len, 0, attrib, &current_target);
+	return xfer_memory (memaddr, myaddr, len, 0, &current_target);
     }
 
   /* The quick case is that the top target can handle the transfer.  */
   res = current_target.deprecated_xfer_memory
-    (memaddr, myaddr, len, write, attrib, &current_target);
+    (memaddr, myaddr, len, write, &current_target);
 
   /* If res <= 0 then we call it again in the loop.  Ah well. */
   if (res <= 0)
@@ -1086,7 +1085,7 @@ do_xfer_memory (CORE_ADDR memaddr, gdb_b
 	  if (!t->to_has_memory)
 	    continue;
 
-	  res = t->deprecated_xfer_memory (memaddr, myaddr, len, write, attrib, t);
+	  res = t->deprecated_xfer_memory (memaddr, myaddr, len, write, t);
 	  if (res > 0)
 	    break;		/* Handled all or part of xfer */
 	  if (t->to_has_all_memory)
@@ -1146,8 +1145,7 @@ target_xfer_memory (CORE_ADDR memaddr, g
 	    res = dcache_xfer_memory (target_dcache, memaddr, myaddr,
 				      reg_len, write);
 	  else
-	    res = do_xfer_memory (memaddr, myaddr, reg_len, write,
-				 &region->attrib);
+	    res = do_xfer_memory (memaddr, myaddr, reg_len, write);
 	      
 	  if (res <= 0)
 	    {
@@ -1222,8 +1220,7 @@ target_xfer_memory_partial (CORE_ADDR me
     res = dcache_xfer_memory (target_dcache, memaddr, myaddr,
 			      reg_len, write_p);
   else
-    res = do_xfer_memory (memaddr, myaddr, reg_len, write_p,
-			  &region->attrib);
+    res = do_xfer_memory (memaddr, myaddr, reg_len, write_p);
       
   if (res <= 0)
     {
@@ -1288,12 +1285,12 @@ default_xfer_partial (struct target_ops 
 	  struct cleanup *cleanup = make_cleanup (xfree, buffer);
 	  memcpy (buffer, writebuf, len);
 	  xfered = ops->deprecated_xfer_memory (offset, buffer, len,
-						1/*write*/, NULL, ops);
+						1/*write*/, ops);
 	  do_cleanups (cleanup);
 	}
       if (readbuf != NULL)
 	xfered = ops->deprecated_xfer_memory (offset, readbuf, len, 0/*read*/,
-					      NULL, ops);
+					      ops);
       if (xfered > 0)
 	return xfered;
       else if (xfered == 0 && errno == 0)
@@ -2006,13 +2003,12 @@ debug_to_prepare_to_store (void)
 
 static int
 deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
-			      int write, struct mem_attrib *attrib,
-			      struct target_ops *target)
+			      int write, struct target_ops *target)
 {
   int retval;
 
   retval = debug_target.deprecated_xfer_memory (memaddr, myaddr, len, write,
-						attrib, target);
+                                                target);
 
   fprintf_unfiltered (gdb_stdlog,
 		      "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d",
--- target.h	(revision 31)
+++ target.h	(local)
@@ -376,7 +376,6 @@ struct target_ops
 
     int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
 				   int len, int write,
-				   struct mem_attrib *attrib,
 				   struct target_ops *target);
 
     void (*to_files_info) (struct target_ops *);
@@ -584,7 +583,7 @@ extern void target_disconnect (char *, i
 extern DCACHE *target_dcache;
 
 extern int do_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-			   int write, struct mem_attrib *attrib);
+			   int write);
 
 extern int target_read_string (CORE_ADDR, char **, int, int *);
 
@@ -594,10 +593,10 @@ extern int target_write_memory (CORE_ADD
 				int len);
 
 extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
-			struct mem_attrib *, struct target_ops *);
+                        struct target_ops *);
 
 extern int child_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
-			      struct mem_attrib *, struct target_ops *);
+                              struct target_ops *);
 
 /* Make a single attempt at transfering LEN bytes.  On a successful
    transfer, the number of bytes actually transfered is returned and
--- win32-nat.c	(revision 31)
+++ win32-nat.c	(local)
@@ -2078,8 +2078,7 @@ win32_stop (void)
 
 static int
 win32_xfer_memory (CORE_ADDR memaddr, gdb_byte *our, int len,
-		   int write, struct mem_attrib *mem,
-		   struct target_ops *target)
+		   int write, struct target_ops *target)
 {
   DWORD done = 0;
   if (write)
--- wince.c	(revision 31)
+++ wince.c	(local)
@@ -1835,7 +1835,6 @@ child_mourn_inferior (void)
 int
 child_xfer_memory (CORE_ADDR memaddr, gdb_byte *our, 
 		   int len, int write,
-		   struct mem_attrib *attrib,
 		   struct target_ops *target)
 {
   if (len <= 0)

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