Commit Graph

35 Commits

Author SHA1 Message Date
Alan Modra
e874cbd387 Remove LIBINTL_DEP
The intl directory in the source no longer exists.  LIBINTL_DEP is
thus always empty.  Remove references to it.

config/
	* gettext-sister.m4: Don't AC_SUBST LIBINTL_DEP.
bfd/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
binutils/
	* Makefile.am (*_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
gas/
	* Makefile.am (as_new_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
gdb/
	* Makefile.in (INTL_DEPS): Don't set or reference.
	* configure: Regenerate.
gdbserver/
	* Makefile.in (INTL_DEPS): Don't set or reference.
gdbsupport/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
gold/
	* Makefile.am (deps_var): Remove LIBINTL_DEP.
	(incremental_dump_DEPENDENCIES, dwp_DEPENDENCIES): Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.am (DEPENDENCIES): Remove LIBINTL_DEP.
	* testsuite/Makefile.in: Regenerate.
gprof/
	* Makefile.am (gprof_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
ld/
	* Makefile.am (ld_new_DEPENDENCIES): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
libctf/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
opcodes/
	* configure.ac (BUILD_LIBS): Remove LIBINTL.
	(BUILD_LIB_DEPS): Remove LIBINTL_DEP.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2024-06-20 18:33:28 +09:30
Simon Marchi
ab7daea3ad gdb, gdbserver, gdbsupport: include early header files with -include
The motivation for this change is for analysis tools and IDEs to be
better at analyzing header files on their own.

There are some definitions and includes we want to occur at the very
beginning of all translation units.  The way we currently do that is by
requiring all source files (.c and .cc files) to include one of defs.h
(for gdb), server.h (for gdbserver) of common-defs.h (for gdbsupport and
shared source files).  These special header files define and include
everything that needs to be included at the very beginning.  Other
header files are written in a way that assume that these special
"prologue" header files have already been included.

My problem with that is that my editor (clangd-based) provides a very
bad experience when editing header files.  Since clangd doesn't know
that one of defs.h/server.h/common-defs.h was included already, a lot of
things are flagged as errors.  For instance, CORE_ADDR is not known.
It's possible to edit the files in this state, but a lot of the power of
the editor is unavailable.

My proposal to help with this is to include those things we always want
to be there using the compilers' `-include` option.  Tom Tromey said
that the current approach might exist because not all compilers used to
have an option like this.  But I believe that it's safe to assume they
do today.

With this change, clangd picks up the -include option from the compile
command, and is able to analyze the header file correctly, as it sees
all that stuff included or defined by that -include option.  That works
because when editing a header file, clangd tries to get the compilation
flags from a source file that includes said header file.

This change is a bit self-serving, because it addresses one of my
frustrations when editing header files, but it might help others too.
I'd be curious to know if others encounter the same kinds of problems
when editing header files.  Also, even if the change is not necessary by
any means, I think the solution of using -include for stuff we always
want to be there is more elegant than the current solution.

Even with this -include flag, many header files currently don't include
what they use, but rather depend on files included before them.  This
will still cause errors when editing them, but it should be easily
fixable by adding the appropriate include.  There's no rush to do so, as
long as the code still compiles, it's just a convenience thing.

The changes are:

 - Add the appropriate `-include` option to the various Makefiles.

 - There is one particularity for gdbserver's Makefile: we do not want
   to include server.h when building `gdbreplay.o`, as `gdbreplay.cc`
   doesn't include it.  So we can't simply put the `-include` in
   `INTERNAL_CFLAGS`.  Add the `-include server.h` option to the
   `COMPILE` and `IPAGENT_COMPILE` variables, and added a special rule
   to compile `gdbreplay.o` with `-include gdbsupport/common-defs.h`.

 - Remove the `-include` option from the `check-headers` rule in
   gdb/Makefile.in, since it is already included in `INTERNAL_CFLAGS`.

Change-Id: If3e345d00a9fc42336322f1d8286687d22134340
Approved-By: Pedro Alves <pedro@palves.net>
2024-03-26 21:09:19 -04:00
Simon Marchi
2f3dfa7f90 gdb, gdbserver, gdbsupport: reformat some Makefile variables, one entry per line
Reformat some variables definitions.  I think it makes them easier to
read, and it also makes diffs clearer.

Change-Id: I82f63ba0e6d0fe268eb1f1ad5ab22c3cd016ab02
Approved-By: Pedro Alves <pedro@palves.net>
2024-03-26 21:09:19 -04:00
Andrew Burgess
1d506c26d9 Update copyright year range in header of all files managed by GDB
This commit is the result of the following actions:

  - Running gdb/copyright.py to update all of the copyright headers to
    include 2024,

  - Manually updating a few files the copyright.py script told me to
    update, these files had copyright headers embedded within the
    file,

  - Regenerating gdbsupport/Makefile.in to refresh it's copyright
    date,

  - Using grep to find other files that still mentioned 2023.  If
    these files were updated last year from 2022 to 2023 then I've
    updated them this year to 2024.

I'm sure I've probably missed some dates.  Feel free to fix them up as
you spot them.
2024-01-12 15:49:57 +00:00
Mike Frysinger
3f258212a8 gdb: move libiberty.m4 to gdbsupport
This is used by gdb, gdbsupport, and gdbserver.  We want to use it
in the sim tree too.  Move it to gdbsupport which is meant as the
common sharing space for these projects.

Approved-By: Tom Tromey <tom@tromey.com>
2024-01-10 19:52:52 -05:00
Tom Tromey
542e23ffbe Add gdb::task_group
This adds gdb::task_group, a convenient way to group background tasks
and then call a function when all the tasks have completed.
2024-01-08 18:40:21 -07:00
Arsen Arsenovi?
862776f26a Finalized intl-update patches
* intl: Remove directory.  Replaced with out-of-tree GNU gettext.
  * .gitignore: Add '/gettext*'.
  * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag.  Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing.
  * configure: Regenerate.
  * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext.
  * Makefile.in: Regenerate.
  * src-release.sh: Remove references to the intl/ directory.
2023-11-15 12:53:04 +00:00
Lancelot Six
f74dc26792 gdb/gdbsupport/gdbserver: Require c++17
This patch proposes to require a C++17 compiler to build gdb /
gdbsupport / gdbserver.  Before this patch, GDB required a C++11
compiler.

The general policy regarding bumping C++ language requirement in GDB (as
stated in [1]) is:

    Our general policy is to wait until the oldest compiler that
    supports C++NN is at least 3 years old.

    Rationale: We want to ensure reasonably widespread compiler
    availability, to lower barrier of entry to GDB contributions, and to
    make it easy for users to easily build new GDB on currently
    supported stable distributions themselves. 3 years should be
    sufficient for latest stable releases of distributions to include a
    compiler for the standard, and/or for new compilers to appear as
    easily installable optional packages. Requiring everyone to build a
    compiler first before building GDB, which would happen if we
    required a too-new compiler, would cause too much inconvenience.

    See the policy proposal and discussion
    [here](https://sourceware.org/ml/gdb-patches/2016-10/msg00616.html).

The first GCC release which with full C++17 support is GCC-9[2],
released in 2019[3], which is over 4 years ago.  Clang has had C++17
support since Clang-5[4] released in 2018[5].

A discussions with many distros showed that a C++17-able compiler is
always available, meaning that this no hard requirement preventing us to
require it going forward.

[1] https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#When_is_GDB_going_to_start_requiring_C.2B-.2B-NN_.3F
[2] https://gcc.gnu.org/projects/cxx-status.html#cxx17
[3] https://gcc.gnu.org/gcc-9/
[4] https://clang.llvm.org/cxx_status.html
[5] https://releases.llvm.org/

Change-Id: Id596f5db17ea346e8a978668825787b3a9a443fd
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
Approved-By: Pedro Alves <pedro@palves.net>
2023-10-28 19:25:34 +00:00
Alan Modra
6a6859cbff regen config
This regenerates config files changed by the previous 44 commits.
Note that subject lines in these commits mostly match the gcc git
originating commit.
2023-08-12 10:27:57 +09:30
Tom Tromey
147699fd69 Remove struct buffer
I've long wanted to remove 'struct buffer', and thanks to Simon's
earlier patch, I was finally able to do so.  My feeling has been that
gdb already has several decent structures available for growing
strings: std::string of course, but also obstack and even objalloc
from BFD and dyn-string from libiberty.  The previous patches in this
series removed all the uses of struct buffer, so this one can remove
the code and the remaining #includes.
2023-02-24 11:53:03 -07:00
Simon Marchi
8b35ed1feb gdbsupport: move libxxhash configure check to gdbsupport
The following patch moves the fast_hash function, which uses libxxhash,
to gdbsupport.  Move the libxxhash configure check to gdbsupport (and
transitively to gdbserver).

Change-Id: I242499e50c8cd6fe9f51e6e92dc53a1b3daaa96e
Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-01-05 14:38:51 -05:00
Tsukasa OI
39eedb20b7 gdbsupport: Fix config.status dependency
Commit 171fba11ab ("Make GDBserver abort on internal error in development mode")
created a new substitution CONFIG_STATUS_DEPENDENCIES but this is used by
Makefile.in (which is not regenerated by that commit).  After regenerating
it, it is found that CONFIG_STATUS_DEPENDENCIES value is not valid, making
gdbsupport fail to build.

Since the CONFIG_STATUS_DEPENDENCIES value is used in the Makefile, macro
substitution must have a Makefile format but commit 171fba11ab used shell
format "$srcdir/../bfd/development.sh".

This commit fixes this issue by substituting "$srcdir" (shell format) to
"$(srcdir)" (Makefile format).  It preserves the dependency as Pedro
intended and fixes the build problem.

It also regenerates corresponding files with the maintainer mode.

gdbsupport/ChangeLog:

	* configure.ac: Fix config.status dependency.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2022-09-08 11:03:12 +00:00
John Baldwin
ea3e7446dc gdbsupport: Add an event-pipe class.
This pulls out the implementation of an event pipe used to implement
target async support in both linux-low.cc (gdbserver) and linux-nat.c
(gdb).

This will be used to replace the existing event pipe in linux-low.cc
and linux-nat.c in future commits.

Co-Authored-By: Lancelot SIX <lsix@lancelotsix.com>
2022-02-22 11:22:14 -08:00
Tom Tromey
d322d6d69d Move gdb_regex to gdbsupport
This moves the gdb_regex convenience class to gdbsupport.
2022-01-18 10:14:43 -07:00
Tom Tromey
0589ca4e7b Introduce gdb-hashtab module in gdbsupport
gdb has some extensions and helpers for working with the libiberty
hash table.  This patch consolidates these and moves them to
gdbsupport.
2022-01-18 10:14:43 -07:00
Tom Tromey
bf31fd38f0 Move gdb obstack code to gdbsupport
This moves the gdb-specific obstack code -- both extensions like
obconcat and obstack_strdup, and things like auto_obstack -- to
gdbsupport.
2022-01-18 10:14:42 -07:00
Andrew Burgess
4b74833d1a gdb: don't use -Wmissing-prototypes with g++
This commit aims to not make use of -Wmissing-prototypes when
compiling with g++.

Use of -Wmissing-prototypes was added with this commit:

  commit a0761e34f0
  Date:   Wed Mar 11 15:15:12 2020 -0400

      gdb: enable -Wmissing-prototypes warning

Because clang can provide helpful warnings with this flag.
Unfortunately, g++ doesn't accept this flag, and will give this
warning:

  cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++

In theory the fact that this flag is not supported should be detected
by the configure check in gdbsupport/warning.m4, but for users of
ccache, this check doesn't work due to a long standing ccache issue:

  https://github.com/ccache/ccache/issues/738

The ccache problem is that -W... options are reordered on the command
line, and so -Wmissing-prototypes is seen before -Werror.  Usually
this doesn't matter, but the above warning (about the flag not being
valid) is issued before the -Werror flag is processed, and so is not
fatal.

There have been two previous attempts to fix this that I'm aware of.
The first is:

  https://sourceware.org/pipermail/gdb-patches/2021-September/182148.html

In this attempt, instead of just relying on a compile to check if a
flag is valid, the proposal was to both compile and link.  As linking
doesn't go through ccache, we don't suffer from the argument
reordering problem, and the link phase will correctly fail when using
-Wmissing-prototypes with g++.  The configure script will then disable
the use of this flag.

This approach was rejected, and the suggestion was to only add the
-Wmissing-prototypes flag if we are compiling with gcc.

The second attempt, attempts this approach, and can be found here:

  https://sourceware.org/pipermail/gdb-patches/2021-November/183076.html

This attempt only adds the -Wmissing-prototypes flag is the value of
GCC is not 'yes'.  This feels like it is doing the right thing,
unfortunately, the GCC flag is really a 'is gcc like' flag, not a
strict, is gcc check.  As such, GCC is set to 'yes' for clang, which
would mean the flag was not included for clang or gcc.  The entire
point of the original commit was to add this flag for clang, so
clearly the second attempt is not sufficient either.

In this new attempt I have added gdbsupport/compiler-type.m4, this
file defines AM_GDB_COMPILER_TYPE.  This macro sets the variable
GDB_COMPILER_TYPE to either 'gcc', 'clang', or 'unknown'.  In future
the list of values might be extended to cover other compilers, if this
is ever useful.

I've then modified gdbsupport/warning.m4 to only add the problematic
-Wmissing-prototypes flag if GDB_COMPILER_TYPE is not 'gcc'.

I've tested this with both gcc and clang and see the expected results,
gcc no longer attempts to use the -Wmissing-prototypes flag, while
clang continues to use it.

When compiling using ccache, I am no longer seeing the warning.
2022-01-13 10:25:45 +00:00
Andrew Burgess
9ed5be5650 gdbsupport: regenerate Makefile.in
I had cause to regenerate gdbsupport/Makefile.in, and noticed some
unexpected changes in the copyright header dates.

I suspect that this was caused by the end of year date range update
process.

The Makefile.in contains two date ranges.  The first range appears to
be the date range for the version of automake being used, that is the
range runs up to 2017 only, when automake 1.15.1 was released.

The second date range in Makefile.in represents the date range for the
generated file, and so, now runs up to 2022.

Anyway, this is the result of running autoreconf (using automake
1.15.1) in the gdbsupport directory.
2022-01-11 10:10:51 +00:00
Joel Brobecker
4a94e36819 Automatic Copyright Year update after running gdb/copyright.py
This commit brings all the changes made by running gdb/copyright.py
as per GDB's Start of New Year Procedure.

For the avoidance of doubt, all changes in this commits were
performed by the script.
2022-01-01 19:13:23 +04:00
Simon Marchi
b6703327bb gdbsupport: re-generate configure & friends
I get these changes when re-generating the autoconf stuff in gdbsupport,
fallouts from 4655f8509f ("Don't run personality syscall at configure
time; don't check it at all").

gdbsupport/ChangeLog:

	* Makefile.in: Re-generate.
	* config.in: Re-generate.
	* configure: Re-generate.

Change-Id: Ie1876ee58d6f4f1cf25fa14900eecf4c85a744c1
2021-05-08 21:27:49 -04:00
Joel Brobecker
3666a04883 Update copyright year range in all GDB files
This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...

gdb/ChangeLog

        Update copyright year range in copyright header of all GDB files.
2021-01-01 12:12:21 +04:00
Simon Marchi
006811bc02 gdb: move ptrace.m4 to gdbsupport
ptrace.m4, providing the GDB_AC_PTRACE autoconf macro, is used by gdb,
gdbserver and gdbsupport.  I think it would make sense to move it to
gdbsupport.

gdb/ChangeLog:

	* acinclude.m4: Update ptrace.m4 path.
	* ptrace.m4: Moved to gdbsupport.

gdbserver/ChangeLog:

	* acinclude.m4: Update ptrace.m4 path.

gdbsupport/ChangeLog:

	* Makefile.in: Re-generate.
	* acinclude.m4: Update ptrace.m4 path.
	* ptrace.m4: Move here.

Change-Id: I849c149fd5dd8c3b2b0af38654fb353e3727871b
2020-10-25 21:08:49 -04:00
Tom Tromey
4a72de7366 Move simple_search_memory to gdbsupport/search.cc
This moves the simple_search_memory function to a new file,
gdbsupport/search.cc.  The API is slightly changed to make it more
general.  This generality is useful for wiring it to gdbserver, and
also for unit testing.

gdb/ChangeLog
2020-10-07  Tom Tromey  <tromey@adacore.com>

	* target.h (simple_search_memory): Don't declare.
	* target.c (simple_search_memory): Move to gdbsupport.
	(default_search_memory): Update.
	* remote.c (remote_target::search_memory): Update.

gdbsupport/ChangeLog
2020-10-07  Tom Tromey  <tromey@adacore.com>

	* Makefile.in: Rebuild.
	* Makefile.am (libgdbsupport_a_SOURCES): Add search.cc.
	* search.h: New file.
	* search.cc: New file.
2020-10-07 12:07:55 -06:00
Rainer Orth
c8693053f8 Unify Solaris procfs and largefile handling
GDB currently doesn't build on 32-bit Solaris:

* On Solaris 11.4/x86:

In file included from /usr/include/sys/procfs.h:26,
                 from /vol/src/gnu/gdb/hg/master/dist/gdb/i386-sol2-nat.c:24:
/usr/include/sys/old_procfs.h:31:2: error: #error "Cannot use procfs in the large file compilation environment"
 #error "Cannot use procfs in the large file compilation environment"
  ^~~~~

* On Solaris 11.3/x86 there are several more instances of this.

The interaction between procfs and large-file support historically has
been a royal mess on Solaris:

* There are two versions of the procfs interface:

** The old ioctl-based /proc, deprecated and not used any longer in
   either gdb or binutils.

** The `new' (introduced in Solaris 2.6, 1997) structured /proc.

* There are two headers one can possibly include:

** <procfs.h> which only provides the structured /proc, definining
   _STRUCTURED_PROC=1 and then including ...

** <sys/procfs.h> which defaults to _STRUCTURED_PROC=0, the ioctl-based
   /proc, but provides structured /proc if _STRUCTURED_PROC == 1.

* procfs and the large-file environment didn't go well together:

** Until Solaris 11.3, <sys/procfs.h> would always #error in 32-bit
   compilations when the large-file environment was active
   (_FILE_OFFSET_BITS == 64).

** In both Solaris 11.4 and Illumos, this restriction was lifted for
   structured /proc.

So one has to be careful always to define _STRUCTURED_PROC=1 when
testing for or using <sys/procfs.h> on Solaris.  As the errors above
show, this isn't always the case in binutils-gdb right now.

Also one may need to disable large-file support for 32-bit compilations
on Solaris.  config/largefile.m4 meant to do this by wrapping the
AC_SYS_LARGEFILE autoconf macro with appropriate checks, yielding
ACX_LARGEFILE.  Unfortunately the macro doesn't always succeed because
it neglects the _STRUCTURED_PROC part.

To make things even worse, since GCC 9 g++ predefines
_FILE_OFFSET_BITS=64 on Solaris.  So even if largefile.m4 deciced not to
enable large-file support, this has no effect, breaking the gdb build.

This patch addresses all this as follows:

* All tests for the <sys/procfs.h> header are made with
  _STRUCTURED_PROC=1, the definition going into the various config.h
  files instead of having to make them (and sometimes failing) in the
  affected sources.

* To cope with the g++ predefine of _FILE_OFFSET_BITS=64,
  -U_FILE_OFFSET_BITS is added to various *_CPPFLAGS variables.  It had
  been far easier to have just

  #undef _FILE_OFFSET_BITS

  in config.h, but unfortunately such a construct in config.in is
  commented by config.status irrespective of indentation and whitespace
  if large-file support is disabled.  I found no way around this and
  putting the #undef in several global headers for bfd, binutils, ld,
  and gdb seemed way more invasive.

* Last, the applicability check in largefile.m4 was modified only to
  disable largefile support if really needed.  To do so, it checks if
  <sys/procfs.h> compiles with _FILE_OFFSET_BITS=64 defined.  If it
  doesn't, the disabling only happens if gdb exists in-tree and isn't
  disabled, otherwise (building binutils from a tarball), there's no
  conflict.

  What initially confused me was the check for $plugins here, which
  originally caused the disabling not to take place.  Since AC_PLUGINGS
  does enable plugin support if <dlfcn.h> exists (which it does on
  Solaris), the disabling never happened.

  I could find no explanation why the linker plugin needs large-file
  support but thought it would be enough if gld and GCC's lto-plugin
  agreed on the _FILE_OFFSET_BITS value.  Unfortunately, that's not
  enough: lto-plugin uses the simple-object interface from libiberty,
  which includes off_t arguments.  So to fully disable large-file
  support would mean also disabling it in libiberty and its users: gcc
  and libstdc++-v3.  This seems highly undesirable, so I decided to
  disable the linker plugin instead if large-file support won't work.

The patch allows binutils+gdb to build on i386-pc-solaris2.11 (both
Solaris 11.3 and 11.4, using GCC 9.3.0 which is the worst case due to
predefined _FILE_OFFSET_BITS=64).  Also regtested on
amd64-pc-solaris2.11 (again on Solaris 11.3 and 11.4),
x86_64-pc-linux-gnu and i686-pc-linux-gnu.

	config:
	* largefile.m4 (ACX_LARGEFILE) <sparc-*-solaris*|i?86-*-solaris*>:
	Check for <sys/procfs.h> incompatilibity with large-file support
	on Solaris.
	Only disable large-file support and perhaps plugins if needed.
	Set, substitute LARGEFILE_CPPFLAGS if so.

	bfd:
	* bfd.m4 (BFD_SYS_PROCFS_H): New macro.
	(BFD_HAVE_SYS_PROCFS_TYPE): Require BFD_SYS_PROCFS_H.
	Don't define _STRUCTURED_PROC.
	(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise.
	* elf.c [HAVE_SYS_PROCFS_H] (_STRUCTURED_PROC): Don't define.
	* configure.ac: Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>.
	* configure, config.in: Regenerate.
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in, doc/Makefile.in: Regenerate.

	binutils:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in, doc/Makefile.in: Regenerate.
	* configure: Regenerate.

	gas:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in, doc/Makefile.in: Regenerate.
	* configure: Regenerate.

	gdb:
	* proc-api.c (_STRUCTURED_PROC): Don't define.
	* proc-events.c: Likewise.
	* proc-flags.c: Likewise.
	* proc-why.c: Likewise.
	* procfs.c: Likewise.

	* Makefile.in (INTERNAL_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* configure, config.in: Regenerate.

	gdbserver:
	* configure, config.in: Regenerate.

	gdbsupport:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* common.m4 (GDB_AC_COMMON): Use BFD_SYS_PROCFS_H to check for
	<sys/procfs.h>.
	* Makefile.in: Regenerate.
	* configure, config.in: Regenerate.

	gnulib:
	* configure.ac: Run ACX_LARGEFILE before gl_EARLY.
	* configure: Regenerate.

	gprof:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

	ld:
	* Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2020-07-30 15:41:50 +02:00
Tom Tromey
400b5eca00 Move event-loop.[ch] to gdbsupport/
This moves event-loop.[ch] to gdbsupport/ and updates the uses in gdb.

gdb/ChangeLog
2020-04-13  Tom Tromey  <tom@tromey.com>

	* run-on-main-thread.c: Update include.
	* unittests/main-thread-selftests.c: Update include.
	* tui/tui-win.c: Update include.
	* tui/tui-io.c: Update include.
	* tui/tui-interp.c: Update include.
	* tui/tui-hooks.c: Update include.
	* top.h: Update include.
	* top.c: Update include.
	* ser-base.c: Update include.
	* remote.c: Update include.
	* remote-notif.c: Update include.
	* remote-fileio.c: Update include.
	* record-full.c: Update include.
	* record-btrace.c: Update include.
	* python/python.c: Update include.
	* posix-hdep.c: Update include.
	* mingw-hdep.c: Update include.
	* mi/mi-main.c: Update include.
	* mi/mi-interp.c: Update include.
	* main.c: Update include.
	* linux-nat.c: Update include.
	* interps.c: Update include.
	* infrun.c: Update include.
	* inf-loop.c: Update include.
	* event-top.c: Update include.
	* event-loop.c: Move to ../gdbsupport/.
	* event-loop.h: Move to ../gdbsupport/.
	* async-event.h: Update include.
	* Makefile.in (COMMON_SFILES, HFILES_NO_SRCDIR): Update.

gdbsupport/ChangeLog
2020-04-13  Tom Tromey  <tom@tromey.com>

	* event-loop.h: Move from ../gdb/.
	* event-loop.cc: Move from ../gdb/.
2020-04-13 14:10:04 -06:00
Simon Marchi
272cd5a31e Move gdb/selftest.m4 to gdbsupport/selftest.m4
The selftest.m4 file is used by gdb, gdbserver and gdbsupport, I think
it belongs in gdbsupport.

gdb/ChangeLog:

	* selftest.m4: Move to gdbsupport/.
	* acinclude.m4: Update path to selftest.m4.

gdbserver/ChangeLog:

	* acinclude.m4: Update path to selftest.m4.

gdbsupport/ChangeLog:

	* selftest.m4: Moved from gdb/.
	* acinclude.m4: Update path to selftest.m4.
2020-03-12 14:19:38 -04:00
Simon Marchi
89725b0d53 gdbsupport: re-generate Makefile.in
It looks like after doing last minute changes to Makefile.am in commit
06b3c5bdb ("gdbsupport: rename source files to .cc"), I forgot to
re-generate Makefile.in.  This patch fixes it.

gdbsupport/ChangeLog:

	* Makefile.in: Re-generate.
2020-03-03 17:11:12 -05:00
Simon Marchi
06b3c5bdb0 gdbsupport: rename source files to .cc
This patch renames the .c source files in gdbsupport to .cc.

In the gdb directory, there is an argument against renaming the source
files, which is that it makes using some git commands more difficult to
do archeology.  Some commands have some kind of "follow" option that
makes git try to follow renames, but it doesn't work in all situations.

Given that we have just moved the gdbsupport directory, that argument
doesn't hold for source files in that directory.  I therefore suggest
renaming them to .cc, so that they are automatically recognized as C++
by various tools and editors.

The original motivation behind this is that when building gdbsupport
with clang, I get:

      CC       agent.o
    clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

In the gdb/ directory, we make clang happy by passing "-x c++".  We
could do this in gdbsupport too, but I think that renaming the files is
a better long-term solution.

gdbserver still does its own build of gdbsupport, so a few changes in
its Makefile are necessary.

gdbsupport/ChangeLog:

	* Makefile.am: Rename source files from .c to .cc.
	(CC, CFLAGS): Don't override.
	(AM_CFLAGS): Rename to ...
	(AM_CXXFLAGS): ... this.
	* Makefile.in: Re-generate.
	* %.c: Rename to %.cc.

gdbserver/ChangeLog:

	* Makefile.in: Rename gdbsupport source files from .c to .cc.
2020-02-13 16:27:03 -05:00
Simon Marchi
58df732b21 Move gdb/warning.m4 to gdbsupport
This file is used by gdbsupport, gdbserver and gdb, so I think it
belongs in gdbsupport.  Move it there and update the references the
various acinclude.m4 files.

gdbsupport/ChangeLog:

	* warning.m4: Move here, from gdb/warning.m4.
	* acinclude.m4: Update warning.m4 path.
	* Makefile.in: Re-generate.

gdbserver/ChangeLog:

	* acinclude.m4: Update warning.m4 path.

gdb/ChangeLog:

	* acinclude: Update warning.m4 path.
	* warning.m4: Move to gdbsupport.
2020-02-11 10:51:43 -05:00
Simon Marchi
629c296280 gdbsupport: use AM_GDB_WARNINGS
Since gdbsupport has been given its own build system, it is no longer
compiled with the warning flags specified in gdb/warning.m4.

This patch makes it use AM_GDB_WARNINGS.

gdbsupport/ChangeLog:

	* acinclude.m4: Include ../gdb/warning.m4.
	* configure.ac: Use AM_GDB_WARNINGS.
	* Makefile.am: Set AM_CFLAGS to WARN_CFLAGS and WERROR_CFLAGS.
	* Makefile.in: Re-generate.
	* configure: Re-generate.
2020-02-11 10:46:23 -05:00
Pedro Alves
67b10306d1 Fix gdbsupport build on compilers that don't default to C++11 or above
gdbsupport fails to build with compilers that don't default to C++11
or above.  gdbsupport's configure.ac is already using
AX_CXX_COMPILE_STDCXX, which sets CXX_DIALECT to the -std=gnu++11
switch if necessary, but the problem is that nowhere are we using
CXX_DIALECT.  This fixes it.

gdbsupport/ChangeLog:
2020-01-17   Pedro Alves  <palves@redhat.com>

	* Makefile.am: Append CXX_DIALECT to CXX.
	* Makefile.in: Regenerate.
2020-01-17 15:19:42 +00:00
Pedro Alves
3684d331fd Fix gdbsupport build
I'm seeing this on F27 (a clean build from scratch):

~~~~~~~~~~~~~~~~~~~~~~~~~~~
 make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport'
   CC       gdb_tilde_expand.o
 In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0,
                  from ../gnulib/import/glob.h:544,
                  from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22:
 ../bfd/config.h:7:4: error: #error config.h must be #included before system headers
  #  error config.h must be #included before system headers
     ^~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~

libc-config.h, where it includes config.h, says:

~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /* This is intended to be a good-enough substitute for glibc system
    macros like those defined in <sys/cdefs.h>, so that Gnulib code
    shared with glibc can do this as the first #include:

      #ifndef _LIBC
      # include <libc-config.h>
      #endif

    When compiled as part of glibc this is a no-op; when compiled as
    part of Gnulib this includes Gnulib's <config.h> and defines macros
    that glibc library code would normally assume.  */

 #include <config.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The issue is that that '#include <config.h>' picks up bfd's config.h
instead of gnulib's.

This problem doesn't trigger in the gdb dir because there we generate
config.h under that exact name so gnulib's libc-config.h ends up
picking gdb's config.h instead of gnulib.c and that ends up harmless.

In gdbsupport, the config.h file is really named support-config.h, so
that '#include <config.h>' in libc-config.h doesn't pick it like it
would if it had the conventional config.h name.

This patch fixes it by simply renaming gdbserver's support-config.h to
config.h.

gdbsupport/ChangeLog:
2020-01-17  Pedro Alves  <palves@redhat.com>

	* configure.ac: Generate config.h instead of support-config.h.
	* common-defs.h: Include <gdbsupport/config.h> instead of
	<gdbsupport/support-config.h>.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2020-01-17 15:14:56 +00:00
Tom Tromey
0454ef42e7 Add gdbsupport check-defines script
This adds a new script that tries to check that none of the support
code uses defines that are not defined by common.m4.  This check is
necessarily inexact, but this script caught all the issues fixed in
the previous patches.

gdbsupport/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* Makefile.in: Rebuild.
	* Makefile.am (check-defines): New target.
	* check-defines.el: New file.

Change-Id: I59450e91394d5e6a7fa59e9ab53c95843c4bacd9
2020-01-14 16:25:04 -07:00
Tom Tromey
05ea2a0510 Move many configure checks to common.m4
This moves many needed configure checks from gdb and gdbserver into
common.m4.  This helps gdbsupport, nat, and target be self-contained.

The result is a bit spaghetti-ish, because gdbsupport uses another m4
file from gdb/.  The resulting code is somewhat non-obvious.  However,
these problems already exist, so it's not really that much worse than
what is already done.

gdb/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* configure: Rebuild.
	* configure.ac: Move many checks to ../gdbsupport/common.m4.

gdb/gdbserver/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* configure: Rebuild.
	* configure.ac: Remove any checks that were added to common.m4.
	* acinclude.m4: Include lib-ld.m4, lib-prefix.m4, and
	lib-link.m4.

gdbsupport/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* configure, Makefile.in, aclocal.m4, common.m4, config.in:
	Rebuild.
	* common.m4 (GDB_AC_COMMON): Move many checks from
	gdb/configure.ac.
	* acinclude.m4: Include bfd.m4, ptrace.m4.

Change-Id: I931eaa94065df268b30a2f1354390710df89c7f8
2020-01-14 16:25:03 -07:00
Tom Tromey
01027315f5 Move gdbsupport to the top level
This patch moves the gdbsupport directory to the top level.  This is
the next step in the ongoing project to move gdbserver to the top
level.

The bulk of this patch was created by "git mv gdb/gdbsupport gdbsupport".

This patch then adds a build system to gdbsupport and wires it into
the top level.  Then it changes gdb to use the top-level build.

gdbserver, on the other hand, is not yet changed.  It still does its
own build of gdbsupport.

ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
	* MAINTAINERS: Add gdbsupport.
	* configure: Rebuild.
	* configure.ac (configdirs): Add gdbsupport.
	* gdbsupport: New directory, move from gdb/gdbsupport.
	* Makefile.def (host_modules, dependencies): Add gnulib.
	* Makefile.in: Rebuild.

gdb/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* nat/x86-linux-dregs.c: Include configh.h.
	* nat/linux-ptrace.c: Include configh.h.
	* nat/linux-btrace.c: Include configh.h.
	* defs.h: Include config.h, bfd.h.
	* configure.ac: Don't source common.host.
	(CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files.
	* configure: Rebuild.
	* acinclude.m4: Update path.
	* Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables.
	(CONFIG_SRC_SUBDIR): Remove gdbsupport.
	(INTERNAL_CFLAGS_BASE): Add INCSUPPORT.
	(CLIBS): Add LIBSUPPORT.
	(CDEPS): Likewise.
	(COMMON_SFILES): Remove gdbsupport files.
	(HFILES_NO_SRCDIR): Likewise.
	(stamp-version): Update path to create-version.sh.
	(ALLDEPFILES): Remove gdbsupport files.

gdb/gdbserver/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* server.h: Include config.h.
	* gdbreplay.c: Include config.h.
	* configure: Rebuild.
	* configure.ac: Don't source common.host.
	* acinclude.m4: Update path.
	* Makefile.in (INCSUPPORT): New variable.
	(INCLUDE_CFLAGS): Add INCSUPPORT.
	(SFILES): Update paths.
	(version-generated.c): Update path to create-version.sh.
	(gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths.

gdbsupport/ChangeLog
2020-01-14  Tom Tromey  <tom@tromey.com>

	* common-defs.h: Add GDBSERVER case.  Update includes.
	* acinclude.m4, aclocal.m4, config.in, configure, configure.ac,
	Makefile.am, Makefile.in, README: New files.
	* Moved from ../gdb/gdbsupport/

Change-Id: I07632e7798635c1bab389bf885971e584fb4bb78
2020-01-14 16:25:02 -07:00