Introduce and use debug_printf and debug_vprintf

This introduces debug_printf and debug_vprintf, a function that
clients of "common" are expected to implement.  gdbserver's
existing debug_printf is repurposed as debug_vprintf, and a new
wrapper is written.

common/agent.c is changed to use debug_vprintf rather than
defining the macro DEBUG_AGENT depending on GDBSERVER.

nat/i386-dregs.c is changed to use the externally-implemented
debug_printf, rather than defining it itself.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>
	    Gary Benson  <gbenson@redhat.com>

	* common/common-debug.h: New file.
	* utils.h: Include common-debug.h.
	* utils.c (debug_vprintf): New function.
	(debug_printf): Likewise.
	* common/agent.c (debug_agent_print): New function.
	(DEBUG_AGENT): Redefine.
	* nat/i386-dregs.c (debug_printf): Undefine.

gdb/gdbserver/
2014-01-09  Tom Tromey  <tromey@redhat.com>
	    Gary Benson  <gbenson@redhat.com>

	* utils.h: Include common-debug.h.
	* debug.h (debug_printf): Don't declare.
	* debug.c (debug_vprintf): New function.
	(debug_printf): Use the above.
Remove simple GDBSERVER uses from common and nat

This removes various simple GDBSERVER uses from common and nat.  The
simple uses are just cases where the code includes defs.h or server.h
depending on GDBSERVER.  Instead, now the files include the headers
that they require.  Unfortunately for the time being we still need to
check GDBSERVER to decide which gnulib config header to import; but
this is not very significant in the long run.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* common/buffer.c: Don't include server.h or defs.h; update
	includes.
	* common/common-utils.c: Don't include server.h or defs.h; update
	includes.
	* common/filestuff.c: Don't include server.h or defs.h; update
	includes.
	* common/filestuff.h: Include stdio.h.
	* common/format.c: Don't include server.h or defs.h; update
	includes.
	* common/gdb_vecs.c: Don't include server.h or defs.h; update
	includes.
	* common/linux-osdata.c: Don't include server.h or defs.h; update
	includes.
	* common/linux-procfs.c: Don't include server.h or defs.h; update
	includes.
	* common/signals.c: Don't include server.h or defs.h; update
	includes.
	* common/vec.c: Don't include server.h or defs.h; update includes.
	* common/xml-utils.c: Don't include server.h or defs.h; update
	includes.
Remove GDBSERVER use from nat/i386-dregs.c

This removes the use of GDBSERVER from nat/i386-dregs.c.  Neither
defs.h or server.h are included: the specific files required are
listed instead.  Also, a declaration previously made only outside
of gdbserver is made unconditional.

gdb/
2014-06-18  Gary Benson  <gbenson@redhat.com>

	* gdb/nat/i386-dregs.c: Don't include server.h or defs.h; update
	includes.
	(debug_hw_points): Declare regardless of GDBSERVER.
Remove GDBSERVER use from common/linux-ptrace.c

This mostly removes the use of GDBSERVER from common/linux-ptrace.c.
A use must remain for the gnulib header for the time being.

gdb/
2014-01-09  Tom Tromey  <tromey@redhat.com>

	* common/linux-ptrace.c: Don't include server.h or defs.h; update
	includes.
Make btrace-common.h not use GDBSERVER

This changes btrace-common.h not to include defs.h or server.h.
Instead it moves the defs.h include to btrace.c.

gdb/
2014-01-09  Tom Tromey  <tromey@redhat.com>

	* btrace.c: Include defs.h.
	* common/btrace-common.h: Don't include server.h or defs.h.
Add target/target.h

This adds target/target.h.  This file declares some functions that the
"common" code can use and that the clients must implement.  It also
changes code in common to use these functions.

gdb/
2014-01-09  Tom Tromey  <tromey@redhat.com>

	* 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: Don't include server.h or defs.h; update
	includes.
	(agent_get_helper_thread_id): Use target_read_uint32.
	(agent_run_command): Always use target_write_memory,
	target_read_memory.
	(agent_capability_check): Use target_read_uint32.
	* target/target.h: New file.

gdb/gdbserver/
2014-01-09  Tom Tromey  <tromey@redhat.com>

	* target.c (target_read_memory, target_read_uint32)
	(target_write_memory): New functions.
More target unification

This unifies a few more top-level target functions -- target_resume,
target_wait, and target_stop -- and the declaration of the variable
"non_stop".  This follows the usual pattern, where clients of "common"
are expected to define the objects appropriately, thus simplifying
common/agent.c a bit more.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* target/target.h (target_resume, target_wait, target_stop)
	(non_stop): Moved from target.h.
	* target.h (target_resume, target_wait, target_stop, non_stop):
	Move to target/target.h.
	* common/agent.c (agent_run_command): Always use target_resume,
	target_stop, and target_wait.

gdb/gdbserver/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* target.c (target_wait, target_stop, target_resume): New
	functions.
Add target/symbol.h, update users

This adds a new "target/symbol.h" file, that declares a symbol-lookup
function used by code in common.  It follows the usual pattern, where
clients of "common" have their own definitions of this function.  This
simplifies agent.c a bit.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* target/symbol.h: New file.
	* target.h: Include target/symbol.h.
	* target.c (target_look_up_symbol): New function.
	* common/agent.c: Include target/symbol.h.
	(agent_look_up_symbols): Use target_look_up_symbol.

gdb/gdbserver/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* target.c: Include target/symbol.h.
	(target_look_up_symbol): New function.
Finally remove GDBSERVER (mostly) from agent.c

This reduces the use of the GDBSERVER define in agent.c to deciding
which gnulib header to include.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* common/agent.c: Don't include defs.h or server.h.
Introduce common_get_thread_regcache

This introduces common_get_thread_regcache so that we can simplify
common/linux-btrace.c.  A better long term solution would be unify the
regcache code, but this suffices for my current purposes.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* regcache.h (common_get_thread_regcache): Declare.
	* regcache.c (common_get_thread_regcache): New function.
	* common/linux-btrace.h (common_get_thread_regcache): Declare.
	* common/linux-btrace.c (perf_event_read_bts): Use
	common_get_thread_regcache.

gdb/gdbserver/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* regcache.c (common_get_thread_regcache): New function.
Finally remove GDBSERVER (mostly) from linux-btrace.c

This applies the usual GDBSERVER treatment to linux-btrace.c.
Now it is used only to find the gnulib header.

gdb/
2014-06-18  Tom Tromey  <tromey@redhat.com>

	* common/linux-btrace.c: Don't include defs.h or server.h.
	* common/linux-btrace.h (struct target_ops): Declare.