From f045800c90783c13d6f116d99ca429a9ef556055 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:28:08 -0700 Subject: [PATCH] Add target_ops argument to to_post_attach 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. (target_post_attach): Add argument. * target.c (debug_to_post_attach): Add argument. (update_current_target): Update. * spu-linux-nat.c (spu_child_post_attach): Add 'self' argument. * nto-procfs.c (procfs_post_attach): Add 'self' argument. * linux-nat.c (linux_child_post_attach): Add 'self' argument. * inf-ptrace.c (inf_ptrace_post_attach): Add 'self' argument. * inf-child.c (inf_child_post_attach): Add 'self' argument. --- gdb/ChangeLog | 12 ++++++++++++ gdb/inf-child.c | 2 +- gdb/inf-ptrace.c | 2 +- gdb/linux-nat.c | 2 +- gdb/nto-procfs.c | 2 +- gdb/spu-linux-nat.c | 2 +- gdb/target.c | 6 +++--- gdb/target.h | 4 ++-- 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a98901b10ea..96d6e580183 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add argument. + (target_post_attach): Add argument. + * target.c (debug_to_post_attach): Add argument. + (update_current_target): Update. + * spu-linux-nat.c (spu_child_post_attach): Add 'self' argument. + * nto-procfs.c (procfs_post_attach): Add 'self' argument. + * linux-nat.c (linux_child_post_attach): Add 'self' argument. + * inf-ptrace.c (inf_ptrace_post_attach): Add 'self' argument. + * inf-child.c (inf_child_post_attach): Add 'self' argument. + 2014-02-19 Tom Tromey * windows-nat.c (windows_close): Add 'self' argument. diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 549e44aa5cc..c1429126502 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -87,7 +87,7 @@ inf_child_store_inferior_registers (struct target_ops *ops, } static void -inf_child_post_attach (int pid) +inf_child_post_attach (struct target_ops *self, int pid) { /* This version of Unix doesn't require a meaningful "post attach" operation by a debugger. */ diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 1269d24b657..ac4d2a44cc8 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -246,7 +246,7 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty) #ifdef PT_GET_PROCESS_STATE static void -inf_ptrace_post_attach (int pid) +inf_ptrace_post_attach (struct target_ops *self, int pid) { ptrace_event_t pe; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index a76ba304389..a6118affb99 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -329,7 +329,7 @@ linux_init_ptrace (pid_t pid) } static void -linux_child_post_attach (int pid) +linux_child_post_attach (struct target_ops *self, int pid) { linux_init_ptrace (pid); } diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 7739197c185..9fab8618641 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -648,7 +648,7 @@ procfs_attach (struct target_ops *ops, char *args, int from_tty) } static void -procfs_post_attach (pid_t pid) +procfs_post_attach (struct target_ops *self, pid_t pid) { if (exec_bfd) solib_create_inferior_hook (0); diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index a68e4e0531d..71c1643c550 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -420,7 +420,7 @@ spu_child_post_startup_inferior (ptid_t ptid) /* Override the post_attach routine to try load the SPE executable file image from its copy inside the target process. */ static void -spu_child_post_attach (int pid) +spu_child_post_attach (struct target_ops *self, int pid) { int fd; ULONGEST addr; diff --git a/gdb/target.c b/gdb/target.c index e63725af670..73531e1e89a 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -721,7 +721,7 @@ update_current_target (void) (void (*) (struct target_ops *)) target_ignore); de_fault (to_post_attach, - (void (*) (int)) + (void (*) (struct target_ops *, int)) target_ignore); de_fault (to_prepare_to_store, (void (*) (struct target_ops *, struct regcache *)) @@ -3914,9 +3914,9 @@ target_stop (ptid_t ptid) } static void -debug_to_post_attach (int pid) +debug_to_post_attach (struct target_ops *self, int pid) { - debug_target.to_post_attach (pid); + debug_target.to_post_attach (&debug_target, pid); fprintf_unfiltered (gdb_stdlog, "target_post_attach (%d)\n", pid); } diff --git a/gdb/target.h b/gdb/target.h index 125d649a88b..1e8d6122d03 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -404,7 +404,7 @@ struct target_ops void (*to_xclose) (struct target_ops *targ); void (*to_close) (struct target_ops *); void (*to_attach) (struct target_ops *ops, char *, int); - void (*to_post_attach) (int); + void (*to_post_attach) (struct target_ops *, int); void (*to_detach) (struct target_ops *ops, const char *, int); void (*to_disconnect) (struct target_ops *, char *, int); void (*to_resume) (struct target_ops *, ptid_t, int, enum gdb_signal) @@ -1019,7 +1019,7 @@ void target_attach (char *, int); This operation provides a target-specific hook that allows the necessary bookkeeping to be performed after an attach completes. */ #define target_post_attach(pid) \ - (*current_target.to_post_attach) (pid) + (*current_target.to_post_attach) (¤t_target, pid) /* Takes a program previously attached to and detaches it. The program may resume execution (some targets do, some don't) and will -- 2.30.2