binutils-gdb/gdb/nat
Simon Marchi e7eee665a1 gdb: fix darwin-nat.c build / adapt to multi-target
The darwin-nat.c file doesn't build since the multi-target changes
(5b6d1e4f, "Multi-target support").  This patch makes it build.  I have
access to a macOS vm, so I am able to build it, but I wasn't able to
successfully codesign it and try to actually debug something, so I don't
know if it works.  I don't have much more time to put on this to figure
it out, so I thought I'd sent the patch anyway, as it's at least a step
in the right direction.

The bulk of the patch is to change a bunch of functions to be methods of
the darwin_nat_target object, so that this can pass `this` to
find_inferior_ptid and other functions that now require a
process_stratum_target pointer.

The darwin_ptrace_him function (renamed to darwin_nat_target::ptrace_him
in this patch) is passed to fork_inferior as the `init_trace_fun`
parameter.  Since the method can't be passed as a plain function pointer
(we need the `this` pointer), I changed the `init_trace_fun` parameter
of fork_inferior to be a gdb::function_view, so we can pass a lambda and
capture `this`.

The changes in darwin-nat.h are only to move definition higher in the
file, so that forward declarations are not needed.

gdb/ChangeLog:

	* darwin-nat.h (struct darwin_exception_msg, enum
	darwin_msg_state, struct darwin_thread_info, darwin_thread_t):
	Move up.
	(class darwin_nat_target) <wait_1, check_new_threads,
	decode_exception_message, decode_message, stop_inferior,
	init_thread_list, ptrace_him, cancel_breakpoint>: Declare.
	* darwin-nat.c (darwin_check_new_threads): Rename to...
	(darwin_nat_target::check_new_threads): ... this.
	(darwin_suspend_inferior_it): Remove.
	(darwin_decode_exception_message): Rename to...
	(darwin_nat_target::decode_exception_message): ... this.
	(darwin_nat_target::resume): Pass target to find_inferior_ptid.
	(darwin_decode_message): Rename to...
	(darwin_nat_target::decode_message): ... this.
	(cancel_breakpoint): Rename to...
	(darwin_nat_target::cancel_breakpoint): ... this.
	(darwin_wait): Rename to...
	(darwin_nat_target::wait_1): ... this.  Use range-based for loop
	instead of iterate_over_inferiors.
	(darwin_nat_target::wait): Call wait_1 instead of darwin_wait.
	(darwin_stop_inferior): Rename to...
	(darwin_nat_target::stop_inferior): ... this.
	(darwin_nat_target::kill): Call wait_1 instead of darwin_wait.
	(darwin_init_thread_list): Rename to...
	(darwin_nat_target::init_thread_list): ... this.
	(darwin_ptrace_him): Rename to...
	(darwin_nat_target::ptrace_him): ... this.
	(darwin_nat_target::create_inferior): Pass lambda function to
	fork_inferior.
	(darwin_nat_target::detach): Call stop_inferior instead of
	darwin_stop_inferior.
	* fork-inferior.h (fork_inferior): Change init_trace_fun
	parameter to gdb::function_view.
	* fork-inferior.c (fork_inferior): Likewise.
2020-01-23 14:55:50 -05:00
..
aarch64-linux-hw-point.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
aarch64-linux-hw-point.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
aarch64-linux.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
aarch64-linux.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
aarch64-sve-linux-ptrace.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
aarch64-sve-linux-ptrace.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
aarch64-sve-linux-sigcontext.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
amd64-linux-siginfo.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
amd64-linux-siginfo.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
fork-inferior.c gdb: fix darwin-nat.c build / adapt to multi-target 2020-01-23 14:55:50 -05:00
fork-inferior.h gdb: fix darwin-nat.c build / adapt to multi-target 2020-01-23 14:55:50 -05:00
gdb_ptrace.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
gdb_thread_db.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
glibc_thread_db.h
linux-btrace.c Fix some spelling errors. 2020-01-16 16:46:25 -06:00
linux-btrace.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-namespaces.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-namespaces.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-nat.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-osdata.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-osdata.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-personality.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-personality.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-procfs.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-procfs.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-ptrace.c Remove use of <config.h> from gdb/nat/ 2020-01-14 16:25:04 -07:00
linux-ptrace.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-waitpid.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
linux-waitpid.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mips-linux-watch.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
mips-linux-watch.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
ppc-linux.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
ppc-linux.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-cpuid.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-dregs.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-dregs.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-gcc-cpuid.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-linux-dregs.c Remove use of <config.h> from gdb/nat/ 2020-01-14 16:25:04 -07:00
x86-linux-dregs.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-linux.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
x86-linux.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00