diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-01-19 11:47:57 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-01-19 11:47:57 -0500 |
commit | 6e1e1966bac965c5a26b5e5cae69cb0ed21be4cc (patch) | |
tree | 30c533a292724e5807665894aa56aa89065690d2 /gdb/target-delegates.c | |
parent | 6bd6f3b6569945700386847f624dc9e8b7f57450 (diff) | |
download | gdb-6e1e1966bac965c5a26b5e5cae69cb0ed21be4cc.zip gdb-6e1e1966bac965c5a26b5e5cae69cb0ed21be4cc.tar.gz gdb-6e1e1966bac965c5a26b5e5cae69cb0ed21be4cc.tar.bz2 |
Pass inferior down to target_detach and to_detach
The to_detach target_ops method implementations are currently expected
to work on current_inferior/inferior_ptid. In order to make things more
explicit, and remove some "shadow" parameter passing through globals,
this patch adds an "inferior" parameter to to_detach. Implementations
will be expected to use this instead of relying on the global. However,
to keep things simple, this patch only does the minimum that is
necessary to add the parameter. The following patch gives an example of
how one such implementation would be adapted. If the approach is deemed
good, we can then look into adapting more implementations. Until then,
they'll continue to work as they do currently.
gdb/ChangeLog:
* target.h (struct target_ops) <to_detach>: Add inferior
parameter.
(target_detach): Likewise.
* target.c (dispose_inferior): Pass inferior down.
(target_detach): Pass inferior down. Assert that it is equal to
the current inferior.
* aix-thread.c (aix_thread_detach): Pass inferior down.
* corefile.c (core_file_command): Pass current_inferior() down.
* corelow.c (core_detach): Add inferior parameter.
* darwin-nat.c (darwin_detach): Likewise.
* gnu-nat.c (gnu_detach): Likewise.
* inf-ptrace.c (inf_ptrace_detach): Likewise.
* infcmd.c (detach_command): Pass current_inferior() down to
target_detach.
* infrun.c (follow_fork_inferior): Pass parent_inf to
target_detach.
(handle_vfork_child_exec_or_exit): Pass inf->vfork_parent to
target_detach.
* linux-nat.c (linux_nat_detach): Add inferior parameter.
* linux-thread-db.c (thread_db_detach): Likewise.
* nto-procfs.c (procfs_detach): Likewise.
* procfs.c (procfs_detach): Likewise.
* record.c (record_detach): Likewise.
* record.h (struct inferior): Forward-declare.
(record_detach): Add inferior parameter.
* remote-sim.c (gdbsim_detach): Likewise.
* remote.c (remote_detach_1): Likewise.
(remote_detach): Likewise.
(extended_remote_detach): Likewise.
* sol-thread.c (sol_thread_detach): Likewise.
* target-debug.h (target_debug_print_inferior_p): New macro.
* target-delegates.c: Re-generate.
* top.c (kill_or_detach): Pass inferior down to target_detach.
* windows-nat.c (windows_detach): Add inferior parameter.
Diffstat (limited to 'gdb/target-delegates.c')
-rw-r--r-- | gdb/target-delegates.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 6bb7d7f..bc84791 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -28,26 +28,28 @@ debug_post_attach (struct target_ops *self, int arg1) } static void -delegate_detach (struct target_ops *self, int arg1) +delegate_detach (struct target_ops *self, inferior *arg1, int arg2) { self = self->beneath; - self->to_detach (self, arg1); + self->to_detach (self, arg1, arg2); } static void -tdefault_detach (struct target_ops *self, int arg1) +tdefault_detach (struct target_ops *self, inferior *arg1, int arg2) { } static void -debug_detach (struct target_ops *self, int arg1) +debug_detach (struct target_ops *self, inferior *arg1, int arg2) { fprintf_unfiltered (gdb_stdlog, "-> %s->to_detach (...)\n", debug_target.to_shortname); - debug_target.to_detach (&debug_target, arg1); + debug_target.to_detach (&debug_target, arg1, arg2); fprintf_unfiltered (gdb_stdlog, "<- %s->to_detach (", debug_target.to_shortname); target_debug_print_struct_target_ops_p (&debug_target); fputs_unfiltered (", ", gdb_stdlog); - target_debug_print_int (arg1); + target_debug_print_inferior_p (arg1); + fputs_unfiltered (", ", gdb_stdlog); + target_debug_print_int (arg2); fputs_unfiltered (")\n", gdb_stdlog); } |