summaryrefslogtreecommitdiff
path: root/gdb/gdbserver/configure.ac
AgeCommit message (Collapse)Author
2018-01-17configure: Fix test for fs_base/gs_base in <sys/user.h>Eldar Abusalimov
Make <sys/types.h> be included prior to including <sys/user.h>. glibc versions older than 2.14 use __uintNN_t types within certain structures defined in <sys/user.h> probably assuming these types are defined prior to including the header. This results in the following `configure` feature test compilation error that makes it think that `struct user_regs_struct` doesn't have `fs_base`/`gs_base` fields, althouh it does. configure:13617: checking for struct user_regs_struct.fs_base configure:13617: gcc -c -g -O2 -I/linux/include conftest.c >&5 In file included from conftest.c:158:0: /usr/include/sys/user.h:32:3: error: unknown type name '__uint16_t' __uint16_t cwd; ^ /usr/include/sys/user.h:33:3: error: unknown type name '__uint16_t' __uint16_t swd; ^ /usr/include/sys/user.h:34:3: error: unknown type name '__uint16_t' __uint16_t ftw; ^ /usr/include/sys/user.h:35:3: error: unknown type name '__uint16_t' __uint16_t fop; ^ /usr/include/sys/user.h:36:3: error: unknown type name '__uint64_t' __uint64_t rip; ^ /usr/include/sys/user.h:37:3: error: unknown type name '__uint64_t' __uint64_t rdp; ^ /usr/include/sys/user.h:38:3: error: unknown type name '__uint32_t' __uint32_t mxcsr; ^ /usr/include/sys/user.h:39:3: error: unknown type name '__uint32_t' __uint32_t mxcr_mask; ^ /usr/include/sys/user.h:40:3: error: unknown type name '__uint32_t' __uint32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ ^ /usr/include/sys/user.h:41:3: error: unknown type name '__uint32_t' __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */ ^ /usr/include/sys/user.h:42:3: error: unknown type name '__uint32_t' __uint32_t padding[24]; ^ configure:13617: $? = 1 configure: failed program was: | /* confdefs.h */ ... | /* end confdefs.h. */ | #include <sys/user.h> | | int | main () | { | static struct user_regs_struct ac_aggr; | if (ac_aggr.fs_base) | return 0; | ; | return 0; | } Recent glibc versions don't use typedef'ed int types in <sys/user.h>, thus allowing it to be included as is (glibc commit d79a9c949c84e7f0ba33e87447c47af833e9f11a). However there're still some distros alive that use older glibc, for instance, RHEL/CentOS 6 package glibc 2.12. Also affects PR gdb/21559: ../../gdb/regcache.c:1087: internal-error: void regcache_raw_supply(regcache, int, const void): Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed. As noted by Andrew Paprocki, who submitted the PR (https://sourceware.org/bugzilla/show_bug.cgi?id=21559#c3): > It should be noted that modifying `configure` to force on > `HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE` and > `HAVE_STRUCT_USER_REGS_STRUCT_GS_BASE` fixes this issue. For some > reason the `configure` tests for `fs_base` and `gs_base` fail > even though `sys/user.h` on RHEL5 has the fields defined in > `user_regs_struct`. Note that this patch does NOT fix the root cause of PR gdb/21559, although now that `configure` properly detects the presence of the fields and sets HAVE_XXX accordingly, the execution takes another path, which doesn't lead to the assertion failure in question. gdb/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2018-01-17 Eldar Abusalimov <eldar.abusalimov@jetbrains.com> PR gdb/21559 * configure.ac: Include <sys/types.h> prior to <sys/user.h> when checking for fs_base/gs_base fields in struct user_regs_struct. * configure: Regenerate.
2018-01-08Fix GDBserver build failure when $development is falseYao Qi
When we set bfd/development.sh:$development to false, GDBserver failed to build, selftest.o: In function `selftests::run_tests(char const*)': binutils-gdb/gdb/gdbserver/../common/selftest.c:97:undefined reference to `selftests::reset()' collect2: error: ld returned 1 exit status selftest.o shouldn't be compiled and linked when $development is false. With this patch, in release mode, GDBserver doesn't nothing with option --selftest, $ ./gdbserver --selftest=foo Selftests are not available in a non-development build. $ ./gdbserver --selftest Selftests are not available in a non-development build. gdb/gdbserver: 2018-01-08 Yao Qi <yao.qi@linaro.org> Simon Marchi <simon.marchi@ericsson.com> * Makefile.in (OBS): Remove selftest.o. * configure.ac: Set srv_selftest_objs if $development is true. (GDBSERVER_DEPFILES): Append $srv_selftest_objs. * configure: Re-generated. * server.c (captured_main): Wrap variable selftest_filter with GDB_SELF_TEST. gdb/testsuite: 2018-01-08 Simon Marchi <simon.marchi@ericsson.com> * gdb.server/unittest.exp: Match the output in non-development mode.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker
gdb/ChangeLog: Update copyright year range in all GDB files
2017-11-06Assume termios is available, remove support for termio and sgttyPedro Alves
This commit garbage collects the termio and sgtty support. GDB's terminal handling code still has support for the old termio and sgtty interfaces in addition to termios. However, I think it's pretty safe to assume that for a long, long time, Unix-like systems provide termios. GNU/Linux, Solaris, Cygwin, AIX, DJGPP, macOS and the BSDs all have had termios.h for many years. Looking around the web, I found discussions about FreeBSD folks trying to get rid of old sgtty.h a decade ago: https://lists.freebsd.org/pipermail/freebsd-hackers/2007-March/019983.html So I think support for termio and sgtty in GDB is just dead code that is never compiled anywhere and is just getting in the way. For example, serial_noflush_set_tty_state and the raw<->cooked concerns mentioned in inflow.c only exist because of sgtty (see hardwire_noflush_set_tty_state). Regtested on GNU/Linux. Confirmed that I can still build Solaris, DJGPP and AIX GDB and that the resulting GDBs still include the termios.h-guarded code. Confirmed mingw-w64 GDB still builds and skips the termios.h-guarded code. gdb/ChangeLog: 2017-11-06 Pedro Alves <palves@redhat.com> * Makefile.in (SER_HARDWIRE): Update comment. (HFILES_NO_SRCDIR): Remove gdb_termios.h. * common/gdb_termios.h: Delete file. * common/job-control.c: Include termios.h and unistd.h instead of gdb_termios.h. (gdb_setpgid): Remove HAVE_TERMIOS || TIOCGPGRP preprocessor check. (have_job_control): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS. Remove sgtty code. * configure.ac: No longer check for termio.h and sgtty.h. * configure: Regenerate. * inflow.c: Include termios.h instead of gdb_termios.h. Replace PROCESS_GROUP_TYPE checks with HAVE_TERMIOS_H checks throughout. Replace PROCESS_GROUP_TYPE references with pid_t references throughout. (gdb_getpgrp): Delete. (set_initial_gdb_ttystate): Use tcgetpgrp instead of gdb_getpgrp. (child_terminal_inferior): Remove comment. Remove sgtty code. (child_terminal_ours_1): Use tcgetpgrp directly instead of gdb_getpgrp. Use serial_set_tty_state instead aof serial_noflush_set_tty_state. Remove sgtty code. * inflow.h: Include unistd.h instead of gdb_termios.h. Replace PROCESS_GROUP_TYPE check with HAVE_TERMIOS_H check. (inferior_process_group): Now returns pid_t. * ser-base.c (ser_base_noflush_set_tty_state): Delete. * ser-base.h (ser_base_noflush_set_tty_state): Delete. * ser-event.c (serial_event_ops): Update. * ser-go32.c (dos_noflush_set_tty_state): Delete. (dos_ops): Update. * ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): Update. * ser-pipe.c (pipe_ops): Update. * ser-tcp.c (tcp_ops): Update. * ser-unix.c: Include termios.h instead of gdb_termios.h. Remove HAVE_TERMIOS checks. [HAVE_TERMIO] (struct hardwire_ttystate): Delete. [HAVE_SGTTY] (struct hardwire_ttystate): Delete. (get_tty_state, set_tty_state): Drop termio and sgtty code, and assume termios. (hardwire_noflush_set_tty_state): Delete. (hardwire_print_tty_state, hardwire_drain_output) (hardwire_flush_output, hardwire_flush_input) (hardwire_send_break, hardwire_raw, hardwire_setbaudrate) (hardwire_setstopbits, hardwire_setparity): Drop termio and sgtty code, and assume termios. (hardwire_ops): Update. (_initialize_ser_hardwire): Remove HAVE_TERMIOS check. * serial.c (serial_noflush_set_tty_state): Delete. * serial.h (serial_noflush_set_tty_state): Delete. (serial_ops::noflush_set_tty_state): Delete. gdb/gdbserver/ChangeLog: 2017-11-06 Pedro Alves <palves@redhat.com> * configure.ac: No longer check for termio.h and sgtty.h. * configure: Regenerate. * remote-utils.c: Include termios.h instead of gdb_termios.h. (remote_open): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS. Remove termio and sgtty code.
2017-10-17[GDBserver] Replicate src dir in build dirYao Qi
Similar to f38307f5 (Replicate src dir in build dir), this patch change configure and Makefile to generate object files in arch/ directory. gdb/gdbserver: 2017-10-17 Yao Qi <yao.qi@linaro.org> * Makefile.in (CONFIG_SRC_SUBDIR): New variable. (clean): Remove .o files in CONFIG_SRC_SUBDIR. (distclean): Remove DEPDIR in CONFIG_SRC_SUBDIR. (arch-i386.o, arch-amd64.o): Remove rules. (arch/%.o): New rule. Update POSTCOMPILE and COMPILE.pre. * configure.ac: Invoke AC_CONFIG_COMMANDS. * configure: Re-generated. * configure.srv: Replace arch-i386.o with arch/i386.o. Replace arch-amd64.o with arch/amd64.o.
2017-08-18GDBserver self testsYao Qi
This patch uses GDB self test in GDBserver. The self tests are run if GDBserver is started with option --selftest. gdb: 2017-08-18 Yao Qi <yao.qi@linaro.org> * NEWS: Mention GDBserver's new option "--selftest". * Makefile.in (SFILES): Remove selftest.c, add common/selftest.c. * selftest.c: Move it to common/selftest.c. * selftest.h: Move it to common/selftest.h. * selftest-arch.c (reset): New function. (tests_with_arch): Call reset. gdb/gdbserver: 2017-08-18 Yao Qi <yao.qi@linaro.org> * Makefile.in (OBS): Add selftest.o. * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. * configure, config.in: Re-generated. * server.c: Include common/sefltest.h. (captured_main): Handle option --selftest. gdb/testsuite: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.server/unittest.exp: New. gdb/doc: 2017-08-18 Yao Qi <yao.qi@linaro.org> * gdb.texinfo (Server): Document "--selftest".
2017-01-27gdbserver-amd64: add HAVE_STRUCT_USER_REGS_STRUCT_(GS|FS)_BASE for gdbserver.Walfred Tedeschi
The macros mentioned in the title were set only for GDB. In gdbserver they were not set until now. To align the code in GDB and gdbserver these macros are also added into gdbserver, enabling read and write of gs_base and fs_base registers from the system in new and old kernels. 2017-01-27 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/gdbserver/ChangeLog: * configure.ac: Check if the fs_base and gs_base members of `struct user_regs_struct' exist. * config.in: Regenerated. * configure: Likewise.
2017-01-01update copyright year range in GDB filesJoel Brobecker
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-11-17Remove code that checks for GNU/non-GNU makeSimon Marchi
Since GNU make is now required to build GDB, we can remove everything that checks whether the current make implemention is the GNU one or not. I simply removed the @GMAKE_TRUE@ prefixes and removed the whole lines that were prefixed with @GMAKE_FALSE@. I removed the code in the configure scripts that set those variables. I also removed the following bits from the configure scripts: AC_CHECK_PROGS(MAKE, make): GNU make already defines a MAKE variable internally to be used when invoking Makefiles recursively. I don't see this variable being used anywhere else (in scripts for example), so I think it's safe for removal. AC_PROG_MAKE_SET: This macro defines a SET_MAKE output variable, which is meant to be used in Makefiles to define the MAKE variable when using an implementation of make that doesn't already define it. Since we are now requiring GNU make, we don't need it anymore. Plus, I don't see SET_MAKE being used anywhere, so I don't think it was actually doing anything... gdb/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate. gdb/gdbserver/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate. gdb/testsuite/ChangeLog: * Makefile.in: Remove @GMAKE_TRUE@ prefixes and removes lines prefixed with @GMAKE_FALSE@. Update comment related to non-GNU make. * configure.ac: Remove checks for the make program. * configure: Re-generate.
2016-10-28gdb: Require C++11Pedro Alves
Use AX_CXX_COMPILE_STDCXX to detect if the compiler supports C++11, and if -std=xxx switches are necessary to enable C++11. We need to tweak AX_CXX_COMPILE_STDCXX a bit though. Pristine upstream AX_CXX_COMPILE_STDCXX appends -std=gnu++11 to CXX directly. That doesn't work for us, because the top level Makefile passes CXX down to subdirs, and that overrides whatever gdb/Makefile may set CXX to. The result would be that a make invocation from the build/gdb/ directory would use "g++ -std=gnu++11" as expected, while a make invocation at the top level would not. So instead of having AX_CXX_COMPILE_STDCXX set CXX directly, tweak it to AC_SUBST a separate variable -- CXX_DIALECT -- and use '$(CXX) (CXX_DIALECT)' to compile/link. Confirmed that this enables C++11 starting with gcc 4.8, the first gcc release with full C++11 support. Also confirmed that configure errors out gracefully with older GCC releases: checking whether /opt/gcc-4.7/bin/g++ supports C++11 features by default... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=gnu++0x... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -std=c++0x... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with +std=c++11... no checking whether /opt/gcc-4.7/bin/g++ supports C++11 features with -h std=c++11... no configure: error: *** A compiler with support for C++11 language features is required. Makefile:9451: recipe for target 'configure-gdb' failed make[1]: *** [configure-gdb] Error 1 make[1]: Leaving directory '/home/pedro/brno/pedro/gdb/mygit/cxx-convertion/build-gcc-4.7' If we need to revert back to making C++11 optional, all that's necessary is to change the "mandatory" to "optional" in configure.ac and regenerate configure (both gdb and gdbserver). gdb/ChangeLog: 2016-10-28 Pedro Alves <palves@redhat.com> * Makefile.in (CXX_DIALECT): Get from configure. (COMPILE.pre, CC_LD): Append $(CXX_DIALECT). (FLAGS_TO_PASS): Pass CXX_DIALECT. * acinclude.m4: Include ax_cxx_compile_stdcxx.m4. * ax_cxx_compile_stdcxx.m4: Add FSF copyright header. Set and AC_SUBST CXX_DIALECT instead of changing CXX/CXXCPP. * configure.ac: Call AX_CXX_COMPILE_STDCXX. * config.in: Regenerate. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-10-28 Pedro Alves <palves@redhat.com> * Makefile.in (CXX_DIALECT): Get from configure. (COMPILE.pre, CC_LD): Append $(CXX_DIALECT). * acinclude.m4: Include ../ax_cxx_compile_stdcxx.m4. * configure.ac: Call AX_CXX_COMPILE_STDCXX. * config.in: Regenerate. * configure: Regenerate.
2016-09-05gdb/: Require a C++ compilerPedro Alves
This removes all support for building gdb & gdbserver with a C compiler from gdb & gdbserver's build machinery. gdb/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> * NEWS: Mention that a C++ compiler is now required. * Makefile.in (COMPILER, COMPILER_CFLAGS): Remove. (COMPILE.pre, CC_LD): Use CXX directly. (INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly. * acinclude.m4: Don't include build-with-cxx.m4. * build-with-cxx.m4: Delete file. * configure.ac: Remove GDB_AC_BUILD_WITH_CXX call. * warning.m4: Assume $enable_build_with_cxx is yes. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER, COMPILER_CFLAGS): Remove. (COMPILE.pre, CC_LD): Use CXX directly. (INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly. * acinclude.m4: Don't include build-with-cxx.m4. * configure.ac: Remove GDB_AC_BUILD_WITH_CXX call. * configure: Regenerate.
2016-08-19x32 Fast tracepoints: IPA target descriptionsPedro Alves
Building GDB for x32 fails building the IPA, with: .../src/gdb/gdbserver/linux-amd64-ipa.c: In function ‘const target_desc* get_ipa_tdesc(int)’: .../src/gdb/gdbserver/linux-amd64-ipa.c:182:14: error: ‘tdesc_amd64_avx_linux’ was not declared in this scope return tdesc_amd64_avx_linux; ^ .../src/gdb/gdbserver/linux-amd64-ipa.c:184:14: error: ‘tdesc_amd64_mpx_linux’ was not declared in this scope return tdesc_amd64_mpx_linux; ^ .../src/gdb/gdbserver/linux-amd64-ipa.c:186:14: error: ‘tdesc_amd64_avx_mpx_linux’ was not declared in this scope return tdesc_amd64_avx_mpx_linux; ^ [...] The problem is that the IPA is trying to use the 64-bit descriptions, when it should be using the x32 ones. gdb/gdbserver/ChangeLog: 2016-08-19 Pedro Alves <palves@redhat.com> PR gdb/20415 * Makefile.in (x32-linux-ipa.o, x32-avx-linux-ipa.o) (x32-avx512-linux-ipa.o): New rules. * configure.ac (x86_64-*-linux*): New x32 check. * configure.srv (ipa_x32_linux_regobj): New. (x86_64-*-linux*): Use $ipa_x32_linux_regobj if building for x32. * linux-amd64-ipa.c (get_ipa_tdesc) [__ILP32__]: Return x32 descriptions. (initialize_low_tracepoint) [__ILP32__]: Initialize x32 descriptions. * configure: Regenerate.
2016-02-09Modernize configure.ac'sSimon Marchi
Using AC_OUTPUT with arguments has been deprecated for some time in autoconf, even in version 2.64, which we are using. This change should not affect functionality. I also removed the "exit 0"'s, they shouldn't be necessary. gdb/ChangeLog: * configure.ac: Use AC_CONFIG_FILES instead of passing arguments to AC_OUTPUT. Remove "exit 0" at the end. * configure: Regenerate. gdb/testsuite/ChangeLog: * configure.ac: Use AC_CONFIG_FILES instead of passing arguments to AC_OUTPUT. * configure: Regenerate. gdb/gdbserver/ChangeLog: * configure.ac: Use AC_CONFIG_FILES instead of passing arguments to AC_OUTPUT. * configure: Regenerate.
2016-01-18Fix gdbserver build failure on targets without forkGary Benson
This commit fixes nat/linux-namespaces.c to build correctly on targets without fork. gdb/ChangeLog: * nat/linux-namespaces.c (do_fork): New function. (linux_mntns_get_helper): Use the above. gdb/gdbserver/ChangeLog: * configure.ac (AC_FUNC_FORK): New check. * config.in: Regenerate. * configure: Likewise.
2016-01-12gdbserver: use the new gdb warning helpersMike Frysinger
We need to use -Wno-missing-prototypes for now as much of the code sticks externs in local files and not in common headers. 2016-01-11 Mike Frysinger <vapier@gentoo.org> * acinclude.m4: Include new ../warning.m4 file. * configure: Regenerated. * configure.ac: Replace all warning logic with AM_GDB_WARNINGS.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-12-16Fix -Wno-unknown-warning support detectionPedro Alves
Ref: https://sourceware.org/ml/gdb/2015-12/msg00024.html We have code in configure.ac that tries to detect whether the compiler supports each warning and suppress it if not, but that doesn't work with "-Wno-" options, because gcc doesn't error out for -Wno-unknown-warning unless other diagnostics are being produced. See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html. Handle this by checking whether -Wfoo works when we actually want -Wno-foo. gdb/ChangeLog: 2015-12-16 Pedro Alves <palves@redhat.com> * configure.ac (compiler warning flags): When testing a -Wno-foo option, check whether -Wfoo works instead. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2015-12-16 Pedro Alves <palves@redhat.com> * configure.ac (compiler warning flags): When testing a -Wno-foo option, check whether -Wfoo works instead. * configure: Regenerate.
2015-11-23[gdbserver] disable Elf32_auxv_t/Elf64_auxv_t AC_CHECK_TYPES check on AndroidJoel Brobecker
See the comment added in configure.ac for more details behind this change. gdb/gdbserver/ChangeLog: * configure.ac: Do not call AC_CHECK_TYPES for Elf32_auxv_t and Elf64_auxv_t if the target is Android.
2015-11-19[C++] Default to -Werror in C++ mode tooPedro Alves
Both x86_64 GNU/Linux and x86_64 mingw-w64 build cleanly with --enable-targets=all. This enables -Werror by default in C++ mode too, in order to let the buildbot catch C++ build regressions for us. gdb/ChangeLog: 2015-11-19 Pedro Alves <palves@redhat.com> * configure.ac (ERROR_ON_WARNING): Don't check whether in C++ mode. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2015-11-19 Pedro Alves <palves@redhat.com> * configure.ac (ERROR_ON_WARNING): Don't check whether in C++ mode. * configure: Regenerate.
2015-07-24make gdbserver use the same ptrace autoconf checks as gdbPedro Alves
This factors the ptrace checks out of gdb's configure.ac to a new ptrace.m4 file, and then makes gdbserver's configure.ac source it too. gdb/ChangeLog: 2015-07-24 Pedro Alves <palves@redhat.com> * acinclude.m4: Include ptrace.m4. * configure.ac: Call GDB_AC_PTRACE and move ptrace checks ... * ptrace.m4: ... to this new file. gdb/gdbserver/ChangeLog: 2015-07-24 Pedro Alves <palves@redhat.com> * acinclude.m4: Include ../ptrace.m4. * configure.ac: Call GDB_AC_PTRACE. * config.in, configure: Regenerate.
2015-06-10Introduce nat/linux-namespaces.[ch]Gary Benson
This commit introduces new shared files nat/linux-namespaces.[ch] containing code to support Linux namespaces that will be used by both GDB and gdbserver. gdb/ChangeLog: * configure.ac (AC_CHECK_FUNCS): Add setns. * config.in: Regenerate. * configure: Likewise. * nat/linux-namespaces.h: New file. * nat/linux-namespaces.c: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-namespaces.h. (linux-namespaces.o): New rule. * config/aarch64/linux.mh (NATDEPFILES): Add linux-namespaces.o. * config/alpha/alpha-linux.mh (NATDEPFILES): Likewise. * config/arm/linux.mh (NATDEPFILES): Likewise. * config/i386/linux.mh (NATDEPFILES): Likewise. * config/i386/linux64.mh (NATDEPFILES): Likewise. * config/ia64/linux.mh (NATDEPFILES): Likewise. * config/m32r/linux.mh (NATDEPFILES): Likewise. * config/m68k/linux.mh (NATDEPFILES): Likewise. * config/mips/linux.mh (NATDEPFILES): Likewise. * config/pa/linux.mh (NATDEPFILES): Likewise. * config/powerpc/linux.mh (NATDEPFILES): Likewise. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise. * config/powerpc/spu-linux.mh (NATDEPFILES): Likewise. * config/s390/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux64.mh (NATDEPFILES): Likewise. * config/tilegx/linux.mh (NATDEPFILES): Likewise. * config/xtensa/linux.mh (NATDEPFILES): Likewise. gdb/gdbserver/ChangeLog: * configure.ac (AC_CHECK_FUNCS): Add setns. * config.in: Regenerate. * configure: Likewise. * Makefile.in (SFILES): Add nat/linux-namespaces.c. (linux-namespaces.o): New rule. * configure.srv (srv_linux_obj): Add linux-namespaces.o.
2015-05-14Fix gdbserver build failure on arm-android.Joel Brobecker
The following patch... | proc-service, extern "C" | | libthread_db.so calls symbols in the client (GDB), through the | proc-service interface. These routines must have extern "C" linkage | so their symbol names are not mangled when GDB is built as a C++ | program. On the GDBserver side, we were missing fallback declarations for | all these symbols. | | gdb/ChangeLog: | | * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP. | | gdb/gdbserver/ChangeLog: | 2015-02-27 Pedro Alves <palves@redhat.com> | | * gdb_proc_service.h: Wrap with EXTERN_C_PUSH/EXTERN_C_POP. | [!HAVE_PROC_SERVICE_H] (struct ps_prochandle): Forward declare. | [!HAVE_PROC_SERVICE_H] (ps_pdread, ps_pdwrite, ps_ptread) | ps_ptwrite, ps_lgetregs, ps_lsetregs, ps_lgetfpregs) | (ps_lsetfpregs, ps_getpid) | (ps_get_thread_area, ps_pglobal_lookup, ps_pstop, ps_pcontinue) | (ps_lstop, ps_lcontinue, ps_lgetxregsize, ps_lgetxregs) | (ps_lsetxregs, ps_plog): Declare. ... added a number of declarations which do not compile when cross- compiling GDBserver on arm-android. The problem comes from type prfpregset_t not being declared: /[...]/gdbserver/gdb_proc_service.h:98:47: error: unknown type name 'prfpregset_t' After searching through the includes of the install we have, I could not find that type being declared anywhere. So I did the same as for prgregset_t, and created the typedef if the type isn't declared. gdb/gdbserver/ChangeLog: * configure.ac: Add prfpregset_t BFD_HAVE_SYS_PROCFS_TYPE check. * configure, config.in: Regenerate. * gdb_proc_service.h [HAVE_PRFPREGSET_T] (prfpregset_t): Declare typedef.
2015-03-11Move remote_fileio_to_fio_stat to gdb/commonGary Benson
This commit moves remote_fileio_to_fio_stat and its supporting functions into new files common/common-remote-fileio.[ch]. gdb/ChangeLog: * common/common-remote-fileio.h: New file. * common/common-remote-fileio.c: Likewise. * Makefile.in (SFILES): Add common/common-remote-fileio.c. (HFILES_NO_SRCDIR): Add common/common-remote-fileio.h. (COMMON_OBS): Add common-remote-fileio.o. (common-remote-fileio.o): New rule. * remote-fileio.h (common-remote-fileio.h): New include. * remote-fileio.c (gdb/fileio.h): Do not include. (remote_fileio_to_be): Moved to common-remote-fileio.h. (remote_fileio_to_fio_uint): Likewise. (remote_fileio_to_fio_time): Likewise. (remote_fileio_mode_to_target): Moved to common-remote-fileio.c. (remote_fileio_to_fio_mode): Likewise. (remote_fileio_to_fio_ulong): Likewise. (remote_fileio_to_fio_stat): Likewise. gdb/gdbserver/ChangeLog: * configure.ac (AC_CHECK_MEMBERS): Add checks for struct stat.st_blocks and struct stat.st_blksize. * configure: Regenerate. * config.in: Likewise. * Makefile.in (SFILES): Add common/common-remote-fileio.c. (OBS): Add common-remote-fileio.o. (common-remote-fileio.o): New rule.
2015-03-07Remove C-specific warnings from common warning setPedro Alves
Whoops, these are C specific, but I somehow missed the warnings before: cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default] cc1plus: warning: command line option ‘-Wmissing-parameter-type’ is valid for C/ObjC but not for C++ [enabled by default] cc1plus: warning: command line option ‘-Wold-style-declaration’ is valid for C/ObjC but not for C++ [enabled by default] cc1plus: warning: command line option ‘-Wold-style-definition’ is valid for C/ObjC but not for C++ [enabled by default] gdb/ChangeLog: 2015-03-07 Pedro Alves <palves@redhat.com> * configure.ac (build_warnings): Move -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition to the C-specific set. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2015-03-07 Pedro Alves <palves@redhat.com> * configure.ac (build_warnings): Move -Wdeclaration-after-statement to the C-specific set. * configure: Regenerate.
2015-02-27Add --enable-build-with-cxx configure switchPedro Alves
This new option, disabled by default for now, allows specifying whether to build GDB, GDBserver, and friends with a C++ (98/03) compiler. The name of the switch should be familiar to those who followed GCC's own C++ conversion process. . Adding -fpermissive to COMPILER in C++ mode (see the new build-with-cxx.m4 file) makes errors like these be warnings instead: gdb/infrun.c:6597:1: error: initializing argument 1 of ‘void sig_print_info(gdb_signal)’ [-fpermissive] sig_print_info (enum gdb_signal oursig) ^ gdb/infrun.c: In function ‘void do_restore_infcall_suspend_state_cleanup(void*)’: gdb/infrun.c:7164:39: error: invalid conversion from ‘void*’ to ‘infcall_suspend_state*’ [-fpermissive] restore_infcall_suspend_state (state); ^ so that the compiler carries on compiling the file. -Werror still catches the warnings, so nothing is lost, only our lifes are made easier by concentrating on getting other more important things out of the way first. There's no way to quiet those warnings. Until they're all fixed, when building in C++ mode, -Werror is disabled by default. . Adding -Wno-narrowing suppresses thousands of instances of this warning: gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing] gdb/arm-linux-tdep.c:439:1: error: narrowing conversion of ‘-1l’ from ‘LONGEST {aka long int}’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing] gdb/arm-linux-tdep.c:450:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘ULONGEST {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Werror=narrowing] We can defer handling those until we target C++11. . Adding -Wno-sign-compare suppresses thousands of instances of this warning: gdb/linux-record.c:1763:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (tmpulongest == tdep->fcntl_F_GETLK64) ^ . Adding -Wno-write-strings suppresses thousands of instances of this warning: gdb/mi/mi-cmd-var.c: In function ‘void mi_cmd_var_show_attributes(char*, char**, int)’: gdb/mi/mi-cmd-var.c:514:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] attstr = "editable"; ^ gdb/mi/mi-cmd-var.c:516:12: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] attstr = "noneditable"; ^ For now, it's best to hide these warnings from view until we're '-fpermissive'-clean, and can thus start building with -Werror. The C compiler has always managed to build working GDBs with these issues in the code, so a C++ compiler should too. gdb/ChangeLog: 2015-02-27 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER): New, get it from autoconf. (COMPILE.pre, CC_LD): Use COMPILER. (CXX): Get from autoconf instead. (CXX_FOR_TARGET): Default to g++ instead of gcc. * acinclude.m4: Include build-with-cxx.m4. * build-with-cxx.m4: New file. * configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX. Disable -Werror by default if building in C++ mode. (build_warnings): Add -Wno-sign-compare, -Wno-write-strings and -Wno-narrowing in C++ mode. Only enable -Wpointer-sign in C mode. Run supported-warning-flags tests with the C++ compiler. Save/restore CXXFLAGS too. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2015-02-27 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER): New, get it from autoconf. (CXX): Get from autoconf instead. (COMPILE.pre): Use COMPILER. (CC-LD): Rename to ... (CC_LD): ... this. Use COMPILER. (gdbserver$(EXEEXT), gdbreplay$(EXEEXT), $(IPA_LIB)): Adjust. (CXX_FOR_TARGET): Default to g++ instead of gcc. * acinclude.m4: Include build-with-cxx.m4. * configure.ac: Call AC_PROG_CXX and GDB_AC_BUILD_WITH_CXX. Disable -Werror by default if building in C++ mode. (build_warnings): Add -Wno-sign-compare, -Wno-write-strings and -Wno-narrowing in C++ mode. Run supported-warning-flags tests with the C++ compiler. Save/restore CXXFLAGS too. * configure: Regenerate.
2015-02-27Create libiberty.m4, have GDB and GDBserver use itPedro Alves
Converting GDB to be a C++ program, I stumbled on 'basename' issues, like: src/gdb/../include/ansidecl.h:169:64: error: new declaration ‘char* basename(const char*)’ /usr/include/string.h:597:26: error: ambiguates old declaration ‘const char* basename(const char*)’ which I believe led to this bit in gold's configure.ac: dnl We have to check these in C, not C++, because autoconf generates dnl tests which have no type information, and current glibc provides dnl multiple declarations of functions like basename when compiling dnl with C++. AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp]) These checks IIUC intend to generate all the HAVE_DECL_FOO symbols that libiberty.h and ansidecl.h check. GDB is missing these checks currently, which results in the conflict shown above. This adds an m4 file that both GDB and GDBserver's configury use to pull in the autoconf checks that libiberty clients needs done in order to use these libiberty.h/ansidecl.h. gdb/ChangeLog: 2015-02-27 Pedro Alves <palves@redhat.com> * libiberty.m4: New file. * acinclude.m4: Include libiberty.m4. * configure.ac: Call libiberty_INIT. * config.in, configure: Regenerate. gdb/gdbserver/ 2015-02-27 Pedro Alves <palves@redhat.com> * acinclude.m4: Include libiberty.m4. * configure.ac: Call libiberty_INIT. * config.in, configure: Regenerate.
2015-01-15Move safe_strerror to common/Sergio Durigan Junior
This patch moves safe_strerror from the gdb/{posix,mingw}-hdep.c files to the respective common/{posix,mingw}-strerror.c files. This is a preparation for the next patch, which shares a common code (to disable address space randomization when creating a new inferior). The patch has been regtested on Fedora 20 x86_64, and no regressions were found. gdb/ChangeLog 2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (ALLDEPFILES): Including common/mingw-strerror.c and common/posix-strerror.c. (posix-strerror.o): New rule. (mingw-strerror.o): Likewise. * common/common-utils.h (safe_strerror): Move prototype to here, from utils.h. * common/common.host: New file. * common/mingw-strerror.c: Likewise. * common/posix-strerror.c: Likewise. * configure: Regenerated. * configure.ac: Source common/common.host. Add variable common_host_obs to gdb_host_obs. * contrib/ari/gdb_ari.sh: Mention gdb/common/mingw-strerror.c and gdb/common/posix-strerror.c when warning about the use of strerror. * mingw-hdep.c (safe_strerror): Remove definition; move it to common/mingw-strerror.c. * posix-hdep.c (safe_strerror): Remove definition; move it to common/posix-hdep.c. * utils.h (safe_strerror): Remove prototype; move to common/common-utils.h. gdb/gdbserver/ChangeLog 2015-01-15 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (posix-strerror.o): New rule. (mingw-strerror.o): Likewise. * configure: Regenerated. * configure.ac: Source file ../common/common.host. Initialize new variable srv_host_obs. Add srv_host_obs to GDBSERVER_DEPFILES.
2015-01-14Detect 64-bit-ness in PowerPC Book III-EYao Qi
This patch is to teach both GDB and GDBServer to detect 64-bit inferior correctly. We find a problem that GDBServer is unable to detect on a e5500 core processor. Current GDBServer assumes that MSR is a 64-bit register, but MSR is a 32-bit register in Book III-E. This patch is to fix this problem by checking the right bit in MSR, in order to handle both Book III-S and Book III-E. In order to detect Book III-S and Book III-E, we check the PPC_FEATURE_BOOKE from the host's HWCAP (by getauxval on glibc >= 2.16. If getauxval doesn't exist, we implement the fallback by parsing /proc/self/auxv), because it should an invariant on the same machine cross different processes. In order to share code, I add nat/ppc-linux.c for both GDB and GDBserver side. gdb: 2015-01-14 Yao Qi <yao@codesourcery.com> * Makefile.in (ppc-linux.o): New rule. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Add ppc-linux.o. * configure.ac: AC_CHECK_FUNCS(getauxval). * config.in: Re-generated. * configure: Re-generated. * nat/ppc-linux.h [__powerpc64__] (ppc64_64bit_inferior_p): Declare. * nat/ppc-linux.c: New file. * ppc-linux-nat.c (ppc_linux_target_wordsize) [__powerpc64__]: Call ppc64_64bit_inferior_p. gdb/gdbserver: 2015-01-14 Yao Qi <yao@codesourcery.com> * Makefile.in (SFILES): Add nat/ppc-linux.c. (ppc-linux.o): New rule. * configure.srv (powerpc*-*-linux*): Add ppc-linux.o. * configure.ac: AC_CHECK_FUNCS(getauxval). * config.in: Re-generated. * configure: Re-generated. * linux-ppc-low.c (ppc_arch_setup) [__powerpc64__]: Call ppc64_64bit_inferior_p
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-12-13configure gdb/gnulib with --disable-largefile if largefile support disabled.Joel Brobecker
This patch mostly aims at fixing a GDB build failure on 32bit Solaris systems (Sparc and x86), due to a recent gnulib update adding the readlink module. But it might also fix related issues when configuring with --disable-largefile. A side-effect of the gnulib readlink module addition is that it caused largefile support to be added as well, and in particular gnulib/import/m4/largefile.m4 introduced the following new #define in gnulib's config.in: | +/* Number of bits in a file offset, on hosts where this is settable. */ | +#undef _FILE_OFFSET_BITS When defined to 64, it triggers an issue with procfs.h while trying to build sparc-sol2-nat.c: | #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 | #error "Cannot use procfs in the large file compilation environment" | #endif As it turns out, this is a fairly familiar problem, and one of the reasons behind ACX_LARGEFILE having been created. In that macro, we have some code which disables largefile support on solaris hosts: | sparc-*-solaris*|i[3-7]86-*-solaris*) | changequote([,])dnl | # On native 32bit sparc and ia32 solaris, large-file and procfs support | # are mutually exclusive; and without procfs support, the bfd/ elf module | # cannot provide certain routines such as elfcore_write_prpsinfo | # or elfcore_write_prstatus. So unless the user explicitly requested | # large-file support through the --enable-largefile switch, disable | # large-file support in favor of procfs support. | test "${target}" = "${host}" -a "x$plugins" = xno \ | && : ${enable_largefile="no"} | ;; But gnulib ignores this fact, and so tries to determine how to enable large-file support irrespective of whether we want it or not. This patch fixes the issue by passing --disable-largefile to gnulib's configure when large-file support in GDB is disabled. This is done by first enhancing ACX_CONFIGURE_DIR to allow us to pass extra arguments to be passed to the configure command, and then by modifying GDB's configure to pass --disable-largefile if large-file support is disabled. gdb/ChangeLog: * acx_configure_dir.m4 (ACX_CONFIGURE_DIR): Add support for new "EXTRA-ARGS" parameter. * configure.ac: If large-file support is disabled in GDB, pass --disable-largefile to ACX_CONFIGURE_DIR call for "gnulib". * configure: Regenerate. gdb/gdbserver/ChangeLog: * configure.ac: If large-file support is disabled in GDBserver, pass --disable-largefile to ACX_CONFIGURE_DIR call for "gnulib". * configure: Regenerate. Tested by rebuilding on sparc-solaris and x86_64-linux (with gdbserver). This fixes the build failure on sparc-solaris. I also verified in gnulib's config.log file that we pass --disable-largefile in the solaris case, while we do not in the GNU/Linux case.
2014-11-28Use readlink unconditionallyYao Qi
Since readlink module is imported, we can use it unconditionally. This patch is to remove configure checks and HAVE_READLINK checks in code. It was mentioned in the patch below [RFA/commit] gdbserver: return ENOSYS if readlink not supported. https://sourceware.org/ml/gdb-patches/2012-02/msg00148.html to use readlink in gdbserver, but we chose something simple at that moment. gdb: 2014-11-28 Yao Qi <yao@codesourcery.com> * configure.ac (AC_CHECK_FUNCS): Remove readlink. * config.in, configure: Re-generate. * inf-child.c (inf_child_fileio_readlink): Don't check HAVE_READLINK is defined. gdb/gdbserver: 2014-11-28 Yao Qi <yao@codesourcery.com> * configure.ac(AC_CHECK_FUNCS): Remove readlink. * config.in, configure: Re-generate. * hostio.c (handle_unlink): Remove code checking HAVE_READLINK is defined.
2014-11-21Include alloca.h unconditionallyYao Qi
Since gnulib alloca module was imported, we can include alloca.h in both gdb and gdbserver unconditionally, so this patch adds inclusion of alloca.h in common-defs.h. This patch also removes AC_FUNC_ALLOCA in configure.ac because we don't need to check alloca any more. This patch below is removed in fact. [RFA/commit] include alloca.h if available. https://www.sourceware.org/ml/gdb-patches/2010-08/msg00566.html Since alloca.h is from gnulib now, we don't have to check malloc.h in configure and include malloc.h in code. This patch also remove them too. gdb: 2014-11-21 Yao Qi <yao@codesourcery.com> * common/common-defs.h: Include alloca.h * configure.ac: Don't invoke AC_FUNC_ALLOCA. * configure: Re-generated. * defs.h: Remove code handling alloca. * utils.c (gdb_realpath): Don't check HAVE_ALLOCA is defined or not. gdb/gdbserver: 2014-11-21 Yao Qi <yao@codesourcery.com> * configure.ac: Don't invoke AC_FUNC_ALLOCA. (AC_CHECK_HEADERS): Remove malloc.h. * configure: Re-generated. * config.in: Re-generated. * server.h: Don't include alloca.h and malloc.h. * gdbreplay.c: Don't check HAVE_ALLOCA_H is defined. Don't include malloc.h.
2014-08-07Move errno.h to common-defs.hGary Benson
This commit moves the inclusion of errno.h to common-defs.h and removes all other inclusions. Note that prior to this commit server.h included errno.h protected by "#ifdef HAVE_ERRNO_H". This protection was added with the Windows CE port, which is currently broken. Since no other platform needs this, I have removed the protection and the configury to support it. gdb/ 2014-08-07 Gary Benson <gbenson@redhat.com> * common/common-defs.h: Include errno.h. * defs.h: Do not include errno.h. * ada-typeprint.c: Likewise. * c-typeprint.c: Likewise. * core-regset.c: Likewise. * corefile.c: Likewise. * corelow.c: Likewise. * event-loop.c: Likewise. * f-typeprint.c: Likewise. * gnu-nat.c: Likewise. * go32-nat.c: Likewise. * i386gnu-nat.c: Likewise. * m2-typeprint.c: Likewise. * nat/linux-btrace.c: Likewise. * p-typeprint.c: Likewise. * procfs.c: Likewise. * remote-sim.c: Likewise. * rs6000-nat.c: Likewise. * target.c: Likewise. * typeprint.c: Likewise. * ui-file.c: Likewise. * valops.c: Likewise. * valprint.c: Likewise. gdb/gdbserver/ 2014-08-07 Gary Benson <gbenson@redhat.com> * configure.ac (AC_CHECK_HEADERS): Remove errno.h. * configure: Regenerate. * config.in: Likewise. * server.h: Do not include errno.h. * event-loop.c: Likewise. * hostio-errno.c: Likewise. * linux-low.c: Likewise. * remote-utils.c: Likewise. * spu-low.c: Likewise. * utils.c: Likewise. * gdbreplay.c: Unconditionally include errno.h.
2014-06-20Fix mingw32 build on x86-64 RHEL 6.5Gary Benson
This commit fixes the mingw32 build on x86-64 RHEL 6.5. gdb/gdbserver/ 2014-06-20 Gary Benson <gbenson@redhat.com> * configure.ac (AC_REPLACE_FUNCS) <vasprintf, vsnprintf>: Removed. * configure: Regenerated. * config.in: Likewise.
2014-06-20Fix gdbserver cross build.Marcus Shawcroft
The recent libiberty patch caused issues when cross building gdbserver. The Makefile ends invoking the build machine's "ar" instead of the --host version: ar ./libiberty.a \ ./regex.o (...) ar: illegal option -- . Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file... ar -M [<mri-script] The libiberty configure script does probe for and finds an appropriate AR. However, gdbserver's configure does not probe for AR and overrides the AR used in the libiberty build by explicitly passing AR to the sub-builds. gdb/gdbserver/ 2014-06-20 Marcus Shawcroft <marcus.shawcroft@arm.com> * configure.ac: Invoke. AC_CHECK_TOOL(AR, ar). * Makefile.in (AR, AR_FLAGS): Define. * configure: Regenerate.
2014-06-12link gdbserver against libibertyTom Tromey
This builds a libiberty just for gdbserver and arranges for gdbserver to use it. I've tripped across the lack of libiberty in gdbserver at least once, and I have seen other threads where it would have been useful. 2014-06-12 Tom Tromey <tromey@redhat.com> * debug.c (debug_printf): Remove HAVE_GETTIMEOFDAY checks. * server.c (monitor_show_help): Remove HAVE_GETTIMEOFDAY check. (parse_debug_format_options): Likewise. (gdbserver_usage): Likewise. * Makefile.in (LIBIBERTY_BUILDDIR, LIBIBERTY): New variables. (SUBDIRS, REQUIRED_SUBDIRS): Add libiberty. (gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Depend on and link against libiberty. ($(LIBGNU)): Depend on libiberty. (all-lib): Recurse into all subdirs. (install-only): Invoke "install" target in subdirs. (vasprintf.o, vsnprintf.o, safe-ctype.o, lbasename.o): Remove targets. * configure: Rebuild. * configure.ac: Add ACX_CONFIGURE_DIR for libiberty. Don't check for vasprintf, vsnprintf, or gettimeofday. * configure.srv: Don't add safe-ctype.o or lbasename.o to srv_tgtobj.
2014-06-05Make it easy to make --disable-werror the default for both binutils and gdbJoel Brobecker
The goal of this patch is to provide an easy way to make --disable-werror the default when building binutils, or the parts of binutils that need to get built when building GDB. In development mode, we want to continue making -Werror the default with GCC. But, when making releases, I think we want to make it as easy as possible for regular users to successfully build from sources. GDB already has this kind of feature to turn -Werror as well as the use of the libmcheck library. As GDB Release Manager, I take advantage of it to turn those off after having cut the branch. I'd like to be able to do the same for the binutils bits. And perhaps Tristan will want to do the same for his releases too (not sure, binutils builders might be a little savvier than GDB builders). This patch introduces a new file, called development.sh, which just sets a variable called $development. In our development branches (Eg. "master"), it's set to true. But setting it to false would allow us to change the default behavior of various development-related features to be turned off; in this case, it turns off the use of -Werror by default (use --enable-werror to turn it back on). bfd/ChangeLog: * development.sh: New file. * warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh. Make -Werror the default with GCC only if DEVELOPMENT is true. * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add $(srcdir)/development.sh. * Makefile.in, configure: Regenerate. binutils/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. gas/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. gold/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New. * Makefile.in, configure: Regenerate. gprof/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. ld/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. opcodes/ChangeLog: * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on bfd's development.sh. * Makefile.in, configure: Regenerate. gdb/ChangeLog: * development.sh: Delete. * Makefile.in (config.status): Adjust dependency on development.sh. * configure.ac: Adjust development.sh source call. * configure: Regenerate. gdb/gdbserver/ChangeLog: * configure.ac: Adjust development.sh source call. * Makefile.in (config.status): Adjust dependency on development.sh. * configure: Regenerate. Tested on x86_64-linux by building two ways: One with DEVELOPMENT set to true, and one with DEVELOPMENT set to false. In the first case, I could see the use of -Werror, while it disappeared in the second case.
2014-05-20Do not build gdbserver with -Werror by default if development=falseJoel Brobecker
On GDB release branches, we change $development in gdb/development.sh to false, in order to build the GDB release without -Werror by default, thus avoiding harmless compiler warnings from breaking the build of someone who's only interested in building GDB rather than working on it. This patch implements the same strategy for gdbserver, using the exact same method. gdb/gdbserver/ChangeLog: * configure.ac: Only use -Werror by default when DEVELOPMENT is true. * configure: Regenerate. Tested on x86_64-linux, by rebuilding GDBserver first with development set to true, and then doing it again with development set to false. Werror was used in the first case, but not in the second.
2014-01-22 New gdbserver option --debug-format=timestamp.Doug Evans
* NEWS: Mention it. gdbserver/ * configure.ac (AC_CHECK_FUNCS): Add test for gettimeofday. * configure: Regenerate. * config.in: Regenerate. * Makefile.in (SFILES): Add debug.c. (OBS): Add debug.o. * debug.c: New file. * debug.h: New file. * linux-aarch64-low.c (*): Update all debugging printfs to use debug_printf instead of fprintf. * linux-arm-low.c (*): Ditto. * linux-cris-low.c (*): Ditto. * linux-crisv32-low.c (*): Ditto. * linux-m32r-low.c (*): Ditto. * linux-sparc-low.c (*): Ditto. * linux-x86.c (*): Ditto. * linux-low.c (*): Ditto. (linux_wait_1): Add calls to debug_enter, debug_exit. (linux_wait): Remove redundant debugging printf. (stop_all_lwps): Add calls to debug_enter, debug_exit. (linux_resume, unstop_all_lwps): Ditto. * mem-break.c (*): Update all debugging printfs to use debug_printf instead of fprintf. * remote-utils.c (*): Ditto. * thread-db.c (*): Ditto. * server.c #include <ctype.h>, "gdb_vecs.h". (debug_threads): Moved to debug.c. (*): Update all debugging printfs to use debug_printf instead of fprintf. (start_inferior): Replace call to fflush with call to debug_flush. (monitor_show_help): Mention set debug-format. (parse_debug_format_options): New function. (handle_monitor_command): Handle "monitor set debug-format". (gdbserver_usage): Mention --debug-format. (main): Parse --debug-format. * server.h (debug_threads): Declaration moved to debug.h. #include "debug.h". * tracepoint.c (trace_debug_1) [!IN_PROCESS_AGENT]: Add version of trace_debug_1 that uses debug_printf. (tracepoint_look_up_symbols): Update all debugging printfs to use debug_printf instead of fprintf. doc/ * gdb.texinfo (Server): Mention --debug-format=all|none|timestamp. (gdbserver man): Ditto. testsuite/ * gdb.server/server-mon.exp: Add tests for "set debug-format".
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker
2013-11-18stdlib.h is universal tooTom Tromey
stdlib.h is universal as well, so there is no need to check for it. 2013-11-18 Tom Tromey <tromey@redhat.com> * configure: Rebuild. * configure.ac: Don't check for stdlib.h * defs.h: Include stdlib.h unconditionally. 2013-11-18 Tom Tromey <tromey@redhat.com> * configure: Rebuild. * configure.ac: Don't check for stdlib.h. * gdbreplay.c: Unconditionally include stdlib.h.
2013-11-18remove gdb_dirent.hTom Tromey
This removes gdb_dirent.h and updates the code to use dirent.h instead. It also removes the now-useless configure checks. 2013-11-18 Tom Tromey <tromey@redhat.com> * common/common.m4 (GDB_AC_COMMON): Don't use AC_HEADER_DIRENT. * common/gdb_dirent.h: Remove. * common/filestuff.c: Use dirent.h. * common/linux-osdata.c: Use dirent.h. (NAMELEN): Define. * config.in: Rebuild. * configure: Rebuild. * configure.ac: Don't use AC_HEADER_DIRENT. * linux-fork.c: Use dirent.h * linux-nat.c: Use dirent.h. * nto-procfs.c: Use dirent.h. * procfs.c: Use dirent.h. 2013-11-18 Tom Tromey <tromey@redhat.com> * config.in: Rebuild. * configure: Rebuild. * configure.ac: Don't use AC_HEADER_DIRENT.
2013-11-08remove unused gdbserver configuryTom Tromey
This updates gdbserver's configure.ac to remove checks that aren't directly needed by gdbserver. 2013-11-08 Tom Tromey <tromey@redhat.com> * configure, config.in: Rebuild. * configure.ac: Remove unused configury.
2013-11-08introduce common.m4Tom Tromey
It has bothered me for a while that files in common/ use macros defined via autoconf checks, but rely on each configure.ac doing the proper checks independently. This patch introduces common/common.m4 which consolidates the checks assumed by code in common. The rule I propose is that if something is needed or used by common, it should be checked for by common.m4. However, if the check is also needed by gdb or gdbserver, then it should be duplicated there. Built and regtested on x86-64 Fedora 18 (though this is hardly the most strenuous case) and using the Fedora 18 mingw cross compilers. I also examined the config.in diffs to ensure that symbols did not go missing. 2013-11-08 Tom Tromey <tromey@redhat.com> * acinclude.m4: Include common.m4. * common/common.m4: New file. * configure, config.in: Rebuild. * configure.ac: Use GDB_AC_COMMON. 2013-11-08 Tom Tromey <tromey@redhat.com> * acinclude.m4: Include common.m4, codeset.m4. * configure, config.in: Rebuild. * configure.ac: Use GDB_AC_COMMON.
2013-09-29gdb: btrace: fix build errors on older glibc buildsMike Frysinger
It is possible to have a build of glibc where SYS_perf_event_open is not defined (because when the glibc was compiled, the syscall did not exist), but have newer kernel headers installed so that linux/perf_event.h is available. In this setup, you get a build failure: ./common/linux-btrace.c: In function 'kernel_supports_btrace': ./common/linux-btrace.c:316:23: error: 'SYS_perf_event_open' undeclared (first use in this function) Update the ifdef check to also see if the syscall is available. URL: https://bugs.gentoo.org/473522 Reported-by: William Throwe <wtt6@cornell.edu> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-07-04gdb/Yao Qi
2013-07-04 Yao Qi <yao@codesourcery.com> Revert: 2013-06-27 Yao Qi <yao@codesourcery.com> * common/create-version.sh: Update comments. Handle the case that TARGET_ALIAS is empty. gdb/gdbserver/ 2013-07-04 Yao Qi <yao@codesourcery.com> * Makefile.in (host_alias): Use @host_noncanonical@. (target_alias): Use @target_noncanonical@. * configure.ac: Use ACX_NONCANONICAL_TARGET and ACX_NONCANONICAL_HOST. * configure: Regenerated. Revert: 2013-06-28 Mircea Gherzan <mircea.gherzan@intel.com> * configure.ac (version_host, version_target): Set and AC_SUBST them. * configure: Rebuild. * Makefile.in (version_host, version_target): Get from configure. (version.c): Use $(version_host) and $(version_target).
2013-07-03On mainline/development, also link GDBserver with -lmcheck.Pedro Alves
This factors --enable-libmcheck related bits from GDB's configure.ac and makes GDBserver use them too. Specifically, the 'development' global is moved to a separate script to it can be sourced by both GDB and GDBserver, and the --enable-libmcheck/--disable-libmcheck bits proper are moved to a new m4 file. I started out by defining 'development' in the m4 file, but in the end decided against it, as a separate script has the advantage that changing it in release branches does not require regenerating configure, unlike today. I had also started out by making the new GDB_AC_LIBMCHECK itself handle the yes/no default fallback depending on release/developement, but since I had split out 'development' to a separate script, and, GDB needs the python checks anyway (hence we'd need to do the python checks in gdb's configure.ac, and pass in a 'default lmcheck yes/no' parameter to GDB_AC_LIBMCHECK anyway), I ended up keeping GDB_AC_LIBMCHECK isolated from the 'development' global. IOW, it's the caller's business to handle it. Tested on x86_64 Fedora 17. Built GDB and GDBserver with and without --enable-libmcheck, and observed --enable-libmcheck overrides the disablement of -lmcheck caused by python supporting threads, and that GDBserver links with -lmcheck when expected. Also observed that changing the 'development' global, and issuing "make" triggers a relink, and '-lmcheck' is included or not from the link accordingly. gdb/ 2013-07-03 Pedro Alves <palves@redhat.com> * Makefile.in (config.status): Depend on development.sh. (aclocal_m4_deps): Add libmcheck.m4. * acinclude.m4: Include libmcheck.m4. * configure.ac: Source development.sh instead of setting 'development' here. --enable-libmcheck/--disable-libmcheck code factored out to GDB_AC_LIBMCHECK. Run it. * development.sh: New file. * libmcheck.m4: New file. * configure: Regenerate. gdb/gdbserver/ 2013-07-03 Pedro Alves <palves@redhat.com> * Makefile.in (config.status): Depend on development.sh. * acinclude.m4: Include libmcheck.m4. * configure: Regenerate.
2013-07-01Rely on gnulib's unistd.h replacement.Pedro Alves
With gnulib's unistd module, we can assume unistd.h is always present, and that STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO are always defined. Don't remove unistd.h from GDB's configure.ac, as later tests in the file use HAVE_UNISTD_H checks. gdb/ 2013-07-01 Pedro Alves <palves@redhat.com> * defs.h: Don't check HAVE_UNISTD_H before including <unistd.h>. (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Delete. * tracepoint.c: Don't check HAVE_UNISTD_H before including <unistd.h>. gdb/gdbserver/ 2013-07-01 Pedro Alves <palves@redhat.com> * event-loop.c: Don't check HAVE_UNISTD_H before including <unistd.h>. * gdbreplay.c: Likewise. * remote-utils.c: Likewise. * server.c: Likewise. * configure.ac: Don't check for unistd.h. * configure: Regenerate.
2013-06-28gdbserver: fix the standalone buildMircea Gherzan
When directly invoking gdb/gdbserver/configure && make, the build will fail because the $(host_alias) is empty and thus create-version.sh does not get enough parameters. The output of gdbserver --version without this patch (built like above): [...] This gdbserver was configured as "" After applying this patch: [...] This gdbserver was configured as "x86_64-unknown-linux-gnu" 2013-06-28 Mircea Gherzan <mircea.gherzan@intel.com> gdbserver: * configure.ac (version_host, version_target): Set and AC_SUBST them. * configure: Rebuild. * Makefile.in (version_host, version_target): Get from configure. (version.c): Use $(version_host) and $(version_target). Change-Id: Id48240532ad3d624ec78867a6db5ebd4c09583ff Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
2013-04-22 PR gdb/7912:Tom Tromey
* Makefile.in (SFILES): Add filestuff.c (COMMON_OBS): Add filestuff.o. (filestuff.o): New target. * auto-load.c (auto_load_objfile_script_1): Use gdb_fopen_cloexec. * auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec. * cli/cli-cmds.c (shell_escape): Call close_most_fds. * cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec. * common/agent.c (gdb_connect_sync_socket): Use gdb_socket_cloexec. * common/filestuff.c: New file. * common/filestuff.h: New file. * common/linux-osdata.c (linux_common_core_of_thread) (command_from_pid, commandline_from_pid, print_source_lines) (linux_xfer_osdata_shm, linux_xfer_osdata_sem) (linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use gdb_fopen_cloexec. * common/linux-procfs.c (linux_proc_get_int) (linux_proc_pid_has_state): Use gdb_fopen_cloexec. * config.in, configure: Rebuild. * configure.ac: Don't check for sys/socket.h. Check for fdwalk, pipe2. * corelow.c (core_open): Use gdb_open_cloexec. * dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec. * fork-child.c (fork_inferior): Call close_most_fds. * gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec. * inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec. * linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals): Use gdb_fopen_cloexec. (linux_proc_xfer_partial, linux_proc_xfer_spu): Use gdb_open_cloexec. (linux_async_pipe): Use gdb_pipe_cloexec. * remote-fileio.c (remote_fileio_func_open): Use gdb_open_cloexec. * remote.c (remote_file_put, remote_file_get): Use gdb_fopen_cloexec. * ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec, close_most_fds. * ser-tcp.c (net_open): Use gdb_socket_cloexec. * ser-unix.c (hardwire_open): Use gdb_open_cloexec. * solib.c (solib_find): Use gdb_open_cloexec. * source.c (openp, find_and_open_source): Use gdb_open_cloexec. * tracepoint.c (tfile_start): Use gdb_fopen_cloexec. (tfile_open): Use gdb_open_cloexec. * tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec. * ui-file.c (gdb_fopen): Use gdb_fopen_cloexec. * xml-support.c (xml_fetch_content_from_file): Use gdb_fopen_cloexec. * main.c (captured_main): Call notice_open_fds. gdbserver * Makefile.in (SFILES): Add filestuff.c. (OBS): Add filestuff.o. (filestuff.o): New target. * config.in, configure: Rebuild. * configure.ac: Check for fdwalk, pipe2.