aboutsummaryrefslogtreecommitdiff
path: root/gdb/configure
AgeCommit message (Collapse)AuthorFilesLines
2020-12-19Warn about static libs vs. source-highlight only when necessaryBernd Edlinger1-6/+6
Avoid the error message when source-highlight is actually available. 2020-12-19 Bernd Edlinger <bernd.edlinger@hotmail.de> * configure.ac: Move the static libs vs. source-highlight error message to a better place. * configure: Regenerate.
2020-11-28GDB: Fix detection of ELF support when configuring with ↵Alex Richardson1-0/+2
-Werror=implicit-function-declaration I am getting I'm sorry, Dave, I can't do that. Symbol format `elf64-littleriscv' unknown. errors after updating from GDB 8.3 to 10. Bisecting showed that since commit 1ff6de031241 ("bfd, ld: add CTF section linking"), bfd.h depends on strncmp() being present, so configuring with -Werror=implicit-function-declaration results in the check for ELF support in BFD failing: .../gdb/gdb/../bfd/elf-bfd.h: In function 'bfd_section_is_ctf': .../gdb/gdb/../bfd/elf-bfd.h:3086:10: error: implicit declaration of function 'strncmp' [-Werror=implicit-function-declaration] return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.'); gdb/ChangeLog: * acincludde.m4 (GDB_AC_CHECK_BFD): Include string.h in the test program. Change-Id: Iec5e21d454c2a544c44d65e23cfde552c424c18e
2020-11-15gdb: Make GMP a required dependency for building GDBJoel Brobecker1-0/+3
This commit modifies gdb's configure script to trigger an error if we cannot find a usable libgmp. For the record, making this a requirement was discussed in March 2018: https://sourceware.org/pipermail/gdb-patches/2018-March/147373.html gdb/ChangeLog: * configure.ac: Generate an error if a usable GMP library could not be found. * configure: Regenerate.
2020-11-15gdb/configure: Add --with-libgmp-prefix optionJoel Brobecker1-0/+488
This patch allows a user to tell gdb's configure script where his GMP library is installed. gdb/ChangeLog: * configure.ac: Add support for --with-libgmp-prefix. * Makefile.in (LIBGMP): New variable. (CLIBS): Include $(LIBGMP). * configure, config.in: Regenerate
2020-11-06gdb: better static python detection in configure machineryRomain Geissler1-1/+1
In python 3, itertools is a builtin module, so whether or not the python you link against is a shared or a static one, importing it works. Change the import test to use ctypes which is a dynamic module in both python 2 and 3. gdb/ChangeLog: PR python/26832 * configure: Regenerate. * configure.ac: Check for python modules ctypes instead of itertools.
2020-10-31gdb: replace AC_TRY_LINK in sanitize.m4Simon Marchi1-0/+1
... with AC_LINK_IFELSE + AC_LANG_PROGRAM. All changes in the generated configure file are insignificant whitespace changes. gdb/ChangeLog: * configure: Re-generate. * sanitize.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE + AC_LANG_PROGRAM. Change-Id: I6fc4c39e10b28d2ade964e0d59a7f8ec0d3a272a
2020-10-31gdbsupport: replace AC_TRY_COMPILE in common.m4Simon Marchi1-4/+7
... with AC_COMPILE_IFELSE + AC_LANG_PROGRAM. All the changes in the generated configure files are insignificant whitespace changes. gdb/ChangeLog: * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * common.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM. * configure: Re-generate. Change-Id: Id58e6e887f6be817d52b189921845838031dbd2a
2020-10-31gdbsupport: replace AC_TRY_COMPILE in warning.m4Simon Marchi1-3/+4
Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM. All changes in generated configure files are insignificant whitespace changes. gdb/ChangeLog: * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * configure: Re-generate. * warning.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM. Change-Id: I517bd20ec3af960ad999a586761df0ac8959a3fc
2020-10-31gdbsupport: replace AC_TRY_COMPILE in ptrace.m4Simon Marchi1-1/+6
Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM. All the changes in the generated configure files are insignificant whitespace changes. gdb/ChangeLog: * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * configure: Re-generate. * ptrace.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM. Change-Id: Ia782b5477fe49dad04e68c0f41c6d8ab3fde5bf0
2020-10-31gdbsupport: re-indent ptrace.m4Simon Marchi1-27/+28
For some reason, autoupdate isn't able to grok ptrace.m4: $ autoupdate ptrace.m4 /usr/bin/m4:/tmp/auYjuodw/input.m4:171: ERROR: end of file in string autoupdate: /usr/bin/m4 failed with exit status: 1 Honestly, I'm unable to grok it either. This patch re-indents it in a way that I think is easier to read. With this patch applied, autoupdate becomes able to parse ptrace.m4, but I chose to keep this re-indent in a patch of its own. All the changes in generated configure files consist of insignificant whitespace changes. gdb/ChangeLog: * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * configure: Re-generate. * ptrace.m4: Re-indent. Change-Id: Ie2afab09fecc8b6d0cccccb47ac9756f3843881e
2020-10-31gdb: modernize acinclude.m4Simon Marchi1-6/+10
Run autoupdate, fix indentation for readability. gdb/ChangeLog: * acinclude.m4: Modernize. * configure: Re-generate. Change-Id: I8949f885326a3206f414776b63a1fdba197bb19a
2020-10-31gdb: modernize configure.acSimon Marchi1-41/+77
Run autoupdate on configure.ac and adjust the indentation of the result for better readability. This removes a bunch of warnings when running `autoreconf -vf -Wall`. The changes are: * Replace AC_INIT with AC_INIT and no arguments plus AC_CONFIG_SRCDIR. * Replace AC_ERROR with AC_MSG_ERROR. * Replace AC_TRY_LINK with AC_LINK_IFELSE. * Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. * Replace AC_HELP_STRING with AS_HELP_STRING. autoupdate erroneously tries to replace AC_C_LONG_DOUBLE in a comment, which I reverted manually. All the changes in the generated configure file are insignificant whitespaces changes. gdb/ChangeLog: * configure.ac: Modernize. * configure: Re-generate. Change-Id: Ie3a1409c8032a36a6383da964286a46ece9b546e
2020-10-31gdb: use AC_PROG_CC_STDC instead of AM_PROG_CC_STDCSimon Marchi1-82/+0
`autoconf -Wall` notes that AM_PROG_CC_STDC is obsolete: Fixes this autoconf warning: configure.ac:40: warning: 'AM_PROG_CC_STDC': this macro is obsolete. configure.ac:40: You should simply use the 'AC_PROG_CC' macro instead. configure.ac:40: Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', configure.ac:40: but upon 'ac_cv_prog_cc_stdc'. aclocal.m4:770: AM_PROG_CC_STDC is expanded from... configure.ac:40: the top level Since we build with a C++ compiler now, I don't think this is relevant. If you look at the messages removed from gdbsupport/aclocal.m4, it says that this functionality is now integrated in AC_PROG_CC, which we already call. So it might not even make a difference. We had a local version of AM_PROG_CC_STDC, in gdb/acinclude.m4 (only used by gdb/configure.ac), remove it. gdb/ChangeLog: * acinclude.m4 (AM_PROG_CC_STDC): Remove. * configure: Re-generate. * configure.ac: Remove AM_PROG_CC_STDC. gdbsupport/ChangeLog: * aclocal.m4: Re-generate. * configure: Re-generate. * configure.ac: Remove AM_PROG_CC_STDC. Change-Id: Ic824393598805d4f78cda9d119f8af46096e9c73
2020-10-31gdb, gdbserver, gdbsupport: use AC_CANONICAL_{BUILD,HOST,TARGET} instead of ↵Simon Marchi1-0/+9
AC_CANONICAL_SYSTEM `autoreconf -Wall` notes that AC_CANONICAL_SYSTEM is obsolete: configure.ac:36: warning: The macro `AC_CANONICAL_SYSTEM' is obsolete. Replace it by AC_CANONICAL_BUILD, AC_CANONICAL_HOST and AC_CANONICAL_TARGET in configure.ac files in gdb, gdbserver and gdbsupport. All three macros may not be needed everywhere, but it is hard to completely audit the configure files to see which are required, so I think it's better (and that there's no downside) to just call all three. gdb/ChangeLog: * configure.ac: Use AC_CANONICAL_{BUILD,HOST,TARGET} instead of AC_CANONICAL_SYSTEM. * configure: Re-generate. gdbserver/ChangeLog: * configure.ac: Use AC_CANONICAL_{BUILD,HOST,TARGET} instead of AC_CANONICAL_SYSTEM. * configure: Re-generate. gdbsupport/ChangeLog: * configure.ac: Use AC_CANONICAL_{BUILD,HOST,TARGET} instead of AC_CANONICAL_SYSTEM. * configure: Re-generate. Change-Id: Ifd0e21f1e478634e768b5de1b8ee06a7f690d863
2020-09-16Require kinfo_get_file and kinfo_get_vmmap for FreeBSD hosts.John Baldwin1-62/+15
FreeBSD systems have provided these functions in libutil since 7.1 release. The most recent release without support is 6.4 released in November of 2008. This also requires libutil-freebsd on GNU/kFreeBSD systems. I assume that those systems have supported kinfo_get_file and kinfo_get_vmmap over a similar timeframe. gdb/ChangeLog: * configure.ac: Remove check for kinfo_getvmmap(). * configure, config.in: Regenerate. * fbsd-nat.c (fbsd_read_mapping): Remove (fbsd_nat_target::find_memory_regions): Remove the procfs version. (fbsd_nat_target::info_proc): Assume kinfo_getfile() and kinfo_get_vmmap() are always present. gdbsupport/ChangeLog: * common.m4 (GDB_AC_COMMON): Refactor checks for kinfo_getfile(). * configure, config.in: Regenerate.
2020-07-30Unify Solaris procfs and largefile handlingRainer Orth1-34/+83
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-28PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS worksH.J. Lu1-6/+8
There is no need to check $pkg_cv_[]$1[]_LIBS works if package check failed. config/ PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if $pkg_failed = no. binutils/ PR binutils/26301 * configure: Regenerated. gdb/ PR binutils/26301 * configure: Regenerated.
2020-07-28PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS worksH.J. Lu1-0/+22
It is quite normal to have headers without library on multilib OSes. Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS works. config/ PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if $pkg_cv_[]$1[]_LIBS works. binutils/ PR binutils/26301 * configure: Regenerated. gdb/ PR binutils/26301 * configure: Regenerated.
2020-07-27[gdb/build] Fix typo sys/sockets.h -> sys/socket.hTom de Vries1-4/+4
I'm running into a build breaker: ... src/gdb/ser-tcp.c:65:13: error: conflicting declaration ‘typedef int socklen_t’ 65 | typedef int socklen_t; | ^~~~~~~~~ In file included from ../gnulib/import/unistd.h:40, from /home/vries/gdb_versions/devel/src/gdb/../gnulib/import/pathmax.h:42, from /home/vries/gdb_versions/devel/src/gdb/../gdbsupport/common-defs.h:120, from src/gdb/defs.h:28, from src/gdb/ser-tcp.c:20: /usr/include/unistd.h:277:21: note: previous declaration as ‘typedef __socklen_t socklen_t’ 277 | typedef __socklen_t socklen_t; | ^~~~~~~~~ ... after commit 05a6b8c28b "Don't unnecessarily redefine 'socklen_t' type in MinGW builds". The root cause is a typo in gdb/configure.ac, using sys/sockets.h where sys/socket.h was meant: ... AC_CHECK_HEADERS([sys/sockets.h]) ... Fix the typo. Build and tested on x86_64-linux. gdb/ChangeLog: 2020-07-27 Tom de Vries <tdevries@suse.de> * configure.ac: Fix sys/sockets.h -> sys/socket.h typo. * config.in: Regenerate. * configure: Regenerate.
2020-07-26Don't unnecessarily redefine 'socklen_t' type in MinGW builds.Eli Zaretskii1-1/+30
The original configure-time tests in gdb/ and gdbserver/ failed to detect that 'socklen_t' is defined in MinGW headers because the test program included only sys/socket.h, which is absent in MinGW system headers. However on MS-Windows this data type is declared in another header, ws2tcpip.h. The modified test programs try using ws2tcpip.h if sys/socket.h is unavailable. Thanks to Joel Brobecker who helped me regenerate the configure scripts and the config.in files. gdb/ChangeLog: 2020-07-26 Eli Zaretskii <eliz@gnu.org> * configure.ac (AC_CHECK_HEADERS): Check for sys/socket.h and ws2tcpip.h. When checking whether socklen_t type is defined, use ws2tcpip.h if it is available and sys/socket.h isn't. * configure: Regenerate. * config.in: Regenerate. gdbserver/ChangeLog: 2020-07-26 Eli Zaretskii <eliz@gnu.org> * configure.ac (AC_CHECK_HEADERS): Add ws2tcpip.h. When checking whether socklen_t type is defined, use ws2tcpip.h if it is available and sys/socket.h isn't. * configure: Regenerate. * config.in: Regenerate.
2020-07-24config/debuginfod.m4: Use PKG_CHECK_MODULESAaron Merey1-103/+262
Use PKG_CHECK_MODULES to set debuginfod autoconf vars. Also add pkg.m4 to config/. ChangeLog: * config/debuginfod.m4: use PKG_CHECK_MODULES. * config/pkg.m4: New file. * configure: Rebuild. * configure.ac: Remove AC_DEBUGINFOD. ChangeLog/binutils: * Makefile.am: Replace LIBDEBUGINFOD with DEBUGINFOD_LIBS. * Makefile.in: Rebuild. * configure: Rebuild. * doc/Makefile.in: Rebuild. ChangeLog/gdb: * Makefile.in: Replace LIBDEBUGINFOD with DEBUGINFOD_LIBS. * configure: Rebuild.
2020-07-20guile: Add support for Guile 3.0.Ludovic Courtès1-1/+1
gdb/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * guile/scm-math.c (vlscm_integer_fits_p): Use 'uintmax_t' and 'intmax_t' instead of 'scm_t_uintmax' and 'scm_t_intmax', which are deprecated in Guile 3.0. * configure.ac (try_guile_versions): Add "guile-3.0". * configure (try_guile_versions): Regenerate. * NEWS: Update entry. gdb/testsuite/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * gdb.guile/source2.scm: Add #f first argument to 'format'. * gdb.guile/types-module.exp: Remove "ERROR:" from regexps since Guile 3.0 no longer prints that. gdb/doc/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * doc/guile.texi (Guile Introduction): Mention Guile 3.0. Change-Id: Iff116c2e40f334e4e0ca4e759a097bfd23634679
2020-07-20guile: Add support for Guile 2.2.Ludovic Courtès1-1/+1
This primarily updates code that uses the I/O port API of Guile. gdb/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> Doug Evans <dje@google.com> PR gdb/21104 * guile/scm-ports.c (USING_GUILE_BEFORE_2_2): New macro. (ioscm_memory_port)[read_buf_size, write_buf_size]: Wrap in #if USING_GUILE_BEFORE_2_2. (stdio_port_desc, memory_port_desc) [!USING_GUILE_BEFORE_2_2]: Change type to 'scm_t_port_type *'. (natural_buffer_size) [!USING_GUILE_BEFORE_2_2]: New variable. (ioscm_open_port) [USING_GUILE_BEFORE_2_2]: Add 'stream' parameter and honor it. Update callers. (ioscm_open_port) [!USING_GUILE_BEFORE_2_2]: New function. (ioscm_read_from_port, ioscm_write) [!USING_GUILE_BEFORE_2_2]: New functions. (ioscm_fill_input, ioscm_input_waiting, ioscm_flush): Wrap in #if USING_GUILE_BEFORE_2_2. (ioscm_init_gdb_stdio_port) [!USING_GUILE_BEFORE_2_2]: Use 'ioscm_read_from_port'. Call 'scm_set_port_read_wait_fd'. (ioscm_init_stdio_buffers) [!USING_GUILE_BEFORE_2_2]: New function. (gdbscm_stdio_port_p) [!USING_GUILE_BEFORE_2_2]: Use 'SCM_PORTP' and 'SCM_PORT_TYPE'. (gdbscm_memory_port_end_input, gdbscm_memory_port_seek) (ioscm_reinit_memory_port): Wrap in #if USING_GUILE_BEFORE_2_2. (gdbscm_memory_port_read, gdbscm_memory_port_write) (gdbscm_memory_port_seek, gdbscm_memory_port_close) [!USING_GUILE_BEFORE_2_2]: New functions. (gdbscm_memory_port_print): Remove use of 'SCM_PTOB_NAME'. (ioscm_init_memory_port_type) [!USING_GUILE_BEFORE_2_2]: Use 'gdbscm_memory_port_read'. Wrap 'scm_set_port_end_input', 'scm_set_port_flush', and 'scm_set_port_free' calls in #if USING_GUILE_BEFORE_2_2. (gdbscm_get_natural_buffer_sizes) [!USING_GUILE_BEFORE_2_2]: New function. (ioscm_init_memory_port): Remove. (ioscm_init_memory_port_stream): New function (ioscm_init_memory_port_buffers) [USING_GUILE_BEFORE_2_2]: New function. (gdbscm_memory_port_read_buffer_size) [!USING_GUILE_BEFORE_2_2]: Return scm_from_uint (0). (gdbscm_set_memory_port_read_buffer_size_x) [!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'. (gdbscm_memory_port_write_buffer_size) [!USING_GUILE_BEFORE_2_2]: Return scm_from_uint (0). (gdbscm_set_memory_port_write_buffer_size_x) [!USING_GUILE_BEFORE_2_2]: Call 'scm_setvbuf'. * configure.ac (try_guile_versions): Add "guile-2.2". * configure: Regenerate. * NEWS: Add entry. gdb/testsuite/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * gdb.guile/scm-error.exp ("source $remote_guile_file_1"): Relax error regexp to match on Guile 2.2. gdb/doc/ChangeLog 2020-06-28 Ludovic Courtès <ludo@gnu.org> * guile.texi (Memory Ports in Guile): Mark 'memory-port-read-buffer-size', 'set-memory-port-read-buffer-size!', 'memory-port-write-buffer-size', 'set-memory-port-read-buffer-size!' as deprecated. * doc/guile.texi (Guile Introduction): Clarify which Guile versions are supported. Change-Id: Ib119b10a2787446e0ae482a5e1b36d809c44bb31
2020-06-26Fix --enable-libctf and --disable-staticNick Alcock1-0/+40
This fixes test runs and compilation when --disable-libctf, --disable-static, or --enable-shared are passed. Changes since v2: Use GCC_ENABLE and fix indentation. Fix prototype using 'void'. Use 'unsupported' and gdb_caching_proc. Changes since v3: Adapt to upstream changes providing skip_ctf_tests. Changes since v4: Adapt to upstream changes in the seven months (!) since I last looked at this. gdb/ChangeLog * configure.ac: Add --enable-libctf: handle --disable-static properly. * acinclude.m4: sinclude ../config/enable.m4. * Makefile.in (aclocal_m4_deps): Adjust accordingly. (LIBCTF): Substitute in. (CTF_DEPS): New, likewise. (CLIBS): libctf needs symbols from libbfd: move earlier. (CDEPS): Use CTF_DEPS, not LIBCTF, now LIBCTF can include rpath flags. * ctfread.c: Surround in ENABLE_LIBCTF. (elfctf_build_psymtabs) [!ENABLE_LIBCTF]: New stub. * configure: Regenerate. * config.in: Likewise. gdb/testsuite/ChangeLog * configure.ac: Add --enable-libctf. * aclocal.m4: sinclude ../config/enable.m4. * Makefile.in (site.exp): Add enable_libctf to site.exp. * lib/gdb.exp (skip_ctf_tests): Use it. * gdb.base/ctf-constvars.exp: Error message tweak. * gdb.base/ctf-ptype.exp: Likewise. * configure: Regenerate.
2020-05-30gdb: change bug URL to httpsJonny Grant1-1/+1
gdb/ChangeLog: * configure.ac (ACX_BUGURL): change bug URL to https. Signed-off-by: Jonny Grant <jg@jguk.org> Change-Id: If8d939e50c830e3e452c3e8f7a7aee06d9c96645
2020-04-27gdb, gdbserver: remove configure check for fs_base/gs_base in user_regs_structSimon Marchi1-27/+0
I recently stumbled on this code mentioning Linux kernel 2.6.25, and thought it could be time for some spring cleaning (newer GDBs probably don't need to supports 12-year old kernels). I then found that the "legacy" case is probably broken anyway, which gives an even better motivation for its removal. In short, this patch removes the configure checks that check if user_regs_struct contains the fs_base/gs_base fields and adjusts all uses of the HAVE_STRUCT_USER_REGS_STRUCT_{FS,GS}_BASE macros. The longer explanation/rationale follows. Apparently, Linux kernels since 2.6.25 (that's from 2008) have been reliably providing fs_base and gs_base as part of user_regs_struct. Commit df5d438e33d7 in the Linux kernel [1] seems related. This means that we can get these values by reading registers with PTRACE_GETREGS. Previously, these values were obtained using a separate PTRACE_ARCH_PRCTL ptrace call. First, I'm not even sure the configure check was really right in the first place. The user_regs_struct used by GDB comes from /usr/include/x86_64-linux-gnu/sys/user.h (or equivalent on other distros) and is provided by glibc. glibc has had the fs_base/gs_base fields in there for a very long time, at least since this commit from 2001 [2]. The Linux kernel also has its version of user_regs_struct, which I think was exported to user-space at some point. It included the fs_base/gs_base fields since at least this 2002 commit [3]. In any case, my conclusion is that the fields were there long before the aforementioned Linux kernel commit. The kernel commit didn't add these fields, it only made sure that they have reliable values when obtained with PTRACE_GETREGS. So, checking for the presence of the fs_base/gs_base fields in struct user_regs_struct doesn't sound like a good way of knowing if we can reliably get the fs_base/gs_base values from PTRACE_GETREGS. My guess is that if we were using that strategy on a < 2.6.25 kernel, things would not work correctly: - configure would find that the user_regs_struct has the fs_base/gs_base fields (which are probided by glibc anyway) - we would be reading the fs_base/gs_base values using PTRACE_GETREGS, for which the kernel would provide unreliable values Second, I have tried to see how things worked by forcing GDB to not use fs_base/gs_base from PTRACE_GETREGS (forcing it to use the "legacy" code, by configuring with ac_cv_member_struct_user_regs_struct_gs_base=no ac_cv_member_struct_user_regs_struct_fs_base=no Doing so breaks writing registers back to the inferior. For example, calling an inferior functions gives an internal error: (gdb) p malloc(10) /home/smarchi/src/binutils-gdb/gdb/i387-tdep.c:1408: internal-error: invalid i387 regnum 152 The relevant last frames where this error happens are: #8 0x0000563123d262fc in internal_error (file=0x563123e93fd8 "/home/smarchi/src/binutils-gdb/gdb/i387-tdep.c", line=1408, fmt=0x563123e94482 "invalid i387 regnum %d") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:55 #9 0x0000563123047d0d in i387_collect_xsave (regcache=0x5631269453f0, regnum=152, xsave=0x7ffd38402a20, gcore=0) at /home/smarchi/src/binutils-gdb/gdb/i387-tdep.c:1408 #10 0x0000563122c69e8a in amd64_collect_xsave (regcache=0x5631269453f0, regnum=152, xsave=0x7ffd38402a20, gcore=0) at /home/smarchi/src/binutils-gdb/gdb/amd64-tdep.c:3448 #11 0x0000563122c5e94c in amd64_linux_nat_target::store_registers (this=0x56312515fd10 <the_amd64_linux_nat_target>, regcache=0x5631269453f0, regnum=152) at /home/smarchi/src/binutils-gdb/gdb/amd64-linux-nat.c:335 #12 0x00005631234c8c80 in target_store_registers (regcache=0x5631269453f0, regno=152) at /home/smarchi/src/binutils-gdb/gdb/target.c:3485 #13 0x00005631232e8df7 in regcache::raw_write (this=0x5631269453f0, regnum=152, buf=0x56312759e468 "@\225\372\367\377\177") at /home/smarchi/src/binutils-gdb/gdb/regcache.c:765 #14 0x00005631232e8f0c in regcache::cooked_write (this=0x5631269453f0, regnum=152, buf=0x56312759e468 "@\225\372\367\377\177") at /home/smarchi/src/binutils-gdb/gdb/regcache.c:778 #15 0x00005631232e75ec in regcache::restore (this=0x5631269453f0, src=0x5631275eb130) at /home/smarchi/src/binutils-gdb/gdb/regcache.c:283 #16 0x0000563123083fc4 in infcall_suspend_state::restore (this=0x5631273ed930, gdbarch=0x56312718cf20, tp=0x5631270bca90, regcache=0x5631269453f0) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:9103 #17 0x0000563123081eed in restore_infcall_suspend_state (inf_state=0x5631273ed930) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:9151 The problem seems to be that amd64_linux_nat_target::store_registers calls amd64_native_gregset_supplies_p to know whether gregset provides fs_base. When !HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE, amd64_native_gregset_supplies_p returns false. store_registers therefore assumes that it must be an "xstate" register. This is of course wrong, and that leads to the failed assertion when i387_collect_xsave doesn't recognize the register. amd64_linux_nat_target::store_registers could probably be fixed to handle this case, but I don't think it's worth it, given that it would only be to support very old kernels. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5d438e33d7fc914ba9b6e0d6b019a8966c5fcc [2] https://sourceware.org/git/?p=glibc.git;a=commit;h=c9cf6ddeebb7bb [3] https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=88e4bc32686ebd0b1111a94f93eba2d334241f68 gdb/ChangeLog: * configure.ac: Remove check for fs_base/gs_base in user_regs_struct. * configure: Re-generate. * config.in: Re-generate. * amd64-nat.c (amd64_native_gregset_reg_offset): Adjust. * amd64-linux-nat.c (amd64_linux_nat_target::fetch_registers, amd64_linux_nat_target::store_registers, ps_get_thread_area, ): Adjust. gdbserver/ChangeLog: * configure.ac: Remove check for fs_base/gs_base in user_regs_struct. * configure: Re-generate. * config.in: Re-generate. * linux-x86-low.cc (x86_64_regmap, x86_fill_gregset, x86_store_gregset): Adjust.
2020-04-13Move event-loop configury to common.m4Tom Tromey1-5/+5
gdb_select.h and the event loop require some configure checks, so this moves the needed checks to common.m4 and updates the configure scripts. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Remove checks that are now in GDB_AC_COMMON. gdbserver/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * configure: Rebuild. * config.in: Rebuild. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * config.in, configure: Rebuild. * common.m4 (GDB_AC_COMMON): Check for poll.h, sys/poll.h, sys/select.h, and poll.
2020-03-20gdb: remove HAVE_DECL_PTRACESimon Marchi1-20/+0
I stumbled on this snippet in nat/gdb_ptrace.h: /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64 or whatever it's called these days, don't provide a prototype for ptrace. Provide one to silence compiler warnings. */ #ifndef HAVE_DECL_PTRACE extern PTRACE_TYPE_RET ptrace(); #endif I believe this is unnecessary today and should be removed. First, the comment only mentions OSes we don't support (and to be honest, I had never even heard of). But most importantly, in C++, a declaration with empty parenthesis declares a function that accepts no arguments, unlike in C. So if this declaration was really used, GDB wouldn't build, since all ptrace call sites pass some arguments. Since we haven't heard anything about this causing some build failures since we have transitioned to C++, I conclude that it's not used. This patch removes it as well as the corresponding configure check. gdb/ChangeLog: * ptrace.m4: Don't check for ptrace declaration. * config.in: Re-generate. * configure: Re-generate. * nat/gdb_ptrace.h: Don't declare ptrace if HAVE_DECL_PTRACE is not defined. gdbserver/ChangeLog: * config.in: Re-generate. * configure: Re-generate. gdbsupport/ChangeLog: * config.in: Re-generate. * configure: Re-generate.
2020-03-12Don't include selftests objects in build when unit tests are disabledSimon Marchi1-2/+2
While working on the preceding selftests patches, I noticed that some selftests-specific files are included in the build even when selftests are disabled, namely disasm-selftest.c and gdbarch-selftests.c. These files are entirely #if'ed out when building with selftests disabled. This is not a huge problem, but I think it would make more sense if these files were simply not built. With this patch, I propose to put all the selftests-specific source files into a SELFTESTS_SRCS Makefile variable (even selftest-arch.c, which is currently added by the configure script). gdb/ChangeLog: * Makefile.in (SUBDIR_UNITTESTS_SRCS): Rename to... (SELFTESTS_SRCS): ... this. Add disasm-selftests.c, gdbarch-selfselftests.c and selftest-arch.c. (SUBDIR_UNITTESTS_OBS): Rename to... (SELFTESTS_OBS): ... this. (COMMON_SFILES): Remove disasm-selftests.c and gdbarch-selftests.c. * configure.ac: Don't add selftest-arch.{c,o} to CONFIG_{SRCS,OBS}. * disasm-selftests.c, gdbarch-selftests.c: Remove GDB_SELF_TEST preprocessor conditions.
2020-03-12Move sourcing of development.sh to GDB_AC_COMMONSimon Marchi1-4/+5
The same is done for gdb, gdbserver and gdbsupport. I therefore think it makes sense to move that to GDB_AC_COMMON. It is required to move the call to GDB_AC_COMMON so it is before GDB_AC_SELFTEST in gdbserver/configure.ac, otherwise the $development variable isn't set when the code behind GDB_AC_SELFTEST executes. gdb/ChangeLog: * configure.ac: Don't source bfd/development.sh. * selftest.m4: Modify comment. * configure: Re-generate. gdbserver/ChangeLog: * configure.ac: Don't source bfd/development.sh, move GDB_AC_COMMON higher. * configure: Re-generate. gdbsupport/ChangeLog: * configure.ac: Don't source bfd/development.sh. * common.m4: Source bfd/development.sh. * configure: Re-generate.
2020-03-12gdb/selftest.m4: ensure $development is setSimon Marchi1-0/+5
Before commit 3d1e5a43cbe ("gdbsupport/configure.ac: source development.sh"), the GDB build in non-development mode (turn development to false in bfd/development.sh if you want to try) was broken because the gdbsupport configure script didn't source bfd/development.sh to set the development variable. Since the GDB_AC_SELFTEST macro relies on the `development` variable, I propose to modify it such that it errors out if $development does not have an expected value of "true" or "false". This could prevent a future similar problem from happening while refactoring the configure scripts. It would have caught the problem fixed by the patch mentioned earlier. gdb/ChangeLog: * selftest.m4 (GDB_AC_SELFTEST): Error out if $development is not "true" or "false". * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * configure: Re-generate.
2020-03-11gdb: enable -Wmissing-prototypes warningSimon Marchi1-0/+1
While compiling with clang, I noticed it didn't catch cases where my function declaration didn't match my function definition. This is normally caught by gcc with -Wmissing-declarations. On clang, this is caught by -Wmissing-prototypes instead. Note that on gcc, -Wmissing-prototypes also exists, but is only valid for C and Objective-C. It gets correctly rejected by the configure script since gcc rejects it with: cc1plus: error: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++ -Werror So this warning flag ends up not used for gcc (which is what we want). gdb/ChangeLog: * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * configure: Re-generate. * warning.m4: Enable -Wmissing-prototypes.
2020-02-26Add debuginfod support to GDBAaron Merey1-47/+135
debuginfod is a lightweight web service that indexes ELF/DWARF debugging resources by build-id and serves them over HTTP. This patch enables GDB to query debuginfod servers for separate debug files and source code when it is otherwise not able to find them. GDB can be built with debuginfod using the --with-debuginfod configure option. This requires that libdebuginfod be installed and found at configure time. debuginfod is packaged with elfutils, starting with version 0.178. For more information see https://sourceware.org/elfutils/. Tested on x86_64 Fedora 31. gdb/ChangeLog: 2020-02-26 Aaron Merey <amerey@redhat.com> * Makefile.in: Handle optional debuginfod support. * NEWS: Update. * README: Add --with-debuginfod summary. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Handle optional debuginfod support. * debuginfod-support.c: debuginfod helper functions. * debuginfod-support.h: Ditto. * doc/gdb.texinfo: Add --with-debuginfod to configure options summary. * dwarf2/read.c (dwarf2_get_dwz_file): Query debuginfod servers when a dwz file cannot be found. * elfread.c (elf_symfile_read): Query debuginfod servers when a debuginfo file cannot be found. * source.c (open_source_file): Query debuginfod servers when a source file cannot be found. * top.c (print_gdb_configuration): Include --{with,without}-debuginfod in the output. gdb/testsuite/ChangeLog: 2020-02-26 Aaron Merey <amerey@redhat.com> * gdb.debuginfod: New directory for debuginfod tests. * gdb.debuginfod/main.c: New test file. * gdb.debuginfod/fetch_src_and_symbols.exp: New tests.
2020-02-20gdb: Allow more control over where to find python librariesAndrew Burgess1-0/+49
The motivation behind this commit is to make it easier to bundle the Python *.py library files with GDB when statically linking GDB against libpython. The Python files will be manually added into the GDB installation tree, and GDB should be able to find them at run-time. The installation tree will look like this: . |-- bin/ |-- include/ |-- lib/ | `-- python3.8/ `-- share/ The benefit here is that the entire installation tree can be bundled into a single archive and copied to another machine with a different version of Python installed, and GDB will still work, including its Python support. In use the new configure options would be used something like this, first build and install a static Python library: mkdir python cd python # Clone or download Python into a src/ directory. mkdir build export PYTHON_INSTALL_PATH=$PWD/install cd build ../src/configure --disable-shared --prefix=$PYTHON_INSTALL_PATH make make install Now build and install GDB: mkdir binutils-gdb cd binutils-gdb # Clone or download GDB into a src/ directory. mkdir build export GDB_INSTALL_DIR=$PWD/install cd build ../src/configure \ --prefix=$GDB_INSTALL_DIR \ --with-python=$PYTHON_INSTALL_PATH/bin/python3 \ --with-python-libdir=$GDB_INSTALL_DIR/lib make all-gdb make install-gdb Finally, copy the Python libraries into the GDB install: cp -r $PYTHON_INSTALL_DIR/lib/python3.8/ $GDB_INSTALL_DIR/lib After this the Python src, build, and install directories are no longer needed and can be deleted. If the new --with-python-libdir option is not used then the existing behaviour is left unchanged, GDB will look for the Python libraries in the lib/ directory within the python path. The concatenation of the python prefix and the string 'lib/' is now done at configure time, rather than at run time in GDB as it was previous, however, this was never something that the user had dynamic control over, so there's no loss of functionality. gdb/ChangeLog: * config.in: Regenerate. * configure: Regenerate. * configure.ac: Add --with-python-libdir option. * main.c: Use WITH_PYTHON_LIBDIR.
2020-02-19Merge changes from GCC for the config/ directoryAndrew Burgess1-42/+161
GCC's config/ChangeLog since the last time this merge was done (in the binutils-gdb commit 0b4d000cc4e8e77c823) is included at the end of this commit message. It is worth noting that the binutils-gdb commit 301a9420d947da1458 added the file config/debuginfod.m4 which is not present in GCC's config/ directory. This file is preserved, unmodified, after this commit. In order to regenerate all of the configure files, I configured with --enable-maintainer-mode, and built the 'all' target. I then did the same thing on a source tree without this patch, and only committed those files that changed when this patch was added. GCC's config/ChangeLog entries: 2020-02-12 Sandra Loosemore <sandra@codesourcery.com> PR libstdc++/79193 PR libstdc++/88999 * no-executables.m4: Use a non-empty program to test for linker support. 2020-02-01 Andrew Burgess <andrew.burgess@embecosm.com> * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Update shell syntax. 2020-01-27 Andrew Burgess <andrew.burgess@embecosm.com> * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Add new --with-libXXX-type=... option. Use this to guide the selection of either a shared library or a static library. 2020-01-24 Maciej W. Rozycki <macro@wdc.com> * toolexeclibdir.m4: New file. 2019-09-10 Christophe Lyon <christophe.lyon@st.com> * futex.m4: Handle *-uclinux*. * tls.m4 (GCC_CHECK_TLS): Likewise. 2019-09-06 Florian Weimer <fweimer@redhat.com> * futex.m4 (GCC_LINUX_FUTEX): Include <unistd.h> for the syscall function. 2019-07-08 Richard Sandiford <richard.sandiford@arm.com> * bootstrap-Og.mk: New file. 2019-06-25 Kwok Cheung Yeung <kcy@codesourcery.com> Andrew Stubbs <ams@codesourcery.com> * gthr.m4 (GCC_AC_THREAD_HEADER): Add case for gcn. 2019-05-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * ax_count_cpus.m4: New file. 2019-05-02 Richard Biener <rguenther@suse.de> PR bootstrap/85574 * bootstrap-lto.mk (extra-compare): Set to gcc/lto1$(exeext). 2019-04-16 Martin Liska <mliska@suse.cz> * bootstrap-lto-lean.mk: Filter out -flto in STAGEtrain_CFLAGS. 2019-04-09 Martin Liska <mliska@suse.cz> * bootstrap-lto-lean.mk: New file. 2019-03-02 Johannes Pfau <johannespfau@gmail.com> * mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code. 2018-10-31 Joseph Myers <joseph@codesourcery.com> PR bootstrap/82856 * math.m4, tls.m4: Use AC_LANG_SOURCE. Merge from binutils-gdb: 2018-06-19 Simon Marchi <simon.marchi@ericsson.com> * override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69. config/ChangeLog: * ax_count_cpus.m4: New file, backported from GCC. * bootstrap-Og.mk: New file, backported from GCC. * bootstrap-lto-lean.mk: New file, backported from GCC. * bootstrap-lto.mk: Changes backported from GCC. * futex.m4: Changes backported from GCC. * gthr.m4: Changes backported from GCC. * lib-link.m4: Changes backported from GCC. * mh-mingw: Changes backported from GCC. * no-executables.m4: Changes backported from GCC. * tls.m4: Changes backported from GCC. * toolexeclibdir.m4: New file, backported from GCC. binutils/ChangeLog: * configure: Regenerate. gdb/ChangeLog: * configure: Regenerate. gdbserver/ChangeLog: * configure: Regenerate. gdbsupport/ChangeLog: * configure: Regenerate. intl/ChangeLog: * configure: Regenerate. libiberty/ChangeLog: * configure: Regenerate. zlib/ChangeLog.bin-gdb: * configure: Regenerate.
2020-02-11Re-generate gdb/gdbserver/gdbsupport configure scriptsSimon Marchi1-1/+2
In my previous commit, I did a last minute modification of warning.m4, but forgot to re-generate the configure scripts, this commit fixes that. gdb/ChangeLog: * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdbsupport/ChangeLog: * configure: Re-generate.
2020-02-11Add -Wstrict-null-sentinel to gdbsupport/warning.m4Simon Marchi1-1/+2
Commit 85f0dd3ce ("[gdb] Fix -Wstrict-null-sentinel warnings") fixed some violations of -Wstrict-null-sentinel. If we want to enforce this warning, I think we should enable it in our warning.m4 file. gdbsupport/ChangeLog: * warning.m4: Add -Wstrict-null-sentinel. * configure: Re-generate. gdbserver/ChangeLog: * configure: Re-generate. gdb/ChangeLog: * configure: Re-generate.
2020-02-07Move gdbserver to top levelTom Tromey1-40/+1
This patch moves gdbserver to the top level. This patch is as close to a pure move as possible -- gdbserver still builds its own variant of gnulib and gdbsupport. Changing this will be done in a separate patch. [v2] Note that, per Simon's review comment, this patch changes the tree so that gdbserver is not built for or1k or score. This makes sense, because there is apparently not actually a gdbserver port here. [v3] This version of the patch also splits out some configury into a new file, gdbserver/configure.host, so that the top-level configure script can simply rely on it in order to decide whether gdbserver should be built. [v4] This version adds documentation and removes some unnecessary top-level dependencies. [v5] Update docs to mention "make all-gdbserver" and change how top-level configure decides whether to build gdbserver, switching to a single, shared script. Tested by the buildbot. ChangeLog 2020-02-07 Tom Tromey <tom@tromey.com> Pedro Alves <palves@redhat.com> * src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver. * gdbserver: New directory, moved from gdb/gdbserver. * configure.ac (host_tools): Add gdbserver. Only build gdbserver on certain systems. * Makefile.in, configure: Rebuild. * Makefile.def (host_modules, dependencies): Add gdbserver. * MAINTAINERS: Add gdbserver. gdb/ChangeLog 2020-02-07 Tom Tromey <tom@tromey.com> * README: Update gdbserver documentation. * gdbserver: Move to top level. * configure.tgt (build_gdbserver): Remove. * configure.ac: Remove --enable-gdbserver. * configure: Rebuild. * Makefile.in (distclean): Don't mention gdbserver. Change-Id: I826b7565b54604711dc7a11edea0499cd51ff39e
2020-01-14Move many configure checks to common.m4Tom Tromey1-1500/+1500
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-14Move gdbsupport to the top levelTom Tromey1-2/+2
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-14Consolidate definition of USE_WIN32APITom Tromey1-10/+13
I noticed that USE_WIN32API is defined separately by gdbserver and gdb. However, because it is used by code in gdbsupport, it should be defined by common.m4. This approach ensures that the code will continue to work when it is moved to the top level. gdb/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * gdbsupport/common.m4 (GDB_AC_COMMON): Define WIN32APILIBS and USE_WIN32API when needed. * configure.ac (USE_WIN32API): Don't define. (WIN32LIBS): Use WIN32APILIBS. * configure: Rebuild. gdb/gdbserver/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * configure.ac (LIBS): Use WIN32APILIBS. (USE_WIN32API): Don't define. * configure: Rebuild. Change-Id: I40d524d5445ebfb452b36f4d0e102f0b1e1089df
2020-01-14Fix indentation in common.m4Tom Tromey1-4/+4
Simon pointed out that the indentation in common.m4 is off. This patch fixes the problem. gdb/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * configure: Rebuild. * gdbsupport/common.m4 (GDB_AC_COMMON): Fix indentation. gdb/gdbserver/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * configure: Rebuild. Change-Id: I6a629bd5873cca95ba3e17656f0d0ce583a08361
2020-01-13Enable -Wmissing-declarations diagnosticSimon Marchi1-1/+2
Now that most warnings of this kind are fixed, we can enable -Wmissing-declarations. I say "most", because it is likely that there are some more in some configurations I am not able to build, but they should be pretty easy to fix. gdb/ChangeLog: * warning.m4: Add -Wmissing-declarations to build_warnings. * configure: Re-generate. gdb/gdbserver/ChangeLog: * configure: Re-generate. Change-Id: Iae9b59f22eb5dd1965d09f34c5c9e212cddf67ba
2019-12-19Consistently quote variables used with "test"Christian Biesinger1-33/+33
This ensures that empty variables and variables with spaces are handled correctly. Code was inconsistent on whether the constant string (e.g. yes/no) should also be quoted; I tried to be consistent with surrounding code. This fixes the error Eli reported during configure with mingw (though that was not fatal). gdb/ChangeLog: 2019-12-19 Christian Biesinger <cbiesinger@google.com> * configure: Regenerate. * configure.ac: Quote variable arguments of test. * gdbsupport/common.m4: Likewise. gdb/gdbserver/ChangeLog: 2019-12-19 Christian Biesinger <cbiesinger@google.com> * configure: Regenerate. * configure.ac: Quote variable arguments of test. Change-Id: I220e78b52c7db88b9dd058eda604635b03464fac
2019-12-10Replace the remaining uses of strerror with safe_strerrorChristian Biesinger1-11/+1
To do that, this patch makes IPA compile safe-strerror as well. Because it doesn't use Gnulib, it calls the Glibc version of strerror_r directly. Consequently this patch also removes the configure checks for strerror. gdb/ChangeLog: 2019-12-10 Christian Biesinger <cbiesinger@google.com> * config.in: Regenerate. * configure: Regenerate. * gdbsupport/agent.c (gdb_connect_sync_socket): Call safe_strerror instead of strerror. * gdbsupport/common.m4: Don't check for strerror. * gdbsupport/safe-strerror.c: Support both the glibc version of strerror_r and the XSI version. gdb/gdbserver/ChangeLog: 2019-12-10 Christian Biesinger <cbiesinger@google.com> * Makefile.in: Add safe-strerror.c to gdbreplay and IPA, and change UNDO_GNULIB_CFLAGS to undo strerror_r instead of strerror. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Don't check for strerror. * linux-i386-ipa.c (initialize_fast_tracepoint_trampoline_buffer): Call safe_strerror instead of strerror. * server.h (strerror): Remove this now-unnecessary declaration. * tracepoint.c (init_named_socket): Call safe_strerror instead of strerror. (gdb_agent_helper_thread): Likewise. * utils.c (perror_with_name): Likewise. Change-Id: I74848f072dcde75cb55c435ef9398dc8f958cd73
2019-11-26Set names of worker threadsTom Tromey1-4/+5
This adds some configury so that gdb can set the names of worker threads. This makes them show up more nicely when debugging gdb itself. 2019-11-26 Tom Tromey <tom@tromey.com> * gdbsupport/thread-pool.c (thread_pool::set_thread_count): Set name of worker thread. * gdbsupport/common.m4 (GDB_AC_COMMON): Check for pthread_setname_np. * configure, config.in: Rebuild. gdb/gdbserver/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * configure, config.in: Rebuild. Change-Id: I60473d65ae9ae14d8c56ddde39684240c16aaf35
2019-11-26Add RAII class for blocking gdb signalsTom Tromey1-0/+82
This adds configury support and an RAII class that can be used to temporarily block signals that are used by gdb. (This class is not used in this patch, but it split out for easier review.) The idea of this patch is that these signals should only be delivered to the main thread. So, when creating a background thread, they are temporarily blocked; the blocked state is inherited by the new thread. The sigprocmask man page says: The use of sigprocmask() is unspecified in a multithreaded process; see pthread_sigmask(3). This patch changes gdb to use pthread_sigmask when appropriate, by introducing a convenience define. I've updated gdbserver as well, because I had to touch gdbsupport, and because the threading patches will make it link against the thread library. I chose not to touch the NTO code, because I don't know anything about that platform and because I cannot test it. Finally, this modifies an existing spot in the Guile layer to use the new facility. gdb/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * gdbsupport/signals-state-save-restore.c (original_signal_mask): Remove comment. (save_original_signals_state, restore_original_signals_state): Use gdb_sigmask. * linux-nat.c (block_child_signals, restore_child_signals_mask) (_initialize_linux_nat): Use gdb_sigmask. * guile/guile.c (_initialize_guile): Use block_signals. * Makefile.in (HFILES_NO_SRCDIR): Add gdb-sigmask.h. * gdbsupport/gdb-sigmask.h: New file. * event-top.c (async_sigtstp_handler): Use gdb_sigmask. * cp-support.c (gdb_demangle): Use gdb_sigmask. * gdbsupport/common.m4 (GDB_AC_COMMON): Check for pthread_sigmask. * configure, config.in: Rebuild. * gdbsupport/block-signals.h: New file. gdb/gdbserver/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * remote-utils.c (block_unblock_async_io): Use gdb_sigmask. * linux-low.c (linux_wait_for_event_filtered, linux_async): Use gdb_sigmask. * configure, config.in: Rebuild. Change-Id: If3f37dc57dd859c226e9e4d79458a0514746e8c6
2019-11-26Add configure check for std::threadTom Tromey1-0/+767
This adds a configure check for std::thread. This is needed because std::thread is not available on some systems, like some versions of mingw and DJGPP. This also adds configury to make sure that a threaded gdb links against the correct threading library (-lpthread or the like), and passes the right flags (e.g., -pthread) to the compilations. Note that this also links gdbserver against the thread library. This is not strictly necessary at this point in the series, but a later patch will change gdbsupport to use pthread_sigmask, at which point this will be needed. gdb/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * acinclude.m4: Include ax_pthread.m4. * Makefile.in (PTHREAD_CFLAGS, PTHREAD_LIBS): New variables. (INTERNAL_CFLAGS_BASE): Use PTHREAD_CFLAGS. (CLIBS): Use PTHREAD_LIBS. (aclocal_m4_deps): Add ax_pthread.m4. * config.in, configure: Rebuild. * gdbsupport/common.m4 (GDB_AC_COMMON): Check for std::thread. gdb/gdbserver/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * Makefile.in (PTHREAD_CFLAGS, PTHREAD_LIBS): New variables. (INTERNAL_CFLAGS_BASE): Use PTHREAD_CFLAGS. (GDBSERVER_LIBS): Use PTHREAD_LIBS. * acinclude.m4: Include ax_pthread.m4. * config.in, configure: Rebuild. Change-Id: I00ec55db6077f2615421a93461fc3be57e916aa0
2019-11-15Use gnulib's strerror_r on MinGWChristian Biesinger1-4/+0
There is no need to keep mingw-strerror around; we can just always use the code from posix-strerror. The main reason we had that code, it seems, is to handle winsock error codes, but gnulib's version handles those. Unfortunately the code can't be moved into common-utils.c because libinproctrace.so uses common-utils but not gnulib. gdb/ChangeLog: 2019-11-15 Christian Biesinger <cbiesinger@google.com> * Makefile.in: Replace {posix,mingw}-strerror.c with safe-strerror.c. * configure: Regenerate. * configure.ac: Don't source common.host. * gdbsupport/common.host: Remove. * gdbsupport/mingw-strerror.c: Remove. * gdbsupport/posix-strerror.c: Rename to... * gdbsupport/safe-strerror.c: ...this. gdb/gdbserver/ChangeLog: 2019-11-15 Christian Biesinger <cbiesinger@google.com> * Makefile.in: Add safe-strerror.c. * configure: Regenerate. * configure.ac: Don't source common.host. Change-Id: I9e6d8a752fc398784201f370cafee65e0ea05474
2019-11-15Import the strerror_r-posix module and use it in GDB.Christian Biesinger1-1/+1
Makes sure to assign the return value of strerror_r to an int, so that we get a compile error if we accidentally get the wrong version. gdb/ChangeLog: 2019-11-15 Christian Biesinger <cbiesinger@google.com> * config.in: Regenerate. * configure: Regenerate. * gdbsupport/common.m4: No longer check for strerror_r. * gdbsupport/posix-strerror.c (safe_strerror): Always call the POSIX version of strerror_r, now that gnulib provides it if necessary. gdb/gdbserver/ChangeLog: 2019-11-15 Christian Biesinger <cbiesinger@google.com> * config.in: Regenerate. * configure: Regenerate. gnulib/ChangeLog: 2019-11-15 Christian Biesinger <cbiesinger@google.com> * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. * import/Makefile.am: Update. * import/Makefile.in: Regenerate. * import/extra/config.rpath: New file. * import/glthread/lock.c: New file. * import/glthread/lock.h: New file. * import/glthread/threadlib.c: New file. * import/m4/gnulib-cache.m4: Update. * import/m4/gnulib-comp.m4: Update. * import/m4/lib-ld.m4: New file. * import/m4/lib-link.m4: New file. * import/m4/lib-prefix.m4: New file. * import/m4/lock.m4: New file. * import/m4/strerror_r.m4: New file. * import/m4/threadlib.m4: New file. * import/strerror_r.c: New file. * update-gnulib.sh: Import strerror_r-posix. Change-Id: I5cfeb12a5203a4cd94a78581541e6085a68685c3