Use XCNEW rather than xcalloc (1, ...) in linux-x86-low.c

This commit replaces two uses of xcalloc (1, ...) with XCNEW.

gdb/gdbserver/ChangeLog:

	* linux-x86-low.c (x86_linux_new_process): Use XCNEW.
	(x86_linux_new_thread): Likewise.
Rename 32- and 64-bit Intel files from "i386" to "x86"

This commit renames nine files that contain code used by both 32- and
64-bit Intel ports such that their names are prefixed with "x86"
rather than "i386".  All types, functions and variables within these
files are likewise renamed such that their names are prefixed with
"x86" rather than "i386".  This makes GDB follow the convention used
by gdbserver such that 32-bit Intel code lives in files called
"i386-*", 64-bit Intel code lives in files called "amd64-*", and code
for both 32- and 64-bit Intel lives in files called "x86-*".

This commit only renames OS-independent files.  The Linux ports of
both GDB and gdbserver now follow the i386/amd64/x86 convention fully.
Some ports still use the old convention where "i386" in file/function/
type/variable names can mean "32-bit only" or "32- and 64-bit" but I
don't want to touch ports I can't fully test except where absolutely
necessary.

gdb/ChangeLog:

	* i386-nat.h: Renamed as...
	* x86-nat.h: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.
	* i386-nat.c: Renamed as...
	* x86-nat.c: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.
	* common/i386-xstate.h: Renamed as...
	* common/x86-xstate.h: New file.  All type, function and variable
	name prefixes changed from "i386_" to "x86_".  All references
	updated.
	* nat/i386-cpuid.h: Renamed as...
	* nat/x86-cpuid.h: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.
	* nat/i386-gcc-cpuid.h: Renamed as...
	* nat/x86-gcc-cpuid.h: New file.  All type, function and variable
	name prefixes changed from "i386_" to "x86_".  All references
	updated.
	* nat/i386-dregs.h: Renamed as...
	* nat/x86-dregs.h: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.
	* nat/i386-dregs.c: Renamed as...
	* nat/x86-dregs.c: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.

gdb/gdbserver/ChangeLog:

	* i386-low.h: Renamed as...
	* x86-low.h: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.
	* i386-low.c: Renamed as...
	* x86-low.c: New file.  All type, function and variable name
	prefixes changed from "i386_" to "x86_".  All references updated.
Introduce show_debug_regs

This commit adds a new global flag show_debug_regs to common-debug.h
to replace the flag debug_hw_points used by gdbserver and by the
Linux x86 and AArch64 ports, and to replace the flag maint_show_dr
used by the Linux MIPS port.

gdb/ChangeLog:

	* common/common-debug.h (show_debug_regs): Declare.
	* common/common-debug.c (show_debug_regs): Define.
	* aarch64-linux-nat.c (debug_hw_points): Don't define.  Replace
	all uses with show_debug_regs.  Replace all uses that considered
	debug_hw_points as a multi-value integer with straight boolean
	uses.
	* x86-nat.c (debug_hw_points): Don't define.  Replace all uses
	with show_debug_regs.
	* nat/x86-dregs.c (debug_hw_points): Don't declare.  Replace
	all uses with show_debug_regs.
	* mips-linux-nat.c (maint_show_dr): Don't define.  Replace all
	uses with show_debug_regs.

gdb/gdbserver/ChangeLog:

	* server.h (debug_hw_points): Don't declare.
	* server.c (debug_hw_points): Don't define.  Replace all uses
	with show_debug_regs.
	* linux-aarch64-low.c (debug_hw_points): Don't define.  Replace
	all uses with show_debug_regs.
Introduce target/target.h

This introduces target/target.h.  This file declares some functions
that the shared code can use and that clients must implement.  It also
changes some shared code to use these functions.

gdb/ChangeLog:

	* target/target.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add target/target.h.
	* target.h: Include target/target.h.
	(target_read_memory, target_write_memory): Don't declare.
	* target.c (target_read_uint32): New function.
	* common/agent.c: Include target/target.h.
	[!GDBSERVER]: Don't include target.h.
	(helper_thread_id): Type changed to uint32_t.
	(agent_get_helper_thread_id): Use target_read_uint32.
	(agent_run_command): Always use target_read_memory and
	target_write_memory.
	(agent_capability): Type changed to uint32_t.
	(agent_capability_check): Use target_read_uint32.

gdb/gdbserver/ChangeLog:

	* target.h: Include target/target.h.
	* target.c (target_read_memory, target_read_uint32)
	(target_write_memory): New functions.
Introduce target_{stop,continue}_ptid

This commit introduces two new functions to stop and restart target
processes that shared code can use and that clients must implement.
It also changes some shared code to use these functions.

gdb/ChangeLog:

	* target/target.h (target_stop_ptid, target_continue_ptid):
	Declare.
	* target.c (target_stop_ptid, target_continue_ptid): New
	functions.
	* common/agent.c [!GDBSERVER]: Don't include infrun.h.
	(agent_run_command): Always use target_stop_ptid and
	target_continue_ptid.

gdb/gdbserver/ChangeLog:

	* target.c (target_stop_ptid, target_continue_ptid): New
	functions.
Introduce target/symbol.h

This introduces target/symbol.h.  This file declares a function that
the shared code can use and that the clients must implement.  It also
changes some shared code to use these functions.

gdb/ChangeLog:

	* target/symbol.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add target/symbol.h.
	* target.h: Include target/symbol.h.
	* minsyms.c (find_minimal_symbol_address): New function.
	* common/agent.c: Include target/symbol.h.
	[!GDBSERVER]: Don't include objfiles.h.
	(agent_look_up_symbols): Use find_minimal_symbol_address.

gdb/gdbserver/ChangeLog:

	* symbol.c: New file.
	* Makefile.in (SFILES): Add symbol.c.
	(OBS): Add symbol.o.
Introduce common-regcache.h

This introduces common-regcache.h.  This contains two functions that
allow nat/linux-btrace.c to be simplified.  A better long term
solution would be unify the regcache code, but this is sufficient for
now.

gdb/ChangeLog:

	* common/common-regcache.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add common/common-regcache.h.
	* regcache.h: Include common-regcache.h.
	(regcache_read_pc): Don't declare.
	* regcache.c (get_thread_regcache_for_ptid): New function.
	* nat/linux-btrace.c: Don't include regcache.h.
	Include common-regcache.h.
	(perf_event_read_bts): Use get_thread_regcache_for_ptid.

gdb/gdbserver/ChangeLog:

	* regcache.h: Include common-regcache.h.
	(regcache_read_pc): Don't declare.
	* regcache.c (get_thread_regcache_for_ptid): New function.
Include common-defs.h instead of defs.h/server.h in shared code

This commit makes 19 of the 22 shared .c files in common, nat and
target include common-defs.h instead of defs.h/server.h.  The
remaining three files need slight extra work and are dealt with
in separate commits.

gdb/ChangeLog:

	* common/agent.c: Include common-defs.h.
	Don't include defs.h or server.h.
	* common/buffer.c: Likewise.
	* common/common-debug.c: Likewise.
	* common/common-utils.c: Likewise.
	* common/errors.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/format.c: Likewise.
	* common/gdb_vecs.c: Likewise.
	* common/print-utils.c: Likewise.
	* common/ptid.c: Likewise.
	* common/rsp-low.c: Likewise.
	* common/signals.c: Likewise.
	* common/vec.c: Likewise.
	* common/xml-utils.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-procfs.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/mips-linux-watch.c: Likewise.
	* target/waitstatus.c: Likewise.
Remove GDBSERVER uses from linux-btrace.c

This commit makes nat/linux-btrace.c include common-defs.h rather
than defs.h or server.h.  A couple of minor changes were required
to support this change.

gdb/ChangeLog:

	* nat/linux-btrace.c: Include common-defs.h.
	Don't include defs.h, server.h or gdbthread.h.
	* nat/linux-btrace.h (struct target_ops): New forward declaration.
Remove GDBSERVER uses from x86-dregs.c

This commit makes nat/x86-dregs.c include common-defs.h rather than
defs.h or server.h.  An extra header required including in order to
support this change.

gdb/ChangeLog:

	* nat/x86-dregs.c: Include common-defs.h and break-common.h.
	Don't include defs.h or server.h.
Remove one GDBSERVER use from linux-waitpid.c

This commit makes nat/linux-waitpid.c include common-defs.h rather
than defs.h or server.h.  Some debug code previously only built for
gdbserver is now also built for GDB, and a use of GDBSERVER has had
to remain in order to select the variable used to determine whether
debug printing should be enabled.

gdb/ChangeLog:

	* linux-nat.c (debug_linux_nat): Make nonstatic.
	* nat/linux-waitpid.c: Include common-defs.h.
	Don't include defs.h, server.h or signal.h.
	(debug_linux_waitpid): New macro and extern.
	(linux_debug): Use debug_linux_waitpid and debug_vprintf.