Commit Graph

40 Commits

Author SHA1 Message Date
Pedro Alves b0b92aeb38 Poison non-POD memset & non-trivially-copyable memcpy/memmove
This patch catches invalid initialization of non-POD types with
memset, at compile time.

This is what I used to catch the problems fixed by the previous
patches in the series:

  $ make -k 2>&1 | grep "deleted function"
  src/gdb/breakpoint.c:951:53: error: use of deleted function ‘void* memset(T*, int, size_t) [with T = bp_location; <template-parameter-1-2> = void; size_t = long unsigned int]’
  src/gdb/breakpoint.c:7325:32: error: use of deleted function ‘void* memset(T*, int, size_t) [with T = bp_location; <template-parameter-1-2> = void; size_t = long unsigned int]’
  src/gdb/btrace.c:1153:42: error: use of deleted function ‘void* memset(T*, int, size_t) [with T = btrace_insn; <template-parameter-1-2> = void; size_t = long unsigned int]’
...

gdb/ChangeLog:
2017-04-25  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h: Include "common/poison.h".
	* common/function-view.h: (Not, Or, Requires): Move to traits.h
	and adjust.
	* common/poison.h: New file.
	* common/traits.h: Include <type_traits>.
	(Not, Or, Requires): New, moved from common/function-view.h.
2017-04-25 01:46:19 +01:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Pedro Alves 5cc8c73103 Delete gdb::unique_ptr/gdb::move
Now that we require C++11 and all uses of gdb::unique_ptr and
gdb::move are gone, let's remove their definitions...

With my lazy hat on, I repurposed the header for "generally useful
unique_ptr specializations", and left gdb::unique_xmalloc_ptr in
there.  Not sure whether we it'd be better move it out of the gdb
namespace or leave it be.  I left it because it's less work and avoids
disrupting yet-unmerged patches that use it.

gdb/ChangeLog:
2016-11-15  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h: Update comment.
	* common/gdb_unique_ptr.h: Update header comment and copyright
	year.
	(gdb::unique_ptr, gdb::move): Delete.
2016-11-15 19:54:21 +00:00
Pedro Alves b30f354acb common/common-defs.h: Define __STDC_FORMAT_MACROS as well
Ref: https://sourceware.org/ml/gdb-patches/2016-10/msg00694.html

gdb/ChangeLog:
2016-10-25  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h (__STDC_FORMAT_MACROS): Define.
2016-10-25 13:50:20 +01:00
Pedro Alves 28fe4f87e0 Define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS again.
Revert commit f6abaf7a40 (gdb: no longer define
__STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS), with the tweak suggested
in that commit's log: the macros are now defined before any system
header is included.

This should fix AIX:
  https://sourceware.org/ml/gdb-patches/2016-10/msg00682.html

gdb/ChangeLog:
2016-10-25  Pedro Alves  <palves@redhat.com>

       * common/common-defs.h (__STDC_CONSTANT_MACROS)
       (__STDC_LIMIT_MACROS): Define.
2016-10-25 11:47:18 +01:00
Pedro Alves f6abaf7a40 gdb: no longer define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS
My gnulib fix at:
  https://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00010.html
was merged upstream meanwhile and our gnulib copy now includes it.

As a concidence, Kevin was telling me today that these macros are
causing a build problem on FreeBSD:

common/common-defs.h:47:0: error: "__STDC_CONSTANT_MACROS" redefined [-Werror]
  #define __STDC_CONSTANT_MACROS 1
  /usr/include/sys/cdefs.h:408:0: note: this is the location of the previous definition
  #define __STDC_CONSTANT_MACROS
(and a similar error for __STDC_LIMIT_MACROS)

The problem seems to be that we should be defining these input macros
before including any system header, but, we're not.

So let's just revert e063da6790 ([C++] Define __STDC_CONSTANT_MACROS
/ __STDC_LIMIT_MACROS for stdint.h).  If this causes a problem
somewhere, we can re-define the macros higher up in the file, before
system headers are included.

gdb/ChangeLog:
2016-10-18  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h (__STDC_CONSTANT_MACROS)
	(__STDC_LIMIT_MACROS): Delete.
2016-10-18 20:48:37 +01:00
Pedro Alves da80416474 Introduce gdb::unique_ptr
Many make_cleanup uses in the code base are best eliminated by using a
"owning" smart pointer to manage ownership of the resource
automatically.

The question is _which_ smart pointer.

GDB currently supports building with a C++03 compiler.  We have
std::auto_ptr in C++03, but, as is collective wisdom by now, that's
too easy to misuse, and has therefore been deprecated in C++11 and
finally removed in C++17.

It'd be nice to be able to use std::unique_ptr instead, which is the
modern, safe std::auto_ptr replacement in C++11.

In addition to extra safety -- moving (i.e., transfer of ownership of
the managed pointer between smart pointers) must be explicit --
std::unique_ptr has (among others) one nice feature that std::auto_ptr
doesn't --- ability to specify a custom deleter as template parameter.
In gdb's context, that allows easily creating a smart pointer for
memory allocated with xmalloc -- the smart pointer then knows to
release with xfree instead of delete.  This is particularly
interesting when managing objects allocated in C libraries, and also,
for C++-fying parts of GDB that interact with other parts that still
return objects allocated with xmalloc.

Since std::unique_ptr's API is quite nice, and eventually we'd like to
move to C++11, this patch adds a C++03-compatible smart pointer that
exposes the subset of the std::unique_ptr API that we're interested
in.  An advantage is that whenever we start requiring C++11, we won't
have to learn a new API.  Meanwhile, this allows continuing to support
building with a C++03 compiler.

Since C++03 doesn't support rvalue references (boost gets close to
emulating them, but it's not fully transparent to user code), the
C++03 std::unique_ptr emulation here doesn't try hard to prevent
accidentally moving, which is where most of complication of a more
thorough emulation would be.  Instead, we rely on the fact that GDB
will be usually compiled with a C++11 compiler, and use the real
std::unique_ptr in that case to catch such accidental moves.  IOW, the
goal here is to allow code that would be correct using std::unique_ptr
to be equally correct in C++03 mode, and, just as efficient.

The C++03 version was originally based on GCC 7.0's std::auto_ptr and
then heavily customized to behave more like C++11's std::unique_ptr:

   - Support for custom (stateless) deleters.  (Support for stateful
     deleters could be added, if necessary.)

   - unique_ptr<T[]> partial specialization (auto_ptr<T> does not know
     to use delete[]).

   - Support for all of 'ptr != NULL', 'ptr == NULL' and 'if (ptr)'
     using the safe bool idiom to emulate C++11's explicit bool
     operator.

   - There's no nullptr in C++03, so this allows initialization and
     assignment from NULL instead (std::auto_ptr allows neither).

   - Variable names un-uglified (ie., no leading __ prefix everywhere).

   - Formatting made to follow GDB's coding conventions, including
     comment style.

   - Converting "move" constructors done differently in order to truly
     support:

      unique_ptr<Derived> func_returning_unique_ptr (.....);
      ...
      unique_ptr<Base> ptr = func_returning_unique_ptr (.....);

At this point, it no longer shares much at all with the original file,
but, that's the history.

See comments in the code to find out more.

I thought of putting the "emulation" / shim in the "std" namespace, so
that when we start requiring C++11 at some point, no actual changes to
users of the smart pointer throughout would be necessary.  Putting
things in the std namespace is technically undefined, however in
practice it doesn't cause any issue with any compiler.  However,
thinking that people might be confused with seeing std::unique_ptr and
thinking that we're actually requiring C++11 already, I put the new
types in the "gdb" namespace instead.

For managing xmalloc pointers, this adds a gdb::unique_xmalloc_ptr<T>
"specialization" with a custom xfree deleter.

No actual use of any smart pointer is introduced in this patch.
That'll be done in following patches.

Tested (along with the rest of the series) on:

 - NetBSD 5.1 (gcc70 on the compile farm), w/ gcc 4.1.3
 - x86-64 Fedora 23, gcc 5.3.1 (gnu++03)
 - x86-64 Fedora 23, and gcc 7.0 (gnu++14)

gdb/ChangeLog:
2016-10-18  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h: Include "gdb_unique_ptr.h".
	* common/gdb_unique_ptr.h: New.
2016-10-18 11:42:35 +01:00
Eli Zaretskii 8ffc1bb12a Include strings.h where available
gdb/ChangeLog

2016-10-14  Eli Zaretskii  <eliz@gnu.org>

	* common/common-defs.h [HAVE_STRINGS_H]: Include strings.h if
	available, to get prototypes of 'strcasecmp' and 'strncasecmp'.
2016-10-14 10:08:25 +03:00
Pedro Alves ddb6d63387 gdb: Remove some C compiler support leftovers
Remove some __cplusplus checks, inline EXPORTED_CONST, and update some comments.

gdb/ChangeLog:
2016-10-06  Pedro Alves  <palves@redhat.com>

	* cp-valprint.c (vtbl_ptr_name): Write "extern const" instead of
	EXPORTED_CONST.
	* stub-termcap.c: Remove __cplusplus checks.
	* common/common-defs.h [!__cplusplus] (EXTERN_C, EXTERN_C_PUSH,
	EXTERN_C_POP): Delete.
	* common/common-exceptions.h (GDB_XCPT_SJMP): Update comments.
	(GDB_XCPT) [!__cplusplus]: Delete.
	(throw_exception, throw_exception_sjlj): Update comments.
	* guile/guile-internal.h (as_a_scm_t_subr) [!__cplusplus]: Delete.
	* guile/guile.c (extension_language_guile): Write "extern const"
	instead of EXPORTED_CONST.
	* features/feature_to_c.sh: Don't emit !__cplusplus code.  Write
	"extern const" instead of EXPORTED_CONST.
2016-10-06 19:23:37 +01:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Pedro Alves 91ee7171d0 MinGW and attribute format(printf/gnu_printf)
Cross building gdbserver for --host=x86_64-w64-mingw32 with gcc 4.8.4
20141219 (Fedora MinGW 4.8.4-1.fc20), I get:

  src/gdb/gdbserver/tracepoint.c: In function 'cmd_qtdp':
  src/gdb/gdbserver/tracepoint.c:2577:7: error: unknown conversion type character 'l' in format [-Werror=format=]
	 trace_debug ("Defined %stracepoint %d at 0x%s, "
	 ^
  src/gdb/gdbserver/tracepoint.c:2577:7: error: unknown conversion type character 'l' in format [-Werror=format=]
  src/gdb/gdbserver/tracepoint.c:2577:7: error: too many arguments for format [-Werror=format-extra-args]
  src/gdb/gdbserver/tracepoint.c: In function 'stop_tracing':
  src/gdb/gdbserver/tracepoint.c:3447:7: error: unknown conversion type character 'l' in format [-Werror=format=]
	 trace_debug ("Stopping the trace because "
	 ^
  src/gdb/gdbserver/tracepoint.c:3447:7: error: too many arguments for format [-Werror=format-extra-args]
  src/gdb/gdbserver/tracepoint.c: In function 'collect_data_at_tracepoint':
  src/gdb/gdbserver/tracepoint.c:4651:3: error: unknown conversion type character 'l' in format [-Werror=format=]
     trace_debug ("Making new traceframe for tracepoint %d at 0x%s, hit %" PRIu64,
     ^
  src/gdb/gdbserver/tracepoint.c:4651:3: error: too many arguments for format [-Werror=format-extra-args]
  src/gdb/gdbserver/tracepoint.c: In function 'collect_data_at_step':
  src/gdb/gdbserver/tracepoint.c:4687:3: error: unknown conversion type character 'l' in format [-Werror=format=]
     trace_debug ("Making new step traceframe for "
     ^

trace_debug is a macro that calls:

  static void trace_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);

The calls that fail checking use PRIu64, etc., like:

      trace_debug ("Defined %stracepoint %d at 0x%s, "
		   "enabled %d step %" PRIu64 " pass %" PRIu64,
		   tpoint->type == fast_tracepoint ? "fast "
		   : tpoint->type == static_tracepoint ? "static " : "",
		   tpoint->number, paddress (tpoint->address), tpoint->enabled,
		   tpoint->step_count, tpoint->pass_count);

gnulib's stdio/printf module replacements may make %llu, etc. work on
mingw, instead of the MS-specific %I64u, and thus may make PRIu64
expand to %llu.  However, gcc isn't aware of that, because libiberty's
ansidecl.h defines ATTRIBUTE_PRINTF as using attribute format(printf).
But, with that format, gcc checks for MS-style format strings (%I64u).
In order to have gcc expect gnu/standard formats, we need to use
gnu_printf format instead.  Which version to use (printf/gnu_printf)
depends on msvcrt and mingw version, and so gnulib has a
configure-time check, and defines _GL_ATTRIBUTE_FORMAT_PRINTF
accordingly.

Since _GL_ATTRIBUTE_FORMAT_PRINTF is compatible with ATTRIBUTE_PRINTF,
the fix is simply to make use of the former.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h (ATTRIBUTE_PRINTF): Redefine in terms of
	_GL_ATTRIBUTE_FORMAT_PRINTF after including ansidecl.h.
2015-11-17 15:22:39 +00:00
Pedro Alves e063da6790 [C++] Define __STDC_CONSTANT_MACROS / __STDC_LIMIT_MACROS for stdint.h
With some toolchains, building in C++ mode stumbles on many instances
of:

 In file included from ../../src/gdb/../include/splay-tree.h:43:0,
                  from ../../src/gdb/dcache.c:26:
 build-gnulib/import/inttypes.h:61:3: error: #error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
  # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
    ^
 make: *** [dcache.o] Error 1

That's:

 #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 #endif

I see it when cross building for --host=x86_64-w64-mingw32 using
Fedora 20's g++ (gcc version 4.8.4 20141219 (Fedora MinGW
4.8.4-1.fc20)), Simon reports seeing this on several cross compilers
too.

The issue is that on some hosts that predate C++11, when using C++ one
must define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS to make visible
the definitions of INTMAX_C / INTMAX_MAX etc.

This was a C99 requirement that later C++11 -- the first to define
stdint.h -- removed, and then C11 removed it as well.

https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html
says that gnulib's stdint.h fixes this, but because we run gnulib's
configure tests with a C compiler, gnulib determines that mingw's
stdint.h is C99-compliant, and doesn't actually replace it.  Actually,
even though configuring gnulib with a C++ compiler does result in
gnulib replacing stdint.h, the resulting replacement is broken for
mingw, because it defines uintptr_t incorrectly.  I sent a gnulib
patch upstream to fix that, here:

  https://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00004.html

but then even with that, gnulib still stumbles on other
configured-with-C++-compiler problems.

So for now, until gnulib + C++ is fixed upstream and then gdb's copy
is updated, which may take a while, I think it's best to keep
configuring gnulib in C, and define
__STDC_LIMIT_MACROS/__STDC_CONSTANT_MACROS ourselves, just like C99
intended.

gdb/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h (__STDC_CONSTANT_MACROS)
	(__STDC_LIMIT_MACROS): Define before including stdint.h.
2015-11-17 15:22:16 +00:00
Jan Kratochvil 03aef70fec Move utility functions to common/
gdb/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	Move utility functions to common/.
	* cli/cli-utils.c (skip_spaces, skip_spaces_const, skip_to_space_const):
	Move defs to common/common-utils.c.
	* cli/cli-utils.h (skip_spaces, skip_spaces_const, skip_to_space)
	(skip_to_space_const): Move decls to common/common-utils.h.
	* common/common-defs.h: Move include of common-types.h before
	common-utils.h.
	* common/common-utils.c: Include host-defs.h and ctype.h.
	(HIGH_BYTE_POSN, is_digit_in_base, digit_to_int, strtoulst): Move
	from utils.c.
	(skip_spaces, skip_spaces_const, skip_to_space_const): Move from
	cli/cli-utils.c.
	* common/common-utils.h (strtoulst): Move decl from utils.h.
	(skip_spaces, skip_spaces_const, skip_to_space, skip_to_space_const):
	Move from cli/cli-utils.h.
	* common/host-defs.h: Include limits.h.
	(TARGET_CHAR_BIT, HOST_CHAR_BIT): Moved from defs.h.
	(skip_spaces, skip_spaces_const): Move decls from cli/cli-utils.h.
	* defs.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Move to
	common/common-utils.h.
	* utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int)
	(strtoulst): Move to common/common-utils.c.
	* utils.h (strtoulst): Moved decl to common/common-utils.h.
2015-06-15 17:04:56 +02:00
Pedro Alves 3c14e5a39b Make functions and variables exported by the IPA be extern "C"
Functions and variables that are exported by the IPA DSO (that
GDBserver needs to look up) should have "C" mangling, thus be declared
with extern "C".

Function and variable declarations need the extern "C" marker, but
variable definitions can't be marked extern, so the patch splits
IP_AGENT_EXPORT into three.

Building in C++ mode revealed that a few variables were missing
IP_AGENT_EXPORT, thus the IPA has been broken when stripped, even in C
mode...  So this ends being a bug fix as well.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* common/agent.h (IPA_SYM_EXPORTED_NAME): New.
	(IPA_SYM): Use it.
	* common/common-defs.h (EXTERN_C_PUSH, EXTERN_C_POP): New macros.

gdb/gdbserver/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* linux-amd64-ipa.c (gdb_agent_get_raw_reg): Use
	IP_AGENT_EXPORT_FUNC.
	* linux-i386-ipa.c (gdb_agent_get_raw_reg): Use
	IP_AGENT_EXPORT_FUNC.
	* tracepoint.c (ATTR_USED, ATTR_NOINLINE, ATTR_CONSTRUCTOR)
	(IP_AGENT_EXPORT): Delete.
	(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
	(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
	(gdb_trampoline_buffer_error, collecting, gdb_collect)
	(stop_tracing, flush_trace_buffer, about_to_request_buffer_space)
	(trace_buffer_is_full, stopping_tracepoint, expr_eval_result)
	(error_tracepoint, tracepoints, tracing, trace_buffer_ctrl)
	(trace_buffer_ctrl_curr, trace_buffer_lo, trace_buffer_hi)
	(traceframe_read_count, traceframe_write_count)
	(traceframes_created, trace_state_variables, get_raw_reg)
	(get_trace_state_variable_value, set_trace_state_variable_value)
	(ust_loaded, helper_thread_id, cmd_buf): Use
	IPA_SYM_EXPORTED_NAME.
	(stop_tracing, flush_trace_buffer): Use IP_AGENT_EXPORT_FUNC.
	(tracepoints) Use IP_AGENT_EXPORT_VAR.
	(stopping_tracepoint, trace_buffer_is_full, expr_eval_result): Use
	IP_AGENT_EXPORT_VAR and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(last_tracepoint): Move into !IN_PROCESS_AGENT block.
	(error_tracepoint): Use IP_AGENT_EXPORT_VAR and wrap in
	EXTERN_C_PUSH/EXTERN_C_POP.
	(trace_state_variables): Use IP_AGENT_EXPORT_VAR.
	(trace_buffer_lo, trace_buffer_hi): Use IP_AGENT_EXPORT_VAR and
	wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(trace_buffer_ctrl, trace_buffer_ctrl_curr)
	(traceframe_write_count, traceframe_read_count)
	(traceframes_created, tracing): Use IP_AGENT_EXPORT_VAR.
	(about_to_request_buffer_space, get_trace_state_variable_value)
	(set_trace_state_variable_value): Use IP_AGENT_EXPORT_FUNC.
	(collecting): Use IP_AGENT_EXPORT_VAR and wrap in
	EXTERN_C_PUSH/EXTERN_C_POP.
	(gdb_collect): Use IP_AGENT_EXPORT_FUNC.
	(ust_loaded, cmd_buf): Use IP_AGENT_EXPORT_VAR.
	(helper_thread_id, gdb_agent_capability): Use IP_AGENT_EXPORT_VAR
	and wrap in EXTERN_C_PUSH/EXTERN_C_POP.
	(gdb_tp_heap_buffer, gdb_jump_pad_buffer, gdb_jump_pad_buffer_end)
	(gdb_trampoline_buffer, gdb_trampoline_buffer_end)
	(gdb_trampoline_buffer_error): Use IP_AGENT_EXPORT_VAR.
	* tracepoint.h (ATTR_USED, ATTR_NOINLINE, EXPORTED_SYMBOL):
	Define.
	(IP_AGENT_EXPORT_FUNC, IP_AGENT_EXPORT_VAR)
	(IP_AGENT_EXPORT_VAR_DECL): Define.
	(tracing): Declare.
	(gdb_agent_get_raw_reg): Declare.
2015-02-27 17:27:29 +00:00
Pedro Alves 56000a9801 Add extern "C" to declarations of C symbols
These symbols are defined in C code, so in C++ mode we need to use
extern "C" to declare them.  As extern "C" can't be used inside a
function's scope, we move the declarations to the global scope at the
same time.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* cli-out.c (_rl_erase_entire_line): Move declaration out of
	cli_mld_erase_entire_line, and make it extern "C".
	* common/common-defs.h (EXTERN_C): New.
	* completer.c (_rl_completion_prefix_display_length)
	(_rl_print_completions_horizontally, QSFUNC): Move declarations
	out of gdb_display_match_list_1.
	(_rl_qsort_string_compare): Move declaration out of
	gdb_display_match_list_1, and make it extern "C".
	* defs.h (re_comp): Use EXTERN_C.
	* maint.c (_mcleanup): Move declaration out of mcleanup_wrapper,
	and make it extern "C".
	(monstartup): Move declaration out of maintenance_set_profile_cmd,
	and make it extern "C".
	(main): Move declaration out of maintenance_set_profile_cmd.
	* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string): Use
	EXTERN_C.
2015-02-27 17:26:16 +00:00
Sergio Durigan Junior 8cc73a3902 Move code to disable ASR to nat/
This patch moves the shared code present on
gdb/linux-nat.c:linux_nat_create_inferior and
gdb/gdbserver/linux-low.c:linux_create_inferior to
nat/linux-personality.c.  This code is responsible for disabling
address space randomization based on user setting, and using
<sys/personality.h> to do that.  I decided to put the prototype of the
maybe_disable_address_space_randomization on nat/linux-osdata.h
because it seemed the best place to put it.

I regression-tested this patch on Fedora 20 x86_64, and found no
regressions.

gdb/ChangeLog
2015-01-15  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-personality.h.
	(linux-personality.o): New rule.
	* common/common-defs.h: Include <stdint.h>.
	* config/aarch64/linux.mh (NATDEPFILES): Include
	linux-personality.o.
	* config/alpha/alpha-linux.mh (NATDEPFILES): Likewise.
	* config/arm/linux.mh (NATDEPFILES): Likewise.
	* config/i386/linux64.mh (NATDEPFILES): Likewise.
	* config/i386/linux.mh (NATDEPFILES): Likewise.
	* config/ia64/linux.mh (NATDEPFILES): Likewise.
	* config/m32r/linux.mh (NATDEPFILES): Likewise.
	* config/m68k/linux.mh (NATDEPFILES): Likewise.
	* config/mips/linux.mh (NATDEPFILES): Likewise.
	* config/pa/linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
	* config/powerpc/spu-linux.mh (NATDEPFILES): Likewise.
	* config/s390/linux.mh (NATDEPFILES): Likewise.
	* config/sparc/linux64.mh (NATDEPFILES): Likewise.
	* config/sparc/linux.mh (NATDEPFILES): Likewise.
	* config/tilegx/linux.mh (NATDEPFILES): Likewise.
	* config/xtensa/linux.mh (NATDEPFILES): Likewise.
	* defs.h: Remove #include <stdint.h> (moved to
	common/common-defs.h).
	* linux-nat.c: Include nat/linux-personality.h.  Remove #include
	<sys/personality.h>; do not define ADDR_NO_RANDOMIZE (moved to
	nat/linux-personality.c).
	(linux_nat_create_inferior): Remove code to disable address space
	randomization (moved to nat/linux-personality.c).  Create cleanup
	to disable address space randomization.
	* nat/linux-personality.c: New file.
	* nat/linux-personality.h: Likewise.

gdb/gdbserver/ChangeLog
2015-01-15  Sergio Durigan Junior  <sergiodj@redhat.com>

	* Makefile.in (SFILES): Add linux-personality.c.
	(linux-personality.o): New rule.
	* configure.srv (srv_linux_obj): Add linux-personality.o to the
	list of objects to be built.
	* linux-low.c: Include nat/linux-personality.h.
	(linux_create_inferior): Remove code to disable address space
	randomization (moved to ../nat/linux-personality.c).  Create
	cleanup to disable address space randomization.
2015-01-15 15:10:49 -05:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Yao Qi 9c232dda88 Include alloca.h unconditionally
Since gnulib alloca module was imported, we can include alloca.h in
both gdb and gdbserver unconditionally, so this patch adds inclusion
of alloca.h in common-defs.h.  This patch also removes AC_FUNC_ALLOCA
in configure.ac because we don't need to check alloca any more.

This patch below is removed in fact.

  [RFA/commit] include alloca.h if available.
  https://www.sourceware.org/ml/gdb-patches/2010-08/msg00566.html

Since alloca.h is from gnulib now, we don't have to check malloc.h in
configure and include malloc.h in code.  This patch also remove them
too.

gdb:

2014-11-21  Yao Qi  <yao@codesourcery.com>

	* common/common-defs.h: Include alloca.h
	* configure.ac: Don't invoke AC_FUNC_ALLOCA.
	* configure: Re-generated.
	* defs.h: Remove code handling alloca.
	* utils.c (gdb_realpath): Don't check HAVE_ALLOCA is defined
	or not.

gdb/gdbserver:

2014-11-21  Yao Qi  <yao@codesourcery.com>

	* configure.ac: Don't invoke AC_FUNC_ALLOCA.
	(AC_CHECK_HEADERS): Remove malloc.h.
	* configure: Re-generated.
	* config.in: Re-generated.
	* server.h: Don't include alloca.h and malloc.h.
	* gdbreplay.c: Don't check HAVE_ALLOCA_H is defined.
	Don't include malloc.h.
2014-11-21 22:05:41 +08:00
Joel Brobecker 355e210214 common-defs.h: include <stdarg.h> before <stdio.h>
When trying to build gdbserver on ppc-lynx178, the compiler reports
while trying to compile gdbserver/ax.c that vsprintf is not declared.
Looking at my C99 reference manual (a draft), I see the following
synopsis:

    #include <stdarg.h>
    #include <stdio.h>
    int vsprintf(char * restrict s, [etc]);

Looking at stdio.h on LynxOS-178, if found where vsprintf gets
declared:

    #if defined(__varargs_h) || defined(__stdarg_h) \
            || defined(_VARARGS_H) || defined(_STDARG_H)
    extern int vsprintf             _AP((char *, const char *, va_list));
    #endif

Digging further, I noticed that common-defs.h, which is included
via server.h, includes stdarg.h after including stdio, explaining
why vsprintf does not get declared in this case.

This patch fixes the problem by including stdarg.h before stdio.h.

gdb/ChangeLog:

        * common/common-defs.h: Move <stdarg.h> #include ahead of
        <stdio.h> #include.

Tested on x86_64-linux.
2014-11-14 21:00:45 +04:00
Gary Benson a442d0713a Include common-exceptions.h in common-defs.h
This commit includes common-exceptions.h in common-defs.h and removes
all other inclusions.

gdb/ChangeLog:

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

gdb/gdbserver/ChangeLog:

	* server.h: Do not include common-exceptions.h.
2014-10-08 09:33:22 +01:00
Gary Benson 6f1947e8a2 Include cleanups.h in common-defs.h
This commit includes cleanups.h in common-defs.h and removes all other
inclusions.

gdb/ChangeLog:

	* common/common-defs.h: Include cleanups.h.
	* common/common-exceptions.c: Do not include cleanups.h.
	* utils.h: Likewise.

gdb/gdbserver/ChangeLog:

	* server.h: Do not include cleanups.h.
2014-10-08 09:33:22 +01:00
Gary Benson 34abf635b3 Introduce common-debug.h
This introduces common-debug.h.  This holds the functions debug_printf
and debug_vprintf, two functions that the common code can use to print
debugging messages.  Clients of the common code are expected to
implement debug_vprintf; a debug_vprintf function is written from
scratch for GDB, and 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/ChangeLog:

	* common/common-debug.h: New file.
	* common/common-debug.c: Likewise.
	* debug.c: Likewise.
	* Makefile.in (SFILES): Add common/common-debug.c.
	(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_printf): New function.
	(DEBUG_AGENT): Redefine.
	* nat/i386-dregs.c (debug_printf): Undefine.

gdb/gdbserver/ChangeLog:

	* 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.
2014-08-19 10:07:20 +01:00
Gary Benson f6e94d78b2 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/ChangeLog:

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

gdb/gdbserver/ChangeLog:

	* utils.h: Do not include print-utils.h.
2014-08-19 10:07:19 +01:00
Gary Benson 9239eeabe3 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/ChangeLog:

	* 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/ChangeLog:

	* server.h: Add static assertion.
	(gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Remove.
2014-08-19 10:07:19 +01:00
Gary Benson ef87c8bbe7 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, nat and
target.  Some of the declared functions must be provided by the client
as documented by the header file comments.

gdb/ChangeLog:

	* common/errors.h: New file.
	* common/errors.c: Likewise.
	* Makefile.in (SFILES): Add common/errors.c.
	(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/ChangeLog:

	* 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.
2014-08-19 10:07:18 +01:00
Gary Benson bb974a2493 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
server.h included errno.h protected by "#ifdef HAVE_ERRNO_H".
This protection was added with the Windows CE port, which is
currently broken.  Since no other platform needs this, I have
removed the protection and the configury to support it.

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

	* 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-08-07  Gary Benson  <gbenson@redhat.com>

	* configure.ac (AC_CHECK_HEADERS): Remove errno.h.
	* configure: Regenerate.
	* config.in: Likewise.
	* 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.
	* gdbreplay.c: Unconditionally include errno.h.
2014-08-07 09:06:48 +01:00
Gary Benson 6d3d12ebef Include string.h in common-defs.h
This commit includes string.h in common-defs.h and removes all other
inclusions.

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

	* common/common-defs.h: Include string.h.
	* aarch64-tdep.c: Do not include string.h.
	* ada-exp.y: Likewise.
	* ada-lang.c: Likewise.
	* ada-lex.l: Likewise.
	* ada-typeprint.c: Likewise.
	* ada-valprint.c: Likewise.
	* aix-thread.c: Likewise.
	* alpha-linux-tdep.c: Likewise.
	* alpha-mdebug-tdep.c: Likewise.
	* alpha-nat.c: Likewise.
	* alpha-osf1-tdep.c: Likewise.
	* alpha-tdep.c: Likewise.
	* alphanbsd-tdep.c: Likewise.
	* amd64-dicos-tdep.c: Likewise.
	* amd64-linux-tdep.c: Likewise.
	* amd64-nat.c: Likewise.
	* amd64-sol2-tdep.c: Likewise.
	* amd64fbsd-tdep.c: Likewise.
	* amd64obsd-tdep.c: Likewise.
	* arch-utils.c: Likewise.
	* arm-linux-nat.c: Likewise.
	* arm-linux-tdep.c: Likewise.
	* arm-tdep.c: Likewise.
	* arm-wince-tdep.c: Likewise.
	* armbsd-tdep.c: Likewise.
	* armnbsd-nat.c: Likewise.
	* armnbsd-tdep.c: Likewise.
	* armobsd-tdep.c: Likewise.
	* avr-tdep.c: Likewise.
	* ax-gdb.c: Likewise.
	* ax-general.c: Likewise.
	* bcache.c: Likewise.
	* bfin-tdep.c: Likewise.
	* breakpoint.c: Likewise.
	* build-id.c: Likewise.
	* buildsym.c: Likewise.
	* c-exp.y: Likewise.
	* c-lang.c: Likewise.
	* c-typeprint.c: Likewise.
	* c-valprint.c: Likewise.
	* charset.c: Likewise.
	* cli-out.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* cli/cli-decode.c: Likewise.
	* cli/cli-dump.c: Likewise.
	* cli/cli-interp.c: Likewise.
	* cli/cli-logging.c: Likewise.
	* cli/cli-script.c: Likewise.
	* cli/cli-setshow.c: Likewise.
	* cli/cli-utils.c: Likewise.
	* coffread.c: Likewise.
	* common/agent.c: Likewise.
	* common/buffer.c: Likewise.
	* common/buffer.h: Likewise.
	* common/common-utils.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/format.c: Likewise.
	* common/print-utils.c: Likewise.
	* common/rsp-low.c: Likewise.
	* common/signals.c: Likewise.
	* common/vec.h: Likewise.
	* common/xml-utils.c: Likewise.
	* core-regset.c: Likewise.
	* corefile.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-name-parser.y: Likewise.
	* cp-support.c: Likewise.
	* cp-valprint.c: Likewise.
	* cris-tdep.c: Likewise.
	* d-exp.y: Likewise.
	* darwin-nat.c: Likewise.
	* dbxread.c: Likewise.
	* dcache.c: Likewise.
	* demangle.c: Likewise.
	* dicos-tdep.c: Likewise.
	* disasm.c: Likewise.
	* doublest.c: Likewise.
	* dsrec.c: Likewise.
	* dummy-frame.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* elfread.c: Likewise.
	* environ.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* exceptions.c: Likewise.
	* exec.c: Likewise.
	* expprint.c: Likewise.
	* f-exp.y: Likewise.
	* f-lang.c: Likewise.
	* f-typeprint.c: Likewise.
	* f-valprint.c: Likewise.
	* fbsd-nat.c: Likewise.
	* findcmd.c: Likewise.
	* findvar.c: Likewise.
	* fork-child.c: Likewise.
	* frame.c: Likewise.
	* frv-linux-tdep.c: Likewise.
	* frv-tdep.c: Likewise.
	* gdb.c: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbarch.c: Likewise.
	* gdbarch.sh: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-nat.c: Likewise.
	* gnu-v2-abi.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-exp.y: Likewise.
	* go-lang.c: Likewise.
	* go32-nat.c: Likewise.
	* guile/guile.c: Likewise.
	* guile/scm-auto-load.c: Likewise.
	* hppa-hpux-tdep.c: Likewise.
	* hppa-linux-nat.c: Likewise.
	* hppanbsd-tdep.c: Likewise.
	* hppaobsd-tdep.c: Likewise.
	* i386-cygwin-tdep.c: Likewise.
	* i386-dicos-tdep.c: Likewise.
	* i386-linux-tdep.c: Likewise.
	* i386-nto-tdep.c: Likewise.
	* i386-sol2-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* i386bsd-tdep.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* i386nbsd-tdep.c: Likewise.
	* i386obsd-tdep.c: Likewise.
	* i387-tdep.c: Likewise.
	* ia64-libunwind-tdep.c: Likewise.
	* ia64-linux-nat.c: Likewise.
	* inf-child.c: Likewise.
	* inf-ptrace.c: Likewise.
	* inf-ttrace.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* inflow.c: Likewise.
	* infrun.c: Likewise.
	* interps.c: Likewise.
	* iq2000-tdep.c: Likewise.
	* irix5-nat.c: Likewise.
	* jv-exp.y: Likewise.
	* jv-lang.c: Likewise.
	* jv-typeprint.c: Likewise.
	* jv-valprint.c: Likewise.
	* language.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Likewise.
	* lm32-tdep.c: Likewise.
	* m2-exp.y: Likewise.
	* m2-typeprint.c: Likewise.
	* m32c-tdep.c: Likewise.
	* m32r-linux-nat.c: Likewise.
	* m32r-linux-tdep.c: Likewise.
	* m32r-rom.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m68hc11-tdep.c: Likewise.
	* m68k-tdep.c: Likewise.
	* m68kbsd-tdep.c: Likewise.
	* m68klinux-nat.c: Likewise.
	* m68klinux-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* machoread.c: Likewise.
	* macrocmd.c: Likewise.
	* main.c: Likewise.
	* mdebugread.c: Likewise.
	* mem-break.c: Likewise.
	* memattr.c: Likewise.
	* memory-map.c: Likewise.
	* mep-tdep.c: Likewise.
	* mi/mi-cmd-break.c: Likewise.
	* mi/mi-cmd-disas.c: Likewise.
	* mi/mi-cmd-env.c: Likewise.
	* mi/mi-cmd-stack.c: Likewise.
	* mi/mi-cmd-var.c: Likewise.
	* mi/mi-cmds.c: Likewise.
	* mi/mi-console.c: Likewise.
	* mi/mi-getopt.c: Likewise.
	* mi/mi-interp.c: Likewise.
	* mi/mi-main.c: Likewise.
	* mi/mi-parse.c: Likewise.
	* microblaze-rom.c: Likewise.
	* microblaze-tdep.c: Likewise.
	* mingw-hdep.c: Likewise.
	* minidebug.c: Likewise.
	* minsyms.c: Likewise.
	* mips-irix-tdep.c: Likewise.
	* mips-linux-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mips64obsd-tdep.c: Likewise.
	* mipsnbsd-tdep.c: Likewise.
	* mipsread.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* mn10300-tdep.c: Likewise.
	* monitor.c: Likewise.
	* moxie-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-procfs.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/linux-waitpid.c: Likewise.
	* nbsd-tdep.c: Likewise.
	* nios2-linux-tdep.c: Likewise.
	* nto-procfs.c: Likewise.
	* nto-tdep.c: Likewise.
	* objc-lang.c: Likewise.
	* objfiles.c: Likewise.
	* opencl-lang.c: Likewise.
	* osabi.c: Likewise.
	* osdata.c: Likewise.
	* p-exp.y: Likewise.
	* p-lang.c: Likewise.
	* p-typeprint.c: Likewise.
	* parse.c: Likewise.
	* posix-hdep.c: Likewise.
	* ppc-linux-nat.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* ppcfbsd-tdep.c: Likewise.
	* ppcnbsd-tdep.c: Likewise.
	* ppcobsd-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* procfs.c: Likewise.
	* prologue-value.c: Likewise.
	* python/py-auto-load.c: Likewise.
	* python/py-gdb-readline.c: Likewise.
	* ravenscar-thread.c: Likewise.
	* regcache.c: Likewise.
	* registry.c: Likewise.
	* remote-fileio.c: Likewise.
	* remote-m32r-sdi.c: Likewise.
	* remote-mips.c: Likewise.
	* remote-notif.c: Likewise.
	* remote-sim.c: Likewise.
	* remote.c: Likewise.
	* reverse.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* ser-base.c: Likewise.
	* ser-go32.c: Likewise.
	* ser-mingw.c: Likewise.
	* ser-pipe.c: Likewise.
	* ser-tcp.c: Likewise.
	* ser-unix.c: Likewise.
	* serial.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* shnbsd-tdep.c: Likewise.
	* skip.c: Likewise.
	* sol-thread.c: Likewise.
	* solib-dsbt.c: Likewise.
	* solib-frv.c: Likewise.
	* solib-osf.c: Likewise.
	* solib-som.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-target.c: Likewise.
	* solib.c: Likewise.
	* somread.c: Likewise.
	* source.c: Likewise.
	* sparc-nat.c: Likewise.
	* sparc-sol2-tdep.c: Likewise.
	* sparc-tdep.c: Likewise.
	* sparc64-tdep.c: Likewise.
	* sparc64fbsd-tdep.c: Likewise.
	* sparc64nbsd-tdep.c: Likewise.
	* sparcnbsd-tdep.c: Likewise.
	* spu-linux-nat.c: Likewise.
	* spu-multiarch.c: Likewise.
	* spu-tdep.c: Likewise.
	* stabsread.c: Likewise.
	* stack.c: Likewise.
	* std-regs.c: Likewise.
	* symfile.c: Likewise.
	* symmisc.c: Likewise.
	* symtab.c: Likewise.
	* target.c: Likewise.
	* thread.c: Likewise.
	* tilegx-linux-nat.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* top.c: Likewise.
	* tracepoint.c: Likewise.
	* tui/tui-command.c: Likewise.
	* tui/tui-data.c: Likewise.
	* tui/tui-disasm.c: Likewise.
	* tui/tui-file.c: Likewise.
	* tui/tui-layout.c: Likewise.
	* tui/tui-out.c: Likewise.
	* tui/tui-regs.c: Likewise.
	* tui/tui-source.c: Likewise.
	* tui/tui-stack.c: Likewise.
	* tui/tui-win.c: Likewise.
	* tui/tui-windata.c: Likewise.
	* tui/tui-winsource.c: Likewise.
	* typeprint.c: Likewise.
	* ui-file.c: Likewise.
	* ui-out.c: Likewise.
	* user-regs.c: Likewise.
	* utils.c: Likewise.
	* v850-tdep.c: Likewise.
	* valarith.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* vax-tdep.c: Likewise.
	* vaxnbsd-tdep.c: Likewise.
	* vaxobsd-tdep.c: Likewise.
	* windows-nat.c: Likewise.
	* xcoffread.c: Likewise.
	* xml-support.c: Likewise.
	* xstormy16-tdep.c: Likewise.
	* xtensa-linux-nat.c: Likewise.

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

	* server.h: Do not include string.h.
	* event-loop.c: Likewise.
	* linux-low.c: Likewise.
	* regcache.c: Likewise.
	* remote-utils.c: Likewise.
	* spu-low.c: Likewise.
	* utils.c: Likewise.
2014-08-07 09:06:47 +01:00
Gary Benson dccbb60975 Include gdb_assert.h in common-defs.h
This commit includes gdb_assert.h in common-defs.h and removes all
other inclusions.

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

	* common/common-defs.h: Include gdb_assert.h.
	* aarch64-tdep.c: Do not include gdb_assert.h.
	* addrmap.c: Likewise.
	* aix-thread.c: Likewise.
	* alpha-linux-tdep.c: Likewise.
	* alpha-mdebug-tdep.c: Likewise.
	* alphanbsd-tdep.c: Likewise.
	* amd64-nat.c: Likewise.
	* amd64-tdep.c: Likewise.
	* amd64bsd-nat.c: Likewise.
	* amd64fbsd-nat.c: Likewise.
	* amd64fbsd-tdep.c: Likewise.
	* amd64nbsd-nat.c: Likewise.
	* amd64nbsd-tdep.c: Likewise.
	* amd64obsd-nat.c: Likewise.
	* amd64obsd-tdep.c: Likewise.
	* arch-utils.c: Likewise.
	* arm-tdep.c: Likewise.
	* armbsd-tdep.c: Likewise.
	* auxv.c: Likewise.
	* bcache.c: Likewise.
	* bfin-tdep.c: Likewise.
	* blockframe.c: Likewise.
	* breakpoint.c: Likewise.
	* bsd-kvm.c: Likewise.
	* bsd-uthread.c: Likewise.
	* buildsym.c: Likewise.
	* c-exp.y: Likewise.
	* c-lang.c: Likewise.
	* charset.c: Likewise.
	* cleanups.c: Likewise.
	* cli-out.c: Likewise.
	* cli/cli-decode.c: Likewise.
	* cli/cli-dump.c: Likewise.
	* cli/cli-logging.c: Likewise.
	* cli/cli-script.c: Likewise.
	* cli/cli-utils.c: Likewise.
	* coffread.c: Likewise.
	* common/common-utils.c: Likewise.
	* common/queue.h: Likewise.
	* common/signals.c: Likewise.
	* common/vec.h: Likewise.
	* complaints.c: Likewise.
	* completer.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-name-parser.y: Likewise.
	* cp-namespace.c: Likewise.
	* cp-support.c: Likewise.
	* cris-tdep.c: Likewise.
	* dbxread.c: Likewise.
	* dictionary.c: Likewise.
	* doublest.c: Likewise.
	* dsrec.c: Likewise.
	* dummy-frame.c: Likewise.
	* dwarf2-frame-tailcall.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2expr.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* exceptions.c: Likewise.
	* expprint.c: Likewise.
	* f-valprint.c: Likewise.
	* fbsd-nat.c: Likewise.
	* findvar.c: Likewise.
	* frame-unwind.c: Likewise.
	* frame.c: Likewise.
	* frv-tdep.c: Likewise.
	* gcore.c: Likewise.
	* gdb-dlfcn.c: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbarch.c: Likewise.
	* gdbarch.sh: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-nat.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-lang.c: Likewise.
	* guile/scm-exception.c: Likewise.
	* guile/scm-gsmob.c: Likewise.
	* guile/scm-lazy-string.c: Likewise.
	* guile/scm-math.c: Likewise.
	* guile/scm-pretty-print.c: Likewise.
	* guile/scm-safe-call.c: Likewise.
	* guile/scm-utils.c: Likewise.
	* guile/scm-value.c: Likewise.
	* h8300-tdep.c: Likewise.
	* hppa-hpux-nat.c: Likewise.
	* hppa-tdep.c: Likewise.
	* hppanbsd-tdep.c: Likewise.
	* hppaobsd-tdep.c: Likewise.
	* i386-darwin-nat.c: Likewise.
	* i386-darwin-tdep.c: Likewise.
	* i386-nto-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* i386bsd-nat.c: Likewise.
	* i386fbsd-tdep.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* i386nbsd-tdep.c: Likewise.
	* i386obsd-tdep.c: Likewise.
	* i387-tdep.c: Likewise.
	* ia64-libunwind-tdep.c: Likewise.
	* ia64-tdep.c: Likewise.
	* inf-ptrace.c: Likewise.
	* inf-ttrace.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* infrun.c: Likewise.
	* inline-frame.c: Likewise.
	* interps.c: Likewise.
	* jv-lang.c: Likewise.
	* jv-typeprint.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Likewise.
	* linux-thread-db.c: Likewise.
	* m32c-tdep.c: Likewise.
	* m32r-linux-nat.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m68k-tdep.c: Likewise.
	* m68kbsd-nat.c: Likewise.
	* m68kbsd-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* machoread.c: Likewise.
	* macroexp.c: Likewise.
	* macrotab.c: Likewise.
	* maint.c: Likewise.
	* mdebugread.c: Likewise.
	* memory-map.c: Likewise.
	* mep-tdep.c: Likewise.
	* mi/mi-common.c: Likewise.
	* microblaze-tdep.c: Likewise.
	* mingw-hdep.c: Likewise.
	* mips-linux-nat.c: Likewise.
	* mips-linux-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mips64obsd-tdep.c: Likewise.
	* mipsnbsd-tdep.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* mn10300-tdep.c: Likewise.
	* moxie-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/mips-linux-watch.c: Likewise.
	* nios2-linux-tdep.c: Likewise.
	* nios2-tdep.c: Likewise.
	* objc-lang.c: Likewise.
	* objfiles.c: Likewise.
	* obsd-nat.c: Likewise.
	* opencl-lang.c: Likewise.
	* osabi.c: Likewise.
	* parse.c: Likewise.
	* ppc-linux-nat.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* ppcfbsd-nat.c: Likewise.
	* ppcfbsd-tdep.c: Likewise.
	* ppcnbsd-nat.c: Likewise.
	* ppcnbsd-tdep.c: Likewise.
	* ppcobsd-nat.c: Likewise.
	* ppcobsd-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* procfs.c: Likewise.
	* prologue-value.c: Likewise.
	* psymtab.c: Likewise.
	* python/py-lazy-string.c: Likewise.
	* python/py-value.c: Likewise.
	* regcache.c: Likewise.
	* reggroups.c: Likewise.
	* registry.c: Likewise.
	* remote-sim.c: Likewise.
	* remote.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* rs6000-tdep.c: Likewise.
	* s390-linux-tdep.c: Likewise.
	* score-tdep.c: Likewise.
	* ser-base.c: Likewise.
	* ser-mingw.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* solib-darwin.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-svr4.c: Likewise.
	* source.c: Likewise.
	* sparc-nat.c: Likewise.
	* sparc-sol2-tdep.c: Likewise.
	* sparc-tdep.c: Likewise.
	* sparc64-sol2-tdep.c: Likewise.
	* sparc64-tdep.c: Likewise.
	* sparc64fbsd-tdep.c: Likewise.
	* sparc64nbsd-tdep.c: Likewise.
	* sparc64obsd-tdep.c: Likewise.
	* sparcnbsd-tdep.c: Likewise.
	* sparcobsd-tdep.c: Likewise.
	* spu-multiarch.c: Likewise.
	* spu-tdep.c: Likewise.
	* stabsread.c: Likewise.
	* stack.c: Likewise.
	* symfile.c: Likewise.
	* symtab.c: Likewise.
	* target-descriptions.c: Likewise.
	* target-memory.c: Likewise.
	* target.c: Likewise.
	* tic6x-linux-tdep.c: Likewise.
	* tic6x-tdep.c: Likewise.
	* tilegx-linux-nat.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* top.c: Likewise.
	* tramp-frame.c: Likewise.
	* tui/tui-out.c: Likewise.
	* tui/tui-winsource.c: Likewise.
	* ui-out.c: Likewise.
	* user-regs.c: Likewise.
	* utils.c: Likewise.
	* v850-tdep.c: Likewise.
	* valops.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* vax-nat.c: Likewise.
	* xml-syscall.c: Likewise.
	* xml-tdesc.c: Likewise.
	* xstormy16-tdep.c: Likewise.
	* xtensa-linux-nat.c: Likewise.
	* xtensa-tdep.c: Likewise.

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

	* server.h: Do not include gdb_assert.h.
2014-08-07 09:06:45 +01:00
Gary Benson e76df0d086 Move common-utils.h to common-defs.h
This commit moves the inclusion of common-utils.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include common-utils.h.
	* defs.h: Do not include common-utils.h.
	* common/gdb_assert.h: Likewise.
	* darwin-nat.h: Likewise.
	* nat/linux-btrace.c: Likewise.
	* target/waitstatus.h: Likewise.

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

	* server.h: Do not include common-utils.h.
2014-08-07 09:06:44 +01:00
Gary Benson 4cb9c81646 Move ptid.h to common-defs.h
This commit moves the inclusion of ptid.h to common-defs.h and removes
all other inclusions.

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

	* common/common-defs.h: Include ptid.h.
	* defs.h: Do not include ptid.h.
	* inferior.h: Likewise.
	* infrun.h: Likewise.
	* nat/linux-btrace.h: Likewise.
	* nat/linux-osdata.h: Likewise.
	* target/waitstatus.h: Likewise.

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

	* server.h: Do not include ptid.h.
	* notif.h: Likewise.
2014-08-07 09:06:44 +01:00
Gary Benson 3995eeeeac Move gdb_locale.h to common-defs.h
This commit moves the inclusion of gdb_locale.h to common-defs.h and
removes all other inclusions.

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

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

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

	* server.h: Do not include gdb_locale.h.
2014-08-07 09:06:43 +01:00
Gary Benson cb9f1a9bcd Move gdb/signals.h to common-defs.h
This commit moves the inclusion of gdb/signals.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include gdb/signals.h.
	* defs.h: Do not include gdb/signals.h.

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

	* server.h: Do not include gdb/signals.h.
	* win32-low.c: Likewise.
2014-08-07 09:06:42 +01:00
Gary Benson a5fceff840 Move pathmax.h to common-defs.h
This commit moves the inclusion of pathmax.h to common-defs.h and
removes all other inclusions.

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

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

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

	* server.h: Do not include pathmax.h.
2014-08-07 09:06:42 +01:00
Gary Benson b939114242 Move libiberty.h to common-defs.h
This commit moves the inclusion of libiberty.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include libiberty.h.
	* defs.h: Do not include libiberty.h.
	* common/queue.h: Likewise.
	* cp-name-parser.y: Likewise.
	* mi/mi-cmd-catch.c: Likewise.
	* python/python.c: Likewise.

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

	* server.h: Do not include libiberty.h.
	* linux-bfin-low.c: Likewise.
2014-08-07 09:06:41 +01:00
Gary Benson 0e443c875f Move ansidecl.h to common-defs.h
This commit moves the inclusion of ansidecl.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include ansidecl.h.
	* defs.h: Do not include ansidecl.h.
	* common/buffer.h: Likewise.
	* common/common-utils.h: Likewise.

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

	* server.h: Do not include ansidecl.h.
2014-08-07 09:06:40 +01:00
Gary Benson 8ebb3f5606 Move stddef.h to common-defs.h
This commit moves the inclusion of stddef.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include stddef.h.
	* defs.h: Do not include stddef.h.
	* common/common-utils.h: Likewise.
	* amd64fbsd-nat.c: Likewise.
	* bcache.c: Likewise.
	* charset.c: Likewise.
	* common/buffer.h: Likewise.
	* common/vec.h: Likewise.
	* i386bsd-nat.c: Likewise.
	* nat/linux-btrace.h: Likewise.
	* ppcfbsd-nat.c: Likewise.
	* ppcnbsd-tdep.h: Likewise.
	* ppcobsd-nat.c: Likewise.
	* ppcobsd-tdep.h: Likewise.
	* python/py-gdb-readline.c: Likewise.

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

	* linux-x86-low.c: Do not include stddef.h.
	* lynx-ppc-low.c: Likewise.
	* tracepoint.c: Likewise.
2014-08-07 09:06:40 +01:00
Gary Benson 8980bdf628 Move stdarg.h to common-defs.h
This commit moves the inclusion of stdarg.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include stdarg.h.
	* defs.h: Do not include stdarg.h.
	* ada-lang.c: Likewise.
	* common/common-utils.h: Likewise.
	* guile/scm-string.c: Likewise.
	* guile/scm-utils.c: Likewise.
	* m32c-tdep.c: Likewise.

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

	* server.h: Do not include stdarg.h.
	* nto-low.c: Likewise.
2014-08-07 09:06:39 +01:00
Gary Benson d7096f7165 Move stdlib.h to common-defs.h
This commit moves the inclusion of stdlib.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include stdlib.h.
	* defs.h: Do not include stdlib.h.
	* addrmap.c: Likewise.
	* bcache.c: Likewise.
	* common/buffer.c: Likewise.
	* common/common-utils.c: Likewise.
	* cp-name-parser.y: Likewise.
	* go32-nat.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* tui/tui.c: Likewise.
	* windows-nat.c: Likewise.

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

	* server.h: Do not include stdlib.h.
	* inferiors.c: Likewise.
	* linux-low.c: Likewise.
	* regcache.c: Likewise.
	* spu-low.c: Likewise.
	* tracepoint.c: Likewise.
	* utils.c: Likewise.
2014-08-07 09:06:38 +01:00
Gary Benson d02f550d39 Move stdio.h to common-defs.h
This commit moves the inclusion of stdio.h to common-defs.h and
removes all other inclusions.

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

	* common/common-defs.h: Include stdio.h.
	* defs.h: Do not include stdio.h.
	* ada-lang.c: Likewise.
	* common/buffer.c: Likewise.
	* common/common-utils.c: Likewise.
	* cp-name-parser.y: Likewise.
	* gnu-nat.c: Likewise.
	* go32-nat.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* proc-api.c: Likewise.
	* proc-events.c: Likewise.
	* proc-flags.c: Likewise.
	* proc-why.c: Likewise.
	* python/python-internal.h: Likewise.
	* target-memory.c: Likewise.
	* tui/tui-io.c: Likewise.
	* tui/tui.c: Likewise.

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

	* server.h: Do not include stdio.h.
	* linux-low.c: Likewise.
	* remote-utils.c: Likewise.
	* spu-low.c: Likewise.
	* utils.c: Likewise.
	* wincecompat.c: Likewise.
2014-08-07 09:06:37 +01:00
Gary Benson 976411d6b6 Introduce common/common-defs.h
This commit creates a new header, common/common-defs.h, to hold
definitions common to all code under gdb/.  Both gdb/defs.h and
gdb/gdbserver/server.h are modified to include common-defs.h as
their first non-comment line; all code under gdb/ includes either
defs.h or server.h as appropriate, so common-defs.h will be the
first actual code the compiler sees.

For this initial commit common-defs.h includes only the two
config.h files.  Future commits will move more code currently
duplicated across defs.h and server.h such that shared code in
gdb/{common,target,nat} can be modified to include common-defs.h
rather than defs.h or server.h.

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

	* common/common-defs.h: New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add common/common-defs.h.
	* defs.h: Include common-defs.h.
	Do not include config.h or build-gnulib/config.h.

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

	* server.h: Include common-defs.h.
	Do not include config.h or build-gnulib-gdbserver/config.h.
2014-07-30 09:22:49 +01:00