aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
AgeCommit message (Collapse)AuthorFilesLines
2020-04-28Fix typo (thead -> thread)Tankut Baris Aktemur2-1/+5
gdb/stubs/ChangeLog: 2020-04-28 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * ia64vms-stub.c: Fix typo in comment (thead -> thread). gdb/testsuite/ChangeLog: 2020-04-28 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.threads/stop-with-handle.exp: Fix typo in comment (theads -> threads). gdbsupport/ChangeLog: 2020-04-28 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb-sigmask.h: Fix typo (pthead_sigmask -> pthread_sigmask).
2020-04-27gdbsupport: include cstdlib in common-defs.hSimon Marchi2-0/+9
In PR 25731 [1], the following build failure was reported: ../../binutils-gdb/gdb/gdbtypes.c:1254:10: error: no member named 'abs' in namespace 'std'; did you mean simply 'abs'? = ((std::abs (stride) * element_count) + 7) / 8; ^~~~~~~~ abs /usr/include/stdlib.h:129:6: note: 'abs' declared here int abs(int) __pure2; ^ The original report was using: $ gcc -v Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Note that I was _not_ able to reproduce using: $ g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.17) Target: x86_64-apple-darwin19.3.0 The proposed fix is to include <cstdlib> in addition to <stdlib.h>. Here's an excerpt of [2] relevant to this problem: These headers [speaking of the .h form] are allowed to also declare the same names in the std namespace, and the corresponding cxxx headers are allowed to also declare the same names in the global namespace: including <cstdlib> definitely provides std::malloc and may also provide ::malloc. Including <stdlib.h> definitely provides ::malloc and may also provide std::malloc Since we use std::abs, we should not assume that our include of stdlib.h declares an `abs` function in the `std` namespace. If we replace the include of stdlib.h with cstdlib, then we fall in the opposite situation. A standard C++ library may decide to only put the declarations in the std namespace, requiring us to prefix all standard functions with `std::`. I'm not against that, but for the moment I think the safest way forward is to just include both. Note that I don't know what effect this patch can have on any stdlib.h fix provided by gnulib. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=25731 [2] https://en.cppreference.com/w/cpp/header#C_compatibility_headers gdbsupport/ChangeLog: * common-defs.h: Include cstdlib.h.
2020-04-20Mark move constructors as "noexcept"Tom Tromey4-8/+14
I recently learned that move constructors generally should be marked "noexcept". This ensures that standard containers will move objects when possible, rather than copy them. This patch fixes the cases I could find. Note that implicitly-defined or defaulted move constructors will automatically do what you'd expect; that is, they are noexcept if all the members have noexcept move constructors. While doing this, I noticed a couple of odd cases where the move constructor seemed to assume that the object being constructed could have state requiring destruction. I've fixed these as well. See completion_result and scoped_mmap. gdb/ChangeLog 2020-04-20 Tom Tromey <tromey@adacore.com> * python/python.c (struct gdbpy_event): Mark move constructor as noexcept. * python/py-tui.c (class gdbpy_tui_window_maker): Mark move constructor as noexcept. * completer.h (struct completion_result): Mark move constructor as noexcept. * completer.c (completion_result::completion_result): Use initialization style. Don't call reset_match_list. gdbsupport/ChangeLog 2020-04-20 Tom Tromey <tromey@adacore.com> * scoped_mmap.h (scoped_mmap): Mark move constructor as noexcept. Use initialization style. Don't call destroy. * scoped_fd.h (class scoped_fd): Mark move constructor as noexcept. * gdb_ref_ptr.h (class ref_ptr): Mark move constructor as noexcept.
2020-04-13Move gdb_notifier commentTom Tromey2-11/+12
This moves the gdb_notifier comment a bit lower in event-loop.c, to where it belongs; and removes an obsolete comment that Pedro pointed out. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.c: Move comment. Remove obsolete comment.
2020-04-13Move event-loop.[ch] to gdbsupport/Tom Tromey5-10/+1009
This moves event-loop.[ch] to gdbsupport/ and updates the uses in gdb. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * run-on-main-thread.c: Update include. * unittests/main-thread-selftests.c: Update include. * tui/tui-win.c: Update include. * tui/tui-io.c: Update include. * tui/tui-interp.c: Update include. * tui/tui-hooks.c: Update include. * top.h: Update include. * top.c: Update include. * ser-base.c: Update include. * remote.c: Update include. * remote-notif.c: Update include. * remote-fileio.c: Update include. * record-full.c: Update include. * record-btrace.c: Update include. * python/python.c: Update include. * posix-hdep.c: Update include. * mingw-hdep.c: Update include. * mi/mi-main.c: Update include. * mi/mi-interp.c: Update include. * main.c: Update include. * linux-nat.c: Update include. * interps.c: Update include. * infrun.c: Update include. * inf-loop.c: Update include. * event-top.c: Update include. * event-loop.c: Move to ../gdbsupport/. * event-loop.h: Move to ../gdbsupport/. * async-event.h: Update include. * Makefile.in (COMMON_SFILES, HFILES_NO_SRCDIR): Update. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.h: Move from ../gdb/. * event-loop.cc: Move from ../gdb/.
2020-04-13Introduce and use flush_streamsTom Tromey2-0/+8
Code in gdbsupport can't call gdb_flush, so this introduces a new "flush_streams" function that must be supplied by the client. Note that the similar gdb_flush_out_err exists, but it isn't defined in quite the same way, so it wasn't clear to me whether the two could be merged. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * utils.c (flush_streams): New function. * event-loop.c (gdb_wait_for_event): Call flush_streams. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * errors.h (flush_streams): Declare.
2020-04-13Move gdb_select.h to gdbsupport/Tom Tromey2-0/+55
This moves gdb_select.h to gdbsupport/, so it can be used by other code there. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * gdb_select.h: Move to ../gdbsupport/. * event-loop.c: Update include path. * top.c: Update include path. * ser-base.c: Update include path. * ui-file.c: Update include path. * ser-tcp.c: Update include path. * guile/scm-ports.c: Update include path. * posix-hdep.c: Update include path. * ser-unix.c: Update include path. * gdb_usleep.c: Update include path. * mingw-hdep.c: Update include path. * inflow.c: Update include path. * infrun.c: Update include path. * event-top.c: Update include path. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * gdb_select.h: Move from ../gdb/.
2020-04-13Move event-loop configury to common.m4Tom Tromey4-4/+23
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-31Don't pass NULL to memcpy in gdbTom Tromey2-1/+7
I compiled gdb with -fsanitize=undefined and ran the test suite. A couple of reports came from passing NULL to memcpy, e.g.: [...]btrace-common.cc:176:13: runtime error: null pointer passed as argument 2, which is declared to never be null While it would be better to fix this in the standard, in the meantime it seems easy to avoid this error. gdb/ChangeLog 2020-03-31 Tom Tromey <tromey@adacore.com> * dwarf2/abbrev.c (abbrev_table::read): Conditionally call memcpy. gdbsupport/ChangeLog 2020-03-31 Tom Tromey <tromey@adacore.com> * btrace-common.cc (btrace_data_append): Conditionally call memcpy.
2020-03-27gdbsupport: Resolve shellcheck issues in create-version.sh scriptAndrew Burgess2-8/+14
Run shellcheck (version 0.4.7) on the create-version.sh script, and resolve the issues it highlighter - they all seemed reasonable. gdbsupport/ChangeLog: * create-version.sh: Resolve issues highlighted by shellcheck.
2020-03-20gdb: remove HAVE_DECL_PTRACESimon Marchi3-24/+5
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-18Include <alloca.h> conditionallyKamil Rytarowski2-0/+6
Fixes build on NetBSD, where alloca() is defined in <stdlib.h>. gdbsupport: * common-defs.h: Include alloca.h if HAVE_ALLOCA_H is defined.
2020-03-12Change gdbsupport not to rely on BFDTom Tromey3-43/+11
This changes gdbsupport so that it no longer relies on BFD. This is a precursor to making gdbserver use the already-built gdbsupport, because building gdbserver should not require BFD to be built. The most notable change here is that CORE_ADDR is always a 64-bit type. This makes it so that gdb acts as if it were always built in 64-bit mode. ChangeLog 2020-03-12 Tom Tromey <tom@tromey.com> * Makefile.in: Rebuild. * Makefile.def (gdbsupport): Don't depend on bfd. gdbsupport/ChangeLog 2020-03-12 Tom Tromey <tom@tromey.com> * common-types.h: Remove GDBSERVER code. (gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Redefine. * common-defs.h: Remove GDBSERVER code.
2020-03-12Move gdb/selftest.m4 to gdbsupport/selftest.m4Simon Marchi4-3/+57
The selftest.m4 file is used by gdb, gdbserver and gdbsupport, I think it belongs in gdbsupport. gdb/ChangeLog: * selftest.m4: Move to gdbsupport/. * acinclude.m4: Update path to selftest.m4. gdbserver/ChangeLog: * acinclude.m4: Update path to selftest.m4. gdbsupport/ChangeLog: * selftest.m4: Moved from gdb/. * acinclude.m4: Update path to selftest.m4.
2020-03-12Move sourcing of development.sh to GDB_AC_COMMONSimon Marchi4-7/+14
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 Marchi2-0/+9
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 Marchi3-0/+7
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-03-08Fix two typos in gdb_binary_search.hTom Tromey2-2/+6
I noticed a couple of typos in gdb_binary_search.h. This fixes them. gdbsupport/ChangeLog 2020-03-08 Tom Tromey <tom@tromey.com> * gdb_binary_search.h: Fix two typos.
2020-03-06gdbserver/gdbsupport: Add .dir-locals.el fileAndrew Burgess2-0/+45
Copy the .dir-locls.el file from gdb/ to gdbserver/ and gdbsupport/ so that we get the GNU/GDB style when editing these files in Emacs. I initially wanted to remove the (c-mode . ((mode . c++))) that switches c-mode files into c++-mode as we store C++ code in *.cc files in the gdbserver/ directory, unlike gdb/ where we use *.c, however, I was forgetting about the header files - we still use *.h for our C++ header files, so for now I left the settings in place to open all C files in c++-mode. We now have three copies of this file, which are all identical. It would be nice if we could remove this duplication, however, for now we haven't found a good way to do this. Some options considered were: 1. Use symlinks to only have one copy of the file. This was rejected as not all targets support symlinks in the way. 2. Have two of the .dir-locals.el files contain some mechanism by which the third copy of the file is sourced. Though this would, in theory, be possible, it would involve some advanced Emacs scripting, would be fragile, and a maintenance burdon. 3. Move the .dir-locals up into top level src/ directory, then use Emacs dir-locals directory pattern matching to only apply the rules for the three directories we care about. The problem is that each directory has to be listed separately, so we still end up having to duplicate all the rules. In the end, it was decided that having three copies of the file, though not ideal, is probably easiest for now. This was all discussed in this mailing list thread: https://sourceware.org/ml/gdb-patches/2020-03/msg00024.html The copyright date in the new files is left as for gdb/.dir-locals.el, as the new files are a copy of the old, this is inline with this rule: https://sourceware.org/gdb/wiki/ContributionChecklist#Copyright_Header gdb/ChangeLog: * .dir-locals.el: Add a comment referencing the other copies of this file. gdbserver/ChangeLog: * .dir-locals.el: New file. gdbsupport/ChangeLog: * .dir-locals.el: New file.
2020-03-05gdbsupport/configure.ac: source development.shVyacheslav Petrishchev3-0/+11
[Commit message by Simon Marchi] The GDB build in non-development mode (turn development to false in bfd/development.sh if you want to try) is currently broken: CXXLD gdb /home/smarchi/src/binutils-gdb/gdb/disasm-selftests.c:218: error: undefined reference to 'selftests::register_test_foreach_arch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void (*)(gdbarch*))' /home/smarchi/src/binutils-gdb/gdb/disasm-selftests.c:220: error: undefined reference to 'selftests::register_test_foreach_arch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void (*)(gdbarch*))' /home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:2310: error: undefined reference to 'selftests::register_test_foreach_arch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void (*)(gdbarch*))' /home/smarchi/src/binutils-gdb/gdb/gdbarch-selftests.c:168: error: undefined reference to 'selftests::register_test_foreach_arch(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void (*)(gdbarch*))' /home/smarchi/src/binutils-gdb/gdbsupport/selftest.cc:96: error: undefined reference to 'selftests::reset()' This is because the gdbsupport configure script doesn't source bfd/development.sh to set the development variable. When $development is unset, GDB_AC_SELFTEST defaults to enabling selftests. I don't think the macro was written with this intention in mind, it just happens to be that way. So gdbsupport thinks selftests are enabled, while gdb thinks they are disabled. gdbsupport compiles in code that calls selftests:: functions, which are normally provided by gdb, but gdb doesn't provide them, hence the undefined references. Fix this by sourcing bfd/development.sh in gdbsupport/configure.ac, so that the development variable is set. gdbsupport/ChangeLog: * configure.ac: Added call development.sh. * configure: Regenerate.
2020-03-05gdb, gdbserver, gdbsupport: add .gitattributes filesTankut Baris Aktemur2-0/+10
Create .gitattributes files in gdb/, gdbserver/, and gdbsupport/. The files specify cpp-style diffs for .h and .c files. This is particularly helpful if a class in a header file is modified. For instance, if the `stop_requested` field of `thread_info` in gdb/gdbthread.h is modified, we get the following diff with 'git diff' (using git version 2.17.1): @@ -379,7 +379,7 @@ public: struct target_waitstatus pending_follow; /* True if this thread has been explicitly requested to stop. */ - int stop_requested = 0; + bool stop_requested = 0; /* The initiating frame of a nexting operation, used for deciding which exceptions to intercept. If it is null_frame_id no Note that the context of the change shows up as 'public:'; not so useful. With the .gitattributes file, we get: @@ -379,7 +379,7 @@ class thread_info : public refcounted_object struct target_waitstatus pending_follow; /* True if this thread has been explicitly requested to stop. */ - int stop_requested = 0; + bool stop_requested = 0; /* The initiating frame of a nexting operation, used for deciding which exceptions to intercept. If it is null_frame_id no The context is successfully shown as 'class thread_info'. This patch creates a .gitattributes file per each of gdb, gdbserver, and gdbsupport folders. An alternative would be to define the attributes in the root folder -- this would impact all the top-level folders, though. I opted for the more conservative approach. gdb/ChangeLog: 2020-03-05 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * .gitattributes: New file. gdbserver/ChangeLog: 2020-03-05 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * .gitattributes: New file. gdbsupport/ChangeLog: 2020-03-05 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * .gitattributes: New file.
2020-03-03gdbsupport: re-generate Makefile.inSimon Marchi2-1/+7
It looks like after doing last minute changes to Makefile.am in commit 06b3c5bdb ("gdbsupport: rename source files to .cc"), I forgot to re-generate Makefile.in. This patch fixes it. gdbsupport/ChangeLog: * Makefile.in: Re-generate.
2020-02-28Fix comment for 'gdb_dlopen'Sergio Durigan Junior2-2/+6
The 'gdb_dlopen' function doesn't return NULL if the shlib load fails; it actually throws an error. This patch updates the comment to reflect this. gdbsupport/ChangeLog: 2020-02-28 Sergio Durigan Junior <sergiodj@redhat.com> * gdb-dlfcn.h (gdb_dlopen): Update comment.
2020-02-19Merge changes from GCC for the config/ directoryAndrew Burgess2-6/+27
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-14Change gdbserver to use existing gnulib and libibertyTom Tromey2-1/+5
This changes gdbserver so that it no longer builds its own gnulib and libiberty. Instead, it now relies on the ones that were already built at the top level. gdbsupport is still built specially for gdbserver. This is more complicated and will be tackled in a subsequent patch. ChangeLog 2020-02-14 Tom Tromey <tom@tromey.com> * Makefile.in: Rebuild. * Makefile.def: Make gdbserver require gnulib and libiberty. gdbserver/ChangeLog 2020-02-14 Tom Tromey <tom@tromey.com> * acinclude.m4: Don't include acx_configure_dir.m4. * Makefile.in (LIBIBERTY_BUILDDIR, GNULIB_BUILDDIR): Update. (SUBDIRS, CLEANDIRS, REQUIRED_SUBDIRS): Remove. (all, install-only, uninstall, clean-info, clean) (maintainer-clean): Don't recurse. (subdir_do, all-lib): Remove. ($(LIBGNU) $(LIBIBERTY) $(GNULIB_H)): Remove rule. (GNULIB_H): Remove. (generated_files): Update. ($(GNULIB_BUILDDIR)/Makefile): Remove rule. * configure: Rebuild. * configure.ac: Don't configure gnulib or libiberty. (GNULIB): Update. gdbsupport/ChangeLog 2020-02-14 Tom Tromey <tom@tromey.com> * common-defs.h: Change path to gnulib/config.h. Change-Id: I469cbbf5db2ab37109c058e9e3a1e4f4dabdfc98
2020-02-13gdbsupport: rename source files to .ccSimon Marchi37-103/+105
This patch renames the .c source files in gdbsupport to .cc. In the gdb directory, there is an argument against renaming the source files, which is that it makes using some git commands more difficult to do archeology. Some commands have some kind of "follow" option that makes git try to follow renames, but it doesn't work in all situations. Given that we have just moved the gdbsupport directory, that argument doesn't hold for source files in that directory. I therefore suggest renaming them to .cc, so that they are automatically recognized as C++ by various tools and editors. The original motivation behind this is that when building gdbsupport with clang, I get: CC agent.o clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated] In the gdb/ directory, we make clang happy by passing "-x c++". We could do this in gdbsupport too, but I think that renaming the files is a better long-term solution. gdbserver still does its own build of gdbsupport, so a few changes in its Makefile are necessary. gdbsupport/ChangeLog: * Makefile.am: Rename source files from .c to .cc. (CC, CFLAGS): Don't override. (AM_CFLAGS): Rename to ... (AM_CXXFLAGS): ... this. * Makefile.in: Re-generate. * %.c: Rename to %.cc. gdbserver/ChangeLog: * Makefile.in: Rename gdbsupport source files from .c to .cc.
2020-02-11Re-generate gdb/gdbserver/gdbsupport configure scriptsSimon Marchi2-1/+6
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 Marchi3-2/+10
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-11Move gdb/warning.m4 to gdbsupportSimon Marchi4-2/+167
This file is used by gdbsupport, gdbserver and gdb, so I think it belongs in gdbsupport. Move it there and update the references the various acinclude.m4 files. gdbsupport/ChangeLog: * warning.m4: Move here, from gdb/warning.m4. * acinclude.m4: Update warning.m4 path. * Makefile.in: Re-generate. gdbserver/ChangeLog: * acinclude.m4: Update warning.m4 path. gdb/ChangeLog: * acinclude: Update warning.m4 path. * warning.m4: Move to gdbsupport.
2020-02-11gdbsupport: use AM_GDB_WARNINGSSimon Marchi6-1/+215
Since gdbsupport has been given its own build system, it is no longer compiled with the warning flags specified in gdb/warning.m4. This patch makes it use AM_GDB_WARNINGS. gdbsupport/ChangeLog: * acinclude.m4: Include ../gdb/warning.m4. * configure.ac: Use AM_GDB_WARNINGS. * Makefile.am: Set AM_CFLAGS to WARN_CFLAGS and WERROR_CFLAGS. * Makefile.in: Re-generate. * configure: Re-generate.
2020-02-10[gdb] Fix -Wstrict-null-sentinel warningsTom de Vries2-1/+5
When passed in CXXFLAGS, -Wstrict-null-sentinel triggers twice in a gdb/gdbserver build. Fix the two occurrences. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-02-10 Tom de Vries <tdevries@suse.de> * dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL sentinel to char *. gdbsupport/ChangeLog: 2020-02-10 Tom de Vries <tdevries@suse.de> * environ.c (gdb_environ::set): Cast concat NULL sentinel to char *.
2020-01-24Support the NetBSD version of pthread_setname_npChristian Biesinger2-2/+15
On NetBSD, pthread_setname_np takes a printf-style format string plus one argument: https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current This patch makes thread-pool.c handle that. gdbsupport/ChangeLog: 2020-01-24 Christian Biesinger <cbiesinger@google.com> * thread-pool.c (set_thread_name): Add an overload for the NetBSD version of pthread_setname_np. Change-Id: I61e664a813eaa7f52b6811b1a43e08ac3082d8ef
2020-01-17Fix gdbsupport build on compilers that don't default to C++11 or abovePedro Alves3-0/+9
gdbsupport fails to build with compilers that don't default to C++11 or above. gdbsupport's configure.ac is already using AX_CXX_COMPILE_STDCXX, which sets CXX_DIALECT to the -std=gnu++11 switch if necessary, but the problem is that nowhere are we using CXX_DIALECT. This fixes it. gdbsupport/ChangeLog: 2020-01-17 Pedro Alves <palves@redhat.com> * Makefile.am: Append CXX_DIALECT to CXX. * Makefile.in: Regenerate.
2020-01-17Fix gdbsupport buildPedro Alves5-54/+62
I'm seeing this on F27 (a clean build from scratch): ~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[3]: Entering directory '/home/pedro/brno/pedro/gdb/binutils-gdb/build/gdbsupport' CC gdb_tilde_expand.o In file included from /home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import/libc-config.h:33:0, from ../gnulib/import/glob.h:544, from /home/pedro/gdb/binutils-gdb/src/gdbsupport/gdb_tilde_expand.c:22: ../bfd/config.h:7:4: error: #error config.h must be #included before system headers # error config.h must be #included before system headers ^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ libc-config.h, where it includes config.h, says: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* This is intended to be a good-enough substitute for glibc system macros like those defined in <sys/cdefs.h>, so that Gnulib code shared with glibc can do this as the first #include: #ifndef _LIBC # include <libc-config.h> #endif When compiled as part of glibc this is a no-op; when compiled as part of Gnulib this includes Gnulib's <config.h> and defines macros that glibc library code would normally assume. */ #include <config.h> ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The issue is that that '#include <config.h>' picks up bfd's config.h instead of gnulib's. This problem doesn't trigger in the gdb dir because there we generate config.h under that exact name so gnulib's libc-config.h ends up picking gdb's config.h instead of gnulib.c and that ends up harmless. In gdbsupport, the config.h file is really named support-config.h, so that '#include <config.h>' in libc-config.h doesn't pick it like it would if it had the conventional config.h name. This patch fixes it by simply renaming gdbserver's support-config.h to config.h. gdbsupport/ChangeLog: 2020-01-17 Pedro Alves <palves@redhat.com> * configure.ac: Generate config.h instead of support-config.h. * common-defs.h: Include <gdbsupport/config.h> instead of <gdbsupport/support-config.h>. * Makefile.in: Regenerate. * configure: Regenerate.
2020-01-16Ensure proc-service symbols have default visibility (PR build/24805)Pedro Alves1-0/+29
Compiling GDB with '-fvisibility=hidden' removes the symbols that should be exported. This patch explicitly marks them as visible. gdb/ChangeLog: 2020-01-16 Pedro Alves <palves@redhat.com> Norbert Lange <nolange79@gmail.com> PR build/24805 * gdbsupport/gdb_proc_service.h (PS_EXPORT): New. (ps_get_thread_area, ps_getpid, ps_lcontinue, ps_lgetfpregs) (ps_lgetregs, ps_lsetfpregs, ps_lsetregs, ps_lstop, ps_pcontinue) (ps_pdread, ps_pdwrite, ps_pglobal_lookup, ps_pstop, ps_ptread) (ps_ptwrite, ps_lgetxregs, ps_lgetxregsize, ps_lsetxregs) (ps_plog): Redeclare exported functions with default visibility.
2020-01-14Add gdbsupport check-defines scriptTom Tromey4-0/+91
This adds a new script that tries to check that none of the support code uses defines that are not defined by common.m4. This check is necessarily inexact, but this script caught all the issues fixed in the previous patches. gdbsupport/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * Makefile.in: Rebuild. * Makefile.am (check-defines): New target. * check-defines.el: New file. Change-Id: I59450e91394d5e6a7fa59e9ab53c95843c4bacd9
2020-01-14Move many configure checks to common.m4Tom Tromey8-6/+2128
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 Tromey125-0/+27929
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