Commit Graph

103588 Commits

Author SHA1 Message Date
Andrew Burgess
361cb21935 gnulib: Ensure all libraries are used when building gdb/gdbserver
An issue was reported here related to building GDB on MinGW:

  https://sourceware.org/pipermail/gdb/2020-September/048927.html

It was suggested here:

  https://sourceware.org/pipermail/gdb/2020-September/048931.html

that the solution might be to make use of $(LIB_GETRANDOM), a variable
defined in the gnulib makefile, when linking GDB.

In fact I think the issue is bigger than just LIB_GETRANDOM.  When
using the script binutils-gdb/gnulib/update-gnulib.sh to reimport
gnulib there is a lot of output from gnulib's gnulib-tool.  Part of
that output is this:

  You may need to use the following makefile variables when linking.
  Use them in <program>_LDADD when linking a program, or
  in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.
    $(FREXPL_LIBM)
    $(FREXP_LIBM)
    $(INET_NTOP_LIB)
    $(LIBTHREAD)
    $(LIB_GETLOGIN)
    $(LIB_GETRANDOM)
    $(LIB_HARD_LOCALE)
    $(LIB_MBRTOWC)
    $(LIB_SETLOCALE_NULL)
    $(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise

What I think this is telling us is that we should be including the
value of all these variables on the link line for gdb and gdbserver.

The problem though is that these variables are define in gnulib's
makefile, but are not (necessarily) defined in GDB's makefile.

One solution would be to recreate the checks that gnulib performs in
order to recreate these variables in both gdb's and gdbserver's
makefile.  Though this shouldn't be too hard, most (if not all) of
these checks are in the form macros defined in m4 files in the gnulib
tree, so we could just reference these as needed.  However, in this
commit I propose a different solution.

Currently, in the top level makefile, we give gdb and gdbserver a
dependency on gnulib.  Once gnulib has finished building gdb and
gdbserver can start, these projects then have a hard coded (relative)
path to the compiled gnulib library in their makefiles.

In this commit I extend the gnulib configure script to install a new
makefile fragment in the gnulib build directory.  This new file will
have the usual variable substitutions applied to it, and so can
include the complete list (see above) of all the extra libraries that
are needed when linking against gnulib.

In fact the new makefile fragment defines three variables, these are:

LIBGNU: The path to the archive containing gnulib.  Can be used as a
       dependency as when this file changes gdb/gdbserver should be
       relinked.

LIBGNU_EXTRA_LIBS: A list of linker -l.... flags that should be
       included in the link line of gdb/gdbserver.  These are
       libraries that $(LIBGNU) depends on.  This list is taken from
       the output of gnulib-tool, which is run by our
       gnulib/update-gnulib.sh script.

INCGNU: A list of -I.... include paths that should be passed to the
       compiler, these are where the gnulib headers can be found.

Now both gdb and gdbserver can include the makefile fragment and make
use of these variables.

The makefile fragment relies on the variable GNULIB_BUILDDIR being
defined.  This is checked for in the fragment, and was already defined
in the makefiles of gdb and gdbserver.

gdb/ChangeLog:

	* Makefile.in: Include Makefile.gnulib.inc.  Don't define LIBGNU
	or INCGNU.  Make use of LIBGNU_EXTRA_LIBS when linking.

gdbserver/ChangeLog:

	* Makefile.in: Include Makefile.gnulib.inc.  Don't define LIBGNU
	or INCGNU.  Make use of LIBGNU_EXTRA_LIBS when linking.

gnulib/ChangeLog:

	* Makefile.gnulib.inc.in: New file.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Install the new file.
2020-10-09 09:31:43 +01:00
Jan Vrany
f5c4b229c6 Notify observers that directories have changed when using "directory" CLI command
gdb/ChangeLog

	* source.c (directory_command): Notify observers that "directories"
	parameter has changed.

gdb/testsuite/ChangeLog

	* gdb.mi/mi-cmd-param-changed.exp: Check that notification is
	is emmited for both 'set directories' and 'directory' commands.
2020-10-09 06:49:33 +01:00
Tom Tromey
b270168504 Style more output of "disassemble" command
I noticed a couple of spots where the "disassemble" could style its
output, but currently does not.  This patch adds styling to the
function name at the start of the disassembly, and any addresses
printed there.

gdb/ChangeLog
2020-10-08  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (print_disassembly): Style function name and
	addresses.  Add _() wrappers.

gdb/testsuite/ChangeLog
2020-10-08  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Check that "main"'s name is styled.
2020-10-08 19:41:45 -06:00
GDB Administrator
b3d3944ee5 Automatic date update in version.in 2020-10-09 00:00:07 +00:00
H.J. Lu
f511427204 gold: Update testsuite/split_[i386|x32|x86_64].sh
Update testsuite/split_i386.sh, testsuite/split_x32.sh and
testsuite/split_x86_64.sh for

commit f9ff65d4df
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Oct 8 10:27:43 2020 +1030

    [GOLD] Increase --split-stack-adjust-size

	* testsuite/split_i386.sh: Updated for --split-stack-adjust-size
	default change.
	* testsuite/split_x32.sh: Likewise.
	* testsuite/split_x86_64.sh: Likewise.
2020-10-08 05:01:22 -07:00
Shahab Vahedi
ada508b6cc Update GDB NEWS with ARC support in GDBserver
gdb/ChangeLog:

	* NEWS: Mention ARC support in GDBserver.
2020-10-08 13:51:42 +02:00
Andrew Burgess
51a948fdf0 gdb: Have allocate_target_description return a unique_ptr
Update allocate_target_description to return a target_desc_up, a
specialisation of unique_ptr.

This commit does not attempt to make use of the unique_ptr in the
best possible way, in almost all cases we immediately release the
pointer from within the unique_ptr and then continue as before.

There are a few places where it was easy to handle the unique_ptr, and
in these cases I've done that.

Everything under gdb/features/* is auto-regenerated.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* arch/aarch32.c (aarch32_create_target_description): Release
	unique_ptr returned from allocate_target_description.
	* arch/aarch64.c (aarch64_create_target_description): Likewise.
	* arch/amd64.c (amd64_create_target_description): Likewise.
	* arch/arc.c (arc_create_target_description): Likewise.
	* arch/arm.c (arm_create_target_description): Likewise.
	* arch/i386.c (i386_create_target_description): Likewise.
	* arch/riscv.c (riscv_create_target_description): Update return
	type.  Handle allocate_target_description returning a unique_ptr.
	(riscv_lookup_target_description): Update to handle unique_ptr.
	* arch/tic6x.c (tic6x_create_target_description): Release
	unique_ptr returned from allocate_target_description.
	* features/microblaze-with-stack-protect.c: Regenerate.
	* features/microblaze.c: Regenerate.
	* features/mips-dsp-linux.c: Regenerate.
	* features/mips-linux.c: Regenerate.
	* features/mips64-dsp-linux.c: Regenerate.
	* features/mips64-linux.c: Regenerate.
	* features/nds32.c: Regenerate.
	* features/nios2.c: Regenerate.
	* features/or1k.c: Regenerate.
	* features/rs6000/powerpc-32.c: Regenerate.
	* features/rs6000/powerpc-32l.c: Regenerate.
	* features/rs6000/powerpc-403.c: Regenerate.
	* features/rs6000/powerpc-403gc.c: Regenerate.
	* features/rs6000/powerpc-405.c: Regenerate.
	* features/rs6000/powerpc-505.c: Regenerate.
	* features/rs6000/powerpc-601.c: Regenerate.
	* features/rs6000/powerpc-602.c: Regenerate.
	* features/rs6000/powerpc-603.c: Regenerate.
	* features/rs6000/powerpc-604.c: Regenerate.
	* features/rs6000/powerpc-64.c: Regenerate.
	* features/rs6000/powerpc-64l.c: Regenerate.
	* features/rs6000/powerpc-7400.c: Regenerate.
	* features/rs6000/powerpc-750.c: Regenerate.
	* features/rs6000/powerpc-860.c: Regenerate.
	* features/rs6000/powerpc-altivec32.c: Regenerate.
	* features/rs6000/powerpc-altivec32l.c: Regenerate.
	* features/rs6000/powerpc-altivec64.c: Regenerate.
	* features/rs6000/powerpc-altivec64l.c: Regenerate.
	* features/rs6000/powerpc-e500.c: Regenerate.
	* features/rs6000/powerpc-e500l.c: Regenerate.
	* features/rs6000/powerpc-isa205-32l.c: Regenerate.
	* features/rs6000/powerpc-isa205-64l.c: Regenerate.
	* features/rs6000/powerpc-isa205-altivec32l.c: Regenerate.
	* features/rs6000/powerpc-isa205-altivec64l.c: Regenerate.
	* features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c: Regenerate.
	* features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c: Regenerate.
	* features/rs6000/powerpc-isa205-vsx32l.c: Regenerate.
	* features/rs6000/powerpc-isa205-vsx64l.c: Regenerate.
	* features/rs6000/powerpc-isa207-htm-vsx32l.c: Regenerate.
	* features/rs6000/powerpc-isa207-htm-vsx64l.c: Regenerate.
	* features/rs6000/powerpc-isa207-vsx32l.c: Regenerate.
	* features/rs6000/powerpc-isa207-vsx64l.c: Regenerate.
	* features/rs6000/powerpc-vsx32.c: Regenerate.
	* features/rs6000/powerpc-vsx32l.c: Regenerate.
	* features/rs6000/powerpc-vsx64.c: Regenerate.
	* features/rs6000/powerpc-vsx64l.c: Regenerate.
	* features/rs6000/rs6000.c: Regenerate.
	* features/rx.c: Regenerate.
	* features/s390-gs-linux64.c: Regenerate.
	* features/s390-linux32.c: Regenerate.
	* features/s390-linux32v1.c: Regenerate.
	* features/s390-linux32v2.c: Regenerate.
	* features/s390-linux64.c: Regenerate.
	* features/s390-linux64v1.c: Regenerate.
	* features/s390-linux64v2.c: Regenerate.
	* features/s390-te-linux64.c: Regenerate.
	* features/s390-tevx-linux64.c: Regenerate.
	* features/s390-vx-linux64.c: Regenerate.
	* features/s390x-gs-linux64.c: Regenerate.
	* features/s390x-linux64.c: Regenerate.
	* features/s390x-linux64v1.c: Regenerate.
	* features/s390x-linux64v2.c: Regenerate.
	* features/s390x-te-linux64.c: Regenerate.
	* features/s390x-tevx-linux64.c: Regenerate.
	* features/s390x-vx-linux64.c: Regenerate.
	* mips-tdep.c (_initialize_mips_tdep): Release unique_ptr returned
	from allocate_target_description.
	* target-descriptions.c (allocate_target_description): Update
	return type.
	(print_c_tdesc::visit_pre): Release unique_ptr returned from
	allocate_target_description.

gdbserver/ChangeLog:

	* linux-low.cc (linux_process_target::handle_extended_wait):
	Release the unique_ptr returned from allocate_target_description.
	* linux-riscv-low.cc (riscv_target::low_arch_setup): Likewise.
	* linux-x86-low.cc (tdesc_amd64_linux_no_xml): Change type.
	(tdesc_i386_linux_no_xml): Change type.
	(x86_linux_read_description): Borrow pointer from unique_ptr
	object.
	(x86_target::get_ipa_tdesc_idx): Likewise.
	(initialize_low_arch): Likewise.
	* tdesc.cc (allocate_target_description): Update return type.

gdbsupport/ChangeLog:

	* tdesc.h (allocate_target_description): Update return type.
2020-10-08 10:14:14 +01:00
Alan Modra
f9ff65d4df [GOLD] Increase --split-stack-adjust-size
For functions with small (< 256 bytes) stack frames, the current x86
do_calls_non_split ignores --split-stack-adjust-size and, in
combination with __morestack_non_split, supplies a non-split-stack
function with at least 0x100000 (1M) available stack.  On powerpc64, a
default of 0x4000 is not large enough to reliably work with the golang
testsuite.  This increase the default size to the defacto x86 value.

	* options.h (split_stack_adjust_size): Default to 0x100000.
2020-10-08 11:28:05 +10:30
GDB Administrator
467eed626a Automatic date update in version.in 2020-10-08 00:00:06 +00:00
H.J. Lu
3d08aa66b3 x86: Update GNU property tests
Update property tests for glibc compiled by Fedora binary annotation
plugin for GCC, which may insert additonal GNU properties:

	x86 ISA needed: SSE, SSE2

	* testsuite/ld-i386/property-3.r: Updated for Fedora binary
	annotation plugin for GCC.
	* testsuite/ld-i386/property-4.r: Likewise.
	* testsuite/ld-i386/property-5.r: Likewise.
	* testsuite/ld-x86-64/property-3.r: Likewise.
	* testsuite/ld-x86-64/property-4.r: Likewise.
	* testsuite/ld-x86-64/property-5.r: Likewise.
2020-10-07 15:54:18 -07:00
Tom Tromey
485c47e523 Add simple_search_memory unit tests
This adds some unit tests for simple_search_memory.  I tried here to
reproduce some bugs (PR gdb/11158 and PR gdb/17756), but was unable
to.

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

	* unittests/search-memory-selftests.c: New file.
	* Makefile.in (SELFTESTS_SRCS): Add
	unittests/search-memory-selftests.c.
2020-10-07 12:07:56 -06:00
Tom Tromey
3a135a9186 Document inclusive range in help for "find"
PR gdb/16930 points out that the "find" command uses an inclusive
range; but this is not documented in the "help".  This patch updates
the help text.

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

	PR gdb/16930:
	* findcmd.c (_initialize_mem_search): Mention that the range is
	inclusive.
2020-10-07 12:07:56 -06:00
Tom Tromey
60b746622b Remove some dead code from handle_search_memory
handle_search_memory had some code after a call to error.  This code
is dead, and this patch removes it.

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

	* server.cc (handle_search_memory): Remove dead code.
2020-10-07 12:07:56 -06:00
Tom Tromey
55b10d89a4 Use simple_search_memory in gdbserver
This replaces gdbserver's memory-searching function with
simple_search_memory.

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

	* server.cc (handle_search_memory_1): Remove.
	(handle_search_memory): Use simple_search_memory.
2020-10-07 12:07:56 -06:00
Tom Tromey
4a72de7366 Move simple_search_memory to gdbsupport/search.cc
This moves the simple_search_memory function to a new file,
gdbsupport/search.cc.  The API is slightly changed to make it more
general.  This generality is useful for wiring it to gdbserver, and
also for unit testing.

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

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

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

	* Makefile.in: Rebuild.
	* Makefile.am (libgdbsupport_a_SOURCES): Add search.cc.
	* search.h: New file.
	* search.cc: New file.
2020-10-07 12:07:55 -06:00
Tom Tromey
e86efb3310 Rename some tests in find.exp
This renames some tests in find.exp, to avoid duplicate test names.

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

	* gdb.base/find.exp: Rename some tests.
2020-10-07 12:07:55 -06:00
Simon Marchi
a038ffd88e gdb: put user-supplied CFLAGS at the end
GDB currently doesn't build cleanly with clang (a -Wdeprecated-copy-dtor
error).  I configured my clang-based GDB build with
CXXFLAGS="-Wno-error=deprecated-copy-dtor", so I can use it despite that
problem.  However, I found that it had no effect.  This is because my
-Wno-error=Wdeprecated-copy-dtor switch is followed by -Werror in the
command line, which switches back all warnings to be errors.

If we want the user-supplied C(XX)FLAGS to be able to override flags
added by our configure script, the user-supplied C(XX)FLAGS should
appear after the configure-supplied flags.

This patch moves the user-supplied CXXFLAGS at the very end of the
compilation command line, which fixes the problem described above.  This
means moving it out of INTERNAL_CFLAGS and inlining it in the users of
INTERNAL_CFLAGS.

I observed the problem when building GDB, but the same problem could
happen with GDBserver, so the change is done there too.

In GDBserver, INTERNAL_CFLAGS is passed when linking

gdb/ChangeLog:

	* Makefile.in (COMPILE): Add CXXFLAGS.
	(INTERNAL_CFLAGS_BASE): Remove CXXFLAGS.
	(check-headers): Add CXXFLAGS.

gdbserver/ChangeLog:

	* Makefile.in (COMPILE): Add CXXFLAGS.
	(INTERNAL_CFLAGS_BASE): Remove CXXFLAGS.
	(gdbserver$(EXEEXT)): Add CXXFLAGS.
	(gdbreplay$(EXEEXT)): Add CXXFLAGS.
	($(IPA_LIB)): Add CXXFLAGS.
	(IPAGENT_COMPILE): Add CXXFLAGS.

Change-Id: I00e054506695e0e9536095c6d14827e48abd8f69
2020-10-07 13:59:23 -04:00
Kamil Rytarowski
8b558efe7a Add Makefile.in entry for "Add NetBSD/aarch64 gdbserver support"
The support is on par with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

         * netbsd-aarch64-low.cc: Add.
         * Makefile.in (SFILES): Register "netbsd-aarch64-low.c".
         * configure.srv: Add aarch64*-*-netbsd*.
2020-10-07 19:38:46 +02:00
Shahab Vahedi
bbe90b5def gdb: Correct the ChageLog entry
Becausae of a copy/paste, I've put myself as the author of the
following patch which was not true:

6d2d7c5668 gdbserver: Add GNU/Linux support for ARC

This change will place the correct date and author in the ChangeLog.
2020-10-07 18:20:45 +02:00
Anton Kolesov
cc463201c4 arc: Add support for Linux coredump files
With the implemenations in this patch, ARC gdb can handle
coredump related matters.  The binutils counter part of
this patch has already been pushed [1].

v2 [2]:
- arc_linux_collect_gregset: Use "reg <= ARC_LAST_REGNUM" instead of
  "reg < ARC_LAST_REGNUM" for the condition check of the for-loop.
- arc-linux-tdep.c: Use "ARC_LAST_REGNUM < ARRAY_SIZE (...)" instead of
  "ARC_LAST_REGNUM <= ARRAY_SIZE (...)" for the "asserts".
- Use "buf + arc_linux_core_reg_offsets[ARC_ERET_REGNUM]" instead of
  "buf + REG_OFF (6)".
- Fix a few typos/indentation.

v3 [3]:
- Use gdb_assert_not_reached(text) instead of gdb_assert (!text).
- Remove unnecessary braces in the for loop.

[1] arc: Add support for ARC HS extra registers in core files
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=2745674244d6aecddcf636475034bdb9c0a6b4a0

[2] First remarks
https://sourceware.org/pipermail/gdb-patches/2020-September/171912.html

[3] Second remarks
https://sourceware.org/pipermail/gdb-patches/2020-October/172302.html

gdb/ChangeLog:

	* arc-linux-tdep.h: New file.
	* arc-linux-tdep.c (arc_linux_core_reg_offsets,
	arc_linux_supply_gregset, arc_linux_supply_v2_regset,
	arc_linux_collect_gregset, arc_linux_collect_v2_regset,
	arc_linux_gregset, arc_linux_v2_regset,
	arc_linux_iterate_over_regset_sections,
	arc_linux_core_read_description): Implement.
	(arc_linux_init_osabi): Set iterate_over_regset_sections.
	* arc-tdep.h (ARC_OFFSET_NO_REGISTER): Declare.
        (arc_gdbarch_features_create): Add.
	* arc-tdep.c (arc_gdbarch_features_create): Not static anymore.
2020-10-07 18:08:56 +02:00
Anton Kolesov
6d2d7c5668 gdbserver: Add GNU/Linux support for ARC
This gdbserver implementation supports ARC ABI v3 and v4 (older ARC ABI
versions are not supported by other modern GNU tools or Linux itself).
Gdbserver supports inspection of ARC HS registers R30, R58 and R59 - feature
that has been added to Linux 4.12.  Whether gdbserver build will actually
support this feature depends on the version of Linux headers used to build
the server.

v2 [1]:
- Use "this->read_memory ()" instead of "the_target->read_memory ()".
- Remove the unnecessary "arch-arc.o:" target from the "Makefile.in".
- Got rid of "ntohs()" function and added lots of comments about
  endianness.
- Clarify why "pc" value is read from and saved to different fields
  in user regs struct.
- In function "is_reg_name_available_p()", use a range-based iterator
  to loop over the registers.
- Removed mentioning of issue number that was not related to sourceware.
- A few typo's fixed.

[1] Remarks
https://sourceware.org/pipermail/gdb-patches/2020-September/171911.html
https://sourceware.org/pipermail/gdb-patches/2020-September/171919.html

gdbserver/ChangeLog:

	* configure.srv: Support ARC architecture.
	* Makefile.in: Add linux-arc-low.cc and arch/arc.o.
	* linux-arc-low.cc: New file.
2020-10-07 17:46:23 +02:00
Shahab Vahedi
e4bd363f99 arc: Rename "arc_gdbarch_features" struct
"arc_gdbarch_features" is a data structure containing information
about the ARC architecture: ISA version, register size, etc.
This name is misleading, because although it carries the phrase
"gdbarch", it has nothing to do with the type/interface in GDB.
Traditionaly, "gdbarch" structures are only used for that purpose.
To rectify this, this patch changes the name to "arc_arch_features".

gdb/ChangeLog:

	* arch/arc.h: Rename "arc_gdbarch_features" to
	"arc_arch_features".
	* arc-tdep.h: Likewise.
	* arc-tdep.c: Likewise.
2020-10-07 17:46:23 +02:00
Kamil Rytarowski
4849105512 Stop passing netbsd_process_target to local functions
Switch from target->read_memory to netbsd_nat::read_memory and
cleanup the code.

No functional change.

gdbserver/ChangeLog:

        * netbsd-low.cc (get_dynamic, get_r_debug, read_one_ptr)
        (netbsd_qxfer_libraries_svr4): Remove "target" argument and update.
        (netbsd_process_target::qxfer_libraries_svr4): Update.
2020-10-07 17:38:37 +02:00
Tankut Baris Aktemur
b68bef998c gdb/infcmd: remove redundant clear_proceed_status call
In `attach_command`, there is a call to `init_wait_for_inferior`
followed by a call to `clear_proceed_status`.  However,
`init_wait_for_inferior` already calls `clear_proceed_status`.  Remove
the redundant call.

Regression-tested on X86_64 Linux.

gdb/ChangeLog:
2020-10-07  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* infcmd.c (attach_command): Remove the redundant call to
	`clear_proceed_status`.
2020-10-07 16:55:52 +02:00
Kamil Rytarowski
4641551a7a Correct logical error in NetBSD's read_memory and write_memory
In case of repeated ptrace PT_IO call and returning the value of
transferred bytes equal to 0, do not return without setting
xfered_len.

gdb/ChangeLog:

        * nat/netbsd-nat.c (write_memory, read_memory): Update.
2020-10-07 15:15:54 +02:00
Kamil Rytarowski
2be01f639c Fix whitespace formatting
gdbserver/ChangeLog:

        * netbsd-low.cc: Fix whitespace formatting.
        * netbsd-amd64-low.cc: Likewise.
2020-10-07 15:08:31 +02:00
Kamil Rytarowski
91e5e8db33 Add common write_memory and read_memory NetBSD routines
Instead of sharing the native-only code with all BSDs with slightly
different semantics of the kernels, share the NetBSD-only behavior beteen
the NetBSD native and gdbserver setup.

NetBSD does not differentiate the address space I and D in the
operations (contrary to OpenBSD). NetBSD handles EACCES that integrates
with NetBSD specific PaX MPROTECT error handling.

Add a verbose message in the native client that an operation could be
cancelled due to PaX MPROTECT setup.

gdb/ChangeLog:

       * nat/netbsd-nat.c (write_memory, read_memory): Add.
       * nat/netbsd-nat.h (write_memory, read_memory): Likewise.
       * nbsd-nat.c (nbsd_nat_target::xfer_partial): Update.

gdbserver/ChangeLog:

       * netbsd-low.cc (netbsd_process_target::read_memory)
       (netbsd_process_target::write_memory): Update.
2020-10-07 14:52:25 +02:00
Kamil Rytarowski
9529c85266 Add ChangeLog for "Add NetBSD/aarch64 gdbserver support"
The support is on par with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

         * netbsd-aarch64-low.cc: Add.
         * Makefile.in (SFILES): Register "netbsd-aarch64-low.c".
         * configure.srv: Add aarch64*-*-netbsd*.
2020-10-07 14:47:27 +02:00
Kamil Rytarowski
8e1d092929 Add NetBSD/aarch64 gdbserver support
The support is on par with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

         * netbsd-aarch64-low.cc: Add.
         * Makefile.in (SFILES): Register "netbsd-aarch64-low.c".
         * configure.srv: Add aarch64*-*-netbsd*.
2020-10-07 14:39:59 +02:00
Simon Marchi
64c03bdb6e gdb: make signal_catch_counts a static array
I noticed that signal_catch_counts is a dynamically-allocated array of
constant size, allocated at startup an never freed.  This might as well
be a statically-allocated array.

gdb/ChangeLog:

	* break-catch-sig.c (signal_catch_counts): Make a static arrray.
	(_initialize_break_catch_sig): Don't allocate array.

Change-Id: I220321df5ad6c1d2664ec9d483eea2dc1c979afe
2020-10-07 08:13:44 -04:00
Michael Forney
4b136f6f9a gdb: Fix installation of gcore.1 on some platforms
gcore is installed on NetBSD, FreeBSD, Solaris (HAVE_NATIVE_GCORE_HOST=1)
and Linux (HAVE_NATIVE_GCORE_TARGET=1). However, even though gcore.1
is installed conditional on those variables, HAVE_NATIVE_GCORE_HOST
was missing from gdb/doc/Makefile.in, so manual installation was
skipped on NetBSD, FreeBSD, and Solaris.

gdb/doc/ChangeLog:
2020-10-06  Michael Forney  <mforney@mforney.org>

        * Makefile.in (HAVE_NATIVE_GCORE_HOST): Add for gcore.1
        install condition.

Change-Id: I17c3ce2ecdfb806ece17f05ba78356b25ffa865e
2020-10-06 22:31:13 -04:00
GDB Administrator
8ab0be1717 Automatic date update in version.in 2020-10-07 00:00:10 +00:00
H.J. Lu
574df58f52 x86: Properly merge -z ibt and -z shstk
Merge -z ibt and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND, not
any GNU_PROPERTY_X86_UINT32_AND_XXX properties.

bfd/

	PR ld/26711
	* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Merge -z ibt
	and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND.

ld/

	PR ld/26711
	* testsuite/ld-i386/i386.exp: Run ld/26711 tests.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr26711-1.d: Likewise.
	* testsuite/ld-i386/pr26711-2.d: Likewise.
	* testsuite/ld-i386/pr26711-3.d: Likewise.
	* testsuite/ld-x86-64/pr26711-1-x32.d: Likewise.
	* testsuite/ld-x86-64/pr26711-1.d: Likewise.
	* testsuite/ld-x86-64/pr26711-2-x32.d: Likewise.
	* testsuite/ld-x86-64/pr26711-2.d: Likewise.
	* testsuite/ld-x86-64/pr26711-3-x32.d: Likewise.
	* testsuite/ld-x86-64/pr26711-3.d: Likewise.
	* testsuite/ld-x86-64/pr26711.s: Likewise.
2020-10-06 15:38:34 -07:00
Shahab Vahedi
981b570a53 gdbserver: Remove unused argument in register_data()
The register_data() function in gdbserver/regcache.cc has an
input argument called "fetch".  This argument is not used by this
static function at all.  Therefore, it is time to get rid of it.

gdbserver/ChangeLog:

	* regcache.cc (register_data): Remove unused "fetch" argument.
2020-10-06 17:23:22 +02:00
Alex Coplan
05cfb0d8cc aarch64: Fix bogus type punning in parse_barrier() [PR26699]
This patch fixes a bogus use of type punning in parse_barrier() which
was causing an assembly failure on big endian LP64 hosts when attempting
to assemble "isb sy" for AArch64.

The type of the entries in aarch64_barrier_opt_hsh is
aarch64_name_value_pair. We were incorrectly casting this to the
locally-defined asm_barrier_opt which has a wider type (on LP64) for the
second member. This happened to work on little-endian hosts but fails on
LP64 big endian.

The fix is to use the correct type in parse_barrier(). This makes the
locally-defined asm_barrier_opt redundant, so remove it.

gas/ChangeLog:

	* config/tc-aarch64.c (asm_barrier_opt): Delete.
	(parse_barrier): Fix bogus type punning.
	* testsuite/gas/aarch64/system.d: Update disassembly.
	* testsuite/gas/aarch64/system.s: Add isb sy test.
2020-10-06 15:56:44 +01:00
Nick Clifton
0ec992e664 Fix a bug in objcopy/strip's ability to merge notes in multiple same-named sections.
* objcopy.c (copy_object): Compare input and output sections by
	pointer rather than name.
2020-10-06 15:49:40 +01:00
Gary Benson
3089759191 Fix gdb.base/list.exp with Clang
Two subtests of gdb.base/list.exp failed when built with Clang
because the unused function "unused" was optimized out.  This
commit adds __attribute__ ((used)) to both definitions.

gdb/testsuite/ChangeLog:

	* gdb.base/list0.c (unused): Add __attribute__ ((used)).
	* gdb.base/list1.c (unused): Likewise.
2020-10-06 15:08:37 +01:00
Gary Benson
ced4a4c1cc Fix gdb.base/list-ambiguous.exp with Clang
The ambiguous variable parts of gdb.base/list-ambiguous.exp failed
when built with Clang because the variable in question was unused
and was optimized out.  This commit adds __attribute__ ((used)) to
both definitions.

gdb/testsuite/ChangeLog:

	* gdb.base/list-ambiguous0.c (ambiguous_var): Add
	__attribute__ ((used)).
	* gdb.base/list-ambiguous1.c (ambiguous_var): Likewise.
2020-10-06 15:08:37 +01:00
Sergey Belyashav
0ae9445d52 A small set of code improvements for the Z80 assembler.
PR 26692
	* config/tc-z80.c (md_begin): Ensure that xpressions are empty
	before using them.
	(unify_indexed): Likewise.
	(z80_start_line_hook): Improve hash sign handling when SDCC
	compatibility mode enabled.
	(md_parse_exp_not_indexed): Improve indirect addressing
	detection.
	(md_pseudo_table): Accept hd64 as an alias of z810.
2020-10-06 11:58:57 +01:00
Andrew Burgess
043f5c63f0 sim: Fix autoreconf errors in sim/ directory
Run autoreconf in sim/ directory and you'll see some errors.  The
problem is that autoreconf (a perl script) does not evaluate the value
passed as an argument to AC_CONFIG_AUX_DIR, so something like:

  AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)

does not do the right thing inside autoreconf, my understanding is
that changing to something like this is fine:

  AC_CONFIG_AUX_DIR(../..)

the generated configure seems to check the value passed, and the value
passed relative to the source directory, so I think we get basically
the same behaviour as before.

sim/testsuite/ChangeLog:

	* configure: Regnerate.
	* configure.ac (AC_CONFIG_AUX_DIR): Update.

sim/testsuite/d10v-elf/ChangeLog:

	* configure: Regnerate.
	* configure.ac (AC_CONFIG_AUX_DIR): Update.

sim/testsuite/frv-elf/ChangeLog:

	* configure: Regnerate.
	* configure.ac (AC_CONFIG_AUX_DIR): Update.

sim/testsuite/m32r-elf/ChangeLog:

	* configure: Regnerate.
	* configure.ac (AC_CONFIG_AUX_DIR): Update.

sim/testsuite/mips64el-elf/ChangeLog:

	* configure: Regnerate.
	* configure.ac (AC_CONFIG_AUX_DIR): Update.
2020-10-06 11:29:44 +01:00
Andrew Burgess
31a8f60f2f gdb: handle unmapped overlays in find_pc_line
I configured and built an m32r-elf toolchain, and ran the
gdb.base/overlays.exp test.  I saw a couple of errors where GDB would
place a breakpoint in the wrong place when placing a breakpoint using
a function name, for example in this function:

/* 1 */  int foo (int x)
/* 2 */  {
/* 3 */    if (x)
/* 4 */      return some_global_variable;
/* 5 */    else
/* 6 */      return 0;
/* 7 */  }

GDB would place the breakpoint on line 2 instead of line 3.  The issue
is that GDB was failing to skip the prologue correctly.

The reason for this is that in m32r-tdep.c:m32r_skip_prologue, we
first use find_pc_partial_function to find the functions start and end
addresses, then we use find_pc_line to find the start and end of the
first line of the function.

Currently, if the pc value passed to find_pc_partial_function is in an
unmapped overlay then the function start and end addresses that are
returned are also the unmapped addresses.

However, this is not the case for find_pc_line, here, if the address
passed in is in an unmapped overlay then we still get back a
symtab_and_line describing the mapped location.

What this means is that if a function's mapped location is 0x100 ->
0x120, and its unmapped locations is 0x400 -> 0x420 then we think that
the start/end is 0x400 and 0x420 respectively, but the first line
might run from 0x100 to 0x108.

GDB will then try to scan the prologue starting from 0x400 and ending
at 0x108, this immediately gives up as it thinks we have gone past the
end of the prologue and the breakpoint is placed at 0x400.

In this commit I propose that we change find_pc_line to return
addresses in the unmapped range if the address passed in is already in
the unmapped range.  Now the first line will appear to run from 0x400
to 0x408 and the prologue scanner will correctly find the end of the
prologue.

With this commit gdb.base/overlays.exp now completely passes with an
m32r-elf toolchain.

gdb/ChangeLog:

	* symtab.c (find_pc_line): Return unmapped addresses when the
	requested address is also unmapped.
2020-10-06 11:18:37 +01:00
Andrew Burgess
ed3bdac42c gdb/testsuite: allow gdb.base/overlays.exp to compile for m32r
The gdb.base/overlays.exp test is only currently supported on m32r
baremetal targets, however, when I configure a toolchain for m32r-elf
the test does not compile.

This commit updates the linker script, fixes some TCL errors in the
exp file, and adds some missing includes to the source file so that
the test does compile.

With this test, when run against an m32r-elf toolchain the test mostly
passes, but there are a couple of failures, these are GDB issues and
will be addressed in a later commit.

gdb/testsuite/ChangeLog:

	* gdb.base/m32r.ld: Remove SEARCH_DIR line.  Add MEMORY regions,
	make use of regions throughout.
	* gdb.base/overlays.exp: Enclose string with variableds in "..",
	not {...}.
	* gdb.base/ovlymgr.c: Add 'string.h' and 'stdlib.h' includes.
2020-10-06 11:18:37 +01:00
Alan Modra
3ce6300ea8 Fix gas sh-link-zero test for hppa64-hpux
* testsuite/gas/elf/sh-link-zero.s: Don't start directives in
	first column.  Don't use numeric labels.
2020-10-06 20:22:43 +10:30
Brandon Bergren
6afcdeb358 PR26667, Add powerpc64le-*-freebsd* support
PR 26667
bfd/
	* config.bfd: Add powerpc64le-*-freebsd*.
	* configure.ac: Add powerpc_elf64_fbsd_le_vec.
	* elf64-ppc.c (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Define for
	freebsd.
	* targets.c (powerpc_elf64_fbsd_le_vec): Declare.
	(_bfd_target_vector): Add it.
	* configure: Regenerate.
ld/
	* Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf64lppc_fbsd.c.
	Include $(DEPDIR)/eelf64lppc_fbsd.Pc.
	* configure.tgt: Add powerpc64le-*-freebsd*.
	* emulparams/elf64lppc_fbsd.sh: New file.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2020-10-06 17:09:27 +10:30
GDB Administrator
0897537869 Automatic date update in version.in 2020-10-06 00:00:09 +00:00
Simon Marchi
9e6dbd8b54 gdb: sync tui header files in HFILES_NO_SRCDIR
I noticed that tui/tui-windata.h didn't exist anymore, and that
tui/tui-out.h wasn't listed.  Fix that.

gdb/ChangeLog:

	* Makefile.in (HFILES_NO_SRCDIR): Remove tui/tui-windata.h, add
	tui/tui-out.h.

Change-Id: Ic75cc68432b90ba5be857a2852ad52dea326fe36
2020-10-05 12:37:23 -04:00
Simon Marchi
a1d217e844 gdb: TYPE_VECTOR -> type::is_vector in amd64-windows-tdep.c
I get this build failure:

      CXX    amd64-windows-tdep.o
    cc1plus: warning: command-line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
    /home/smarchi/src/binutils-gdb/gdb/amd64-windows-tdep.c: In function 'return_value_convention amd64_windows_return_value(gdbarch*, value*, type*, regcache*, gdb_byte*, const gdb_byte*)':
    /home/smarchi/src/binutils-gdb/gdb/amd64-windows-tdep.c:374:6: error: 'TYPE_VECTOR' was not declared in this scope
      374 |  if (TYPE_VECTOR (type) && len == 16)
          |      ^~~~~~~~~~~

TYPE_VECTOR was removed in favor of the type::is_vector method.

gdb/ChangeLog:

	* amd64-windows-tdep.c (amd64_windows_return_value): Use
	type::is_vector instead of TYPE_VECTOR.

Change-Id: I0ce26c3f7a33625761a8dba351c3158464f21b01
2020-10-05 12:22:39 -04:00
Nick Clifton
1f1845d435 Fix compile time error building windmc, detected by gcc 11.
PR 26698
	* windmc.c (mc_unify_path): Fix typo checking character at end of
	pathname.
2020-10-05 16:09:00 +01:00
Przemyslaw Wirkus
f9b1d75e91 [PATCH][GAS][AArch64] Update Cortex-X1 feature flags
This is feature flags update for Cortex-X1 CPU.
For more information about this processor, see [0].

[0] : https://www.arm.com/products/cortex-x

gas/ChangeLog:

2020-10-05  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* config/tc-aarch64.c: Update Cortex-X1 feature flags.
2020-10-05 15:43:41 +01:00
Przemyslaw Wirkus
a417e439c2 [PATCH][GAS][arm] Update Cortex-X1 feature flags
This is feature flags update for Cortex-X1 CPU.
For more information about this processor, see [0].

[0] : https://www.arm.com/products/cortex-x

gas/ChangeLog:

2020-10-05  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* config/tc-arm.c: Update Cortex-X1 feature flags.
2020-10-05 15:43:32 +01:00