Add target_ops argument to to_find_memory_regions
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 04:35:39 +0000 (21:35 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:45:59 +0000 (07:45 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_find_memory_regions>: Add
argument.
(target_find_memory_regions): Add argument.
* target.c (dummy_find_memory_regions): Add 'self' argument.
* procfs.c (proc_find_memory_regions): Add 'self' argument.
* gnu-nat.c (gnu_find_memory_regions): Add 'self' argument.
* fbsd-nat.h (fbsd_find_memory_regions): Add 'self' argument.
* fbsd-nat.c (fbsd_find_memory_regions): Add 'self' argument.
* exec. (exec_do_find_memory_regions): New global.
(exec_set_find_memory_regions): Rewrite.
(exec_find_memory_regions): New function.
(init_exec_ops): Use exec_find_memory_regions.

gdb/ChangeLog
gdb/exec.c
gdb/fbsd-nat.c
gdb/fbsd-nat.h
gdb/gnu-nat.c
gdb/procfs.c
gdb/target.c
gdb/target.h

index 327e68c8bc5ab9011f51d8de6c92039ebfbae026..7cade09543acd8b6e5563307f78de975c8d9cf17 100644 (file)
@@ -1,3 +1,18 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target.h (struct target_ops) <to_find_memory_regions>: Add
+       argument.
+       (target_find_memory_regions): Add argument.
+       * target.c (dummy_find_memory_regions): Add 'self' argument.
+       * procfs.c (proc_find_memory_regions): Add 'self' argument.
+       * gnu-nat.c (gnu_find_memory_regions): Add 'self' argument.
+       * fbsd-nat.h (fbsd_find_memory_regions): Add 'self' argument.
+       * fbsd-nat.c (fbsd_find_memory_regions): Add 'self' argument.
+       * exec. (exec_do_find_memory_regions): New global.
+       (exec_set_find_memory_regions): Rewrite.
+       (exec_find_memory_regions): New function.
+       (init_exec_ops): Use exec_find_memory_regions.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target.h (struct target_ops) <to_supports_non_stop>: Add
index 1885afd74e19e82a3c0927940b844d0c5c3d57ec..f3df4b1b2919406e401dcefd207123eb3a8b5757 100644 (file)
@@ -62,6 +62,10 @@ void _initialize_exec (void);
 
 struct target_ops exec_ops;
 
+/* Function used to implement to_find_memory_regions.  */
+
+static int (*exec_do_find_memory_regions) (find_memory_region_ftype, void *);
+
 /* True if the exec target is pushed on the stack.  */
 static int using_exec_ops;
 
@@ -835,7 +839,14 @@ exec_has_memory (struct target_ops *ops)
 extern void
 exec_set_find_memory_regions (int (*func) (find_memory_region_ftype, void *))
 {
-  exec_ops.to_find_memory_regions = func;
+  exec_do_find_memory_regions = func;
+}
+
+static int
+exec_find_memory_regions (struct target_ops *self,
+                         find_memory_region_ftype func, void *data)
+{
+  return exec_do_find_memory_regions (func, data);
 }
 
 static char *exec_make_note_section (bfd *, int *);
@@ -862,6 +873,7 @@ Specify the filename of the executable file.";
   exec_ops.to_stratum = file_stratum;
   exec_ops.to_has_memory = exec_has_memory;
   exec_ops.to_make_corefile_notes = exec_make_note_section;
+  exec_ops.to_find_memory_regions = exec_find_memory_regions;
   exec_ops.to_magic = OPS_MAGIC;
 }
 
index 43ee605ceed5d42a88c322c5d32f31d8df79faef..dc6d76d753319ae1deef16d0861404e1f6df5fcc 100644 (file)
@@ -91,7 +91,8 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
    argument to FUNC.  */
 
 int
-fbsd_find_memory_regions (find_memory_region_ftype func, void *obfd)
+fbsd_find_memory_regions (struct target_ops *self,
+                         find_memory_region_ftype func, void *obfd)
 {
   pid_t pid = ptid_get_pid (inferior_ptid);
   char *mapfilename;
index a048733da49f583cf3894891b876f2faf3be343f..7ed89464e26e20ebcfaa5499c194c2b30875b910 100644 (file)
@@ -29,7 +29,8 @@ extern char *fbsd_pid_to_exec_file (struct target_ops *self, int pid);
    calling FUNC for each memory region.  OBFD is passed as the last
    argument to FUNC.  */
 
-extern int fbsd_find_memory_regions (find_memory_region_ftype func, void *obfd);
+extern int fbsd_find_memory_regions (struct target_ops *self,
+                                    find_memory_region_ftype func, void *obfd);
 
 /* Create appropriate note sections for a corefile, returning them in
    allocated memory.  */
index b22649819639692b8e9f8324c1326ea0072ba948..296c162e0384c12b42ece905e0fd188fe96f4862 100644 (file)
@@ -2545,7 +2545,8 @@ gnu_xfer_partial (struct target_ops *ops, enum target_object object,
 
 /* Call FUNC on each memory region in the task.  */
 static int
-gnu_find_memory_regions (find_memory_region_ftype func, void *data)
+gnu_find_memory_regions (struct target_ops *self,
+                        find_memory_region_ftype func, void *data)
 {
   error_t err;
   task_t task;
index 575984cce719f96a8fca84d74280e3ab6e4dda88..360a5155a317f5fcede44dc9abc73bf4f160f3f6 100644 (file)
@@ -137,7 +137,8 @@ static int procfs_thread_alive (struct target_ops *ops, ptid_t);
 static void procfs_find_new_threads (struct target_ops *ops);
 static char *procfs_pid_to_str (struct target_ops *, ptid_t);
 
-static int proc_find_memory_regions (find_memory_region_ftype, void *);
+static int proc_find_memory_regions (struct target_ops *self,
+                                    find_memory_region_ftype, void *);
 
 static char * procfs_make_note_section (bfd *, int *);
 
@@ -5058,7 +5059,8 @@ find_memory_regions_callback (struct prmap *map,
    the callback.  */
 
 static int
-proc_find_memory_regions (find_memory_region_ftype func, void *data)
+proc_find_memory_regions (struct target_ops *self,
+                         find_memory_region_ftype func, void *data)
 {
   procinfo *pi = find_procinfo_or_die (ptid_get_pid (inferior_ptid), 0);
 
index 0fc4e869a1b115754bb24134dba9a37a52308fd2..fd4f62d8154f19fbc37666cc4107fabdb639797e 100644 (file)
@@ -3770,7 +3770,8 @@ dummy_pid_to_str (struct target_ops *ops, ptid_t ptid)
 
 /* Error-catcher for target_find_memory_regions.  */
 static int
-dummy_find_memory_regions (find_memory_region_ftype ignore1, void *ignore2)
+dummy_find_memory_regions (struct target_ops *self,
+                          find_memory_region_ftype ignore1, void *ignore2)
 {
   error (_("Command not implemented for this target."));
   return 0;
index c3c117a90711e074a5784bbafed51daa0d2a3588..8f7d38c94086db3f14405823493da7cc8c0e0f79 100644 (file)
@@ -547,7 +547,8 @@ struct target_ops
       TARGET_DEFAULT_NORETURN (tcomplain ());
     int (*to_supports_non_stop) (struct target_ops *);
     /* find_memory_regions support method for gcore */
-    int (*to_find_memory_regions) (find_memory_region_ftype func, void *data);
+    int (*to_find_memory_regions) (struct target_ops *,
+                                  find_memory_region_ftype func, void *data);
     /* make_corefile_notes support method for gcore */
     char * (*to_make_corefile_notes) (bfd *, int *);
     /* get_bookmark support method for bookmarks */
@@ -1560,7 +1561,7 @@ extern char *target_thread_name (struct thread_info *);
  */
 
 #define target_find_memory_regions(FUNC, DATA) \
-     (current_target.to_find_memory_regions) (FUNC, DATA)
+     (current_target.to_find_memory_regions) (&current_target, FUNC, DATA)
 
 /*
  * Compose corefile .note section.
This page took 0.030807 seconds and 4 git commands to generate.