From 2e97a79e221eed05a015a9b37595edd09b08eb36 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:31:40 -0700 Subject: [PATCH] Add target_ops argument to to_post_startup_inferior 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. (target_post_startup_inferior): Add argument. * target.c (debug_to_post_startup_inferior): Add argument. (update_current_target): Update. * spu-linux-nat.c (spu_child_post_startup_inferior): Add 'self' argument. * linux-nat.c (linux_child_post_startup_inferior): Add 'self' argument. * inf-ptrace.c (inf_ptrace_post_startup_inferior): Add 'self' argument. * inf-child.c (inf_child_post_startup_inferior): Add 'self' argument. * i386-linux-nat.c (i386_linux_child_post_startup_inferior): Add 'self' argument. (super_post_startup_inferior): Likewise. * amd64-linux-nat.c (amd64_linux_child_post_startup_inferior): Add 'self' argument. (super_post_startup_inferior): Likewise. * aarch64-linux-nat.c (aarch64_linux_child_post_startup_inferior): Add 'self' argument. (super_post_startup_inferior): Likewise. --- gdb/ChangeLog | 25 +++++++++++++++++++++++++ gdb/aarch64-linux-nat.c | 8 +++++--- gdb/amd64-linux-nat.c | 7 ++++--- gdb/i386-linux-nat.c | 7 ++++--- gdb/inf-child.c | 2 +- gdb/inf-ptrace.c | 2 +- gdb/linux-nat.c | 2 +- gdb/spu-linux-nat.c | 2 +- gdb/target.c | 6 +++--- gdb/target.h | 4 ++-- 10 files changed, 47 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3db2aa636ab..87f2d46bc9a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,28 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add + argument. + (target_post_startup_inferior): Add argument. + * target.c (debug_to_post_startup_inferior): Add argument. + (update_current_target): Update. + * spu-linux-nat.c (spu_child_post_startup_inferior): Add 'self' + argument. + * linux-nat.c (linux_child_post_startup_inferior): Add 'self' + argument. + * inf-ptrace.c (inf_ptrace_post_startup_inferior): Add 'self' + argument. + * inf-child.c (inf_child_post_startup_inferior): Add 'self' + argument. + * i386-linux-nat.c (i386_linux_child_post_startup_inferior): Add + 'self' argument. + (super_post_startup_inferior): Likewise. + * amd64-linux-nat.c (amd64_linux_child_post_startup_inferior): Add + 'self' argument. + (super_post_startup_inferior): Likewise. + * aarch64-linux-nat.c (aarch64_linux_child_post_startup_inferior): + Add 'self' argument. + (super_post_startup_inferior): Likewise. + 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index c6437fe0ded..28ad38ba9c5 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -828,16 +828,18 @@ aarch64_linux_get_debug_reg_capacity (void) } } -static void (*super_post_startup_inferior) (ptid_t ptid); +static void (*super_post_startup_inferior) (struct target_ops *self, + ptid_t ptid); /* Implement the "to_post_startup_inferior" target_ops method. */ static void -aarch64_linux_child_post_startup_inferior (ptid_t ptid) +aarch64_linux_child_post_startup_inferior (struct target_ops *self, + ptid_t ptid) { aarch64_forget_process (ptid_get_pid (ptid)); aarch64_linux_get_debug_reg_capacity (); - super_post_startup_inferior (ptid); + super_post_startup_inferior (self, ptid); } /* Implement the "to_read_description" target_ops method. */ diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 55973a611ee..af841420d20 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -568,13 +568,14 @@ ps_get_thread_area (const struct ps_prochandle *ph, } -static void (*super_post_startup_inferior) (ptid_t ptid); +static void (*super_post_startup_inferior) (struct target_ops *self, + ptid_t ptid); static void -amd64_linux_child_post_startup_inferior (ptid_t ptid) +amd64_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { i386_cleanup_dregs (); - super_post_startup_inferior (ptid); + super_post_startup_inferior (self, ptid); } diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index fdf5dee5f5f..f7be40cee11 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -982,13 +982,14 @@ i386_linux_resume (struct target_ops *ops, perror_with_name (("ptrace")); } -static void (*super_post_startup_inferior) (ptid_t ptid); +static void (*super_post_startup_inferior) (struct target_ops *self, + ptid_t ptid); static void -i386_linux_child_post_startup_inferior (ptid_t ptid) +i386_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { i386_cleanup_dregs (); - super_post_startup_inferior (ptid); + super_post_startup_inferior (self, ptid); } /* Get Linux/x86 target description from running target. */ diff --git a/gdb/inf-child.c b/gdb/inf-child.c index c1429126502..7726470912b 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -112,7 +112,7 @@ inf_child_open (char *arg, int from_tty) } static void -inf_child_post_startup_inferior (ptid_t ptid) +inf_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { /* This version of Unix doesn't require a meaningful "post startup inferior" operation by a debugger. */ diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index ac4d2a44cc8..048b1588d6c 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -147,7 +147,7 @@ inf_ptrace_create_inferior (struct target_ops *ops, #ifdef PT_GET_PROCESS_STATE static void -inf_ptrace_post_startup_inferior (ptid_t pid) +inf_ptrace_post_startup_inferior (struct target_ops *self, ptid_t pid) { ptrace_event_t pe; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 24cb1b918d7..07289397f40 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -335,7 +335,7 @@ linux_child_post_attach (struct target_ops *self, int pid) } static void -linux_child_post_startup_inferior (ptid_t ptid) +linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { linux_init_ptrace (ptid_get_pid (ptid)); } diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index d80b78c36e1..4841bbefbb1 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -401,7 +401,7 @@ spu_symbol_file_add_from_memory (int inferior_fd) /* Override the post_startup_inferior routine to continue running the inferior until the first spu_run system call. */ static void -spu_child_post_startup_inferior (ptid_t ptid) +spu_child_post_startup_inferior (struct target_ops *self, ptid_t ptid) { int fd; ULONGEST addr; diff --git a/gdb/target.c b/gdb/target.c index b1ad4db63dd..699b55e9d4b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -789,7 +789,7 @@ update_current_target (void) (void (*) (struct target_ops *, char *, int)) tcomplain); de_fault (to_post_startup_inferior, - (void (*) (ptid_t)) + (void (*) (struct target_ops *, ptid_t)) target_ignore); de_fault (to_insert_fork_catchpoint, (int (*) (int)) @@ -4857,9 +4857,9 @@ debug_to_load (struct target_ops *self, char *args, int from_tty) } static void -debug_to_post_startup_inferior (ptid_t ptid) +debug_to_post_startup_inferior (struct target_ops *self, ptid_t ptid) { - debug_target.to_post_startup_inferior (ptid); + debug_target.to_post_startup_inferior (&debug_target, ptid); fprintf_unfiltered (gdb_stdlog, "target_post_startup_inferior (%d)\n", ptid_get_pid (ptid)); diff --git a/gdb/target.h b/gdb/target.h index 60e0e163680..433925e7d54 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -497,7 +497,7 @@ struct target_ops void (*to_load) (struct target_ops *, char *, int); void (*to_create_inferior) (struct target_ops *, char *, char *, char **, int); - void (*to_post_startup_inferior) (ptid_t); + void (*to_post_startup_inferior) (struct target_ops *, ptid_t); int (*to_insert_fork_catchpoint) (int); int (*to_remove_fork_catchpoint) (int); int (*to_insert_vfork_catchpoint) (int); @@ -1298,7 +1298,7 @@ void target_create_inferior (char *exec_file, char *args, Such targets will supply an appropriate definition for this function. */ #define target_post_startup_inferior(ptid) \ - (*current_target.to_post_startup_inferior) (ptid) + (*current_target.to_post_startup_inferior) (¤t_target, ptid) /* On some targets, we can catch an inferior fork or vfork event when it occurs. These functions insert/remove an already-created -- 2.30.2