Add target_xfer_partial_ftype
authorYao Qi <yao@codesourcery.com>
Mon, 4 Nov 2013 09:53:56 +0000 (17:53 +0800)
committerYao Qi <yao@codesourcery.com>
Wed, 18 Dec 2013 03:47:03 +0000 (11:47 +0800)
This patch adds a typedef target_xfer_partial_ftype.  When we change
the signature of xfer_partial functions (for example, adding a new
parameter), we don't have to modify all of their declarations.

This patch also updates the type of parameters of target_xfer_partial
from "void *" to "gdb_byte *".

gdb:

2013-12-18  Yao Qi  <yao@codesourcery.com>

* target.h (target_xfer_partial_ftype): New typedef.
(target_xfer_partial): Update declaration.
* auxv.h (memory_xfer_auxv): Likewise.
* ia64-hpux-nat.c (super_xfer_partial): Likewise.
* ia64-linux-nat.c (super_xfer_partial): Likewise.
* linux-nat.c (super_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-full.c (record_full_beneath_to_xfer_partial):
(tmp_to_xfer_partial): Likewise.
* sparc-nat.c (inf_ptrace_xfer_partial): Likewise.
* target.c (default_xfer_partial): Likewise.
(current_xfer_partial): Likewise.
(target_xfer_partial): Change parameter type to 'gdb_byte *'.

gdb/ChangeLog
gdb/auxv.h
gdb/ia64-hpux-nat.c
gdb/ia64-linux-nat.c
gdb/linux-nat.c
gdb/procfs.c
gdb/record-full.c
gdb/sparc-nat.c
gdb/target.c
gdb/target.h

index 196bcb011ae53849eaedbea1052a683164c9328d..7d9308f515caf49fd79e5696ce6c59465bbae34d 100644 (file)
@@ -1,3 +1,19 @@
+2013-12-18  Yao Qi  <yao@codesourcery.com>
+
+       * target.h (target_xfer_partial_ftype): New typedef.
+       (target_xfer_partial): Update declaration.
+       * auxv.h (memory_xfer_auxv): Likewise.
+       * ia64-hpux-nat.c (super_xfer_partial): Likewise.
+       * ia64-linux-nat.c (super_xfer_partial): Likewise.
+       * linux-nat.c (super_xfer_partial): Likewise.
+       * procfs.c (procfs_xfer_partial): Likewise.
+       * record-full.c (record_full_beneath_to_xfer_partial):
+       (tmp_to_xfer_partial): Likewise.
+       * sparc-nat.c (inf_ptrace_xfer_partial): Likewise.
+       * target.c (default_xfer_partial): Likewise.
+       (current_xfer_partial): Likewise.
+       (target_xfer_partial): Change parameter type to 'gdb_byte *'.
+
 2013-12-18  Yao Qi  <yao@codesourcery.com>
 
        * linux-nat.c (linux_proc_xfer_partial): Call xsnprintf instead
index 0244cd82f899f641832e5216015145e9add9a105..7360fea3900ff911b8787ce627d8852638e6e75c 100644 (file)
@@ -42,13 +42,7 @@ extern int target_auxv_search (struct target_ops *ops,
 /* Print the contents of the target's AUXV on the specified file.  */
 extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
 
-extern LONGEST memory_xfer_auxv (struct target_ops *ops,
-                                enum target_object object,
-                                const char *annex,
-                                gdb_byte *readbuf,
-                                const gdb_byte *writebuf,
-                                ULONGEST offset,
-                                LONGEST len);
+extern target_xfer_partial_ftype memory_xfer_auxv;
 
 
 #endif
index e4e1d3278e70773c4f44f09f7f36ac8b5233e77b..48aa6de19ecad225f7c261fed3d3bf2fca54916f 100644 (file)
@@ -337,9 +337,7 @@ ia64_hpux_store_registers (struct target_ops *ops,
    need to be handled manually.  So we override this routine and
    delegate back if we detect that we are not in a special case.  */
 
-static LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
-                                     const char *, gdb_byte *,
-                                     const gdb_byte *, ULONGEST, LONGEST);
+static target_xfer_partial_ftype *super_xfer_partial;
 
 /* The "xfer_partial" routine for a memory region that is completely
    outside of the backing-store region.  */
index edc1e23913a0b386b7214bf898d6782370685c01..fd3a8de758812f39cd99b50f742f11d47382f3c7 100644 (file)
@@ -833,9 +833,7 @@ ia64_linux_store_registers (struct target_ops *ops,
 }
 
 
-static LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
-                                     const char *, gdb_byte *,
-                                     const gdb_byte *, ULONGEST, LONGEST);
+static target_xfer_partial_ftype *super_xfer_partial;
 
 static LONGEST 
 ia64_linux_xfer_partial (struct target_ops *ops,
index a34b29a11620a9f117fd237b20c4fbbb1fa2dc1f..88af3b5e5bae511efa7e49039815e4f1096e5dd4 100644 (file)
@@ -200,11 +200,7 @@ static int (*linux_nat_siginfo_fixup) (siginfo_t *,
 
 /* The saved to_xfer_partial method, inherited from inf-ptrace.c.
    Called by our to_xfer_partial.  */
-static LONGEST (*super_xfer_partial) (struct target_ops *, 
-                                     enum target_object,
-                                     const char *, gdb_byte *, 
-                                     const gdb_byte *,
-                                     ULONGEST, LONGEST);
+static target_xfer_partial_ftype *super_xfer_partial;
 
 static unsigned int debug_linux_nat;
 static void
index ef9bb3de40aaf050736af900cf7c3cdc516646d1..4ee0fa88cf2c28c179fab6ca5d1e857d289d553d 100644 (file)
@@ -129,12 +129,7 @@ static ptid_t procfs_wait (struct target_ops *,
 static int procfs_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
                               struct mem_attrib *attrib,
                               struct target_ops *);
-static LONGEST procfs_xfer_partial (struct target_ops *ops,
-                                   enum target_object object,
-                                   const char *annex,
-                                   gdb_byte *readbuf,
-                                   const gdb_byte *writebuf,
-                                   ULONGEST offset, LONGEST len);
+static target_xfer_partial_ftype procfs_xfer_partial;
 
 static int procfs_thread_alive (struct target_ops *ops, ptid_t);
 
index f9af408e8d3b9c9fbaf3ace419b68ca9dfb90d0a..dfb033bcd127f70c31673603bc7d1077fe2891be 100644 (file)
@@ -228,14 +228,7 @@ static void (*record_full_beneath_to_store_registers) (struct target_ops *,
                                                       struct regcache *,
                                                       int regno);
 static struct target_ops *record_full_beneath_to_xfer_partial_ops;
-static LONGEST
-  (*record_full_beneath_to_xfer_partial) (struct target_ops *ops,
-                                         enum target_object object,
-                                         const char *annex,
-                                         gdb_byte *readbuf,
-                                         const gdb_byte *writebuf,
-                                         ULONGEST offset,
-                                         LONGEST len);
+static target_xfer_partial_ftype *record_full_beneath_to_xfer_partial;
 static int
   (*record_full_beneath_to_insert_breakpoint) (struct gdbarch *,
                                               struct bp_target_info *);
@@ -807,13 +800,7 @@ static void (*tmp_to_store_registers) (struct target_ops *,
                                       struct regcache *,
                                       int regno);
 static struct target_ops *tmp_to_xfer_partial_ops;
-static LONGEST (*tmp_to_xfer_partial) (struct target_ops *ops,
-                                      enum target_object object,
-                                      const char *annex,
-                                      gdb_byte *readbuf,
-                                      const gdb_byte *writebuf,
-                                      ULONGEST offset,
-                                      LONGEST len);
+static target_xfer_partial_ftype *tmp_to_xfer_partial;
 static int (*tmp_to_insert_breakpoint) (struct gdbarch *,
                                        struct bp_target_info *);
 static int (*tmp_to_remove_breakpoint) (struct gdbarch *,
index d90ef968bae285659d75dafc4903924510c36858..45a0b54cd62a194b9190579124c103ea880481fd 100644 (file)
@@ -313,9 +313,7 @@ sparc_xfer_wcookie (struct target_ops *ops, enum target_object object,
   return len;
 }
 
-LONGEST (*inf_ptrace_xfer_partial) (struct target_ops *, enum target_object,
-                                   const char *, gdb_byte *, const gdb_byte *,
-                                   ULONGEST, LONGEST);
+target_xfer_partial_ftype *inf_ptrace_xfer_partial;
 
 static LONGEST
 sparc_xfer_partial (struct target_ops *ops, enum target_object object,
index 85b50374318064f260cdca0cf7cbfc7352c6bc3f..04dc06397f4974d3703edff766e2b6cd151c9bee 100644 (file)
@@ -70,17 +70,9 @@ static void target_command (char *, int);
 
 static struct target_ops *find_default_run_target (char *);
 
-static LONGEST default_xfer_partial (struct target_ops *ops,
-                                    enum target_object object,
-                                    const char *annex, gdb_byte *readbuf,
-                                    const gdb_byte *writebuf,
-                                    ULONGEST offset, LONGEST len);
-
-static LONGEST current_xfer_partial (struct target_ops *ops,
-                                    enum target_object object,
-                                    const char *annex, gdb_byte *readbuf,
-                                    const gdb_byte *writebuf,
-                                    ULONGEST offset, LONGEST len);
+static target_xfer_partial_ftype default_xfer_partial;
+
+static target_xfer_partial_ftype current_xfer_partial;
 
 static struct gdbarch *default_thread_architecture (struct target_ops *ops,
                                                    ptid_t ptid);
@@ -1695,7 +1687,7 @@ make_show_memory_breakpoints_cleanup (int show)
 LONGEST
 target_xfer_partial (struct target_ops *ops,
                     enum target_object object, const char *annex,
-                    void *readbuf, const void *writebuf,
+                    gdb_byte *readbuf, const gdb_byte *writebuf,
                     ULONGEST offset, LONGEST len)
 {
   LONGEST retval;
index f22e5c691826c204aa9be298e218fa44daf3f0ec..5b9b34d7a3d2ee1cf6d85f06bd756a8064ff03f6 100644 (file)
@@ -238,6 +238,15 @@ enum trace_find_type
 typedef struct static_tracepoint_marker *static_tracepoint_marker_p;
 DEF_VEC_P(static_tracepoint_marker_p);
 
+typedef LONGEST
+  target_xfer_partial_ftype (struct target_ops *ops,
+                            enum target_object object,
+                            const char *annex,
+                            gdb_byte *readbuf,
+                            const gdb_byte *writebuf,
+                            ULONGEST offset,
+                            LONGEST len);
+
 /* Request that OPS transfer up to LEN 8-bit bytes of the target's
    OBJECT.  The OFFSET, for a seekable object, specifies the
    starting point.  The ANNEX can be used to provide additional
@@ -319,12 +328,7 @@ extern char *target_read_stralloc (struct target_ops *ops,
                                   const char *annex);
 
 /* See target_ops->to_xfer_partial.  */
-
-extern LONGEST target_xfer_partial (struct target_ops *ops,
-                                   enum target_object object,
-                                   const char *annex,
-                                   void *readbuf, const void *writebuf,
-                                   ULONGEST offset, LONGEST len);
+extern target_xfer_partial_ftype target_xfer_partial;
 
 /* Wrappers to target read/write that perform memory transfers.  They
    throw an error if the memory transfer fails.
This page took 0.033037 seconds and 4 git commands to generate.