From 135340afdf3b333cde11e4429fb16271d5170335 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 3 May 2018 00:37:27 +0100 Subject: linux_nat_target: More low methods This converts the remaining linux-nat.c hooks low_ methods like had been started in a previous patch. The linux_nat_set_foo routines are all gone with this. gdb/ChangeLog: 2018-05-02 Pedro Alves * linux-nat.h (linux_nat_target) : New virtual methods. (linux_nat_set_new_thread, linux_nat_set_delete_thread) (linux_nat_new_fork_ftype, linux_nat_set_new_fork) (linux_nat_forget_process_ftype, linux_nat_set_forget_process) (linux_nat_forget_process, linux_nat_set_siginfo_fixup) (linux_nat_set_prepare_to_resume, linux_nat_set_status_is_event): Delete. * linux-fork.c (delete_fork): Adjust to call low method. * linux-nat.c (linux_nat_new_thread, linux_nat_delete_thread) (linux_nat_new_fork, linux_nat_forget_process_hook) (linux_nat_prepare_to_resume, linux_nat_siginfo_fixup) (linux_nat_status_is_event): (linux_nat_target::follow_fork, lwp_free, add_lwp, detach_one_lwp) (linux_resume_one_lwp_throw, linux_handle_extended_wait): Adjust to call low method. (sigtrap_is_event): Rename to ... (linux_nat_target::low_status_is_event): ... this. (linux_nat_set_status_is_event): Delete. (save_stop_reason, linux_nat_wait_1) (linux_nat_target::mourn_inferior, siginfo_fixup): Adjust to call low methods. (linux_nat_set_new_thread, linux_nat_set_delete_thread) (linux_nat_set_new_fork, linux_nat_set_forget_process) (linux_nat_forget_process, linux_nat_set_siginfo_fixup) (linux_nat_set_prepare_to_resume): Delete. * aarch64-linux-nat.c: All linux_nat_set_* callbacks converted to low virtual methods. * amd64-linux-nat.c: Likewise. * arm-linux-nat.c: Likewise. * i386-linux-nat.c: Likewise. * ia64-linux-nat.c: Likewise. * mips-linux-nat.c: Likewise. * ppc-linux-nat.c: Likewise. * s390-linux-nat.c: Likewise. * sparc64-linux-nat.c: Likewise. * x86-linux-nat.c: Likewise. * x86-linux-nat.h: Include "nat/x86-linux.h". (x86_linux_nat_target) : Override methods. --- gdb/arm-linux-nat.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'gdb/arm-linux-nat.c') diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 91a7049..2d4d807 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -94,6 +94,17 @@ public: bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; const struct target_desc *read_description () override; + + /* Override linux_nat_target low methods. */ + + /* Handle thread creation and exit. */ + void low_new_thread (struct lwp_info *lp) override; + void low_delete_thread (struct arch_lwp_info *lp) override; + void low_prepare_to_resume (struct lwp_info *lp) override; + + /* Handle process creation and exit. */ + void low_new_fork (struct lwp_info *parent, pid_t child_pid) override; + void low_forget_process (pid_t pid) override; }; static arm_linux_nat_target the_arm_linux_nat_target; @@ -815,8 +826,8 @@ arm_linux_process_info_get (pid_t pid) /* Called whenever GDB is no longer debugging process PID. It deletes data structures that keep track of debug register state. */ -static void -arm_linux_forget_process (pid_t pid) +void +arm_linux_nat_target::low_forget_process (pid_t pid) { struct arm_linux_process_info *proc, **proc_link; @@ -1209,8 +1220,8 @@ arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, /* Handle thread creation. We need to copy the breakpoints and watchpoints in the parent thread to the child thread. */ -static void -arm_linux_new_thread (struct lwp_info *lp) +void +arm_linux_nat_target::low_new_thread (struct lwp_info *lp) { int i; struct arch_lwp_info *info = XCNEW (struct arch_lwp_info); @@ -1229,8 +1240,8 @@ arm_linux_new_thread (struct lwp_info *lp) /* Function to call when a thread is being deleted. */ -static void -arm_linux_delete_thread (struct arch_lwp_info *arch_lwp) +void +arm_linux_nat_target::low_delete_thread (struct arch_lwp_info *arch_lwp) { xfree (arch_lwp); } @@ -1238,8 +1249,8 @@ arm_linux_delete_thread (struct arch_lwp_info *arch_lwp) /* Called when resuming a thread. The hardware debug registers are updated when there is any change. */ -static void -arm_linux_prepare_to_resume (struct lwp_info *lwp) +void +arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp) { int pid, i; struct arm_linux_hw_breakpoint *bpts, *wpts; @@ -1292,8 +1303,8 @@ arm_linux_prepare_to_resume (struct lwp_info *lwp) /* linux_nat_new_fork hook. */ -static void -arm_linux_new_fork (struct lwp_info *parent, pid_t child_pid) +void +arm_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid) { pid_t parent_pid; struct arm_linux_debug_reg_state *parent_state; @@ -1324,13 +1335,4 @@ _initialize_arm_linux_nat (void) /* Register the target. */ linux_target = &the_arm_linux_nat_target; add_target (t); - - /* Handle thread creation and exit. */ - linux_nat_set_new_thread (t, arm_linux_new_thread); - linux_nat_set_delete_thread (t, arm_linux_delete_thread); - linux_nat_set_prepare_to_resume (t, arm_linux_prepare_to_resume); - - /* Handle process creation and exit. */ - linux_nat_set_new_fork (t, arm_linux_new_fork); - linux_nat_set_forget_process (t, arm_linux_forget_process); } -- cgit v1.1