Add target_ops argument to to_find_memory_regions
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.
This commit is contained in:
parent
2a9a2795ff
commit
2e73927ca5
@ -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
|
||||
|
14
gdb/exec.c
14
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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. */
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) (¤t_target, FUNC, DATA)
|
||||
|
||||
/*
|
||||
* Compose corefile .note section.
|
||||
|
Loading…
x
Reference in New Issue
Block a user