aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/exec.c14
-rw-r--r--gdb/fbsd-nat.c3
-rw-r--r--gdb/fbsd-nat.h3
-rw-r--r--gdb/gnu-nat.c3
-rw-r--r--gdb/procfs.c6
-rw-r--r--gdb/target.c3
-rw-r--r--gdb/target.h5
8 files changed, 43 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 327e68c..7cade09 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
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
argument.
* target.c (find_default_supports_non_stop): Add argument.
diff --git a/gdb/exec.c b/gdb/exec.c
index 1885afd..f3df4b1 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -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;
}
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 43ee605..dc6d76d 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -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;
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index a048733..7ed8946 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -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. */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index b226498..296c162 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -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;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 575984c..360a515 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -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);
diff --git a/gdb/target.c b/gdb/target.c
index 0fc4e86..fd4f62d 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -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;
diff --git a/gdb/target.h b/gdb/target.h
index c3c117a..8f7d38c 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -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.