From fc6691b2590f61a2f1deeb9d73e7df23b1ced88a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:35:52 -0700 Subject: [PATCH] Add target_ops argument to to_make_corefile_notes 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. (target_make_corefile_notes): Add argument. * target.c (dummy_make_corefile_notes): Add 'self' argument. * procfs.c (procfs_make_note_section): Add 'self' argument. (procfs_make_note_section): Add 'self' argument. (procfs_make_note_section): Add 'self' argument. * linux-nat.c (linux_nat_make_corefile_notes): Add 'self' argument. * fbsd-nat.h (fbsd_make_corefile_notes): Add 'self' argument. * fbsd-nat.c (fbsd_make_corefile_notes): Add 'self' argument. * exec.c (exec_make_note_section): Add 'self' argument. (exec_make_note_section): Add 'self' argument. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/exec.c | 4 ++-- gdb/fbsd-nat.c | 2 +- gdb/fbsd-nat.h | 3 ++- gdb/linux-nat.c | 3 ++- gdb/procfs.c | 7 ++++--- gdb/target.c | 3 ++- gdb/target.h | 4 ++-- 8 files changed, 31 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7cade09543a..1d0550f09e1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add + argument. + (target_make_corefile_notes): Add argument. + * target.c (dummy_make_corefile_notes): Add 'self' argument. + * procfs.c (procfs_make_note_section): Add 'self' argument. + (procfs_make_note_section): Add 'self' argument. + (procfs_make_note_section): Add 'self' argument. + * linux-nat.c (linux_nat_make_corefile_notes): Add 'self' + argument. + * fbsd-nat.h (fbsd_make_corefile_notes): Add 'self' argument. + * fbsd-nat.c (fbsd_make_corefile_notes): Add 'self' argument. + * exec.c (exec_make_note_section): Add 'self' argument. + (exec_make_note_section): Add 'self' argument. + 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add diff --git a/gdb/exec.c b/gdb/exec.c index f3df4b1b291..61dea49e2d9 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -849,7 +849,7 @@ exec_find_memory_regions (struct target_ops *self, return exec_do_find_memory_regions (func, data); } -static char *exec_make_note_section (bfd *, int *); +static char *exec_make_note_section (struct target_ops *self, bfd *, int *); /* Fill in the exec file target vector. Very few entries need to be defined. */ @@ -921,7 +921,7 @@ Show writing into executable and core files."), NULL, } static char * -exec_make_note_section (bfd *obfd, int *note_size) +exec_make_note_section (struct target_ops *self, bfd *obfd, int *note_size) { error (_("Can't create a corefile")); } diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index dc6d76d7533..a2a1f60ec4b 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -167,7 +167,7 @@ find_stop_signal (void) allocated memory. */ char * -fbsd_make_corefile_notes (bfd *obfd, int *note_size) +fbsd_make_corefile_notes (struct target_ops *self, bfd *obfd, int *note_size) { const struct regcache *regcache = get_current_regcache (); struct gdbarch *gdbarch = get_regcache_arch (regcache); diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index 7ed89464e26..a3f51d65ceb 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -35,6 +35,7 @@ extern int fbsd_find_memory_regions (struct target_ops *self, /* Create appropriate note sections for a corefile, returning them in allocated memory. */ -extern char *fbsd_make_corefile_notes (bfd *obfd, int *note_size); +extern char *fbsd_make_corefile_notes (struct target_ops *self, + bfd *obfd, int *note_size); #endif /* fbsd-nat.h */ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index cb8b3bd83ad..5bb89c18947 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4097,7 +4097,8 @@ linux_nat_collect_thread_registers (const struct regcache *regcache, section for a corefile, and returns it in a malloc buffer. */ static char * -linux_nat_make_corefile_notes (bfd *obfd, int *note_size) +linux_nat_make_corefile_notes (struct target_ops *self, + bfd *obfd, int *note_size) { /* FIXME: uweigand/2011-10-06: Once all GNU/Linux architectures have been converted to gdbarch_core_regset_sections, this function can go away. */ diff --git a/gdb/procfs.c b/gdb/procfs.c index 360a5155a31..822e1e0a1df 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -140,7 +140,8 @@ static char *procfs_pid_to_str (struct target_ops *, ptid_t); static int proc_find_memory_regions (struct target_ops *self, find_memory_region_ftype, void *); -static char * procfs_make_note_section (bfd *, int *); +static char * procfs_make_note_section (struct target_ops *self, + bfd *, int *); static int procfs_can_use_hw_breakpoint (struct target_ops *self, int, int, int); @@ -5475,7 +5476,7 @@ find_stop_signal (void) } static char * -procfs_make_note_section (bfd *obfd, int *note_size) +procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size) { struct cleanup *old_chain; gdb_gregset_t gregs; @@ -5545,7 +5546,7 @@ procfs_make_note_section (bfd *obfd, int *note_size) } #else /* !Solaris */ static char * -procfs_make_note_section (bfd *obfd, int *note_size) +procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size) { error (_("gcore not implemented for this host.")); return NULL; /* lint */ diff --git a/gdb/target.c b/gdb/target.c index fd4f62d8154..4d193c9abb7 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3779,7 +3779,8 @@ dummy_find_memory_regions (struct target_ops *self, /* Error-catcher for target_make_corefile_notes. */ static char * -dummy_make_corefile_notes (bfd *ignore1, int *ignore2) +dummy_make_corefile_notes (struct target_ops *self, + bfd *ignore1, int *ignore2) { error (_("Command not implemented for this target.")); return NULL; diff --git a/gdb/target.h b/gdb/target.h index 8f7d38c9408..7faf059624d 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -550,7 +550,7 @@ struct target_ops 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 *); + char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *); /* get_bookmark support method for bookmarks */ gdb_byte * (*to_get_bookmark) (char *, int); /* goto_bookmark support method for bookmarks */ @@ -1568,7 +1568,7 @@ extern char *target_thread_name (struct thread_info *); */ #define target_make_corefile_notes(BFD, SIZE_P) \ - (current_target.to_make_corefile_notes) (BFD, SIZE_P) + (current_target.to_make_corefile_notes) (¤t_target, BFD, SIZE_P) /* Bookmark interfaces. */ #define target_get_bookmark(ARGS, FROM_TTY) \