+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
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;
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 *);
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;
}
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;
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. */
/* 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;
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 *);
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);
/* 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;
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 */
*/
#define target_find_memory_regions(FUNC, DATA) \
- (current_target.to_find_memory_regions) (FUNC, DATA)
+ (current_target.to_find_memory_regions) (¤t_target, FUNC, DATA)
/*
* Compose corefile .note section.