From fd000fb3dfd9c93e332246bf89b700ab9aac7339 Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Thu, 2 Apr 2020 15:11:28 +0200 Subject: gdbserver/linux-low: turn process/thread addition/deletion ops into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur Turn the 'new_process', 'delete_process', 'new_thread', 'delete_thread', and 'new_fork' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) : Declare. * linux-low.cc (delete_lwp): Turn into... (linux_process_target::delete_lwp): ...this. (linux_process_target::low_delete_thread): Define. (linux_add_process): Turn into... (linux_process_target::add_linux_process): ...this. (linux_process_target::low_new_process): Define. (linux_process_target::low_delete_process): Define. (linux_process_target::low_new_fork): Define. (add_lwp): Turn into... (linux_process_target::add_lwp): ...this. (linux_process_target::low_new_thread): Define. (linux_attach_lwp): Turn into... (linux_process_target::attach_lwp): ...this. (linux_detach_one_lwp): Turn into... (linux_process_target::detach_one_lwp): ...this. (linux_detach_lwp_callback): Remove and inline... (linux_process_target::detach): ...here. (check_zombie_leaders): Turn into... (linux_process_target::check_zombie_leaders): ...this. (filter_exit_event): Turn into... (linux_process_target::filter_exit_event): ...this. Update the callers below. (linux_process_target::handle_extended_wait) (linux_process_target::create_inferior) (attach_proc_task_lwp_callback) (linux_process_target::attach) (linux_process_target::detach) (linux_process_target::mourn) * thread-db.cc (attach_thread) * linux-x86-low.cc (class x86_target) : Declare. (x86_linux_new_process): Turn into... (x86_target::low_new_process): ...this. (x86_linux_delete_process): Turn into... (x86_target::low_delete_process): ...this. (x86_target::low_new_thread): Define. (x86_target::low_delete_thread): Define. (x86_linux_new_fork): Turn into... (x86_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_linux_new_process): Turn into... (aarch64_target::low_new_process): ...this. (aarch64_linux_delete_process): Turn into... (aarch64_target::low_delete_process): ...this. (aarch64_target::low_new_thread): Define. (aarch64_target::low_delete_thread): Define. (aarch64_linux_new_fork): Turn into... (aarch64_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) : Declare. (arm_new_process): Turn into... (arm_target::low_new_process): ...this. (arm_delete_process): Turn into... (arm_target::low_delete_process): ...this. (arm_new_thread): Turn into... (arm_target::low_new_thread): ...this. (arm_delete_thread): Turn into... (arm_target::low_delete_thread): ...this. (arm_new_fork): Turn into... (arm_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) : Declare. (mips_linux_new_process): Turn into... (mips_target::low_new_process): ...this. (mips_linux_delete_process): Turn into... (mips_target::low_delete_process): ...this. (mips_linux_new_thread): Turn into... (mips_target::low_new_thread): ...this. (mips_linux_delete_thread): Turn into... (mips_target::low_delete_thread): ...this. (mips_linux_new_fork): Turn into... (mips_target::low_new_fork): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-crisv32-low.cc (the_low_target): Ditto. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-low.cc (the_low_target): Ditto. * linux-ppc-low.cc (the_low_target): Ditto. * linux-s390-low.cc (the_low_target): Ditto. * linux-sh-low.cc (the_low_target): Ditto. * linux-tic6x-low.cc (the_low_target): Ditto. * linux-tile-low.cc (the_low_target): Ditto. * linux-xtensa-low.cc (the_low_target): Ditto. --- gdbserver/linux-x86-low.cc | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'gdbserver/linux-x86-low.cc') diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index bf4e6ec..be68e00 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -145,6 +145,16 @@ protected: /* Need to fix up i386 siginfo if host is amd64. */ bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction) override; + + arch_process_info *low_new_process () override; + + void low_delete_process (arch_process_info *info) override; + + void low_new_thread (lwp_info *) override; + + void low_delete_thread (arch_lwp_info *) override; + + void low_new_fork (process_info *parent, process_info *child) override; }; /* The singleton target ops object. */ @@ -693,8 +703,8 @@ x86_target::low_stopped_data_address () /* Called when a new process is created. */ -static struct arch_process_info * -x86_linux_new_process (void) +arch_process_info * +x86_target::low_new_process () { struct arch_process_info *info = XCNEW (struct arch_process_info); @@ -705,16 +715,30 @@ x86_linux_new_process (void) /* Called when a process is being deleted. */ -static void -x86_linux_delete_process (struct arch_process_info *info) +void +x86_target::low_delete_process (arch_process_info *info) { xfree (info); } -/* Target routine for linux_new_fork. */ +void +x86_target::low_new_thread (lwp_info *lwp) +{ + /* This comes from nat/. */ + x86_linux_new_thread (lwp); +} -static void -x86_linux_new_fork (struct process_info *parent, struct process_info *child) +void +x86_target::low_delete_thread (arch_lwp_info *alwp) +{ + /* This comes from nat/. */ + x86_linux_delete_thread (alwp); +} + +/* Target routine for new_fork. */ + +void +x86_target::low_new_fork (process_info *parent, process_info *child) { /* These are allocated by linux_add_process. */ gdb_assert (parent->priv != NULL @@ -2930,11 +2954,6 @@ x86_get_ipa_tdesc_idx (void) struct linux_target_ops the_low_target = { - x86_linux_new_process, - x86_linux_delete_process, - x86_linux_new_thread, - x86_linux_delete_thread, - x86_linux_new_fork, x86_linux_prepare_to_resume, x86_linux_process_qsupported, x86_supports_tracepoints, -- cgit v1.1