Move errno.h to common-defs.h

This commit moves the inclusion of errno.h to common-defs.h and
removes all other inclusions.  Note that prior to this commit errno.h
was included unconditionally in defs.h, whereas in common-defs.h it is
protected by "#ifdef HAVE_ERRNO_H".  This does not change the status
quo, since presumably every platform on which GDB built must have had
errno.h.

gdb/
2014-07-30  Gary Benson  <gbenson@redhat.com>

	* common/common.m4 (AC_CHECK_HEADERS): Add errno.h.
	* configure: Regenerate.
	* config.in: Likewise.
	* common/common-defs.h: Include errno.h.
	* defs.h: Do not include errno.h.
	* ada-typeprint.c: Likewise.
	* c-typeprint.c: Likewise.
	* core-regset.c: Likewise.
	* corefile.c: Likewise.
	* corelow.c: Likewise.
	* event-loop.c: Likewise.
	* f-typeprint.c: Likewise.
	* gnu-nat.c: Likewise.
	* go32-nat.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* m2-typeprint.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* p-typeprint.c: Likewise.
	* procfs.c: Likewise.
	* remote-sim.c: Likewise.
	* rs6000-nat.c: Likewise.
	* target.c: Likewise.
	* typeprint.c: Likewise.
	* ui-file.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.

gdb/gdbserver/
2014-07-30  Gary Benson  <gbenson@redhat.com>

	* configure.ac (AC_CHECK_HEADERS): Remove errno.h.
	* configure: Regenerate.
	* server.h: Do not include errno.h.
	* event-loop.c: Likewise.
	* hostio-errno.c: Likewise.
	* linux-low.c: Likewise.
	* remote-utils.c: Likewise.
	* spu-low.c: Likewise.
	* utils.c: Likewise.
Introduce common/errors.h

This introduces common/errors.h.  This holds some error- and
warning-related declarations that can be used by the code in common.
Clients of the "common" code must provide definitions for these
functions.

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

	* common/errors.h: New file.
	* common/errors.c: Likewise.
	* Makefile.in (HFILES_NO_SRCDIR): Add common/errors.h.
	(COMMON_OBS): Add errors.o.
	(errors.o): New rule.
	* common/common-defs.h: Include errors.h.
	* utils.h (perror_with_name, error, verror, warning, vwarning):
	Don't declare.
	* common/common-utils.h: (malloc_failure, internal_error):
	Likewise.

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

	* Makefile.in (SFILES): Add common/errors.c.
	(OBS): Add errors.o.
	(IPA_OBS): Add errors-ipa.o.
	(errors.o): New rule.
	(errors-ipa.o): Likewise.
	* utils.h (perror_with_name, error, warning): Don't declare.
	* utils.c (warning): Renamed and rewritten as...
	(vwarning): New function.
	(error): Renamed and rewritten as...
	(verror): New function.
	(internal_error): Renamed and rewritten as...
	(internal_verror): New function.
Introduce common-types.h

This introduces common-types.h.  This file defines various standard
types used by gdb and gdbserver.

Currently these types are conditionally defined based on GDBSERVER.
The long term goal is to remove all such tests; however, this is
difficult as currently gdb uses definitions from BFD.  In the meantime
this is still a step in the right direction.

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

	* common/common-types.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add common/common-types.h.
	* common/common-defs.h: Include common-types.h.
	* defs.h (gdb_byte, CORE_ADDR, CORE_ADDR_MAX, LONGEST)
	(ULONGEST): Remove.

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

	* server.h: Add static assertion.
	(gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Remove.
Move print-utils.h to common-defs.h

This commit moves the inclusion of print-utils.h to common-defs.h
and removes all other inclusions.

gdb/
2014-07-30  Gary Benson  <gbenson@redhat.com>

	* common/common-defs.h: Include print-utils.h.
	* utils.h: Do not include print-utils.h.

gdb/gdbserver/
2014-07-30  Gary Benson  <gbenson@redhat.com>

	* utils.h: Do not include print-utils.h.
Introduce and use debug_printf and debug_vprintf

This introduces debug_vprintf (a function that clients of "common" are
expected to implement) and debug_printf (a wrapper for debug_vprintf).
A debug_vprintf function is written from scratch for GDB; gdbserver's
existing debug_printf is repurposed as debug_vprintf.

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-07-30  Tom Tromey  <tromey@redhat.com>
	    Gary Benson  <gbenson@redhat.com>

	* common/common-debug.h: New file.
	* common/common-debug.c: Likewise.
	* debug.c: Likewise.
	* Makefile.in (HFILES_NO_SRCDIR): Add common/common-debug.h.
	(COMMON_OBS): Add common-debug.o and debug.o.
	(common-debug.o): New rule.
	* common/common-defs.h: Include common-debug.h.
	* common/agent.c (debug_agent_print): New function.
	(DEBUG_AGENT): Redefine.
	* nat/i386-dregs.c (debug_printf): Undefine.

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

	* Makefile.in (SFILES): Add common/common-debug.c.
	(OBS): Add common-debug.o.
	(common-debug.o): New rule.
	* debug.h (debug_printf): Don't declare.
	* debug.c (debug_printf): Renamed and rewritten as...
	(debug_vprintf): New function.
Remove simple GDBSERVER uses from common, nat and target

This removes various simple GDBSERVER uses from common, nat and
target.  The simple uses are just cases where the code includes
defs.h or server.h depending on GDBSERVER.

gdb/
2014-07-31  Gary Benson  <gbenson@redhat.com>

	* common/buffer.c: Include common-defs.h instead of
	defs.h or server.h.
	* 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-btrace.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.