From 3a8a0396bed4e9dd87c2df0f68386a0f04dfc824 Mon Sep 17 00:00:00 2001 From: Don Breazeal Date: Tue, 12 May 2015 09:52:44 -0700 Subject: Arch-specific remote follow fork This patch implements the architecture-specific pieces of follow-fork for remote and extended-remote Linux targets, which in the current implementation copyies the parent's debug register state into the new child's data structures. This is required for x86, arm, aarch64, and mips. This follows the native implementation as closely as possible by implementing a new linux_target_ops function 'new_fork', which is analogous to 'linux_nat_new_fork' in linux-nat.c. In gdbserver, the debug registers are stored in the process list, instead of an architecture-specific list, so the function arguments are process_info pointers instead of an lwp_info and a pid as in the native implementation. In the MIPS implementation the debug register mirror is stored differently from x86, ARM, and aarch64, so instead of doing a simple structure assignment I had to clone the list of watchpoint structures. Tested using gdb.threads/watchpoint-fork.exp on x86, and ran manual tests on a MIPS board and an ARM board. Aarch64 hasn't been tested. gdb/gdbserver/ChangeLog: * linux-aarch64-low.c (aarch64_linux_new_fork): New function. (the_low_target) : Initialize new member. * linux-arm-low.c (arm_new_fork): New function. (the_low_target) : Initialize new member. * linux-low.c (handle_extended_wait): Call new target function new_fork. * linux-low.h (struct linux_target_ops) : New member. * linux-mips-low.c (mips_add_watchpoint): New function extracted from mips_insert_point. (the_low_target) : Initialize new member. (mips_linux_new_fork): New function. (mips_insert_point): Call mips_add_watchpoint. * linux-x86-low.c (x86_linux_new_fork): New function. (the_low_target) : Initialize new member. --- gdb/gdbserver/linux-low.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/gdbserver/linux-low.h') diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index 41067d6..3300da9 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -187,6 +187,9 @@ struct linux_target_ops allocate it here. */ void (*new_thread) (struct lwp_info *); + /* Hook to call, if any, when a new fork is attached. */ + void (*new_fork) (struct process_info *parent, struct process_info *child); + /* Hook to call prior to resuming a thread. */ void (*prepare_to_resume) (struct lwp_info *); -- cgit v1.1