binutils-gdb.git
4 years ago[PATCH] aarch64: Update missing ChangeLog for AArch64 commits
Przemyslaw Wirkus [Tue, 3 Nov 2020 11:55:14 +0000 (11:55 +0000)]
[PATCH] aarch64: Update missing ChangeLog for AArch64 commits

Patch with missing ChangeLog entries for GAS AArch64 files.

4 years agoFix compile time warning
Nick Clifton [Tue, 3 Nov 2020 08:56:27 +0000 (08:56 +0000)]
Fix compile time warning

4 years agogas: fix symbol value calculation for versioned symbol aliases
Christian Eggers [Sun, 1 Nov 2020 08:10:14 +0000 (09:10 +0100)]
gas: fix symbol value calculation for versioned symbol aliases

Symbol value is in bytes while fragS::fr_address is in octets. Fixes GAS
symver12 and symver13 tests on ELF targets with with OCTETS_PER_BYTE>1.

* config/obj-elf (elf_frob_symbol): Fix symbol value calculation
for versioned symbol aliases.

Signed-off-by: Christian Eggers <ceggers@gmx.de>
4 years agoasan: leak in bfd_section_from_shdr
Alan Modra [Mon, 2 Nov 2020 23:53:03 +0000 (10:23 +1030)]
asan: leak in bfd_section_from_shdr

* elf.c (bfd_section_from_shdr): Free sections_being_created.
Use bfd_zmalloc.

4 years agogold: ensure file_counts_lock is initialized before using
Nick Gasson [Mon, 2 Nov 2020 04:02:05 +0000 (12:02 +0800)]
gold: ensure file_counts_lock is initialized before using

Since upgrading to binutils 2.35 I've been experiencing random memory
corruption related crashes with ld.gold --threads. It's caused by
multiple threads concurrently pushing elements onto the shared
std::vector in File_read::record_file_read(). This vector is supposed to
be protected by file_counts_lock, but that is initialized lazily and
might be NULL when File_read::open() is called, in which case
Hold_optional_lock silently skips locking it.

Fix by calling the initialize() method before attempting to acquire the
lock, the same as other places that use file_counts_lock.

PR 26827
* fileread.cc (File_read::open): Ensure file_counts_lock is
initialized.
* testsuite/Makefile.am (check_PROGRAMS): Add a test that passes
-Wl,--threads.
* testsuite/Makefile.in: Regenerate.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Nov 2020 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb/testsuite: fix failure in gdb.base/step-over-no-symbols.exp
Simon Marchi [Mon, 2 Nov 2020 21:35:47 +0000 (16:35 -0500)]
gdb/testsuite: fix failure in gdb.base/step-over-no-symbols.exp

This test fails on my machine:

    p /x $pc^M
    $2 = 0x55555555514e^M
    (gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
    FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced

This is due to the check added in 5f0e2eb79e6b ("GDB/testsuite: Fix a
catastrophic step-over-no-symbols.exp failure"), that makes sure the PC
values are integer.  As documented in the TCL doc [1], "string is
integer" returns 1 if the string is a valid 32-bit integer format.  The
PC values are greater than 32 bits, so are not recognized as integers by
that test.

    % string is integer -strict 0x55555555
    1
    % string is integer -strict 0x555555555
    0

Replace the "string is integer" test with a regexp one, that verifies
the PC is a hex value.

[1] https://www.tcl.tk/man/tcl/TclCmd/string.htm#M21

gdb/testsuite/ChangeLog:

* gdb.base/step-over-no-symbols.exp (test_step_over): Replace
integer format test with regexp.

Change-Id: I71f8197e7b52e97b4901980544a8d1072aabd362

4 years agoAdd x86_64 ravenscar support
Tom Tromey [Thu, 29 Oct 2020 14:47:16 +0000 (08:47 -0600)]
Add x86_64 ravenscar support

Support for x86_64 ravenscar was recently added to the Ada runtime.
This patch updates gdb to follow.

As this is Ada-specific, and was reviewed internally by Joel, I am
checking it in.

2020-11-02  Tom Tromey  <tromey@adacore.com>

* Makefile.in (ALL_64_TARGET_OBS): Add amd64-ravenscar-thread.o.
(ALLDEPFILES): Add amd64-ravenscar-thread.c.
(HFILES_NO_SRCDIR): Add amd64-ravenscar-thread.h.
* amd64-ravenscar-thread.c: New file.
* amd64-ravenscar-thread.h: New file.
* amd64-tdep.c (amd64_init_abi): Register ravenscar ops.
* configure.tgt (amd64_tobjs): Add ravenscar objects.

4 years agogdb: new function to wrap up executing command line scripts/commands
Andrew Burgess [Wed, 9 Sep 2020 10:26:22 +0000 (11:26 +0100)]
gdb: new function to wrap up executing command line scripts/commands

Small refactor to wrap up executing the scripts and commands passed
using the -x, -ex, -ix, -iex command line flags.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* main.c (execute_cmdargs): New function.
(captured_main_1): Make use of execute_cmdargs.

4 years agogdb: use get_standard_config_dir when looking for .gdbinit
Andrew Burgess [Fri, 25 Sep 2020 13:50:56 +0000 (14:50 +0100)]
gdb: use get_standard_config_dir when looking for .gdbinit

This commit effectively changes the default location of the .gdbinit
file, while maintaining backward compatibility.

For non Apple hosts the .gdbinit file will now be looked for in the
following locations:

  $XDG_CONFIG_HOME/gdb/gdbinit
  $HOME/.config/gdb/gdbinit
  $HOME/.gdbinit

On Apple hosts the search order is instead:

  $HOME/Library/Preferences/gdb/gdbinit
  $HOME/.gdbinit

I've performed an extensive rewrite of the documentation, moving all
information about initialization files and where to find them into a
new @node, text from other areas has been moved into this one
location, and other areas cross-reference to this new @node as much as
possible.

gdb/ChangeLog:

* NEWS: Mention changes to config file search path.
* main.c

gdb/doc/ChangeLog:

* gdb.texinfo (Mode Options): Descriptions of initialization files
has been moved to 'Initialization Files'.
(Startup): Likewise.
(Initialization Files): New node.
(gdb man): Update to mention alternative file paths.
(gdbinit man): Likewise.

4 years agoAdd get_standard_config_dir function
Tom Tromey [Sun, 5 Jul 2020 19:02:40 +0000 (13:02 -0600)]
Add get_standard_config_dir function

This adds a new get_standard_config_dir, which returns the name of the
configuration directory.  In XDG, this is ~/.config/gdb/.  Future
patches will make use of this.

2020-07-05  Tom Tromey  <tom@tromey.com>

* pathstuff.h (get_standard_config_dir): Declare.
* pathstuff.cc (get_standard_config_dir): New function.

4 years agoMinor Python simplifications
Tom Tromey [Mon, 2 Nov 2020 17:17:07 +0000 (10:17 -0700)]
Minor Python simplifications

I noticed that a few "#if"s could be removed from the Python code.
This patch is the result.

gdb/ChangeLog
2020-11-02  Tom Tromey  <tromey@adacore.com>

* python/python.c: Consolidate two HAVE_PYTHON blocks.
(python_GdbModuleDef): Move earlier.  Now static.
(do_start_initialization): Consolidate some IS_PY3K blocks.

4 years agogdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Simon Marchi [Mon, 2 Nov 2020 15:26:14 +0000 (10:26 -0500)]
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues

Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c).  I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it?  What if the lines around it are also
wrong, do I fix them too?  I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.

So I propose to fix as much as possible once and for all (hopefully).

One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines.  My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for.  So you
already need a somewhat efficient way to do this.

Using some interactive tool, rather than plain git-blame, makes this
trivial.  For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too.  My point is that it won't
really make archeology more difficult.

The other typical counter argument is that it will cause conflicts with
existing patches.  That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve.  I have also tried "git
rebase --ignore-whitespace", it seems to work well.  Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).

gdb/ChangeLog:

* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.

gdbserver/ChangeLog:

* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.

gdbsupport/ChangeLog:

* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.

Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695

4 years agoFix gdb.base/print-file-var.exp with Clang
Gary Benson [Mon, 2 Nov 2020 14:19:29 +0000 (14:19 +0000)]
Fix gdb.base/print-file-var.exp with Clang

The C++ parts of gdb.base/print-file-var.exp failed to build with
Clang because the "-x c++" option added by gdb_compile caused the
compiler to attempt to parse .so files as C++.  This commit splits
the compiler and linker options into separate lists, and switches
to building via build_executable_from_specs which can accommodate
this separation.

gdb/testsuite/ChangeLog:

* gdb.base/print-file-var.exp (test): Separate compiler and
linker options, and build using build_executable_from_specs
to accommodate this.

4 years agoDetect and report incompatible gdb_compile options
Gary Benson [Mon, 2 Nov 2020 14:19:29 +0000 (14:19 +0000)]
Detect and report incompatible gdb_compile options

In commits 221db974e653659edb280787af1b3efdd1615083 and
68d654afdfcff840ebb3ae432ed72dca0521d670, these patches:

    2020-06-24  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_compile): Pass "-x c++" explicitly when
compiling C++ programs.

    2020-09-25  Gary Benson <gbenson@redhat.com>

* lib/gdb.exp (gdb_compile): Pass "-x c++" earlier, and only
for .c files.

attempted to fix problems with testcases that compile .c files
using the C++ compiler.  These patches cause gdb_compile to add
"-x c++" to the compiler options when using Clang.  This fix does
not work for gdb.base/print-file-var.exp, however, which attempts
to compile a .c input file to an executable linked with shared
libraries: the resulting command caused the compiler to attempt
to parse the .so files as C++.  This commit causes gdb_compile
to reject this combination of options.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_compile): Inhibit passing "-x c++"
for .c files compiled as C++ with Clang if any shared
libraries are specified.

4 years agoFix testcases using __attribute__((noclone)) with Clang
Gary Benson [Mon, 2 Nov 2020 11:52:41 +0000 (11:52 +0000)]
Fix testcases using __attribute__((noclone)) with Clang

Clang fails to compile a number of files with the following warning:
unknown attribute 'noclone' ignored [-Wunknown-attributes].  This
commit adds a new header, lib/noclone.h, which defines the macro
ATTRIBUTE_NOCLONE accordingly, and updates the relevant testcases
to use it.

gdb/testsuite/ChangeLog:

* lib/attributes.h: New header.
* gdb.base/backtrace.c: Include the above. Replace
__attribute__(noclone)) with ATTRIBUTE_NOCLONE.
* gdb.base/infcall-nested-structs.c: Likewise.
* gdb.base/vla-optimized-out.c: Likewise.

4 years ago[gdb/testsuite] Remove .debug_line.dwo from gdb.dwarf2/fission-multi-cu.S
Tom de Vries [Mon, 2 Nov 2020 10:25:38 +0000 (11:25 +0100)]
[gdb/testsuite] Remove .debug_line.dwo from gdb.dwarf2/fission-multi-cu.S

Consider test-case gdb.dwarf2/fission-multi-cu.exp.  It produces an executable
fission-multi-cu and a dwo file fission-multi-cu.dwo.

The file fission-multi-cu.dwo contains a .debug_line.dwo section, which
according to the DWARF v5 standard is a "specialized line number table" for
type units in the .debug_info.dwo section, and contains only the directory and
filename lists.

When reading the actual .debug_line.dwo section using readelf -w, we get:
...
 The Directory Table is empty.

 The File Name Table is empty.

 No Line Number Statements.
...
So, the section does not contain any actual information.  Furthermore, no
information is required because the .debug_line.dwo section does not contain
any type units.

This is confirmed by:
- re-doing the commands listed at the start of fission-multi-cu.S, which were
  used as starting point for fission-multi-cu.S, and
- compiling the fission-multi-cu{1,2}.c files with clang -flto -g -gsplit-dwarf
In both cases, no .debug_line.dwo section is generated.

Remove the .debug_line.dwo section, to make it fit how split dwarf is actually
generated by clang.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-11-02  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/fission-multi-cu.S: Remove .debug_line.dwo section.

4 years agogdb/riscv: read frame base register as unsigned in the unwinder
Andrew Burgess [Tue, 27 Oct 2020 15:31:53 +0000 (15:31 +0000)]
gdb/riscv: read frame base register as unsigned in the unwinder

I noticed an issue with the RISC-V prologue scanning stack unwinder.
We currently read the frame base register (either $sp or $fp) as a
signed value.  This means that the frame_id's stack_addr field will be
a signed value.

In other contexts though these registers are data pointers, and so are
unsigned.

There's not many places where this mismatch actually shows though, but
I did find one place.  Consider this GDB session:

  (gdb) maintenance set dwarf unwinders off
  (gdb) set backtrace past-main on
  ...
  (gdb) b main
  Breakpoint 1 at 0x20400344: file main.c, line 86.
  (gdb) run
  ...
  (gdb) bt
  #0  main () at main.c:86
  #1  0x2040005c in _start () at start.S:59
  Backtrace stopped: frame did not save the PC
  (gdb) info frame 1
  Stack frame at 0x80000a1c:
   pc = 0x2040005c in _start (start.S:59); saved pc = <not saved>
   Outermost frame: frame did not save the PC
   caller of frame at 0x80000a1c
   source language asm.
   Arglist at 0x80000a1c, args:
   Locals at 0x80000a1c, Previous frame's sp is 0x80000a1c
  (gdb) frame address 0x80000a1c
  No frame at address 0x80000a1c.
  (gdb) frame address 0xffffffff80000a1c
  #1  0x2040005c in _start () at start.S:59
  59              call main

Notice that the 'info frame 1' reports that the frame is at
'0x80000a1c', this is the unsigned frame base value, but when I try
to select a frame using this address I can't.

The reason is that the frame_id for frame #1 actually has the
unsigned (and hence sign-extended) stack_addr value.  When I use the
sign extended address I can correctly select the frame.

I propose changing the prologue scanning unwinder to read the frame
base as unsigned.  After this in the above case I can now do this:

  (gdb) frame address 0x80000a1c
  #1  0x2040005c in _start () at start.S:59
  59              call main
  (gdb) frame address 0xffffffff80000a1c
  No frame at address 0xffffffff80000a1c.

Which I think makes more sense.

This issue causes failures in gdb.base/frame-selection.exp if you
compile for RV32 with a linker script that places the stack in the
correct location, which are resolved by this patch.

gdb/ChangeLog:

* riscv-tdep.c (riscv_frame_cache): Read the frame base register
as an unsigned value.

4 years agosim/bpf: re-generate configure
Simon Marchi [Mon, 2 Nov 2020 00:39:11 +0000 (19:39 -0500)]
sim/bpf: re-generate configure

I noticed a little diff when re-generating the configure file in this
directory.

sim/ChangeLog:

* bpf/configure: Re-generate.

Change-Id: Ieb26be2cc1be8108d4b08387255f45b57f288171

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Nov 2020 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoPR26806, Suspected linker bug with LTO
Alan Modra [Fri, 30 Oct 2020 04:26:35 +0000 (14:56 +1030)]
PR26806, Suspected linker bug with LTO

This patch reverts most of git commit 1e3b96fd6cf, so IR symbols are
again not marked def_regular or ref_regular.  That should be enough to
stop IR symbols from becoming dynamic.  To mark as-needed shared
libraries referenced by IR symbols, use the referencing BFD rather
than the ref flags.

bfd/
PR 15146
PR 26314
PR 26530
PR 26806
* elflink.c (elf_link_add_object_symbols): Don't set def/ref flags
for plugin syms.  Do allow plugin syms to mark as-needed libs.
ld/
PR 26806
* testsuite/ld-plugin/lto-19.h,
* testsuite/ld-plugin/lto-19a.c,
* testsuite/ld-plugin/lto-19b.c,
* testsuite/ld-plugin/lto-19c.c: New test.
* testsuite/ld-plugin/pr26806.c,
* testsuite/ld-plugin/pr26806.d: New test.
* testsuite/ld-plugin/lto.exp: Run them.

4 years agoChange end_psymtab_common to a method
Tom Tromey [Sun, 1 Nov 2020 16:51:13 +0000 (09:51 -0700)]
Change end_psymtab_common to a method

This changes end_psymtab_common to be a method on partial_symtab.
This seems a little cleaner to me.

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

* dbxread.c (dbx_end_psymtab): Update.
* dwarf2/read.c (process_psymtab_comp_unit_reader)
(build_type_psymtabs_reader): Update.
* xcoffread.c (xcoff_end_psymtab): Update.
* ctfread.c (scan_partial_symbols): Update.
* psymtab.c (sort_pst_symbols): Remove.
(partial_symtab::end): Rename from end_psymtab_common.  Inline
sort_pst_symbols.
* psympriv.h (struct partial_symtab) <end>: New method.
(end_psymtab_common): Don't declare.

4 years agoRemove partial symbol statistics
Tom Tromey [Sun, 1 Nov 2020 16:51:13 +0000 (09:51 -0700)]
Remove partial symbol statistics

The "n_psyms" statistic in the per-objfile stats is not really needed,
but its use requires passing the objfile to add_psymbol.  This patch
removes the field in favor of counting the psyms when needed.

Note that this is not exactly equivalent -- in the old approach, a
psymbol can in theory be created and then the psymtab discarded, which
would increment the counter.  This does not seem very important to me.

I rewrote the code to count partial symbols; though TBH I think that
this information is not really very useful.

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

* symmisc.c (count_psyms): New function.
(print_objfile_statistics): Use it.
* psymtab.c (append_psymbol_to_list): Remove.
(partial_symtab::add_psymbol): Inline append_psymbol_to_list.
* objfiles.h (struct objstats) <n_psyms>: Remove.

4 years agoRemove parameter from end_psymtab_common
Tom Tromey [Sun, 1 Nov 2020 16:51:13 +0000 (09:51 -0700)]
Remove parameter from end_psymtab_common

The objfile parameter to end_psymtab_common is no longer needed, so
this removes it.

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

* dbxread.c (dbx_end_psymtab): Update.
* dwarf2/read.c (process_psymtab_comp_unit_reader): Update.
(build_type_psymtabs_reader): Update.
* xcoffread.c (xcoff_end_psymtab): Update.
* ctfread.c (scan_partial_symbols): Update.
* psympriv.h (end_psymtab_common): Update.
* psymtab.c (end_psymtab_common): Remove objfile parameter.
(sort_pst_symbols): Likewise.

4 years agoRemove init_psymbol_list
Tom Tromey [Sun, 1 Nov 2020 16:51:13 +0000 (09:51 -0700)]
Remove init_psymbol_list

init_psymbol_list is now empty, and so this removes it.

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

* dbxread.c (dbx_symfile_read): Update.
* dwarf2/read.c (dwarf2_build_psymtabs): Update.
* xcoffread.c (xcoff_initial_scan): Update.
* psympriv.h (init_psymbol_list): Don't declare.
* psymtab.c (init_psymbol_list): Remove.

4 years agoavoid unwarranted assumption in gdb.ada/fixed_points/fixed_points.adb
Joel Brobecker [Sun, 1 Nov 2020 11:37:41 +0000 (15:37 +0400)]
avoid unwarranted assumption in gdb.ada/fixed_points/fixed_points.adb

The test program being used declares a fixed-point type
(Base_Fixed_Point_Type) Base_Fixed_Point_Type whose (scaled) range
is System.Min_Int .. System.Max_Int. is an unwarranted assumption because
the range is implementation-defined. It means the compiler is therefore
free to reject that declaration.

We noticed this while one of my coworkers was working on enhancing
GNAT to support 128bit integers. The bulk of the work has been done,
but one side-effect is that there is a small gap in this particular
area where the compiler is now rejecting this code. We will eventually
plug that gap, but in meantime, since the testcase itself doesn't really
need such a large range, this commit simply adjusts the test program
to use hard-coded bounds for the range whose value are more reasonable.

gdb/testsuite/ChangeLog:

        * gdb.ada/fixed_points/fixed_points.adb: Replace use of
        System.Min_Int and System.Max_Int with smaller hardcoded
        constants.

4 years agoada-lang.c: Rename gnat_encoded_fixed_type_info
Joel Brobecker [Sun, 1 Nov 2020 07:41:06 +0000 (02:41 -0500)]
ada-lang.c: Rename gnat_encoded_fixed_type_info

This commit renames gnat_encoded_fixed_type_info into
gnat_encoded_fixed_point_type_info, so as to be more consistent
with the naming used for the other associated routines (i.e.
use "fixed_point" rather than just "fixed").

gdb/ChangeLog:

        * ada-lang.c (gnat_encoded_fixed_point_type_info): Renames
        gnat_encoded_fixed_type_info.  Update all callers.

4 years agoada-lang.c: fix line too long in cast_from_gnat_encoded_fixed_point_type
Joel Brobecker [Sun, 1 Nov 2020 07:38:45 +0000 (02:38 -0500)]
ada-lang.c: fix line too long in cast_from_gnat_encoded_fixed_point_type

One of the lines got too long after a renaming done in a previous
commit. This fixes that.

gdb/ChangeLog:

        * ada-lang.c (cast_from_gnat_encoded_fixed_point_type): Split
        line too long.

4 years agoada-lang.c: Renaming some fixed-point-related routines
Joel Brobecker [Sun, 1 Nov 2020 07:29:27 +0000 (02:29 -0500)]
ada-lang.c: Renaming some fixed-point-related routines

This patch renames some of the fixed-point-related subprograms in ada-lang.c
so as to make it obvious that those routines only handle the case where
the types are encoded using the GNAT encoding.

No function change; this patch is preparation work for adding support
for fixed-point types purely based on standard DWARF debug info.

gdb/ChangeLog:

        * ada-lang.c (cast_from_gnat_encoded_fixed_point_type): Renames
        cast_from_fixed.  Update all callers.
        (cast_to_gnat_encoded_fixed_point_type): Renames cast_to_fixed.
        Update all callers.
        (gnat_encoded_fixed_point_scaling_factor): Renames ada_scaling_factor.
        Update all callers.
        * ada-lang.h (gnat_encoded_fixed_point_scaling_factor): Renames
        ada_scaling_factor.
        * ada-typeprint.c: Replace call to ada_scaling_factor by call
        to print_gnat_encoded_fixed_point_type.
        * ada-valprint.c: Likewise.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 Nov 2020 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: restore some checks of debug flags
Andrew Burgess [Sat, 31 Oct 2020 21:50:44 +0000 (21:50 +0000)]
gdb: restore some checks of debug flags

This partially reverts some parts of the commit:

  commit 17417fb0ec9842de1774e1e76f1f11c00cdafc47
  Date:   Sat Oct 31 09:01:25 2020 -0400

      gdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functions

This commit removed 3 places where some debug flags were being
checked.  The result was that debug tracing was being printed
unconditionally.

This commit adds back the 3 flag checks.

gdb/ChangeLog:

* infrun.h (infrun_debug_printf): Add check of debug_infrun flag.
(debug_prefixed_printf): Add check of debug_displaced flag.
* linux-nat.c (linux_nat_debug_printf): Add check of
debug_linux_nat flag.

4 years agogdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functions
Simon Marchi [Sat, 31 Oct 2020 13:01:25 +0000 (09:01 -0400)]
gdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functions

The *_debug_print_1 functions are all very similar, the only difference
being the subsystem name.  Remove them all and make the logging macros
use a new debug_prefixed_printf function directly.

gdb/ChangeLog:

* infrun.c (infrun_debug_printf_1): Remove.
(displaced_debug_printf_1): Remove.
(stop_all_threads): Use debug_prefixed_printf.
* infrun.h (infrun_debug_printf_1): Remove.
(infrun_debug_printf): Use debug_prefixed_printf.
(displaced_debug_printf_1): Remove.
(displaced_debug_printf): Use debug_prefixed_printf.
* linux-nat.c (linux_nat_debug_printf_1): Remove.
(linux_nat_debug_printf): Use debug_prefixed_printf.

gdbsupport/ChangeLog:

* common-debug.cc (debug_prefixed_printf): New.
* common-debug.h (debug_prefixed_printf): New declaration.
* event-loop.cc (event_loop_debug_printf_1): Remove.
* event-loop.h (event_loop_debug_printf_1): Remove.
(event_loop_debug_printf): Use debug_prefixed_printf.
(event_loop_ui_debug_printf): Use debug_prefixed_printf.

Change-Id: Ib323087c7257f0060121d302055c41eb64aa60c6

4 years agogdbserver: replace AC_TRY_COMPILE in acinclude.m4
Simon Marchi [Sat, 31 Oct 2020 12:31:00 +0000 (08:31 -0400)]
gdbserver: replace AC_TRY_COMPILE in acinclude.m4

... with AC_COMPILE_IFELSE and AC_LANG_PROGRAM.

All changes in the generated configure file are insignificant
whitespace changes.

gdbserver/ChangeLog:

* acinclude.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE +
AC_LANG_PROGRAM.
* configure: Re-generate.

Change-Id: Idab8b5e1a984046b5283940c02e5a22da2291d58

4 years agogdb: replace AC_TRY_LINK in sanitize.m4
Simon Marchi [Sat, 31 Oct 2020 12:31:00 +0000 (08:31 -0400)]
gdb: replace AC_TRY_LINK in sanitize.m4

... with AC_LINK_IFELSE + AC_LANG_PROGRAM.

All changes in the generated configure file are insignificant whitespace
changes.

gdb/ChangeLog:

* configure: Re-generate.
* sanitize.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE +
AC_LANG_PROGRAM.

Change-Id: I6fc4c39e10b28d2ade964e0d59a7f8ec0d3a272a

4 years agogdbsupport: replace AC_TRY_COMPILE in common.m4
Simon Marchi [Sat, 31 Oct 2020 12:31:00 +0000 (08:31 -0400)]
gdbsupport: replace AC_TRY_COMPILE in common.m4

... with AC_COMPILE_IFELSE + AC_LANG_PROGRAM.  All the changes in the
generated configure files are insignificant whitespace changes.

gdb/ChangeLog:

* configure: Re-generate.

gdbserver/ChangeLog:

* configure: Re-generate.

gdbsupport/ChangeLog:

* common.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE +
AC_LANG_PROGRAM.
* configure: Re-generate.

Change-Id: Id58e6e887f6be817d52b189921845838031dbd2a

4 years agogdbsupport: use AC_FUNC_FORK instead of AC_FUNC_VFORK
Simon Marchi [Sat, 31 Oct 2020 12:31:00 +0000 (08:31 -0400)]
gdbsupport: use AC_FUNC_FORK instead of AC_FUNC_VFORK

autoupdate does this change, it fixes this warning:

    configure.ac:50: warning: The macro `AC_FUNC_VFORK' is obsolete.
    configure.ac:50: You should run autoupdate.
    ../../lib/autoconf/functions.m4:1944: AC_FUNC_VFORK is expanded from...
    common.m4:20: GDB_AC_COMMON is expanded from...
    configure.ac:50: the top level

There are not changes in the generated configure files.

gdbsupport/ChangeLog:

* common.m4: Replace AC_FUNC_VFORK with AC_FUNC_FORK.

Change-Id: I9de9f718c57e6d51c9734161f36c36ce39170325

4 years agogdbsupport: replace AC_TRY_COMPILE in warning.m4
Simon Marchi [Sat, 31 Oct 2020 12:30:59 +0000 (08:30 -0400)]
gdbsupport: replace AC_TRY_COMPILE in warning.m4

Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM.

All changes in generated configure files are insignificant whitespace
changes.

gdb/ChangeLog:

* configure: Re-generate.

gdbserver/ChangeLog:

* configure: Re-generate.

gdbsupport/ChangeLog:

* configure: Re-generate.
* warning.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE +
AC_LANG_PROGRAM.

Change-Id: I517bd20ec3af960ad999a586761df0ac8959a3fc

4 years agogdbsupport: replace AC_TRY_COMPILE in ptrace.m4
Simon Marchi [Sat, 31 Oct 2020 12:30:59 +0000 (08:30 -0400)]
gdbsupport: replace AC_TRY_COMPILE in ptrace.m4

Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE + AC_LANG_PROGRAM.

All the changes in the generated configure files are insignificant
whitespace changes.

gdb/ChangeLog:

* configure: Re-generate.

gdbserver/ChangeLog:

* configure: Re-generate.

gdbsupport/ChangeLog:

* configure: Re-generate.
* ptrace.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE +
AC_LANG_PROGRAM.

Change-Id: Ia782b5477fe49dad04e68c0f41c6d8ab3fde5bf0

4 years agogdbsupport: re-indent ptrace.m4
Simon Marchi [Sat, 31 Oct 2020 12:30:59 +0000 (08:30 -0400)]
gdbsupport: re-indent ptrace.m4

For some reason, autoupdate isn't able to grok ptrace.m4:

    $ autoupdate ptrace.m4
    /usr/bin/m4:/tmp/auYjuodw/input.m4:171: ERROR: end of file in string
    autoupdate: /usr/bin/m4 failed with exit status: 1

Honestly, I'm unable to grok it either.  This patch re-indents it in a
way that I think is easier to read.  With this patch applied, autoupdate
becomes able to parse ptrace.m4, but I chose to keep this re-indent in a
patch of its own.

All the changes in generated configure files consist of insignificant
whitespace changes.

gdb/ChangeLog:

* configure: Re-generate.

gdbserver/ChangeLog:

* configure: Re-generate.

gdbsupport/ChangeLog:

* configure: Re-generate.
* ptrace.m4: Re-indent.

Change-Id: Ie2afab09fecc8b6d0cccccb47ac9756f3843881e

4 years agogdb: modernize acinclude.m4
Simon Marchi [Sat, 31 Oct 2020 12:30:58 +0000 (08:30 -0400)]
gdb: modernize acinclude.m4

Run autoupdate, fix indentation for readability.

gdb/ChangeLog:

* acinclude.m4: Modernize.
* configure: Re-generate.

Change-Id: I8949f885326a3206f414776b63a1fdba197bb19a

4 years agogdb/testsuite: modernize configure.ac
Simon Marchi [Sat, 31 Oct 2020 12:30:58 +0000 (08:30 -0400)]
gdb/testsuite: modernize configure.ac

Run autoupdate, the only change is to split AC_INIT into AC_INIT and
AC_CONFIG_SRCDIR.

gdb/testsuite/ChangeLog:

* configure.ac: Split AC_INIT into AC_INIT and AC_CONFIG_SRCDIR.
* configure: Re-generate.

Change-Id: I6e40c0261bda4fe9144b896799ef460d23e22e09

4 years agogdb: modernize configure.ac
Simon Marchi [Sat, 31 Oct 2020 12:30:58 +0000 (08:30 -0400)]
gdb: modernize configure.ac

Run autoupdate on configure.ac and adjust the indentation of the result
for better readability.  This removes a bunch of warnings when running
`autoreconf -vf -Wall`.  The changes are:

    * Replace AC_INIT with AC_INIT and no arguments plus
      AC_CONFIG_SRCDIR.
    * Replace AC_ERROR with AC_MSG_ERROR.
    * Replace AC_TRY_LINK with AC_LINK_IFELSE.
    * Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
    * Replace AC_HELP_STRING with AS_HELP_STRING.

autoupdate erroneously tries to replace AC_C_LONG_DOUBLE in a comment,
which I reverted manually.

All the changes in the generated configure file are insignificant
whitespaces changes.

gdb/ChangeLog:

* configure.ac: Modernize.
* configure: Re-generate.

Change-Id: Ie3a1409c8032a36a6383da964286a46ece9b546e

4 years agogdbserver: modernize configure.ac
Simon Marchi [Sat, 31 Oct 2020 12:30:58 +0000 (08:30 -0400)]
gdbserver: modernize configure.ac

Run autoupdate on gdbserver/configure.ac and then tweak it to use easier
to read indentation.  This removes a few warnings when running
`autoreconf -vf -Wall`.

  * Replace AC_INIT with AC_INIT and no arguments plus AC_CONFIG_SRCDIR.
  * Replace AC_GNU_SOURCE with AC_USE_SYSTEM_EXTENSIONS.
  * Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
  * Replace AC_TRY_LINK with AC_LINK_IFELSE.

autoupdate gets it right, except this one here:

    --- a/gdbserver/configure.ac
    +++ b/gdbserver/configure.ac
    @@ -304,7 +304,7 @@ if test "$srv_linux_thread_db" = "yes"; then
         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[found="-Wl,--dynamic-list"
                     RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'],[RDYNAMIC="-rdynamic"
                     LDFLAGS="$old_LDFLAGS $RDYNAMIC"
    -                AC_TRY_LINK([], [],
    +                _au_m4_changequote([,])AC_TRY_LINK([], [],
                                 [found="-rdynamic"],
                                 [found="no"
                                  RDYNAMIC=""])])

... which I had to convert manually.

The changes in the generated configure file only contain insignificant
whitespace changes, so that gives confidence that the conversion is
correct.

gdbserver/ChangeLog:

* configure.ac: Modernize.
* configure: Re-generate.

Change-Id: Ia769aaec2aafac595504f477da955e91dffa4d8f

4 years agogdb: use AC_PROG_CC_STDC instead of AM_PROG_CC_STDC
Simon Marchi [Sat, 31 Oct 2020 12:30:57 +0000 (08:30 -0400)]
gdb: use AC_PROG_CC_STDC instead of AM_PROG_CC_STDC

`autoconf -Wall` notes that AM_PROG_CC_STDC is obsolete:
Fixes this autoconf warning:

    configure.ac:40: warning: 'AM_PROG_CC_STDC': this macro is obsolete.
    configure.ac:40: You should simply use the 'AC_PROG_CC' macro instead.
    configure.ac:40: Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
    configure.ac:40: but upon 'ac_cv_prog_cc_stdc'.
    aclocal.m4:770: AM_PROG_CC_STDC is expanded from...
    configure.ac:40: the top level

Since we build with a C++ compiler now, I don't think this is relevant.
If you look at the messages removed from gdbsupport/aclocal.m4, it says
that this functionality is now integrated in AC_PROG_CC, which we
already call.  So it might not even make a difference.

We had a local version of AM_PROG_CC_STDC, in gdb/acinclude.m4 (only
used by gdb/configure.ac), remove it.

gdb/ChangeLog:

* acinclude.m4 (AM_PROG_CC_STDC): Remove.
* configure: Re-generate.
* configure.ac: Remove AM_PROG_CC_STDC.

gdbsupport/ChangeLog:

* aclocal.m4: Re-generate.
* configure: Re-generate.
* configure.ac: Remove AM_PROG_CC_STDC.

Change-Id: Ic824393598805d4f78cda9d119f8af46096e9c73

4 years agogdb, gdbserver, gdbsupport: use AC_CANONICAL_{BUILD,HOST,TARGET} instead of AC_CANONI...
Simon Marchi [Sat, 31 Oct 2020 12:30:57 +0000 (08:30 -0400)]
gdb, gdbserver, gdbsupport: use AC_CANONICAL_{BUILD,HOST,TARGET} instead of AC_CANONICAL_SYSTEM

`autoreconf -Wall` notes that AC_CANONICAL_SYSTEM is obsolete:

    configure.ac:36: warning: The macro `AC_CANONICAL_SYSTEM' is obsolete.

Replace it by AC_CANONICAL_BUILD, AC_CANONICAL_HOST and
AC_CANONICAL_TARGET in configure.ac files in gdb, gdbserver and
gdbsupport.  All three macros may not be needed everywhere, but it is
hard to completely audit the configure files to see which are required,
so I think it's better (and that there's no downside) to just call all
three.

gdb/ChangeLog:

* configure.ac: Use AC_CANONICAL_{BUILD,HOST,TARGET} instead of
AC_CANONICAL_SYSTEM.
* configure: Re-generate.

gdbserver/ChangeLog:

* configure.ac: Use AC_CANONICAL_{BUILD,HOST,TARGET} instead of
AC_CANONICAL_SYSTEM.
* configure: Re-generate.

gdbsupport/ChangeLog:

* configure.ac: Use AC_CANONICAL_{BUILD,HOST,TARGET} instead of
AC_CANONICAL_SYSTEM.
* configure: Re-generate.

Change-Id: Ifd0e21f1e478634e768b5de1b8ee06a7f690d863

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 31 Oct 2020 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: introduce displaced_debug_printf
Simon Marchi [Fri, 30 Oct 2020 19:10:08 +0000 (15:10 -0400)]
gdb: introduce displaced_debug_printf

Move all debug prints of the "displaced" category to use a new
displaced_debug_printf macro, like what was done for infrun and others
earlier.

The debug output for one displaced step one amd64 looks like:

    [displaced] displaced_step_prepare_throw: stepping process 3367044 now
    [displaced] displaced_step_prepare_throw: saved 0x555555555042: 1e fa 31 ed 49 89 d1 5e 48 89 e2 48 83 e4 f0 50
    [displaced] amd64_displaced_step_copy_insn: copy 0x555555555131->0x555555555042: b8 00 00 00 00 5d c3 0f 1f 84 00 00 00 00 00 f3
    [displaced] displaced_step_prepare_throw: displaced pc to 0x555555555042
    [displaced] resume_1: run 0x555555555042: b8 00 00 00
    [displaced] displaced_step_restore: restored process 3367044 0x555555555042
    [displaced] amd64_displaced_step_fixup: fixup (0x555555555131, 0x555555555042), insn = 0xb8 0x00 ...
    [displaced] amd64_displaced_step_fixup: relocated %rip from 0x555555555047 to 0x555555555136

On test case needed to be updated because it relied on the specific
formatting of the message.

gdb/ChangeLog:

* infrun.h (displaced_debug_printf): New macro.  Replace
displaced debug prints throughout to use it.
(displaced_debug_printf_1): New declaration.
(displaced_step_dump_bytes): Return string, remove ui_file
parameter, update all callers.
* infrun.c (displaced_debug_printf_1): New function.
(displaced_step_dump_bytes): Return string, remove ui_file
parameter

gdb/testsuite/ChangeLog:

* gdb.arch/amd64-disp-step-avx.exp: Update displaced step debug
expected output.

Change-Id: Ie78837f56431f6f98378790ba1e6051337bf6533

4 years agogdb: rs6000_dwarf2_reg_to_regnum return -1 for unknown register number
Simon Marchi [Fri, 30 Oct 2020 19:01:13 +0000 (15:01 -0400)]
gdb: rs6000_dwarf2_reg_to_regnum return -1 for unknown register number

With the current implementation of rs6000_dwarf2_reg_to_regnum, if an
unknown DWARF register number is passed, the same number is returned as
the internal GDB number.  This assumes that the internal GDB register
numbers match the DWARF register numbers, which is not the case.

Change it to return -1, as documented in gdbarch.sh for the
dwarf2_reg_to_regnum method.

This fixes a failure in gdb.dwarf2/bad-regnum.exp:

     (gdb) info addr foo1
    -Symbol "foo1" is a variable in $.
    -(gdb) FAIL: gdb.dwarf2/bad-regnum.exp: info addr foo1
    +Symbol "foo1" is a variable in $bad_register_number.
    +(gdb) PASS: gdb.dwarf2/bad-regnum.exp: info addr foo1

I ran the entire testsuite on powerpc64 (gcc203 on the compile farm) and
didn't see any regression.

gdb/ChangeLog:

* rs6000-tdep.c (rs6000_dwarf2_reg_to_regnum): Return -1 for
  unknown register numbers.

Change-Id: I585aa07a08f845a46c36bfdb6d3118ea94f8f54d

4 years agoHave stamp-init depend on config.status
Tom Tromey [Fri, 30 Oct 2020 16:27:12 +0000 (10:27 -0600)]
Have stamp-init depend on config.status

I recently wrote a patch to modify configure.tgt.  However, I did this
incorrectly the first time, and had to go back and add another file.
After building, I was surprised that my changes did not seem to work.
I tracked this down to the fact that init.c had not been rebuilt after
my changes -- because the files I added to the build were already
older than the existing init.c.

This patch changes the gdb Makefile so that init.c will be rebuilt if
config.status changes.  This should cover various scenarios that cause
a re-configure, like editing configure.tgt.

2020-10-30  Tom Tromey  <tromey@adacore.com>

* Makefile.in (stamp-init): Depend on config.status.

4 years agogold: Support GNU_PROPERTY_X86_ISA_1_BASELINE marker
H.J. Lu [Fri, 30 Oct 2020 13:51:10 +0000 (06:51 -0700)]
gold: Support GNU_PROPERTY_X86_ISA_1_BASELINE marker

* testsuite/gnu_property_test.sh: Updated.

4 years agox86: Support GNU_PROPERTY_X86_ISA_1_BASELINE marker
H.J. Lu [Fri, 30 Oct 2020 13:49:57 +0000 (06:49 -0700)]
x86: Support GNU_PROPERTY_X86_ISA_1_BASELINE marker

GCC 11 supports -march=x86-64-v[234] to enable x86 micro-architecture ISA
levels:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97250

X86 ISA markers are updated:

https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13

GNU_PROPERTY_X86_ISA_1_BASELINE is added and GNU_PROPERTY_X86_ISA_1_V[234]
are updated:

 #define GNU_PROPERTY_X86_ISA_1_BASELINE (1U << 0)
 #define GNU_PROPERTY_X86_ISA_1_V2       (1U << 1)
 #define GNU_PROPERTY_X86_ISA_1_V3       (1U << 2)
 #define GNU_PROPERTY_X86_ISA_1_V4       (1U << 3)

Add -z x86-64-baseline linker command line option to mark x86-64-baseline
ISA level as needed.

bfd/

PR gas/26703
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Generate
GNU_PROPERTY_X86_ISA_1_BASELINE for -z x86-64-baseline.

binutils/

PR gas/26703
* readelf.c (decode_x86_isa): Handle
* GNU_PROPERTY_X86_ISA_1_BASELINE.
* testsuite/binutils-all/i386/empty.d: Updated.
* testsuite/binutils-all/i386/ibt.d: Likewise.
* testsuite/binutils-all/i386/pr21231a.d: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Likewise.
* testsuite/binutils-all/i386/shstk.d: Likewise.
* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
* testsuite/binutils-all/x86-64/empty.d: Likewise.
* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
* testsuite/binutils-all/x86-64/ibt.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
* testsuite/binutils-all/x86-64/shstk.d: Likewise.

gas/

PR gas/26703
* config/tc-i386.c (output_insn): Update for
GNU_PROPERTY_X86_ISA_1_BASELINE.
* testsuite/gas/i386/property-1.d: Updated.
* testsuite/gas/i386/property-2.d: Likewise.
* testsuite/gas/i386/property-3.d: Likewise.
* testsuite/gas/i386/property-4.d: Likewise.
* testsuite/gas/i386/property-5.d: Likewise.
* testsuite/gas/i386/property-6.d: Likewise.
* testsuite/gas/i386/property-11.d: Likewise.
* testsuite/gas/i386/property-12.d: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.
* testsuite/gas/i386/x86-64-property-3.d: Likewise.
* testsuite/gas/i386/x86-64-property-4.d: Likewise.
* testsuite/gas/i386/x86-64-property-5.d: Likewise.
* testsuite/gas/i386/x86-64-property-6.d: Likewise.
* testsuite/gas/i386/x86-64-property-11.d: Likewise.
* testsuite/gas/i386/x86-64-property-12.d: Likewise.

include/

PR gas/26703
* elf/common.h (GNU_PROPERTY_X86_ISA_1_BASELINE): New.
(GNU_PROPERTY_X86_ISA_1_V2): Uppdated.
(GNU_PROPERTY_X86_ISA_1_V3): Likewise.
(GNU_PROPERTY_X86_ISA_1_V4): Likewise.

ld/

PR gas/26703
* NEWS: Mention -z x86-64-baseline.
* ld.texi: Document -z x86-64-baseline.
* emulparams/x86-64-level.sh: Handle -z x86-64-baseline.
* testsuite/ld-elf/x86-feature-1a.rd: Update.
* testsuite/ld-elf/x86-feature-1b.rd: Likewise.
* testsuite/ld-elf/x86-feature-1c.rd: Likewise.
* testsuite/ld-elf/x86-feature-1d.rd: Likewise.
* testsuite/ld-elf/x86-feature-1e.rd: Likewise.
* testsuite/ld-i386/pr23372c.d: Likewise.
* testsuite/ld-i386/pr23486c.d: Likewise.
* testsuite/ld-i386/pr23486d.d: Likewise.
* testsuite/ld-i386/pr24322a.d: Likewise.
* testsuite/ld-i386/pr24322b.d: Likewise.
* testsuite/ld-i386/property-1a.r: Likewise.
* testsuite/ld-i386/property-2a.r: Likewise.
* testsuite/ld-i386/property-3.r: Likewise.
* testsuite/ld-i386/property-3a.r: Likewise.
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-4a.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-5a.r: Likewise.
* testsuite/ld-i386/property-7a.r: Likewise.
* testsuite/ld-i386/property-x86-3.d: Likewise.
* testsuite/ld-i386/property-x86-4a.d: Likewise.
* testsuite/ld-i386/property-x86-5.d: Likewise.
* testsuite/ld-i386/property-x86-cet1.d: Likewise.
* testsuite/ld-i386/property-x86-cet2a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt2.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt4.d: Likewise.
* testsuite/ld-i386/property-x86-ibt5.d: Likewise.
* testsuite/ld-i386/property-x86-isa1.d: Likewise.
* testsuite/ld-i386/property-x86-isa2.d: Likewise.
* testsuite/ld-i386/property-x86-isa3.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk2.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk4.d: Likewise.
* testsuite/ld-i386/property-x86-shstk5.d: Likewise.
* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372c.d: Likewise.
* testsuite/ld-x86-64/pr23486c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486c.d: Likewise.
* testsuite/ld-x86-64/pr23486d-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486d.d: Likewise.
* testsuite/ld-x86-64/pr24322a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322a.d: Likewise.
* testsuite/ld-x86-64/pr24322b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322b.d: Likewise.
* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458a.d: Likewise.
* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458b.d: Likewise.
* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458c.d: Likewise.
* testsuite/ld-x86-64/property-1a.r: Likewise.
* testsuite/ld-x86-64/property-2a.r: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-3a.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-4a.r: Likewise.
* testsuite/ld-x86-64/property-5.r: Likewise.
* testsuite/ld-x86-64/property-5a.r: Likewise.
* testsuite/ld-x86-64/property-7a.r: Likewise.
* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-3.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa1-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa1.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa2.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa3.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.
* testsuite/ld-i386/i386.exp: Run property-x86-isa4.
* testsuite/ld-i386/property-x86-isa4.d: New file.
* testsuite/ld-x86-64/property-x86-isa4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-isa4.d: Likewise.
* ld/testsuite/ld-x86-64/x86-64.exp: Run property-x86-isa4
and property-x86-isa4-x32.

4 years ago[PATCH][GAS] aarch64: Add WFIT instruction for Armv8.7-a
Przemyslaw Wirkus [Fri, 30 Oct 2020 10:27:24 +0000 (10:27 +0000)]
[PATCH][GAS] aarch64: Add WFIT instruction for Armv8.7-a

This patch adds new to Armv8.7 WFIT instruction which take one operand:

    WFIT <Xt>

Where:
    <Xt> is 64-bit name of the general-purpose source register, encoded in the
         "Rd" field.

For more details regarding WFIT (Wait For Interrupt with Timeout) instruction for
Armv8.7-a please refer to Arm A64 Instruction set documentation for Armv8-A
architecture profile, see document pages 570 of [0].

[0]: https://developer.arm.com/docs/ddi0596/i

gas/ChangeLog:

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

* NEWS: Update docs.
* testsuite/gas/aarch64/system-5.d: Update test with WFIT insn.
* testsuite/gas/aarch64/system-5.s: Update test with WFIT insn.

opcodes/ChangeLog:

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

* aarch64-tbl.h (struct aarch64_opcode): New instruction WFIT.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.

4 years agogdb/infrun: disable pagination in fetch_inferior_event
Tankut Baris Aktemur [Fri, 30 Oct 2020 07:13:57 +0000 (08:13 +0100)]
gdb/infrun: disable pagination in fetch_inferior_event

Having pagination enabled when handling an inferior event gives the
user an option to quit, which causes early exit in GDB's flow and may
lead to half-baked state.  For instance, here is a case where we quit
in the middle of handling an inferior exit:

  $ gdb ./a.out
  Reading symbols from ./a.out...
  (gdb) set height 2
  (gdb) run
  Starting program: ./a.out
  --Type <RET> for more, q to quit, c to continue without paging--q
  Quit
  Couldn't get registers: No such process.
  (gdb) set height unlimited
  Couldn't get registers: No such process.
  (gdb) info threads
    Id   Target Id         Frame
  * 1    process 27098     Couldn't get registers: No such process.
  Couldn't get registers: No such process.
  (gdb)

Or suppose having a multi-threaded program like below:

  static void *
  fun (void *dummy)
  {
    int a = 1; /* break-here */
    return NULL;
  }

  int
  main (void)
  {
    pthread_t thread;
    pthread_create (&thread, NULL, fun, NULL);
    pthread_join (thread, NULL);

    return 0;
  }

If we define a breakpoint at line "break-here", we expect only Thread
2 to hit it.

  $ gdb ./a.out
  Reading symbols from ./a.out...
  (gdb) break 7
  Breakpoint 1 at 0x1182: file mt.c, line 7.
  (gdb) set height 2
  (gdb) run
  Starting program: ./a.out
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
  [New Thread 0x7ffff77c4700 (LWP 23048)]
  --Type <RET> for more, q to quit, c to continue without paging--q
  Quit
  (gdb) set height unlimited
  (gdb) info thread
    Id   Target Id                                 Frame
  * 1    Thread 0x7ffff7fe3740 (LWP 23044) "a.out" 0x00007ffff7bbed2d in ...
    2    Thread 0x7ffff77c4700 (LWP 23048) "a.out" fun (dummy=0x0) at mt.c:7
  (gdb)

The prompt for continuation was triggered because Thread 2 hit the
breakpoint.  (If we had hit 'c', we were going to see that stop event,
but we didn't.)  The context did not switch to Thread 2.  GDB also did
not execute several other things it would normally do in
infrun.c:normal_stop after outputting "[Switching to Thread ...]" (but
it seems harmless in this case).  If we 'continue' at this state, both
threads run until termination, and we don't see the breakpoint hit
event ever.

Here is another related and more complicated scenario that leads to a
GDB crash.  Create two inferiors, one sitting on top of a native
target, and the other on a remote target, so that we have a
multi-target setting, like so:

  (gdb) i inferiors
    Num  Description       Connection     Executable
    1    process 13786     1 (native)     a.out
  * 2    process 13806     2 (remote ...) target:a.out

Next, resume both inferiors to run until termination:

  (gdb) set schedule-multiple on
  (gdb) set height 2
  (gdb) continue
  Continuing.
  --Type <RET> for more, q to quit, c to continue without paging--[Inferior 2 (process 13806) exited normally]

  terminate called after throwing an instance of 'gdb_exception_error'
  Aborted

Here, GDB first received a termination event from Inferior 1.  GDB
attempted to print this event, triggering a "prompt for continue", and
GDB started polling for events, hoping to get an input from the user.
However, the exit event from Inferior 2 was received instead.  So, GDB
started processing an exit event while being in the middle of
processing another exit event.  It was not ready for this situation
and eventually crashed.

To address these cases, temporarily disable pagination in
fetch_inferior_event.  This doesn't affect commands like 'info
threads', 'backtrace', or 'thread apply'.

Regression-tested on X86_64 Linux.

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

* infrun.c (fetch_inferior_event): Temporarily disable pagination.

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

* gdb.base/paginate-after-ctrl-c-running.exp: Update with no pagination
behavior.
* gdb.base/paginate-bg-execution.exp: Ditto.
* gdb.base/paginate-inferior-exit.exp: Ditto.
* gdb.base/double-prompt-target-event-error.c: Remove.
* gdb.base/double-prompt-target-event-error.exp: Remove.

4 years agoMove lookup_selected_frame to frame.c
Pedro Alves [Thu, 9 Jul 2020 19:12:15 +0000 (20:12 +0100)]
Move lookup_selected_frame to frame.c

This function is now external, and isn't really threads related.  Move
it to frame.c.

gdb/ChangeLog:

* thread.c (lookup_selected_frame): Move ...
* frame.c (lookup_selected_frame): ... here.

Change-Id: Ia96b79c15767337c68efd3358bcc715ce8e26c15

4 years agoMake scoped_restore_current_thread's cdtors exception free (RFC)
Pedro Alves [Fri, 30 Oct 2020 17:26:15 +0000 (18:26 +0100)]
Make scoped_restore_current_thread's cdtors exception free (RFC)

If the remote target closes while we're reading registers/memory for
restoring the selected frame in scoped_restore_current_thread's dtor,
the corresponding TARGET_CLOSE_ERROR error is swallowed by the
scoped_restore_current_thread's dtor, because letting exceptions
escape from a dtor is bad.  It isn't great to lose that errors like
that, though.  I've been thinking about how to avoid it, and I came up
with this patch.

The idea here is to make scoped_restore_current_thread's dtor do as
little as possible, to avoid any work that might throw in the first
place.  And to do that, instead of having the dtor call
restore_selected_frame, which re-finds the previously selected frame,
just record the frame_id/level of the desired selected frame, and have
get_selected_frame find the frame the next time it is called.  In
effect, this implements most of Cagney's suggestion, here:

  /* On demand, create the selected frame and then return it.  If the
     selected frame can not be created, this function prints then throws
     an error.  When MESSAGE is non-NULL, use it for the error message,
     otherwize use a generic error message.  */
  /* FIXME: cagney/2002-11-28: At present, when there is no selected
     frame, this function always returns the current (inner most) frame.
     It should instead, when a thread has previously had its frame
     selected (but not resumed) and the frame cache invalidated, find
     and then return that thread's previously selected frame.  */
  extern struct frame_info *get_selected_frame (const char *message);

The only thing missing to fully implement that would be to make
reinit_frame_cache just clear selected_frame instead of calling
select_frame(NULL), and the call select_frame(NULL) explicitly in the
places where we really wanted reinit_frame_cache to go back to the
current frame too.  That can done separately, though, I'm not
proposing to do that in this patch.

Note that this patch renames restore_selected_frame to
lookup_selected_frame, and adds a new restore_selected_frame function
that doesn't throw, to be paired with the also-new save_selected_frame
function.

There's a restore_selected_frame function in infrun.c that I think can
be replaced by the new one in frame.c.

Also done in this patch is make the get_selected_frame's parameter be
optional, so that we don't have to pass down nullptr explicitly all
over the place.

lookup_selected_frame should really move from thread.c to frame.c, but
I didn't do that here, just to avoid churn in the patch while it
collects comments.  I did make it extern and declared it in frame.h
already, preparing for the move.  I will do the move as a follow up
patch if people agree with this approach.

Incidentally, this patch alone would fix the crashes fixed by the
previous patches in the series, because with this,
scoped_restore_current_thread's constructor doesn't throw either.

gdb/ChangeLog:

* blockframe.c (block_innermost_frame): Use get_selected_frame.
* frame.c
(scoped_restore_selected_frame::scoped_restore_selected_frame):
Use save_selected_frame.  Save language as well.
(scoped_restore_selected_frame::~scoped_restore_selected_frame):
Use restore_selected_frame, and restore language as well.
(selected_frame_id, selected_frame_level): New.
(selected_frame): Update comments.
(save_selected_frame, restore_selected_frame): New.
(get_selected_frame): Use lookup_selected_frame.
(get_selected_frame_if_set): Delete.
(select_frame): Record selected_frame_level and selected_frame_id.
* frame.h (scoped_restore_selected_frame) <m_level, m_lang>: New
fields.
(get_selected_frame): Make 'message' parameter optional.
(get_selected_frame_if_set): Delete declaration.
(select_frame): Update comments.
(save_selected_frame, restore_selected_frame)
(lookup_selected_frame): Declare.
* gdbthread.h (scoped_restore_current_thread) <m_lang>: New field.
* infrun.c (struct infcall_control_state) <selected_frame_level>:
New field.
(save_infcall_control_state): Use save_selected_frame.
(restore_selected_frame): Delete.
(restore_infcall_control_state): Use restore_selected_frame.
* stack.c (select_frame_command_core, frame_command_core): Use
get_selected_frame.
* thread.c (restore_selected_frame): Rename to ...
(lookup_selected_frame): ... this and make extern.  Select the
current frame if the frame level is -1.
(scoped_restore_current_thread::restore): Also restore the
language.
(scoped_restore_current_thread::~scoped_restore_current_thread):
Don't try/catch.
(scoped_restore_current_thread::scoped_restore_current_thread):
Save the language as well.  Use save_selected_frame.

Change-Id: I73fd1cfc40d8513c28e5596383b7ecd8bcfe700f

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Oct 2020 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: fix documentation of gdbarch_displaced_step_hw_singlestep
Simon Marchi [Thu, 29 Oct 2020 22:11:14 +0000 (18:11 -0400)]
gdb: fix documentation of gdbarch_displaced_step_hw_singlestep

The last commit missed updating the doc of
gdbarch_displaced_step_hw_singlestep to avoid mentioning the removed
parameter, this one fixes it.

gdb/ChangeLog:

* gdbarch.sh (displaced_step_hw_singlestep): Adjust
documentation.
* gdbarch.h: Re-generate.

Change-Id: I33675d9a6c253443eee707e8285d16615ce20aaa

4 years agogdb: remove parameter of gdbarch_displaced_step_hw_singlestep
Simon Marchi [Thu, 29 Oct 2020 22:02:13 +0000 (18:02 -0400)]
gdb: remove parameter of gdbarch_displaced_step_hw_singlestep

I noticed that the closure parameter of
gdbarch_displaced_step_hw_singlestep is never used by any
implementation of the method, so this patch removes it.

gdb/ChangeLog:

* gdbarch.sh (displaced_step_hw_singlestep): Remove closure
parameter.
* aarch64-tdep.c (aarch64_displaced_step_hw_singlestep):
Likewise.
* aarch64-tdep.h (aarch64_displaced_step_hw_singlestep):
Likewise.
* arch-utils.c (default_displaced_step_hw_singlestep):
Likewise.
* arch-utils.h (default_displaced_step_hw_singlestep):
Likewise.
* rs6000-tdep.c (ppc_displaced_step_hw_singlestep):
Likewise.
* s390-tdep.c (s390_displaced_step_hw_singlestep):
Likewise.
* gdbarch.c: Re-generate.
* gdbarch.h: Re-generate.
* infrun.c (resume_1): Adjust.

Change-Id: I7354f0b22afc2692ebff0cd700a462db8f389fc1

4 years agoRemove call to exec_close
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove call to exec_close

There's no need to call exec_close from ~progspace, because that
method just does some cleanup that's already going to be done during
destruction.  This patch removes the call.

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

* progspace.c (program_space::~program_space): Don't call
exec_close.

4 years agoDon't change current program space in exec_target::close
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Don't change current program space in exec_target::close

Now that we've removed the macros and moved various functions to be
methods on program_space (removing uses of current_program_space),
it's clear that exec_target::close can operate on program spaces
without changing the current program space.

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

* exec.c (exec_target::close): Don't change current program
space.

4 years agoChange add_target_sections_of_objfile to method on program_space
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change add_target_sections_of_objfile to method on program_space

This changes add_target_sections_of_objfile to be a method on
program_space.  It is renamed to be another overload of
add_target_sections, because they are semantically equivalent in a
sense.

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

* symfile.c (add_symbol_file_command): Update.
* exec.c (program_space::add_target_sections): Rename.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* progspace.h (struct program_space) <add_target_sections>:
Declare new overload.
* exec.h (add_target_sections_of_objfile): Don't declare.

4 years agoChange add_target_sections to method on program_space
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change add_target_sections to method on program_space

This changes add_target_sections to be a method on program_space.
Like the earlier change to remove_target_sections, this makes sense
because this function is manipulating data that is stored on the
program space.

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

* solib.c (solib_map_sections): Update.
* exec.c (program_space::add_target_sections): Now a method.
(exec_file_attach): Update.
* exec.h (add_target_sections): Don't declare.
* progspace.h (struct program_space) <add_target_sections>:
Declare.

4 years agoChange remove_target_sections to method on program_space
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change remove_target_sections to method on program_space

This changes remove_target_sections to be a method on program_space.
This makes sense because this function manipulates data that is
attached to the program space.

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

* progspace.h (struct program_space) <remove_target_sections>:
Declare.
* exec.c (program_space::remove_target_sections): Now a method.
* exec.h (remove_target_sections): Don't declare.

4 years agoChange program_space_empty_p to method on program_space
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change program_space_empty_p to method on program_space

This changes program_space_empty_p to be a method on program_space.
It also changes it to return bool.  I removed the "_p" suffix because
"empty" is a "well-known" C++ method name.

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

* inferior.c (delete_inferior): Update.
* progspace.c (program_space::empty): Rename from
program_space_empty_p.  Return bool.
* progspace.h (struct program_space) <empty>: New method.
(program_space_empty_p): Don't declare.

4 years agoChange clear_program_space_solib_cache to method on program_space
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change clear_program_space_solib_cache to method on program_space

This changes clear_program_space_solib_cache to be a method on
program_space.  Also, it removes a call to this function from the
program_space destructor, as that is not necessary.

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

* progspace.c (program_space::~program_space): Don't call
clear_program_space_solib_cache.
(program_space::clear_solib_cache): Rename from
clear_solib_cache.
* solib.c (handle_solib_event): Update.
* progspace.h (struct program_space) <clear_solib_cache>: New
method.
(clear_program_space_solib_cache): Don't declare.

4 years agoRemove symfile_objfile macro
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove symfile_objfile macro

This removes the symfile_objfile macro, in favor of just spelling out
the member access.

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

* windows-tdep.c (windows_solib_create_inferior_hook): Update.
* target.c (info_target_command): Update.
* symfile.c (syms_from_objfile_1, finish_new_objfile)
(symbol_file_clear, reread_symbols): Update.
* symfile-mem.c (add_symbol_file_from_memory_command): Update.
* stabsread.c (scan_file_globals): Update.
* solib.c (update_solib_list): Update.
* solib-svr4.c (elf_locate_base, open_symbol_file_object)
(svr4_fetch_objfile_link_map, enable_break)
(svr4_relocate_main_executable)
(svr4_iterate_over_objfiles_in_search_order): Update.
* solib-frv.c (lm_base, enable_break)
(frv_relocate_main_executable): Update.
(main_got, frv_fdpic_find_canonical_descriptor): Update.
(frv_fetch_objfile_link_map): Update.
* solib-dsbt.c (lm_base, dsbt_relocate_main_executable): Update.
* solib-darwin.c (darwin_solib_create_inferior_hook): Update.
* solib-aix.c (solib_aix_solib_create_inferior_hook): Update.
* remote.c (remote_target::get_offsets): Update.
(remote_target::start_remote)
(extended_remote_target::post_attach): Update.
* objfiles.c (entry_point_address_query): Update.
* nto-procfs.c (nto_procfs_target::create_inferior): Update.
* minsyms.c (get_symbol_leading_char): Update.
* frame.c (inside_main_func): Update.
* progspace.h (symfile_objfile): Remove macro.

4 years agoChange program_space::ebfd to a gdb_bfd_ref_ptr
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change program_space::ebfd to a gdb_bfd_ref_ptr

This changes program_space::ebfd to a gdb_bfd_ref_ptr, removing some
manual management.

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

* exec.c (exec_file_attach): Update.
* progspace.c (program_space::exec_close): Update.
* progspace.h (struct program_space) <ebfd>: Now a
gdb_bfd_ref_ptr.
<set_exec_bfd>: Change argument type.
<exec_bfd>: Update.

4 years agoRemove the exec_bfd macro
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove the exec_bfd macro

This removes the exec_bfd macro, in favor of new accessors on
program_space.  In one spot the accessor can't be used; but this is
still a big improvement over the macro, IMO.

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

* windows-tdep.c (windows_solib_create_inferior_hook): Update.
* symfile.c (reread_symbols): Update.
* symfile-mem.c (add_symbol_file_from_memory_command)
(add_vsyscall_page): Update.
* source-cache.c (source_cache::get_plain_source_lines): Update.
* solib-svr4.c (find_program_interpreter, elf_locate_base)
(svr4_current_sos_direct, svr4_exec_displacement)
(svr4_relocate_main_executable): Update.
(svr4_iterate_over_objfiles_in_search_order): Update.
* solib-frv.c (enable_break2, enable_break): Update.
* solib-dsbt.c (lm_base, enable_break): Update.
* solib-darwin.c (find_program_interpreter)
(darwin_solib_create_inferior_hook): Update.
* sol-thread.c (rw_common, ps_pdmodel): Update.
* rs6000-nat.c (rs6000_nat_target::create_inferior): Update.
* remote.c (compare_sections_command)
(remote_target::trace_set_readonly_regions): Update.
* remote-sim.c (get_sim_inferior_data)
(gdbsim_target::create_inferior, gdbsim_target::create_inferior): Update.
(gdbsim_target_open, gdbsim_target::files_info): Update.
* exec.h (exec_bfd): Remove macro.
* progspace.c (initialize_progspace): Update.
* proc-service.c (ps_addr_to_core_addr, core_addr_to_ps_addr):
Update.
* nto-procfs.c (nto_procfs_target::post_attach)
(nto_procfs_target::create_inferior): Update.
* maint.c (maintenance_info_sections): Update.
* linux-thread-db.c (thread_db_target::get_thread_local_address):
Update.
* infcmd.c (post_create_inferior): Update.
* gcore.c (default_gcore_arch, default_gcore_target): Update.
(objfile_find_memory_regions): Update.
* exec.c (validate_exec_file, exec_file_attach)
(exec_read_partial_read_only, print_section_info): Update.
* corelow.c (core_target_open): Update.
* corefile.c (reopen_exec_file, validate_files): Update.
* arm-tdep.c (gdb_print_insn_arm): Update.
* arch-utils.c (gdbarch_update_p, default_print_insn): Update.
* progspace.h (struct program_space) <exec_bfd, set_exec_bfd>: New
methods.

4 years agoRemove current_target_sections macro
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove current_target_sections macro

This removes the current_target_sections macro, replacing it with uses
of the appropriate member from current_program_space.

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

* progspace.h (current_target_sections): Remove macro.
* solib-svr4.c (scan_dyntag): Update.
* solib-dsbt.c (scan_dyntag): Update.
* exec.c (exec_target::close): Update.
(add_target_sections, add_target_sections_of_objfile)
(remove_target_sections, exec_target::get_section_table)
(exec_target::files_info, set_section_command)
(exec_set_section_address, exec_target::has_memory)
(exec_target::has_memory): Update.

4 years agoRemove exec_bfd_mtime define
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove exec_bfd_mtime define

This removes the exec_bfd_mtime define, in favor of directly using the
appropriate member of the current program space.

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

* source-cache.c (source_cache::get_plain_source_lines): Use
current_program_space.
* corefile.c (reopen_exec_file): Use current_program_space.
* exec.c (exec_file_attach): Use current_program_space.
* exec.h (exec_bfd_mtime): Remove.

4 years agoRemove commented-out code from gcore.c
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove commented-out code from gcore.c

I found some code in gcore.c that has been commented out since

d3420b2fce5e (Mark Kettenis     2003-09-04 166) #if 1 /* See if this even matters...  */

This patch deletes this entire function, because the body was reduced
to just "return 0".

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

* gcore.c (default_gcore_mach): Remove.
(create_gcore_bfd): Update.

4 years agoChange exec_close to be a method on program_space
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Change exec_close to be a method on program_space

exec_close uses the current program space, so it seemed cleaner to
change it to be a method on program_space.  This patch makes this
change.

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

* progspace.c (program_space::exec_close): New method, from
exec_close in exec.c.
* exec.c (exec_close): Move to progspace.c.
(exec_target::close, exec_file_attach): Update.
* progspace.h (struct program_space) <exec_close>: Declare
method.

4 years agoRemove exec_filename macro
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Remove exec_filename macro

This removes the exec_filename macro, replacing it with uses of the
member of current_program_space.  This also renames that member, and
changes it to be a unique pointer.

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

* progspace.h (struct program_space) <exec_filename>: Rename from
pspace_exec_filename.  Now a unique_xmalloc_ptr.
* inferior.c (print_selected_inferior): Update.
(print_inferior): Update.
* mi/mi-main.c (print_one_inferior): Update.
* exec.h (exec_filename): Remove macro.
* corefile.c (get_exec_file): Update.
* exec.c (exec_close): Update.
(exec_file_attach): Update.
* progspace.c (clone_program_space): Update.
(print_program_space): Update.

4 years agoAdd target_section constructor
Tom Tromey [Thu, 29 Oct 2020 21:04:33 +0000 (15:04 -0600)]
Add target_section constructor

This adds a constructor to target_section, simplifying the code that
creates instances of this.

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

* target-section.h (struct target_section): Add constructor.
* exec.c (build_section_table, add_target_sections_of_objfile):
Update.
* corelow.c (core_target::build_file_mappings): Update.

4 years agoFix an illegal memory access problem when processing secondary relocs for architectur...
Nick Clifton [Thu, 29 Oct 2020 20:13:00 +0000 (20:13 +0000)]
Fix an illegal memory access problem when processing secondary relocs for architectures which support both REL and RELA relocs.

PR 26809
* elf.c (_bfd_elf_slurp_secondary_reloc_section): Use the correct
sized reloc reading function.
(_bfd_elf_write_secondary_reloc_section): Use the correct sized
reloc writing function.

4 years agoaarch64: Fix DSB instruction 'missing immediate expression' errors
Przemyslaw Wirkus [Thu, 29 Oct 2020 16:30:46 +0000 (16:30 +0000)]
aarch64: Fix DSB instruction 'missing immediate expression' errors

This patch fixes errors with DSB instruction after introduction of DSB nXS
variant. That change would cause GAS to reject valid DSB immediate string
operands.

gas/ChangeLog:

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

* config/tc-aarch64.c (parse_operands): Check for C0-C15 value of DSB
immediate string operand.
* testsuite/gas/aarch64/system-4.d: Update test.
* testsuite/gas/aarch64/system-4.s: Update test.

4 years agodwarf: Also match abbrev base when searching abbrev list
H.J. Lu [Thu, 29 Oct 2020 16:19:25 +0000 (09:19 -0700)]
dwarf: Also match abbrev base when searching abbrev list

A .debug_abbrev section can have multiple CUs.  When caching abbrev list,
we need to check abbrev base to support multiple CUs.

PR binutils/26808
* dwarf.c (abbrev_list): Add abbrev_base.
(new_abbrev_list): Add an abbrev_base argument and record it.
(find_abbrev_list_by_abbrev_offset): Add an abbrev_base argument
and match it.
(process_debug_info): Pass abbrev_base to new_abbrev_list and
find_abbrev_list_by_abbrev_offset.
(display_debug_abbrev): Pass 0 abbrev_base to new_abbrev_list
and find_abbrev_list_by_abbrev_offset.
* testsuite/binutils-all/x86-64/pr26808.dump: New file.
* testsuite/binutils-all/x86-64/pr26808.dwp.bz2: Likewise.
* testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/26808
test.

4 years agogdb: restore thread after detaching or killing an inferior
Tankut Baris Aktemur [Thu, 29 Oct 2020 14:33:39 +0000 (15:33 +0100)]
gdb: restore thread after detaching or killing an inferior

The "detach inferiors N" command causes the current inferior to
switch.  E.g.:

  $ gdb a.out
  Reading symbols from a.out...
  (gdb) start
  ...
  (gdb) add-inferior
  [New inferior 2]
  Added inferior 2 on connection 1 (native)
  (gdb) inferior 2
  [Switching to inferior 2 [<null>] (<noexec>)]
  (gdb) info inferiors
    Num  Description       Connection           Executable
    1    process 18242     1 (native)           /path/to/a.out
  * 2    <null>            1 (native)
  (gdb) detach inferiors 1
  Detaching from program: /path/to/a.out, process 18242
  [Inferior 1 (process 18242) detached]
  (gdb) info inferiors
    Num  Description       Connection           Executable
  * 1    <null>                                 /path/to/a.out
    2    <null>            1 (native)
  (gdb)

The same switch happens with the "kill inferiors N" command.  Prevent
it by restoring the current thread.

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

PR gdb/19318
* inferior.c (detach_inferior_command): Restore the current thread.
(kill_inferior_command): Ditto.

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

* gdb.base/kill-detach-inferiors-cmd.exp: Check that 'kill
inferiors' and 'detach inferiors' do not change the current
inferior.

4 years agoFix a potential illegal memory access by objcopy when extracting dwo sections.
Nick Clifton [Thu, 29 Oct 2020 11:17:39 +0000 (11:17 +0000)]
Fix a potential illegal memory access by objcopy when extracting dwo sections.

 PR 26805
 * objcopy.c (is_dwo_section): Check for missing or short section
 names.

4 years ago[gdb/testsuite] Fix DUPLICATEs in gdb.threads/tls.exp
Tom de Vries [Thu, 29 Oct 2020 06:55:46 +0000 (07:55 +0100)]
[gdb/testsuite] Fix DUPLICATEs in gdb.threads/tls.exp

With test-case gdb.threads/tls.exp, we get these:
...
DUPLICATE: gdb.threads/tls.exp: selected thread: 4
DUPLICATE: gdb.threads/tls.exp: selected thread: 2
DUPLICATE: gdb.threads/tls.exp: selected thread: 3
...

Fix these using with_test_prefix.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-29  Tom de Vries  <tdevries@suse.de>

* gdb.threads/tls.exp: Fix DUPLICATEs.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Oct 2020 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years ago[gdb/testsuite] Fix gdb.python/py-symbol.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 20:04:12 +0000 (21:04 +0100)]
[gdb/testsuite] Fix gdb.python/py-symbol.exp with -readnow

When running test-case gdb.python/py-symbol.exp with target board readnow, we
get:
...
FAIL: gdb.python/py-symbol.exp: print line number of rr
FAIL: gdb.python/py-symbol.exp: print value of rr
...

These are FAILs due to PR25857.

Mark these FAILs as KFAILs.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.python/py-symbol.exp: Add KFAILs for -readnow.

4 years ago[gdb/testsuite] Fix re-read FAILs with -readnow
Tom de Vries [Wed, 28 Oct 2020 20:04:12 +0000 (21:04 +0100)]
[gdb/testsuite] Fix re-read FAILs with -readnow

When running the testsuite with target board readnow, we run into:
...
FAIL: gdb.ada/exec_changed.exp: start second
FAIL: gdb.ada/exec_changed.exp: start just first
FAIL: gdb.base/reread.exp: opts= "" "" : run to foo() second time
FAIL: gdb.base/reread.exp: opts= "" "" : second pass: run to foo() second time
FAIL: gdb.base/reread.exp: opts= "-fPIE" "ldflags=-pie" : \
  run to foo() second time
FAIL: gdb.base/reread.exp: opts= "-fPIE" "ldflags=-pie" : second pass: \
  run to foo() second time
...

These are FAILs due to PR26800.

Mark these as KFAILs.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.ada/exec_changed.exp: Add KFAILs for -readnow.
* gdb.base/reread.exp: Same.

4 years ago[gdb/testsuite] Fix gdb.rust/traits.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 20:04:12 +0000 (21:04 +0100)]
[gdb/testsuite] Fix gdb.rust/traits.exp with -readnow

With test-case gdb.rust/traits.exp and target board readnow we get:
...
FAIL: gdb.rust/traits.exp: print *td
FAIL: gdb.rust/traits.exp: print *tu
...

Mark these FAILs as KFAILs.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (readnow): Handle arg.
* gdb.rust/traits.exp: Add KFAILs for -readnow.

4 years ago[gdb/testsuite] Fix gdb.base/relocate.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 20:04:12 +0000 (21:04 +0100)]
[gdb/testsuite] Fix gdb.base/relocate.exp with -readnow

With test-case gdb.base/relocate.exp and target board readnow, we get:
...
FAIL: gdb.base/relocate.exp: symbol-file with offset
FAIL: gdb.base/relocate.exp: add-symbol-file with offset
FAIL: gdb.base/relocate.exp: add-symbol-file with offset, text address given
FAIL: gdb.base/relocate.exp: add-symbol-file with offset, data address given
...

Fix these FAILs by updating the regexps for -readnow.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.base/relocate.exp: Update regexp for -readnow.

4 years ago[gdb/testsuite] Fix gdb.dwarf2/dw2-error.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 20:04:12 +0000 (21:04 +0100)]
[gdb/testsuite] Fix gdb.dwarf2/dw2-error.exp with -readnow

With test-case gdb.dwarf2/dw2-error.exp and target board readnow, we get:
...
FAIL: gdb.dwarf2/dw2-error.exp: break -q main
...

In the normal case, after running into the dwarf error, the minimal symbols
are still available, but with -readnow this is not the case.

Mark the FAIL as KFAIL.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/dw2-error.exp: Mark failure break in main as known with
-readnow.

4 years ago[gdb/symtab] Fix language of frame without debug info
Tom de Vries [Wed, 28 Oct 2020 20:04:12 +0000 (21:04 +0100)]
[gdb/symtab] Fix language of frame without debug info

On openSUSE Leap 15.2, I run into this FAIL with target board readnow and
test-case gdb.dwarf2/dw2-align.exp:
...
(gdb) set lang c++^M
Warning: the current language does not match this frame.^M
(gdb) FAIL: gdb.dwarf2/dw2-align.exp: set lang c++
...

Adding some extra debugging shows that the current language differs without
and with readnow:
...
 Breakpoint 1, 0x00000000004004ab in main ()^M
 (gdb) show lang^M
-The current source language is "auto; currently c".^M
+The current source language is "auto; currently asm".^M
...

This is explained by find_pc_compunit_symtab (0x4004ab) called from
select_frame, which:
- without readnow: returns NULL, and
- with readnow: returns the symtab for the CU crtn.S, wich has language
  "MIPS assembler".

In the former case, the symtab for crtn.S is not expanded, and
find_pc_compunit_symtab hits the default NULL return.  In the latter case, the
symtab for crtn.S is expanded, and the "best match" loop in
find_pc_compunit_symtab returns that symtab as its best match.

The GLOBAL_BLOCK for crtn.S has these outer limits of the address range:
...
(gdb) p /x b.startaddr
$6 = 0x4003c2
(gdb) p /x b.endaddr
$7 = 0x40053d
...
and 0x4004ab indeed fits in that range, which explains why the CU is
considered a match.

However, the actual address ranges for the CU are:
...
    00000040 ffffffffffffffff 0000000000000000 (base address)
    00000040 00000000004003c2 00000000004003c7
    00000040 0000000000400538 000000000040053d
    00000040 <End of list>
...
which confirms that the CU should not be considered a match.

The problem is that the "best match" loop is based on the assumption that a
symtab with a better match will be found, but in this case we don't find a
better match because there's no debug info describing main.

Fix this by preferring to use the addres map in the "best match" loop, which
will accurately tell us that addrmap_find (bv.map, 0x4004ab) == NULL.

Tested on x86_64-linux (that is, openSUSE Leap 15.2), with and without
readnow.  In the case of a readnow run, brings down the number of unexpected
failures from 66 to 38.

The FAIL does not reproduce on f.i. Ubuntu 18.04.5, because there the exec
does not contain debug info for crtn.S.  The dwarf assembly test-case mimics
the scenario described above, and reproduces the FAIL with and without
-readnow, for both mentioned OS configurations.

Also fixes PR25980 - "Overlapping Dwarf Compile Units with non-overlapping
subranges gives incorrect line information".

gdb/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

PR symtab/26772
* symtab.c (find_pc_sect_compunit_symtab): In case there's an address
map, check it in the "best match" loop.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

PR symtab/26772
* gdb.dwarf2/dw2-ranges-overlap.c: New test.
* gdb.dwarf2/dw2-ranges-overlap.exp: New file.

4 years agoUse sha256 for hashes in the release process
Andreas Rammhold [Mon, 26 Oct 2020 03:03:29 +0000 (04:03 +0100)]
Use sha256 for hashes in the release process

I just came across the GDB 10.1 release notes and saw that md5 is still
being used in those. I thought it would be a good idea to instead have a
more modern, secure and wildly available hash function such as SHA256 as
part of the release process.

The changes have been done rather mechnically via sed but executing the
`src-release.sh -b gdb` did work so I am confident about the result.

While this does not directly address the release mails, I was wasn't
able to find the template/script used for those, this is probably still
an improvement.

ChangeLog:
* src-release.sh: Use sha256sum instead of md5sum.

binutils/ChangeLog:
* README-how-to-make-a-release: Use sha256sum instead of md5sum.

Change-Id: I9cf19ea40699137c45463b8514f6e29271af2347

4 years agoaarch64: Add CSR PDEC instruction
Przemyslaw Wirkus [Wed, 28 Oct 2020 14:16:39 +0000 (14:16 +0000)]
aarch64: Add CSR PDEC instruction

This patch adds:
+ New feature +csre to -march command line.
+ New instruction CSR PDEC associated with CSRE feature.

Please note that CSRE system registers were already upstreamed. This patch
should finalize CSRE feature implementation.

CSRE feature adds CSR PDEC (Decrements Call stack pointer by the size of
a Call stack record) instruction. Although this instruction has operand
(PDEC) it's instruction's only operand. PDEC forces instruction field Rt
to be set to 0b1111. This results in fixed opcode of the instruction.

gas/ChangeLog:

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

* NEWS: Update docs.
* config/tc-aarch64.c (parse_csr_operand): New operand parser.
(parse_operands): Call to CSR operand parser.
* testsuite/gas/aarch64/csre_csr-invalid.d: New test.
* testsuite/gas/aarch64/csre_csr-invalid.l: New test.
* testsuite/gas/aarch64/csre_csr-invalid.s: New test.
* testsuite/gas/aarch64/csre_csr.d: New test.
* testsuite/gas/aarch64/csre_csr.s: New test.

include/ChangeLog:

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

* opcode/aarch64.h (AARCH64_FEATURE_CSRE): New -march feature.
(enum aarch64_opnd): New CSR instruction field AARCH64_OPND_CSRE_CSR.

opcodes/ChangeLog:

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

* aarch64-opc.c (aarch64_print_operand): CSR PDEC operand print-out.
* aarch64-tbl.h (CSRE): New CSRE feature handler.
(_CSRE_INSN): New CSRE instruction type.
(struct aarch64_opcode): New 'csre' entry for a CSRE CLI feature.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.

4 years agoaarch64: Add WFET instruction for Armv8.7-a
Przemyslaw Wirkus [Wed, 28 Oct 2020 14:09:25 +0000 (14:09 +0000)]
aarch64: Add WFET instruction for Armv8.7-a

This patch adds new to Armv8.7 WFET instruction which take one operand:

    WFET <Xt>

Where:
    <Xt> is 64-bit name of the general-purpose source register, encoded in the
         "Rd" field.

For more details regarding WFET (Wait For Event with Timeout) instruction for
Armv8.7-a please refer to Arm A64 Instruction set documentation for Armv8-A
architecture profile, see document pages 565 of [0].

[0]: https://developer.arm.com/docs/ddi0596/i

gas/ChangeLog:

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

* NEWS: Update docs.
* testsuite/gas/aarch64/system-5.d: New test.
* testsuite/gas/aarch64/system-5.s: New test.

opcodes/ChangeLog:

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

* aarch64-tbl.h (struct aarch64_opcode): Add new WFET instruction encoding
and operand description.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.

4 years agoaarch64: Add DSB instruction Armv8.7-a variant
Przemyslaw Wirkus [Wed, 28 Oct 2020 14:01:36 +0000 (14:01 +0000)]
aarch64: Add DSB instruction Armv8.7-a variant

This patch adds new variant (nXS) of DSB memory barrier instruction
available in Armv8.7-a. New nXS variant has different encoding in
comparison with pre Armv8.7-a DSB memory barrier variant thus new
instruction and new operand was added.

DSB memory nXS barrier variant specifies the limitation on the barrier
operation. Allowed values are:

DSB SYnXS|#28
DSB ISHnXS|#24
DSB NSHnXS|#20
DSB OSHnXS|#16

Please note that till now,  for barriers, barrier operation was encoded in
4-bit unsigned immediate CRm field (in the range 0 to 15).
For DSB memory nXS barrier variant, barrier operation is a 5-bit unsigned
assembly instruction immediate, encoded in instruction in two bits CRm<3:2>:

CRm<3:2>  #imm
  00       16
  01       20
  10       24
  11       28

This patch extends current AArch64 barrier instructions with above mapping.

Notable patch changes include:
+ New DSB memory barrier variant encoding for Armv8.7-a.
+ New operand BARRIER_DSB_NXS for above instruction in order to
distinguish between existing and new DSB instruction flavour.
+ New set of DSB nXS barrier options.
+ New instruction inserter and extractor map between instruction
immediate 5-bit value and 2-bit CRm field of the instruction itself (see
FLD_CRm_dsb_nxs).
+ Regeneration of aarch64-[asm|dis|opc]-2.c files.
+ Test cases to cover new instruction assembling and disassembling.

For more details regarding DSB memory barrier instruction and its
Armv8.7-a flavour please refer to Arm A64 Instruction set documentation
for Armv8-A architecture profile, see document pages 132-133 of [0].

[0]: https://developer.arm.com/docs/ddi0596/i

gas/ChangeLog:

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

* NEWS: Docs update.
* config/tc-aarch64.c (parse_operands): Add
AARCH64_OPND_BARRIER_DSB_NXS handler.
(md_begin): Add content of aarch64_barrier_dsb_nxs_options to
aarch64_barrier_opt_hsh hash.
* testsuite/gas/aarch64/system-4-invalid.d: New test.
* testsuite/gas/aarch64/system-4-invalid.l: New test.
* testsuite/gas/aarch64/system-4-invalid.s: New test.
* testsuite/gas/aarch64/system-4.d: New test.
* testsuite/gas/aarch64/system-4.s: New test.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New operand
AARCH64_OPND_BARRIER_DSB_NXS.
(aarch64_barrier_dsb_nxs_options): Declare DSB nXS options.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_ins_barrier_dsb_nxs): New inserter.
* aarch64-asm.h (AARCH64_DECL_OPD_INSERTER): New inserter
ins_barrier_dsb_nx.
* aarch64-dis.c (aarch64_ext_barrier_dsb_nxs): New extractor.
* aarch64-dis.h (AARCH64_DECL_OPD_EXTRACTOR): New extractor
ext_barrier_dsb_nx.
* aarch64-opc.c (aarch64_print_operand): New options table
aarch64_barrier_dsb_nxs_options.
* aarch64-opc.h (enum aarch64_field_kind): New field name FLD_CRm_dsb_nxs.
* aarch64-tbl.h (struct aarch64_opcode): Define DSB nXS barrier
Armv8.7-a instruction.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.

4 years agoaarch64: Add basic support for armv8.7-a architecture
Przemyslaw Wirkus [Wed, 28 Oct 2020 13:58:17 +0000 (13:58 +0000)]
aarch64: Add basic support for armv8.7-a architecture

This patch adds support for AArch64 -march=armv8.7-a command line option
in GAS.

Please note that this change ONLY extends -march= command line interface
with a new "armv8.7-a" option. Architectural changes like new instructions
will be added in following patches.

gas/ChangeLog:

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

* NEWS: Docs update.
* config/tc-aarch64.c (armv8.7-a): New arch.
* doc/c-aarch64.texi (-march=armv8.7-a): Update docs.

include/ChangeLog:

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

* opcode/aarch64.h (AARCH64_FEATURE_V8_7): New feature bitmask.
(AARCH64_ARCH_V8_7): New arch feature set.

opcodes/ChangeLog:

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

* aarch64-tbl.h (ARMV8_7): New macro.

4 years agoFix a potential illegal memory access when creating an srec format file.
Nick Clifton [Wed, 28 Oct 2020 11:07:02 +0000 (11:07 +0000)]
Fix a potential illegal memory access when creating an srec format file.

PR 26774
* srec.c (srec_write_symbols): Do not emit symbols in sections
that have been removed from the output.

4 years agoFix compile time warning building with gcc 11.
Nick Clifton [Wed, 28 Oct 2020 10:56:00 +0000 (10:56 +0000)]
Fix compile time warning building with gcc 11.

PR 26795
* elfedit.c (process_archive): Remove spurious call to free().

4 years ago[gdb/testsuite] Fix gdb.cp/nsalias.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 09:01:32 +0000 (10:01 +0100)]
[gdb/testsuite] Fix gdb.cp/nsalias.exp with -readnow

When running test-case gdb.cp/nsalias.exp with target board readnow, we get:
...
FAIL: gdb.cp/nsalias.exp: complaint for too many recursively imported \
  declarations
...

The complaint is not detected, because:
- the complaint is triggered during the file command instead of during
  "print N100::x"
- the "set complaints 1" is not effective because it's issued
  after the file command

Fix the FAIL by setting the complaints limit earlier, and detecting the
complaint also during the file command.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_file_cmd): Set gdb_file_cmd_msg.
* gdb.cp/nsalias.exp: Set complaints limit before file cmd.  Expect
complaint during file command for -readnow.

4 years ago[gdb/testsuite] Fix typo in gdb.cp/nsalias.exp
Tom de Vries [Wed, 28 Oct 2020 09:01:32 +0000 (10:01 +0100)]
[gdb/testsuite] Fix typo in gdb.cp/nsalias.exp

Fix typo "compaint" -> "complaint".

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.cp/nsalias.exp: Fix typo in test name.

4 years ago[gdb/testsuite] Fix gdb.dwarf2/dw2-filename.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 09:01:32 +0000 (10:01 +0100)]
[gdb/testsuite] Fix gdb.dwarf2/dw2-filename.exp with -readnow

When running test-case gdb.dwarf2/dw2-filename.exp with target board -readnow,
we run into:
...
FAIL: gdb.dwarf2/dw2-filename.exp: info sources
...

The normal output is:
...
(gdb) info sources^M
Source files for which symbols have been read in:^M
^M
Source files for which symbols will be read in on demand:^M
^M
src/gdb/testsuite/gdb.dwarf2/file1.txt^M
(gdb)
...
but with -readnow file1.txt appears in the "Source files for which symbols
have been read in" catagory instead, as expected.

Fix the FAIL by making the regexp match the -readnow output.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/dw2-filename.exp: Update regexp for -readnow.

4 years ago[gdb/testsuite] Fix gdb.dwarf2/dw2-stack-boundary.exp with -readnow
Tom de Vries [Wed, 28 Oct 2020 09:01:32 +0000 (10:01 +0100)]
[gdb/testsuite] Fix gdb.dwarf2/dw2-stack-boundary.exp with -readnow

When running test-case gdb.dwarf2/dw2-stack-boundary.exp with target board
readnow, we run into:
...
FAIL: gdb.dwarf2/dw2-stack-boundary.exp: check partial symtab errors
...

The cause for the FAIL is that these complaints are not there:
...
During symbol reading: location description stack underflow^M
During symbol reading: location description stack overflow^M
...

Fix this by KFAILing the complaints for -readnow.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-28  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/dw2-stack-boundary.exp: KFAILing the complaints for
-readnow.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Oct 2020 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years ago[gdb/testsuite] Fix gdb.base/multi-forks.exp timeout with -readnow
Tom de Vries [Tue, 27 Oct 2020 22:17:09 +0000 (23:17 +0100)]
[gdb/testsuite] Fix gdb.base/multi-forks.exp timeout with -readnow

When running test-case gdb.base/multi-forks.exp with target board readnow, we
run into:
...
FAIL: gdb.base/multi-forks.exp: run to exit 1 (timeout)
...

Fix this by using exp_continue.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-10-27  Tom de Vries  <tdevries@suse.de>

* gdb.base/multi-forks.exp: Use exp_continue to fix timeout.