Introduce current_lwp_ptid

This commit introduces a new function, current_lwp_ptid, that
GNU/Linux shared code can use to obtain the ptid of the current
lightweight process.

gdb/ChangeLog:

	* nat/linux-nat.h (current_lwp_ptid): New declaration.
	* linux-nat.c (current_lwp_ptid): New function.
	* x86-linux-nat.c: Include nat/linux-nat.h.
	(x86_linux_dr_get_addr): Use current_lwp_ptid.
	(x86_linux_dr_get_control): Likewise.
	(x86_linux_dr_get_status): Likewise.
	(x86_linux_dr_set_control): Likewise.
	(x86_linux_dr_set_addr): Likewise.

gdb/gdbserver/ChangeLog:

	* linux-low.c (current_lwp_ptid): New function.
	* linux-x86-low.c: Include nat/linux-nat.h.
	(x86_dr_low_get_addr): Use current_lwp_ptid.
	(x86_dr_low_get_control): Likewise.
	(x86_dr_low_get_status): Likewise.
Add x86_debug_reg_state to gdbserver

This commit introduces a new function, x86_debug_reg_state, that
allows shared x86 code to access the local mirror of a process's
debug registers.  This function already existed in GDB and was
in use by GDB's x86_linux_prepare_to_resume.  An equivalent was
written for gdbserver and gdbserver's x86_linux_prepare_to_resume
was modified to use it.
Add iterate_over_lwps to gdbserver

This commit introduces a new function, iterate_over_lwps, that
shared Linux code can use to call a function for each LWP that
matches certain criteria.  This function already existed in GDB
and was in use by GDB's various low-level Linux x86 debug register
setters.  An equivalent was written for gdbserver and gdbserver's
low-level Linux x86 debug register setters were modified to use
it.
Make linux_stop_lwp be a shared function

Both GDB and gdbserver had identical linux_stop_lwp functions.
This commit moves its declaration to nat/linux-nat.h to allow
shared code to use it.
Introduce basic LWP accessors

This commit introduces three accessors that shared Linux code can
use to access fields of struct lwp_info.  The GDB and gdbserver
Linux x86 code is modified to use them.
Change signature of linux_target_ops.new_thread

This commit changes the signature of linux_target_ops.new_thread in
gdbserver to match that used in GDB's equivalent.
Make lwp_info.arch_private handling shared

This commit moves the code to handle lwp_info.arch_private for
Linux x86 into a new shared file, nat/x86-linux.c.
Rename gdbserver's low-level Linux x86 debug register accessors

This commit renames gdbserver's low-level Linux x86 debug register
accessors to the same names used by GDB.
Linux x86 low-level debug register code synchronization

This commit makes several small changes to the low-level debug
register code for Linux x86, making the code in the GDB and
gdbserver implementations identical.
Linux x86 low-level debug register comment synchronization

This commit updates comments in the low-level debug register code for
Linux x86, making GDB's and gdbserver's implementations identical.
Introduce x86_linux_update_debug_registers

This commit moves the entire body of both GDB's and gdbserver's
x86_linux_prepare_to_resume functions into new functions,
x86_linux_update_debug_registers.  This reorganisation allows
all Linux x86 low-level debug register code to be placed in one
shared file, separate from general Linux x86 shared code.
Move low-level Linux x86 debug register code to a shared file

This commit moves the now-identical low-level Linux x86 debug register
code from gdb/x86-linux-nat.c and gdb/gdbserver/linux-x86-low.c into a
new shared file gdb/nat/x86-linux-dregs.c.
Move duplicated Linux x86 code to nat/x86-linux.c

This commit moves two identical functions from gdb/x86-linux-nat.c and
gdb/gdbserver/linux-x86-low.c into the shared file gdb/nat/x86-linux.c.