]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 19 Feb 2020 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/testsuite] Be quiet about untested dtrace-prob.exp
Tom de Vries [Tue, 18 Feb 2020 23:05:40 +0000 (00:05 +0100)] 
[gdb/testsuite] Be quiet about untested dtrace-prob.exp

When running gdb.base/dtrace-probe.exp, I get this on stdout/stderr:
...
Running src/gdb/testsuite/gdb.base/dtrace-probe.exp ...
gdb compile failed, ld: error in \
  build/gdb/testsuite/outputs/gdb.base/dtrace-probe/dtrace-probe.o\
  (.eh_frame); no .eh_frame_hdr table will be created
ld: crt1.o: in function `_start':
start.S:110: undefined reference to `main'
ld: build/gdb/testsuite/outputs/gdb.base/dtrace-probe/dtrace-probe-p.o:\
  (.SUNW_dof+0x88): undefined reference to `main'
ld: build/gdb/testsuite/outputs/gdb.base/dtrace-probe/dtrace-probe-p.o:\
  (.SUNW_dof+0xb8): undefined reference to `main'
collect2: error: ld returned 1 exit status

                === gdb Summary ===

nr of untested testcases         1
...

There is no reason to be this verbose about the failure to compile.

Fix this by using quiet as additional option to gdb_compile in
dtrace_build_usdt_test_program.  Note that the error message still occurs in
gdb.log.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* lib/dtrace.exp (dtrace_build_usdt_test_program): Use quiet as
gdb_compile option.

4 years agogdb: change print format of flag enums with value 0
Simon Marchi [Tue, 18 Feb 2020 22:30:51 +0000 (17:30 -0500)] 
gdb: change print format of flag enums with value 0

If a flag enum has value 0 and the enumeration type does not have an
enumerator with value 0, we currently print:

  $1 = (unknown: 0x0)

I don't like the display of "unknown" here, since for flags, 0 is a
an expected value.  It just means that no flags are set.  This patch
makes it so that we print it as a simple 0 in this situation:

  $1 = 0

If there is an enumerator with value 0, it is still printed using that
enumerator, for example (from the test):

  $1 = FE_NONE

gdb/ChangeLog:

* valprint.c (generic_val_print_enum_1): When printing a flag
enum with value 0 and there is no enumerator with value 0, print
just "0" instead of "(unknown: 0x0)".

gdb/testsuite/ChangeLog:

* gdb.base/printcmds.exp (test_print_enums): Update expected
output.

4 years agogdb: print unknown part of flag enum in hex
Simon Marchi [Tue, 18 Feb 2020 22:30:21 +0000 (17:30 -0500)] 
gdb: print unknown part of flag enum in hex

When we print the "unknown" part of a flag enum, it is printed in
decimal.  I think it would be more useful if it was printed in hex, as
it helps to determine which bits are set more than a decimal value.

gdb/ChangeLog:

* valprint.c (generic_val_print_enum_1): Print unknown part of
flag enum in hex.

gdb/testsuite/ChangeLog:

* gdb.base/printcmds.exp (test_print_enums): Expect hex values
for "unknown".

4 years agogdb: allow duplicate enumerators in flag enums
Simon Marchi [Tue, 18 Feb 2020 22:29:23 +0000 (17:29 -0500)] 
gdb: allow duplicate enumerators in flag enums

I have come across some uses cases where it would be desirable to treat
an enum that has duplicate values as a "flag enum".  For example, this
one here [1]:

    enum membarrier_cmd {
            MEMBARRIER_CMD_QUERY                                = 0,
            MEMBARRIER_CMD_GLOBAL                               = (1 << 0),
            MEMBARRIER_CMD_GLOBAL_EXPEDITED                     = (1 << 1),
            MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED            = (1 << 2),
            MEMBARRIER_CMD_PRIVATE_EXPEDITED                    = (1 << 3),
            MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED           = (1 << 4),
            MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE          = (1 << 5),
            MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6),

            /* Alias for header backward compatibility. */
            MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL,
    };

The last enumerator is kept for backwards compatibility.  Without this
patch, this enumeration wouldn't be considered a flag enum, because two
enumerators collide.   With this patch, it would be considered a flag
enum, and the value 3 would be printed as:

  MEMBARRIER_CMD_GLOBAL | MEMBARRIER_CMD_GLOBAL_EXPEDITED

Although if people prefer, we could display both MEMBARRIER_CMD_GLOBAL
and MEMBARRIER_CMD_SHARED in the result.  It wouldn't be wrong, and
could perhaps be useful in case a bit may have multiple meanings
(depending on some other bit value).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/membarrier.h?id=0bf999f9c5e74c7ecf9dafb527146601e5c848b9#n125

gdb/ChangeLog:

* dwarf2/read.c (update_enumeration_type_from_children): Allow
flag enums to contain duplicate enumerators.
* valprint.c (generic_val_print_enum_1): Update comment.

gdb/testsuite/ChangeLog:

* gdb.base/printcmds.c (enum flag_enum): Add FE_TWO_LEGACY
enumerator.

4 years agogdb: fix printing of flag enums with multi-bit enumerators
Simon Marchi [Tue, 18 Feb 2020 22:28:23 +0000 (17:28 -0500)] 
gdb: fix printing of flag enums with multi-bit enumerators

GDB has this feature where if an enum looks like it is meant to
represent binary flags, it will present the values of that type as a
bitwise OR of the flags that are set in the value.

The original motivation for this patch is to fix this behavior:

  enum hello { AAA = 0x1, BBB = 0xf0 };

  (gdb) p (enum hello) 0x11
  $1 = (AAA | BBB)

This is wrong because the bits set in BBB (0xf0) are not all set in the
value 0x11, but GDB presents it as if they all were.

I think that enumerations with enumerators that have more than one bit
set should simply not qualify as "flag enum", as far as this
heuristic is concerned.  I'm not sure what it means to have flags of
more than one bit.  So this is what this patch implements.

I have added an assert in generic_val_print_enum_1 to make sure the flag
enum types respect that, in case they are used by other debug info
readers, in the future.

I've enhanced the gdb.base/printcmds.exp test to cover this case.  I've
also added tests for printing flag enums with value 0, both when the
enumeration has and doesn't have an enumerator for value 0.

gdb/ChangeLog:

* dwarf2/read.c: Include "count-one-bits.h".
(update_enumeration_type_from_children): If an enumerator has
multiple bits set, don't treat the enumeration as a "flag enum".
* valprint.c (generic_val_print_enum_1): Assert that enumerators
of flag enums have 0 or 1 bit set.

gdb/testsuite/ChangeLog:

* gdb.base/printcmds.c (enum flag_enum): Prefix enumerators with
FE_, add FE_NONE.
(three): Update.
(enum flag_enum_without_zero): New enum.
(flag_enum_without_zero): New variable.
(enum not_flag_enum): New enum.
(three_not_flag): New variable.
* gdb.base/printcmds.exp (test_artificial_arrays): Update.
(test_print_enums): Add more tests for printing flag enums.

4 years agoFix build with gcc-4.8.x
Bernd Edlinger [Sun, 16 Feb 2020 20:43:33 +0000 (21:43 +0100)] 
Fix build with gcc-4.8.x

Use an explicit conversion from unique_ptr<T> to
displaced_step_closure_up to avoid a compiler bug
with gcc-4.8.4:

../../binutils-gdb/gdb/amd64-tdep.c:1514:10: error: cannot bind
   'std::unique_ptr<amd64_displaced_step_closure>' lvalue to
   'std::unique_ptr<amd64_displaced_step_closure>&&'

gdb:
2020-02-18  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Use an explicit
conversion.
* amd64-tdep.c (amd64_displaced_step_copy_insn): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
* s390-tdep.c (s390_displaced_step_copy_insn): Likewise.

4 years agogdb: update email address for Palmer Dabbelt
Simon Marchi [Tue, 18 Feb 2020 19:37:18 +0000 (14:37 -0500)] 
gdb: update email address for Palmer Dabbelt

gdb/ChangeLog:

* MAINTAINERS: Change palmer@sifive.com to palmer@dabbelt.com.

4 years ago[gdb/testsuite] Handle missing gnatmake in gnat_runtime_has_debug_info
Tom de Vries [Tue, 18 Feb 2020 09:18:36 +0000 (10:18 +0100)] 
[gdb/testsuite] Handle missing gnatmake in gnat_runtime_has_debug_info

After de-installing gnatmake, I get on stdout/stderr:
...
Running src/gdb/testsuite/gdb.base/gdb-caching-proc.exp ...
FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary
  ...
FAIL: gdb-caching-proc.exp: failed to compile gnat-debug-info test binary
...

In gdb.sum, we see these FAILs (each paired with an UNSUPPORTED as well)
followed by:
...
PASS: gdb-caching-proc.exp: gnat_runtime_has_debug_info consistency
...

Likewise, after re-installing gnatmake, I get a PASS for each of the
UNSUPPORTEDs, and the FAILs disappear.

The FAIL comes from gnat_runtime_has_debug_info, the PASS/UNSUPPORTED comes
from gdb_compile_ada.

Fix this by removing the corresponding fail call in
gnat_runtime_has_debug_info, as well as using a new variant gdb_compile_ada_1
that doesn't call pass/unsupported.

Tested on x86_64-linux, with gnatmake installed and de-installed.

gdb/testsuite/ChangeLog:

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

* lib/ada.exp (gdb_compile_ada_1): Factor out of ...
(gdb_compile_ada): ... here.
(gnat_runtime_has_debug_info): Remove fail call for gdb_compile_ada
failure.  Use gdb_compile_ada_1 instead of gdb_compile_ada.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Feb 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix gdbserver-without-gdb build
Tom Tromey [Mon, 17 Feb 2020 17:00:26 +0000 (10:00 -0700)] 
Fix gdbserver-without-gdb build

An earlier patch changed gdbserver to use the already-built top-level
gnulib and gdbsupport.  However, if one did a build that did not
include gdb, then gdbserver would fail to build.

The problem is that configure.ac only adds gnulib and gdbsupport to
the build when gdb is being built.  This patch fixes the problem by
arranging for this to happen when gdbserver is built.

ChangeLog
2020-02-17  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.
* configure.ac (configdirs): Add gnulib and gdbsupport when building
gdbserver.

4 years agox86: Remove CpuABM and add CpuPOPCNT
H.J. Lu [Mon, 17 Feb 2020 15:12:10 +0000 (07:12 -0800)] 
x86: Remove CpuABM and add CpuPOPCNT

AMD ABM has 2 instructions: popcnt and lzcnt.  ABM CPUID feature bit has
been reused for lzcnt and a POPCNT CPUID feature bit is added for popcnt
which used to be the part of SSE4.2.  This patch removes CpuABM and adds
CpuPOPCNT.  It changes ABM to enable both lzcnt and popcnt, changes SSE4.2
to also enable popcnt.

gas/

* config/tc-i386.c (cpu_arch): Add .popcnt.
* doc/c-i386.texi: Remove abm and .abm.  Add popcnt and .popcnt.
Add a tab before @samp{.sse4a}.

opcodes/

* i386-gen.c (cpu_flag_init): Replace CpuABM with
CpuLZCNT|CpuPOPCNT.  Add CpuPOPCNT to CPU_SSE4_2_FLAGS.  Add
CPU_POPCNT_FLAGS.
(cpu_flags): Remove CpuABM.  Add CpuPOPCNT.
* i386-opc.h (CpuABM): Removed.
(CpuPOPCNT): New.
(i386_cpu_flags): Remove cpuabm.  Add cpupopcnt.
* i386-opc.tbl: Replace CpuABM|CpuSSE4_2 with CpuPOPCNT on
popcnt.  Remove CpuABM from lzcnt.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

4 years agox86: fold certain VCVT{,U}SI2S{S,D} templates
Jan Beulich [Mon, 17 Feb 2020 07:59:52 +0000 (08:59 +0100)] 
x86: fold certain VCVT{,U}SI2S{S,D} templates

There don't really need to be separate Cpu64 and CpuNo64 templates for
these. One small issue with this is that slightly strange code

.intel_syntax noprefix
.code16
.arch i286
.arch .avx
vcvtsi2sd xmm0, xmm0, dword ptr [bx]
vcvtsi2sd xmm0, xmm0, qword ptr [bx]

vcvtsi2sd xmm0, xmm0, ebx
vcvtsi2sd xmm0, xmm0, rbx

now will match in behavior with the AVX512 counterparts in that not
only the 2nd vcvtsi2sd won't assemble, but also the first. The last
two, otoh, will continue to assemble fine (due to the lack of any
memory operand size specifier). As a result, another way to make
things behave more consistently would be to avoid the folding and
add IgnoreSize to the CpuNo64 AVX512 variants. A 3rd way to do so
would be to add Cpu386 to any such insn template.

While doing this also make the usual cosmetic adjustments for the
insns touched anyway. Additionally drop the redundant Cpu64 from
the SAE forms of VCVT{,U}SI2SD - they won't assemble outside of
64-bit mode due to there not being anything to match the Reg64
operand.

4 years agox86: fold AddrPrefixOpReg templates
Jan Beulich [Mon, 17 Feb 2020 07:59:07 +0000 (08:59 +0100)] 
x86: fold AddrPrefixOpReg templates

There's no need to have separate Cpu64 and CpuNo64 templates: There
already is special logic handling the attribute, and all that's needed
is rejecting 16-bit address registers in 64-bit mode. Suppress suffix
guessing and group all involved logic together, outside of suffix
processing (arguably it doesn't even belong in process_suffix()).

Also, since no AddrPrefixOpReg template permits any suffixes, move the
No_*Suf specifiers for them to a central place. Along with this drop
the no longer relevant NoRex64 from there.

4 years agox86/Intel: don't swap operands of MONITOR{,X} and MWAIT{,X}
Jan Beulich [Mon, 17 Feb 2020 07:57:54 +0000 (08:57 +0100)] 
x86/Intel: don't swap operands of MONITOR{,X} and MWAIT{,X}

Generally, the documentation doesn't allow for any explicit operands
to be specified with MONITOR/MWAIT. To permit the more legible
overriding of the address size via specifying operands, the option is
being retained even in Intel mode, but operand swapping is being
suppressed by this patch. This is both because it makes no sense here
(all of the operands are inputs) and because, as a result, old gcc
(prior to 4.8) actually expects it this way with -mintel-syntax (and
hence gets fixed by this change rather than, as claimed by a reply in
the bug report, broken).

4 years agox86/Intel: improve diagnostics for ambiguous VCVT* operands
Jan Beulich [Mon, 17 Feb 2020 07:56:18 +0000 (08:56 +0100)] 
x86/Intel: improve diagnostics for ambiguous VCVT* operands

Conversions which shrink element size and which have a memory source
can't be disambiguated between their 128- and 256-bit variants by
looking at the register operand. "operand size mismatch", however, is a
pretty misleading diagnostic. Generalize the logic introduced for
VFPCLASSP{S,D} such that, with suitable similar adjustments to the
respective templates, it'll cover these cases too.

For VCVTNEPS2BF16 also fold the two previously separate AVX512VL
templates to achieve the intended effect. This is then also accompanied
by a respective addition to the inval-avx512f testcase.

4 years agox86: Don't disable SSE3 when disabling SSE4a
H.J. Lu [Mon, 17 Feb 2020 04:10:20 +0000 (20:10 -0800)] 
x86: Don't disable SSE3 when disabling SSE4a

Since SSE3 is independent of SSE4a, don't disable SSE3 when disabling
SSE4a.

* i386-gen.c (cpu_flag_init): Remove CPU_ANY_SSE3_FLAGS from
CPU_ANY_SSE4A_FLAGS.

4 years agoRe: x86: Don't disable SSE4a when disabling SSE4
Alan Modra [Mon, 17 Feb 2020 01:07:38 +0000 (11:37 +1030)] 
Re: x86: Don't disable SSE4a when disabling SSE4

* i386-gen.c (cpu_flag_init): Correct last change.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Feb 2020 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agox86: Don't disable SSE4a when disabling SSE4
H.J. Lu [Sun, 16 Feb 2020 16:36:51 +0000 (08:36 -0800)] 
x86: Don't disable SSE4a when disabling SSE4

commit 7deea9aad8 changed nosse4 to include CpuSSE4a.  But AMD SSE4a is
a superset of SSE3 and Intel SSE4 is a superset of SSSE3.  Disable Intel
SSE4 shouldn't disable AMD SSE4a.  This patch restores nosse4.  It also
adds .sse4a and nosse4a.

gas/

* config/tc-i386.c (cpu_arch): Add .sse4a and nosse4a.  Restore
nosse4.
* doc/c-i386.texi: Document sse4a and nosse4a.

opcodes/

* i386-gen.c (cpu_flag_init): Add CPU_ANY_SSE4A_FLAGS.  Remove
CPU_ANY_SSE4_FLAGS.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Feb 2020 00:01:29 +0000 (00:01 +0000)] 
Automatic date update in version.in

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

4 years agogdb: introduce displaced_step_closure_up type alias
Simon Marchi [Fri, 14 Feb 2020 21:45:40 +0000 (16:45 -0500)] 
gdb: introduce displaced_step_closure_up type alias

To help with readability, add the type displaced_step_closure_up, an
alias for std::unique_ptr<displaced_step_closure>, and use it throughout
the code base.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Use
displaced_step_closure_up.
* aarch64-tdep.h (aarch64_displaced_step_copy_insn): Likewise.
(struct displaced_step_closure_up):
* amd64-tdep.c (amd64_displaced_step_copy_insn): Likewise.
* amd64-tdep.h (amd64_displaced_step_copy_insn): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn):
Likewise.
* gdbarch.sh (displaced_step_copy_insn): Likewise.
* gdbarch.c, gdbarch.h: Re-generate.
* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Use
displaced_step_closure_up.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
* i386-tdep.h (i386_displaced_step_copy_insn): Likewise.
* infrun.h (displaced_step_closure_up): New type alias.
(struct displaced_step_inferior_state) <step_closure>: Change
type to displaced_step_closure_up.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Use
displaced_step_closure_up.
* s390-tdep.c (s390_displaced_step_copy_insn): Likewise.

4 years agoChange gdbserver to use existing gnulib and libiberty
Tom Tromey [Fri, 14 Feb 2020 21:34:20 +0000 (14:34 -0700)] 
Change gdbserver to use existing gnulib and libiberty

This changes gdbserver so that it no longer builds its own gnulib and
libiberty.  Instead, it now relies on the ones that were already built
at the top level.

gdbsupport is still built specially for gdbserver.  This is more
complicated and will be tackled in a subsequent patch.

ChangeLog
2020-02-14  Tom Tromey  <tom@tromey.com>

* Makefile.in: Rebuild.
* Makefile.def: Make gdbserver require gnulib and libiberty.

gdbserver/ChangeLog
2020-02-14  Tom Tromey  <tom@tromey.com>

* acinclude.m4: Don't include acx_configure_dir.m4.
* Makefile.in (LIBIBERTY_BUILDDIR, GNULIB_BUILDDIR): Update.
(SUBDIRS, CLEANDIRS, REQUIRED_SUBDIRS): Remove.
(all, install-only, uninstall, clean-info, clean)
(maintainer-clean): Don't recurse.
(subdir_do, all-lib): Remove.
($(LIBGNU) $(LIBIBERTY) $(GNULIB_H)): Remove rule.
(GNULIB_H): Remove.
(generated_files): Update.
($(GNULIB_BUILDDIR)/Makefile): Remove rule.
* configure: Rebuild.
* configure.ac: Don't configure gnulib or libiberty.
(GNULIB): Update.

gdbsupport/ChangeLog
2020-02-14  Tom Tromey  <tom@tromey.com>

* common-defs.h: Change path to gnulib/config.h.

Change-Id: I469cbbf5db2ab37109c058e9e3a1e4f4dabdfc98

4 years agoCache .gnu_debugdata BFD
Tom Tromey [Fri, 14 Feb 2020 21:16:23 +0000 (14:16 -0700)] 
Cache .gnu_debugdata BFD

While looking at the output of "maint info bfd" with multiple
inferiors, I noticed that there were duplicate entries for
.gnu_debugdata.

There is no reason to re-create this BFD each time it is needed.  This
patch arranges to share the data.

gdb/ChangeLog
2020-02-14  Tom Tromey  <tom@tromey.com>

* minidebug.c (gnu_debug_key): New global.
(find_separate_debug_file_in_section): Use it.

Change-Id: If139f89f0f07db33f399afdbcfbf5aaeffe4de46

4 years agoHave testsuite find gdbserver in new location
Tom Tromey [Fri, 14 Feb 2020 21:14:38 +0000 (14:14 -0700)] 
Have testsuite find gdbserver in new location

This updates the gdb testsuite to look for gdbserver in its new
location.  The old location is also checked for, on the theory that
perhaps someone sets GDB to a full path for install testing.

gdb/testsuite/ChangeLog
2020-02-14  Tom Tromey  <tom@tromey.com>

* lib/gdbserver-support.exp (find_gdbserver): Find gdbserver in
build directory.
* boards/gdbserver-base.exp: Update path to gdbserver.

Change-Id: If03db762ba53882ddfaf2d2d516de14c3fa03938

4 years agogdb: make gdbarch_displaced_step_copy_insn return an std::unique_ptr
Simon Marchi [Fri, 14 Feb 2020 20:29:08 +0000 (15:29 -0500)] 
gdb: make gdbarch_displaced_step_copy_insn return an std::unique_ptr

This callback dynamically allocates a specialized displaced_step_closure, and
gives the ownership of the object to its caller.  So I think it would make
sense for the callback to return an std::unique_ptr, this is what this patch
implements.

gdb/ChangeLog:

* gdbarch.sh (displaced_step_copy_insn): Change return type to an
std::unique_ptr.
* gdbarch.c: Re-generate.
* gdbarch.h: Re-generate.
* infrun.c (displaced_step_prepare_throw): Adjust to std::unique_ptr
change.
* aarch64-tdep.c (aarch64_displaced_step_copy_insn): Change return
type to std::unique_ptr.
* aarch64-tdep.h (aarch64_displaced_step_copy_insn): Likewise.
* amd64-tdep.c (amd64_displaced_step_copy_insn): Likewise.
* amd64-tdep.h (amd64_displaced_step_copy_insn): Likewise.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise.
* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
* i386-tdep.h (i386_displaced_step_copy_insn): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
* s390-tdep.c (s390_displaced_step_copy_insn): Likewise.

4 years agogdb: cleanup of displaced_step_inferior_state::reset/displaced_step_clear
Simon Marchi [Fri, 14 Feb 2020 20:11:58 +0000 (15:11 -0500)] 
gdb: cleanup of displaced_step_inferior_state::reset/displaced_step_clear

displaced_step_inferior_state::reset and displaced_step_clear appear to
have the same goal, but they don't do the same thing.
displaced_step_inferior_state::reset clears more things than
displaced_step_clear, but it misses free'ing the closure, which
displaced_step_clear does.

This patch replaces displaced_step_clear's implementation with just a call to
displaced_step_inferior_state::reset.  It then changes
displaced_step_inferior_state::step_closure to be a unique_ptr, to indicate the
fact that displaced_step_inferior_state owns the closure (and so that it is
automatically freed when the field is reset).

The test gdb.base/step-over-syscall.exp caught a problem when doing this, which
I consider to be a latent bug which my cleanup exposes.  In
handle_inferior_event, in the TARGET_WAITKIND_FORKED case, if we displaced-step
over a fork syscall, we make sure to restore the memory that we used as a
displaced-stepping buffer in the child.  We do so using the
displaced_step_inferior_state of the parent.  However, we do it after calling
displaced_step_fixup for the parent, which clears the information in the
parent's displaced_step_inferior_state.  It worked fine before, because
displaced_step_clear didn't completely clear the displaced_step_inferior_state
structure, so the required information (in this case the gdbarch) was
still available after clearing.

I fixed it by making GDB restore the child's memory before calling the
displaced_step_fixup on the parent.  This way, the data in the
displaced_step_inferior_state structure is still valid when we use it for the
child.  This is the error you would get in
gdb.base/step-over-syscall.exp without this fix:

    /home/smarchi/src/binutils-gdb/gdb/gdbarch.c:3911: internal-error: ULONGEST gdbarch_max_insn_length(gdbarch*): Assertion `gdbarch != NULL' failed.

gdb/ChangeLog:

* infrun.c (get_displaced_step_closure_by_addr): Adjust to
std::unique_ptr.
(displaced_step_clear): Rename to...
(displaced_step_reset): ... this.  Just call displaced->reset ().
(displaced_step_clear_cleanup): Rename to...
(displaced_step_reset_cleanup): ... this.
(displaced_step_prepare_throw): Adjust to std::unique_ptr.
(displaced_step_fixup): Likewise.
(resume_1): Likewise.
(handle_inferior_event): Restore child's memory before calling
displaced_step_fixup on the parent.
* infrun.h (displaced_step_inferior_state) <reset>: Adjust
to std::unique_ptr.
<step_closure>: Change type to std::unique_ptr.

4 years agognulib: import count-one-bits module and use it
Simon Marchi [Fri, 14 Feb 2020 19:41:07 +0000 (14:41 -0500)] 
gnulib: import count-one-bits module and use it

For a fix I intend to submit, I would need a function that counts the
number of set bits in a word.  There is  __builtin_popcount that is
supported by gcc and clang, but there is also a gnulib module that wraps
that and provides a fallback for other compilers, so I think it would be
good to use it.

I also noticed that there is a bitcount function in arch/arm.c, so I
thought that as a first step I would replace that one with the gnulib
count-one-bits module.  This is what this patch does.

The gnulib module provides multiple functions, with various parameter
length (unsigned int, unsigned long int, unsigned long long int), I
chose the one that made sense for each call site based on the argument
type.

gnulib/ChangeLog:

* update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import
count-one-bits module.
* configure: Re-generate.
* aclocal.m4: Re-generate.
* Makefile.in: Re-generate.
* import/count-one-bits.c: New file.
* import/count-one-bits.h: New file.
* import/Makefile.am: Re-generate.
* import/Makefile.in: Re-generate.
* import/m4/gnulib-cache.m4: Re-generate.
* import/m4/gnulib-comp.m4: Re-generate.
* import/m4/count-one-bits.m4: New file.

gdb/ChangeLog:

* arm-tdep.c: Include count-one-bits.h.
(cleanup_block_store_pc): Use count_one_bits.
(cleanup_block_load_pc): Use count_one_bits.
(arm_copy_block_xfer): Use count_one_bits.
(thumb2_copy_block_xfer): Use count_one_bits.
(thumb_copy_pop_pc_16bit): Use count_one_bits.
* arch/arm-get-next-pcs.c: Include count-one-bits.h.
(thumb_get_next_pcs_raw): Use count_one_bits.
(arm_get_next_pcs_raw): Use count_one_bits_l.
* arch/arm.c (bitcount): Remove.
* arch/arm.h (bitcount): Remove.

4 years agoReturn unique_xmalloc_ptr from call_site_find_chain
Tom Tromey [Fri, 14 Feb 2020 16:24:42 +0000 (09:24 -0700)] 
Return unique_xmalloc_ptr from call_site_find_chain

call_site_find_chain returns a pointer that the caller must
deallocate.  It seemed better here to return a unique_xmalloc_ptr
instead.

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

* dwarf2/frame-tailcall.c (dwarf2_tailcall_sniffer_first):
Update.
* dwarf2/loc.h (call_site_find_chain): Return unique_xmalloc_ptr.
* dwarf2/loc.c (call_site_find_chain_1): Return
unique_xmalloc_ptr.
(call_site_find_chain): Likewise.

4 years agoRemove the old movsx and movzx documentation for AT&T syntax
H.J. Lu [Fri, 14 Feb 2020 14:09:28 +0000 (06:09 -0800)] 
Remove the old movsx and movzx documentation for AT&T syntax

* doc/c-i386.texi: Remove the old movsx and movzx documentation
for AT&T syntax.

4 years agoRemove Intel syntax comments on movsx and movzx
H.J. Lu [Fri, 14 Feb 2020 13:40:19 +0000 (05:40 -0800)] 
Remove Intel syntax comments on movsx and movzx

Since movsx and movzx are valid mnemonic in AT&T syntax, remove Intel
syntax comments on movsx and movzx to avoid confusing other readers.

* i386-opc.tbl (movsx): Remove Intel syntax comments.
(movzx): Likewise.

4 years agox86: replace adhoc (partly wrong) ambiguous operand checking for MOVSX/MOVZX
Jan Beulich [Fri, 14 Feb 2020 13:27:28 +0000 (14:27 +0100)] 
x86: replace adhoc (partly wrong) ambiguous operand checking for MOVSX/MOVZX

For these to get treatment consistent with other operand size checking
the special logic shouldn't live in md_assemble(), but process_suffix().
And there's more logic involved than simply zapping the suffix.

Note however that MOVS[BW]* and MOVZ[BW]* still won't be fully
consistent, due to the objection to fold MOVS* templates just like was
done for MOVZ* in c07315e0c6 ("x86: allow suffix-less movzw and 64-bit
movzb").

Note further that it is against my own intentions to have MOVSX/MOVZX
silently default to a byte source in AT&T mode. This should happen only
when the destination register is a 16-bit one. In all other cases there
is an ambiguity, and the user should be warned. But it was explicitly
requested for this to be done in a way inconsistent with everything
else.

Note finally that the assembler change points out (and this patch fixes)
a wrong Intel syntax test introduced by bc31405ebb2c ("x86-64: Properly
encode and decode movsxd"): When source code specifies a 16-bit
destination register, disassembly expectations shouldn't have been to
find a 32-bit one.

4 years agox86: adjust segment override prefix emission
Jan Beulich [Fri, 14 Feb 2020 13:04:23 +0000 (14:04 +0100)] 
x86: adjust segment override prefix emission

Since we already suppress the prefix altogether when it's the default
one for the chosen addressing mode, let's do so also when instruction
prefix and override specified with the memory operand match. (Note that
insn prefix specified segment overrides never get discarded.)

4 years agox86: optimize away pointless segment overrides
Jan Beulich [Fri, 14 Feb 2020 13:03:19 +0000 (14:03 +0100)] 
x86: optimize away pointless segment overrides

When optimizing there's no point keeping the segment overrides when we
warn about their presence in the first place.

4 years agox86: extend LEA's segment override warning
Jan Beulich [Fri, 14 Feb 2020 13:02:05 +0000 (14:02 +0100)] 
x86: extend LEA's segment override warning

For one both possible forms should be warned about. And then, to guard
against future surprises, qualify the original opcode check by excluding
VEX/EVEX-like templates.

4 years agox86: Document movsx/movsxd/movzx for AT&T syntax
H.J. Lu [Fri, 14 Feb 2020 12:57:01 +0000 (04:57 -0800)] 
x86: Document movsx/movsxd/movzx for AT&T syntax

Document different mnemonics of movsx, movsxd and movzx in AT&T syntax.

PR gas/25438
* doc/c-i386.texi: Document movsx, movsxd and movzx for AT&T
syntax.

4 years agoFix argv[] in programs invoked by gdbserver on MS-Windows
Eli Zaretskii [Fri, 14 Feb 2020 09:53:55 +0000 (11:53 +0200)] 
Fix argv[] in programs invoked by gdbserver on MS-Windows

gdbserver/ChangeLog
2020-02-14  Eli Zaretskii  <eliz@gnu.org>

* win32-low.c (create_process): Prepend PROGRAM to ARGS when
preparing the command line for CreateProcess.
(win32_create_inferior): Reflect the program name in debugging
output that shows the process and its command line.

4 years ago[gdb] Speedup lnp_state_machine::handle_special_opcode
Richard Biener [Fri, 14 Feb 2020 07:32:53 +0000 (08:32 +0100)] 
[gdb] Speedup lnp_state_machine::handle_special_opcode

I see for some program at gdb startup:
...
Samples: 102K of event 'cycles:pu', Event count (approx.): 91710925103
Overhead  Command     Shared Object        Symbol
  15.21%  gdb         gdb                  [.]
lnp_state_machine::handle_special
...
where the divisions are the places we stall.  The following
micro-optimizes things but it smells like m_line_header->line_range
is constant, likewise probably m_line_header->maximum_ops_per_instruction
so eventually the divisions could be avoided completely with some
lookup table.

Well.  Micro-optimizing with this patch improves things
(don't expect [load] CSE over the gdbarch_adjust_dwarf2_line call).

Build and reg-tested on x86_64-linux.

gdb/ChangeLog:

2020-02-14  Richard Biener  <rguenther@suse.de>

* dwarf2/read.c (lnp_state_machine::handle_special_opcode): Apply CSE
on expression with division operators.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 14 Feb 2020 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agox86: Resolve PLT32 reloc aganst local symbol to section
H.J. Lu [Thu, 13 Feb 2020 21:44:17 +0000 (13:44 -0800)] 
x86: Resolve PLT32 reloc aganst local symbol to section

Since PLT entry isn't needed for branch to local symbol, we can resolve
R_386_PLT32/R_X86_64_PLT32 relocation aganst local symbol to section,
similar to R_386_PC32/R_X86_64_PC32.

2020-02-13  Fangrui Song   <maskray@google.com>
    H.J. Lu  <hongjiu.lu@intel.com>

PR gas/25551
* config/tc-i386.c (tc_i386_fix_adjustable): Don't check
BFD_RELOC_386_PLT32 nor BFD_RELOC_X86_64_PLT32.
* testsuite/gas/i386/i386.exp: Run relax-5 and x86-64-relax-4.
* testsuite/gas/i386/relax-5.d: New file.
* testsuite/gas/i386/relax-5.s: Likewise.
* testsuite/gas/i386/x86-64-relax-4.d: Likewise.
* testsuite/gas/i386/x86-64-relax-4.s: Likewise.

4 years agogdbserver: rename source files to .cc
Simon Marchi [Thu, 13 Feb 2020 21:27:51 +0000 (16:27 -0500)] 
gdbserver: rename source files to .cc

For the same reasons outlined in the previous patch, this patch renames
gdbserver source files to .cc.

I have moved the "-x c++" switch to only those rules that require it.

gdbserver/ChangeLog:

* Makefile.in: Rename source files from .c to .cc.
* %.c: Rename to %.cc.
* configure.ac: Rename server.c to server.cc.
* configure: Re-generate.

4 years agogdbsupport: rename source files to .cc
Simon Marchi [Thu, 13 Feb 2020 21:27:02 +0000 (16:27 -0500)] 
gdbsupport: rename source files to .cc

This patch renames the .c source files in gdbsupport to .cc.

In the gdb directory, there is an argument against renaming the source
files, which is that it makes using some git commands more difficult to
do archeology.  Some commands have some kind of "follow" option that
makes git try to follow renames, but it doesn't work in all situations.

Given that we have just moved the gdbsupport directory, that argument
doesn't hold for source files in that directory.  I therefore suggest
renaming them to .cc, so that they are automatically recognized as C++
by various tools and editors.

The original motivation behind this is that when building gdbsupport
with clang, I get:

      CC       agent.o
    clang: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

In the gdb/ directory, we make clang happy by passing "-x c++".  We
could do this in gdbsupport too, but I think that renaming the files is
a better long-term solution.

gdbserver still does its own build of gdbsupport, so a few changes in
its Makefile are necessary.

gdbsupport/ChangeLog:

* Makefile.am: Rename source files from .c to .cc.
(CC, CFLAGS): Don't override.
(AM_CFLAGS): Rename to ...
(AM_CXXFLAGS): ... this.
* Makefile.in: Re-generate.
* %.c: Rename to %.cc.

gdbserver/ChangeLog:

* Makefile.in: Rename gdbsupport source files from .c to .cc.

4 years ago[gdb/testsuite] Remove stale exec in gdb_compile_ada
Tom de Vries [Thu, 13 Feb 2020 14:42:07 +0000 (15:42 +0100)] 
[gdb/testsuite] Remove stale exec in gdb_compile_ada

When running test-case gdb.ada/ptype_tagged_param.exp, I get:
...
PASS: gdb.ada/ptype_tagged_param.exp: compilation foo.adb
...

However, when I then de-install gnatmake and run again, I get the same result.
This is due to a stale exec. After removing the stale exec, I get:
...
UNSUPPORTED: gdb.ada/ptype_tagged_param.exp: compilation foo.adb
...

Fix this removing the stale exec in gdb_compile_ada before compilation.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* lib/ada.exp (gdb_compile_ada): Delete stale exec before compilation.

4 years ago[gdb/testsuite] Add unsupported tests in catch_ex_std.exp
Tom de Vries [Thu, 13 Feb 2020 14:34:06 +0000 (15:34 +0100)] 
[gdb/testsuite] Add unsupported tests in catch_ex_std.exp

If I de-install gnatbind, I run into:
...
FAIL: gdb.ada/catch_ex_std.exp: gnatbind foo
...

Fix this by marking the test unsupported instead:
...
UNSUPPORTED: gdb.ada/catch_ex_std.exp: gnatbind foo
...

Likewise for gnatlink.

Tested on x86_64-linux, with and without gnatbind/gnatlink installed.

gdb/testsuite/ChangeLog:

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

* gdb.ada/catch_ex_std.exp: Indicate unsupported if gnatbind/gnatlink
are missing.

4 years agoplugin: Search bfd-plugins directories only once
H.J. Lu [Thu, 13 Feb 2020 11:17:51 +0000 (03:17 -0800)] 
plugin: Search bfd-plugins directories only once

try_load_plugin is updated to take either plugin name or plugin entry.
load_plugin is updated to search bfd-plugins directories first to build
a list of plugins and call try_load_plugin with each plugin on the list.
When --plugin is used, the plugin list only has one entry.

* plugin.c (try_load_plugin): Make plugin_list_iter an argument
and use it if it isn't NULL.  Remove has_plugin_p argument.  Add
a build_list_p argument.  Don't search plugin_list.  Short circuit
when building the plugin list.
(has_plugin): Renamed to has_plugin_list.
(bfd_plugin_set_plugin): Don't set has_plugin.
(bfd_plugin_specified_p): Check plugin_list instead.
(build_plugin_list): New function.
(load_plugin): Call build_plugin_list and use plugin_list.

4 years agoAdding myself to gdb/MAINTAINERS
Alok Kumar Sharma [Thu, 13 Feb 2020 10:26:11 +0000 (15:56 +0530)] 
Adding myself to gdb/MAINTAINERS

2020-02-13  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>

* MAINTAINERS (Write After Approval): Adding myself.

Change-Id: I2e6095a63247902f5fe23d58c2df8f995e41cf58

4 years agox86: fix SSE4a dependencies of ".arch .nosse*"
Jan Beulich [Thu, 13 Feb 2020 09:19:28 +0000 (10:19 +0100)] 
x86: fix SSE4a dependencies of ".arch .nosse*"

Since ".arch .sse4a" enables SSE3 and earlier, disabling SSE3 should
also disable SSE4a. And as per its name, ".arch .nosse4" should also do
so.

4 years ago[gdb/testsuite] Fix gnatmake_version_at_least
Tom de Vries [Thu, 13 Feb 2020 07:37:34 +0000 (08:37 +0100)] 
[gdb/testsuite] Fix gnatmake_version_at_least

After de-installing gnatmake, I get:
...
Running src/gdb/testsuite/gdb.ada/rename_subscript_param.exp ...
ERROR: tcl error sourcing src/gdb/testsuite/gdb.ada/rename_subscript_param.exp.
ERROR: couldn't execute "gnatmake": no such file or directory
    while executing
"exec $gnatmake --version"
    (procedure "gnatmake_version_at_least" line 4)
...

Fix this by wrapping the exec call in a catch call.

Tested with and withouth gnatmake installed on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* lib/ada.exp (gnatmake_version_at_least): Wrap exec call in a catch
call.

4 years agoRemove some dead code from event-loop.c
Tom Tromey [Thu, 13 Feb 2020 00:05:42 +0000 (17:05 -0700)] 
Remove some dead code from event-loop.c

This removes some dead code from event-loop.c.

This patch is from my old series to merge the gdb and gdbserver event
loops; but since it is just removing dead code, it seemed simple to
commit it separately.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* event-loop.c (event_data, gdb_event, event_handler_func):
Remove.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 13 Feb 2020 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoMove the frame data to the BFD when possible
Tom Tromey [Wed, 12 Feb 2020 22:45:08 +0000 (15:45 -0700)] 
Move the frame data to the BFD when possible

Now that comp_unit and the remaining frame data are all independent of
the objfile, it can all be stored on the BFD and shared across
inferiors.

As with other code doing this same thing, care must be taken to not
share the data when the objfile requires relocations.  So, two keys
are used: one for the BFD and one for the objfile, and
gdb_bfd_requires_relocations is used to differentiate between the two
cases.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/frame.c (dwarf2_frame_bfd_data): New global.
(dwarf2_frame_objfile_data): Add comment.
(find_comp_unit, set_comp_unit): New functions.
(dwarf2_frame_find_fde): Use find_comp_unit.
(dwarf2_build_frame_info): Use set_comp_unit.

4 years agoRemove the objfile backlink from comp_unit
Tom Tromey [Wed, 12 Feb 2020 22:45:08 +0000 (15:45 -0700)] 
Remove the objfile backlink from comp_unit

This removes the objfile backlink from comp_unit.  The only remaining
uses involved fetching the text offset from the objfile.  However,
this is already conveniently computed at all the sites that call
execute_cfa_program, and so it can simply be passed in.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/frame.c (struct comp_unit) <objfile>: Remove.
(comp_unit): Don't initialize objfile.
(execute_cfa_program): Add text_offset parameter.
(execute_cfa_program_test, dwarf2_fetch_cfa_info)
(dwarf2_frame_cache): Update.
(dwarf2_build_frame_info): Don't set "objfile" member.

4 years agoRemove a use of the comp_unit backlink
Tom Tromey [Wed, 12 Feb 2020 22:45:08 +0000 (15:45 -0700)] 
Remove a use of the comp_unit backlink

The DWARF frame comp_unit object still has a backlink to the objfile.
In order to be truly objfile-independent, this must be removed.

This patch removes one such use, by passing the gdbarch to
decode_frame_entry directly.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/frame.c (decode_frame_entry_1): Add gdbarch parameter.
(decode_frame_entry): Likewise.
(dwarf2_build_frame_info): Update.

4 years agoAdd per-unit obstack
Tom Tromey [Wed, 12 Feb 2020 22:45:08 +0000 (15:45 -0700)] 
Add per-unit obstack

This adds an auto_obstack to the DWARF frame comp_unit object, and
then changes the remaining code here to use the comp_unit obstack
rather than the objfile obstack.

At this point, all the storage for frame data is self-contained --
that is, it is independent of the objfile.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/frame.c (struct comp_unit) <obstack>: New member.
(decode_frame_entry_1): Use the comp_unit obstack.

4 years agoStore the comp_unit instead of the FDE table
Tom Tromey [Wed, 12 Feb 2020 22:45:08 +0000 (15:45 -0700)] 
Store the comp_unit instead of the FDE table

This changes the DWARF frame code to store the comp_unit on the
objfile, rather than storing the FDE table.  It also changes the
comp_unit to be heap-allocated using "new".

This change makes it simpler for a later patch to add a field to the
comp_unit, and to have deallaction work properly.  This in turn is
important for making the frame data be independent of the objfile.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/frame.c (struct comp_unit): Add initializers and
constructor.
(dwarf2_frame_objfile_data): Store a comp_unit.
(dwarf2_frame_find_fde): Update.
(dwarf2_build_frame_info): Use "new".

4 years agoChange fde table to a vector
Tom Tromey [Wed, 12 Feb 2020 22:45:08 +0000 (15:45 -0700)] 
Change fde table to a vector

This removes struct dwarf2_fde_table, replacing it with a typedef of
std::vector.  This simplifies the code somewhat.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/frame.c (struct dwarf2_fde_table): Remove.
(dwarf2_fde_table): Typedef for std::vector.
(dwarf2_frame_objfile_data): Remove the deleter.  Now static.
(dwarf2_frame_find_fde, add_fde, decode_frame_entry_1)
(decode_frame_entry): Update.
(dwarf2_build_frame_info): Use "new".

4 years agoChange booleans to bool in ARM's gdbarch_tdep
Christian Biesinger [Wed, 12 Feb 2020 22:49:08 +0000 (16:49 -0600)] 
Change booleans to bool in ARM's gdbarch_tdep

gdb/ChangeLog:

2020-02-12  Christian Biesinger  <cbiesinger@google.com>

* arm-tdep.c (arm_gdbarch_init): Update.
* arm-tdep.h (struct gdbarch_tdep) <have_fpa_registers,
have_wmmx_registers, have_vfp_pseudos, have_neon_pseudos,
have_neon, is_m>: Change to bool.

4 years agoPrint more information in arm_dump_tdep
Christian Biesinger [Wed, 12 Feb 2020 22:28:48 +0000 (16:28 -0600)] 
Print more information in arm_dump_tdep

I am keeping the (int) casts because a future patch will change the type
to bool.

gdb/ChangeLog:

2020-02-12  Christian Biesinger  <cbiesinger@google.com>

* arm-tdep.c (arm_dump_tdep): Print more fields of tdep.

4 years agoRemove dwarf_expr_baton
Tom Tromey [Wed, 12 Feb 2020 21:41:33 +0000 (14:41 -0700)] 
Remove dwarf_expr_baton

The type dwarf_expr_baton is unused and can be removed.

gdb/ChangeLog
2020-02-12  Tom Tromey  <tom@tromey.com>

* dwarf2/loc.c (struct dwarf_expr_baton): Remove.

Change-Id: Id8342da31398b9b4b08f31be7c3d612e9590bbbf

4 years agoFix kill of processes created by win32_create_inferior
Hannes Domani [Sat, 8 Feb 2020 18:08:40 +0000 (19:08 +0100)] 
Fix kill of processes created by win32_create_inferior

handle_v_kill uses signal_pid because win32 doesn't support multi-process.

Without this gdb just refuses to kill the process:
(gdb) kill
Kill the program being debugged? (y or n) y
Sending packet: $vKill;a410#33...Packet received: E01
Packet vKill (kill) is supported
Can't kill process

gdbserver/ChangeLog:

2020-02-12  Hannes Domani  <ssbssa@yahoo.de>

* win32-low.c (win32_create_inferior): Set signal_pid.

4 years agoCache the Thread Local Base pointer type in the gdbarch
Hannes Domani [Sun, 9 Feb 2020 16:37:58 +0000 (17:37 +0100)] 
Cache the Thread Local Base pointer type in the gdbarch

gdb/ChangeLog:

2020-02-12  Hannes Domani  <ssbssa@yahoo.de>

* windows-tdep.c (struct windows_gdbarch_data): Add tib_ptr_type.
(windows_get_tlb_type): Use windows_gdbarch_data->tib_ptr_type.

4 years agox86: correct VFPCLASSP{S,D} operand size handling
Jan Beulich [Wed, 12 Feb 2020 15:20:56 +0000 (16:20 +0100)] 
x86: correct VFPCLASSP{S,D} operand size handling

With AVX512VL disabled (e.g. when writing code for the Knights family
of processors) these insns aren't ambiguous when used with a memory
source, and hence should be accepted without suffix or operand size
specifier. When AVX512VL is enabled, to be consistent with this as
well as other ambiguous operand size handling it would seem better to
just warn about the ambiguity in AT&T mode, and still default to 512-bit
operands (on the assumption that the code may have been written without
AVX512VL in mind yet), but it was requested to leave AT&T syntax mode
alone here.

4 years agox86: fold two JMP templates
Jan Beulich [Wed, 12 Feb 2020 15:19:52 +0000 (16:19 +0100)] 
x86: fold two JMP templates

Now that the AMD64 check in match_template() applies to 64-bit code
only, the non-64-bit and the Amd64 template can be folded, as being
otherwise compatible with one another. (Oddly enough the same doesn't
apply to CALL, due to the suffixes it permits, while JMP doesn't
allow for any.)

4 years agox86-64: Intel64 adjustments for insns dealing with far pointers
Jan Beulich [Wed, 12 Feb 2020 15:19:03 +0000 (16:19 +0100)] 
x86-64: Intel64 adjustments for insns dealing with far pointers

AMD and Intel differ in their handling of far indirect branches as well
as LFS/LGS/LSS: AMD CPUs ignore REX.W while Intel ones honors it. (Note
how the latter three were hybrids so far, while far branches were fully
AMD-like.)

4 years agoDisable gdbserver on host != target configurations
Maciej W. Rozycki [Wed, 12 Feb 2020 13:50:30 +0000 (13:50 +0000)] 
Disable gdbserver on host != target configurations

Correct fallout from commit 919adfe84092 ("Move gdbserver to top level")
and revert to not building `gdbserver' in a cross-configuration, that is
where host != target, matching the documented behaviour.  We have no way
to support non-native `gdbserver', and native `gdbserver' is usually of
no use with cross-GDB of the chosen host.

gdbserver/ChangeLog:
2020-02-12  Maciej W. Rozycki <macro@wdc.com>
    Pedro Alves  <palves@redhat.com>

Skip building gdbserver in a cross-configuration.
* configure.srv: Set $gdbserver_host depending on whether $target
is $host.  Use $gdbserver_host instead of $host.

4 years ago[gdb] Fix -Wstrict-null-sentinel warning (--with-iconv-bin)
Tom de Vries [Wed, 12 Feb 2020 10:15:33 +0000 (11:15 +0100)] 
[gdb] Fix -Wstrict-null-sentinel warning (--with-iconv-bin)

When using configure flag --with-iconv-bin=$(which iconv), we run into:
...
gdb/charset.c: In function 'void find_charset_names()':
gdb/charset.c:821:75: error: missing sentinel in function call [-Werror=format=]
     iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL);
                                                                           ^
cc1plus: all warnings being treated as errors
...

Fix the warning.

Build and reg-tested on x86_64-linux.

2020-02-12  Lukas Durfina  <ldurfina@tachyum.com>
    Tom de Vries  <tdevries@suse.de>

* charset.c (find_charset_names): Cast concat NULL sentinel to char *.

4 years agox86: also disallow non-byte/-word registers with byte/word suffix
Jan Beulich [Wed, 12 Feb 2020 09:59:32 +0000 (10:59 +0100)] 
x86: also disallow non-byte/-word registers with byte/word suffix

Along the lines of be4c5e58bd ("x86: Always disallow double word suffix
with word general register") also adjust check_{byte,word}_reg(), to make
overall behavior consistent again in this regard.

4 years agox86/Intel: improve diagnostics
Jan Beulich [Wed, 12 Feb 2020 09:58:42 +0000 (10:58 +0100)] 
x86/Intel: improve diagnostics

The diagnostics issued by check_*_reg() are pretty AT&T-centric. Re-use
logic already used for SIMD memory operand size checking also for ones
where GPRs would alternatively also be allowed. (There's certainly room
for further improvement here.)

4 years agoUpdate a comment in psymtab.h
Tom Tromey [Wed, 12 Feb 2020 01:11:32 +0000 (18:11 -0700)] 
Update a comment in psymtab.h

This updates a comment in psymtab.h to reflect the current reality.

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

* psymtab.h: Update comment.

Change-Id: I438bb5929c3ebd1a4c6e9a902490f2ef63014ab3

4 years agoDon't allow copying of auto_obstack
Tom Tromey [Wed, 12 Feb 2020 00:31:10 +0000 (17:31 -0700)] 
Don't allow copying of auto_obstack

Add DISABLE_COPY_AND_ASSIGN to struct auto_obstack, to prevent copying
it.  Copying an auto_obstack would be a bug.

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

* gdb_obstack.h (struct auto_obstack): Use
DISABLE_COPY_AND_ASSIGN.

Change-Id: Ic9e5ab20acfcfa61c241fed4d99bbb1caefba3cd

4 years agoDon't forward-declare struct objfile in dwarf2/frame.h
Tom Tromey [Wed, 12 Feb 2020 00:31:10 +0000 (17:31 -0700)] 
Don't forward-declare struct objfile in dwarf2/frame.h

dwarf2/frame.h forward-declares struct objfile, but there's no need
for this.

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

* dwarf2/frame.h (struct objfile): Don't forward declare.

Change-Id: I4d54d46ac9422eeb64dc5f0b934792e77a875aa5

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Feb 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoPlugin: Treat each object as independent
H.J. Lu [Tue, 11 Feb 2020 23:36:13 +0000 (15:36 -0800)] 
Plugin: Treat each object as independent

Since plugin treats each object as independent, we must do a fresh dlopen
of plugin for each object.

PR binutils/25355
* plugin.c (try_claim): Always clean up for LTO wrapper.
(try_load_plugin): Treat each object as independent.  Create a
copy for plugin name.

4 years agoRemove use of deprecated_add_core_fns in cris_tdep.c
Christian Biesinger [Tue, 11 Feb 2020 16:39:35 +0000 (10:39 -0600)] 
Remove use of deprecated_add_core_fns in cris_tdep.c

The non-deprecated equivalent is implementing the gdbarch function
iterate_over_regset_sections, this patch does that.

Tested by generating a core file on cris under qemu and comparing
the output of "info registers".

This also fixes this warning when loading cris core files:
  warning: Unexpected size of section `.reg/164' in core file.

gdb/ChangeLog:

2020-02-11  Christian Biesinger  <cbiesinger@google.com>

* cris-tdep.c (cris_supply_gregset): Change signature to match
what struct regset expects.
(cris_regset): New struct.
(fetch_core_registers): Remove.
(cris_iterate_over_regset_sections): New function.
(_initialize_cris_tdep): Don't call deprecated_add_core_fns.
(cris_gdbarch_init): Call set_gdbarch_iterate_over_regset_sections.

Change-Id: Ieef895b5a2fdc797d1a913cd1c0c07563edfe8e7

4 years agoNew testcase for PR tui/25126 (staled source cache)
Sergio Durigan Junior [Thu, 6 Feb 2020 22:52:54 +0000 (17:52 -0500)] 
New testcase for PR tui/25126 (staled source cache)

I'm dealing with a Fedora GDB bug that is related to PR tui/25126, and
I thought I'd write a specific testcase for it because I couldn't find
one.

The idea is to get the simple reproducer from the bug and tweak the
testcase around it.  This one was a bit hard because, since we need to
modify the source file and recompile it, it involved a bit of TCL-foo
to do things.  Also for this reason, I'm only enabling the test for
native boards.

I tested this with an upstream GDB and made sure everything is
passing.  I also tested with a faulty GDB and made sure the test
failed.

gdb/testsuite/ChangeLog:
2020-02-11  Sergio Durigan Junior  <sergiodj@redhat.com>

PR tui/25126
https://bugzilla.redhat.com/show_bug.cgi?id=1784210
* gdb.base/cached-source-file.c: New file.
* gdb.base/cached-source-file.exp: New file.

Change-Id: Ib1b074342ebe8613c6d1dfde631691ebdf6d81c6

4 years agoAdd a comment for the ARM_F{0..7}_REGNUM registers
Christian Biesinger [Mon, 10 Feb 2020 23:34:48 +0000 (17:34 -0600)] 
Add a comment for the ARM_F{0..7}_REGNUM registers

These are for the obsolete FPA architecture.

gdb/ChangeLog:

2020-02-11  Christian Biesinger  <cbiesinger@google.com>

* arch/arm.h (enum gdb_regnum): Add comment for the FP0..7
registers.

Change-Id: I6920616318ee637493d4ca12b91fa2ebcd103d76

4 years agoAdd missing \n in fprintf
Christian Biesinger [Tue, 11 Feb 2020 16:21:14 +0000 (10:21 -0600)] 
Add missing \n in fprintf

gdb/ChangeLog:

2020-02-11  Christian Biesinger  <cbiesinger@google.com>

* arm-tdep.c (arm_dump_tdep): Add \n in fprintf.

Change-Id: I0175572436cc7dec29e852c96371f85ea763ba2a

4 years agoRe-generate gdb/gdbserver/gdbsupport configure scripts
Simon Marchi [Tue, 11 Feb 2020 15:56:05 +0000 (10:56 -0500)] 
Re-generate gdb/gdbserver/gdbsupport configure scripts

In my previous commit, I did a last minute modification of warning.m4,
but forgot to re-generate the configure scripts, this commit fixes that.

gdb/ChangeLog:

* configure: Re-generate.

gdbserver/ChangeLog:

* configure: Re-generate.

gdbsupport/ChangeLog:

* configure: Re-generate.

4 years agoAdd -Wstrict-null-sentinel to gdbsupport/warning.m4
Simon Marchi [Tue, 11 Feb 2020 15:51:49 +0000 (10:51 -0500)] 
Add -Wstrict-null-sentinel to gdbsupport/warning.m4

Commit 85f0dd3ce ("[gdb] Fix -Wstrict-null-sentinel warnings") fixed
some violations of -Wstrict-null-sentinel.  If we want to enforce this
warning, I think we should enable it in our warning.m4 file.

gdbsupport/ChangeLog:

* warning.m4: Add -Wstrict-null-sentinel.
* configure: Re-generate.

gdbserver/ChangeLog:

* configure: Re-generate.

gdb/ChangeLog:

* configure: Re-generate.

4 years agoMove gdb/warning.m4 to gdbsupport
Simon Marchi [Tue, 11 Feb 2020 15:51:43 +0000 (10:51 -0500)] 
Move gdb/warning.m4 to gdbsupport

This file is used by gdbsupport, gdbserver and gdb, so I think it
belongs in gdbsupport.  Move it there and update the references the
various acinclude.m4 files.

gdbsupport/ChangeLog:

* warning.m4: Move here, from gdb/warning.m4.
* acinclude.m4: Update warning.m4 path.
* Makefile.in: Re-generate.

gdbserver/ChangeLog:

* acinclude.m4: Update warning.m4 path.

gdb/ChangeLog:

* acinclude: Update warning.m4 path.
* warning.m4: Move to gdbsupport.

4 years agogdbsupport: use AM_GDB_WARNINGS
Simon Marchi [Tue, 11 Feb 2020 15:46:23 +0000 (10:46 -0500)] 
gdbsupport: use AM_GDB_WARNINGS

Since gdbsupport has been given its own build system, it is no longer
compiled with the warning flags specified in gdb/warning.m4.

This patch makes it use AM_GDB_WARNINGS.

gdbsupport/ChangeLog:

* acinclude.m4: Include ../gdb/warning.m4.
* configure.ac: Use AM_GDB_WARNINGS.
* Makefile.am: Set AM_CFLAGS to WARN_CFLAGS and WERROR_CFLAGS.
* Makefile.in: Re-generate.
* configure: Re-generate.

4 years agoRemove some ui_file_* functions
Tom Tromey [Tue, 11 Feb 2020 14:05:28 +0000 (07:05 -0700)] 
Remove some ui_file_* functions

This removes ui_file_isatty, ui_file_read, ui_file_write,
ui_file_write_async_safe, ui_file_flush, and ui_file_puts, replacing
them with calls to the appropriate method instead.

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

* remote.c (remote_console_output): Update.
* printcmd.c (printf_command): Update.
* event-loop.c (gdb_wait_for_event): Update.
* linux-nat.c (sigchld_handler): Update.
* remote-sim.c (gdb_os_write_stdout): Update.
(gdb_os_flush_stdout): Update.
(gdb_os_flush_stderr): Update.
(gdb_os_write_stderr): Update.
* exceptions.c (print_exception): Update.
* remote-fileio.c (remote_fileio_func_read): Update.
(remote_fileio_func_write): Update.
* tui/tui.c (tui_enable): Update.
* tui/tui-interp.c (tui_interp::init): Update.
* utils.c (init_page_info): Update.
(putchar_unfiltered, fputc_unfiltered): Update.
(gdb_flush): Update.
(emit_style_escape): Update.
(flush_wrap_buffer, fputs_maybe_filtered): Update.
* ui-file.c (ui_file_isatty, ui_file_read, ui_file_write)
(ui_file_write_async_safe, ui_file_flush, ui_file_puts): Remove.
(stderr_file::write): Update.
(stderr_file::puts): Update.
* ui-file.h (ui_file_isatty, ui_file_write)
(ui_file_write_async_safe, ui_file_read, ui_file_flush)
(ui_file_puts): Don't declare.

Change-Id: I3ca9b36e9107f6adbc41e014f5078b41d6bcec4d

4 years agoFix building the bfd/elf32-msp430.c file on a 32-bit host.
Nick Clifton [Tue, 11 Feb 2020 12:38:41 +0000 (12:38 +0000)] 
Fix building the bfd/elf32-msp430.c file on a 32-bit host.

* elf32-msp430.c (msp430_final_link_relocate): Always use longs
for addresses in print statements.
(msp430_elf_relax_delete_bytes): Likewise.
(msp430_elf_relax_add_words): Likewise.
(msp430_elf_relax_section): Likewise.

4 years agoClear plugin_data memory
H.J. Lu [Tue, 11 Feb 2020 12:26:00 +0000 (04:26 -0800)] 
Clear plugin_data memory

Clear plugin_data memory since it may be uninitialized.

* plugin.c (add_symbols): Clear plugin_data memory.

4 years agox86: drop ShortForm attribute
Jan Beulich [Tue, 11 Feb 2020 10:20:55 +0000 (11:20 +0100)] 
x86: drop ShortForm attribute

It is very simple to derive from other template properties, and hence
there's little point wasting storage for it.

4 years agox86: drop stray ShortForm attributes
Jan Beulich [Tue, 11 Feb 2020 10:20:05 +0000 (11:20 +0100)] 
x86: drop stray ShortForm attributes

This attribute is meaningless when there are no operands to encode.

4 years ago[binutils][gas] Fix build failure with -std=c89
Matthew Malcomson [Tue, 11 Feb 2020 10:17:33 +0000 (10:17 +0000)] 
[binutils][gas] Fix build failure with -std=c89

My previous patch introduced the use of a C99 feature.  C99 standard is
not required for gas, so this feature should be removed.

Committed as obvious.

gas/ChangeLog:

2020-02-11  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-arm.c (vcx_handle_register_arguments): Remove `for`
loop initial declaration.

4 years ago[gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.exp
Tom de Vries [Tue, 11 Feb 2020 06:08:33 +0000 (07:08 +0100)] 
[gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.exp

The test-case gdb.server/server-kill-python.exp runs fine by itself:
...
Running src/gdb/testsuite/gdb.server/server-kill-python.exp ...

                === gdb Summary ===

nr of expected passes            3
...

But if we run f.i. gdb.server/file-transfer.exp before it, we get instead:
...
Running src/gdb/testsuite/gdb.server/server-kill-python.exp ...
ERROR: GDB process no longer exists

                === gdb Summary ===

nr of expected passes            13
nr of unresolved testcases       1
...

We can see the origin of the problem here:
...
spawn gdbserver --once localhost:2347 \
  build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer \
  build/gdb/testsuite/outputs/gdb.server/server-kill-python/server-kill-python^M
Process build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer
  \ created; pid = 9464^M
Listening on port 2347^M
...

The spawn of the gdbserver for the server-kill-python test-case gets as
executable argument the file-transfer binary.

This is caused by proc gdbserver_spawn attempting to load the exec file in
$file_last_loaded.  This is something that is meant to load the same exec in
the gdbserver that was earlier loaded into gdb.

In this test-case however, nothing has been loaded into gdb by the test-case,
and consequently we load the file that was loaded into gdb in the previous
test-case.

Fix this by unsetting $file_last_loaded in gdb_init.

Build and reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

PR testsuite/25488
* lib/gdb.exp (gdb_init): Unset $file_last_loaded.

Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b

4 years agoUse GCC LTO wrapper to get real symbols from LTO IR objects
H.J. Lu [Tue, 11 Feb 2020 03:01:42 +0000 (19:01 -0800)] 
Use GCC LTO wrapper to get real symbols from LTO IR objects

GCC LTO wrapper is needed to extract real symbols from LTO IR objects.
This patch does the following:

1. Set up GCC LTO wrapper for each LTO IR object.
2. Run GCC LTO wrapper to get the real object.
3. Extract symbol info from the real object.
4. Cleanup afterwards.

bfd/

PR binutils/25355
* configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE.
(EXECUTABLE_SUFFIX): Likewise.
* config.in: Regenerated.
* configure: Likewise.
* plugin.c (bfd_plugin_close_and_cleanup): Removed.
(plugin_list_entry): Add all_symbols_read, cleanup_handler,
gcc, lto_wrapper, resolution_file, resolution_option, gcc_env,
real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms.
(get_lto_wrapper): New.
(setup_lto_wrapper_env): Likewise.
(current_plugin): Likewise.
(register_all_symbols_read): Likewise.
(register_cleanup): Likewise.
(get_symbols): Likewise.
(add_input_file): Likewise.
(bfd_plugin_close_and_cleanup): Likewise.
(claim_file): Removed.
(register_claim_file): Set current_plugin->claim_file.
(add_symbols): Make a copy of LTO symbols.  Set lto_nsyms and
lto_syms in current_plugin.
(try_claim): Use current_plugin->claim_file.  Call LTO plugin
all_symbols_read handler.  Copy real symbols to plugin_data.
Call LTO plugin cleanup handler.  Clean up for LTO wrapper.
(try_load_plugin): Don't reuse the previous plugin for LTO
wrapper.  Set up GCC LTO wrapper if possible.  Don't set
plugin_list_iter->claim_file.
(bfd_plugin_canonicalize_symtab): Use real LTO symbols if
possible.
* plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and
real_syms.

ld/

PR binutils/25355
* testsuite/ld-plugin/lto.exp: Run PR binutils/25355 test.
* testsuite/ld-plugin/pr25355.c: New file.
* testsuite/ld-plugin/pr25355.d: Likewise.
* testsuite/lib/ld-lib.exp (run_cc_link_tests): Support compile
only dump.

4 years agoEnsure *valuep always written by extract_normal return
Alan Modra [Mon, 10 Feb 2020 22:41:18 +0000 (09:11 +1030)] 
Ensure *valuep always written by extract_normal return

* cgen-ibld.in (extract_normal): Set *valuep on all return paths.
* bpf-ibld.c, * epiphany-ibld.c, * fr30-ibld.c, * frv-ibld.c,
* ip2k-ibld.c, * iq2000-ibld.c, * lm32-ibld.c, * m32c-ibld.c,
* m32r-ibld.c, * mep-ibld.c, * mt-ibld.c, * or1k-ibld.c,
* xc16x-ibld.c, * xstormy16-ibld.c: Regenerate.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Feb 2020 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoMSP430: Enable relaxation of jump instructions to hard-coded pcrel offsets
Jozef Lawrynowicz [Mon, 10 Feb 2020 20:37:57 +0000 (20:37 +0000)] 
MSP430: Enable relaxation of jump instructions to hard-coded pcrel offsets

This patch fixes execution failures which occur when the BR in a
sequence such as:
  J<cond> 1f
  BR
  1:
is relaxed to a JMP, and the pc-relative offset for the destination of
the J<cond> instruction is hard-coded to be 2 words ahead of the
instruction.
The hard-coded offset will cause execution to jump 1 word ahead of where
it should actually go.

Instead we now detect the hard-coded offset is one we inserted earlier,
and invert the condition, allowing us to remove the BR entirely.

bfd/ChangeLog:

2020-02-10  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch,
check if previous instruction matches a conditional jump inserted
earlier. Invert conditional jump and delete branch in this case.

4 years agoMSP430: Enable relaxation of relocs in JMP instructions
Jozef Lawrynowicz [Mon, 10 Feb 2020 20:33:21 +0000 (20:33 +0000)] 
MSP430: Enable relaxation of relocs in JMP instructions

This patch fixes relocation overflows caused by an inability to relax
unconditional JMP instructions to BR instructions.

bfd/ChangeLog:

2020-02-10  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to
msp430_elf_relax_add_words. Support insertion of either one or two
words.
(msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation
needs to be grown. Handle insertion of branch instruction to replace
jump.

4 years agoMSP430: Add printf statements to assist with debugging during relaxation
Jozef Lawrynowicz [Mon, 10 Feb 2020 20:27:36 +0000 (20:27 +0000)] 
MSP430: Add printf statements to assist with debugging during relaxation

bfd/ChangeLog:

2020-02-10  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* elf32-msp430.c (msp430_final_link_relocate): Add printf statements for
debugging relocations.
(msp430_elf_relax_delete_bytes): Likewise.
(msp430_elf_relax_add_two_words): Likewise.
(msp430_elf_relax_section): Likewise.

4 years ago[binutils][arm] Implement Custom Datapath Extensions for MVE
Matthew Malcomson [Mon, 10 Feb 2020 16:39:02 +0000 (16:39 +0000)] 
[binutils][arm] Implement Custom Datapath Extensions for MVE

Here we implement the custom datapath extensions for MVE.

This required the following changes:

- Adding a new register argument type (that takes either an MVE vector or
  a Neon S or D register).
- Adding two new immediate operands types (0-127 and 0-4095).
- Using the Neon type machinery to distinguish between instruction
  types.  This required the introduction of new neon shapes to account
  for the coprocessor operands to these instructions.
- Adding a new disassembly character to `print_insn_cde` to handle the
  new register types.

Specification can be found at
https://developer.arm.com/docs/ddi0607/latest

Successfully regression tested on arm-none-eabi, and arm-wince-pe.

gas/ChangeLog:

2020-02-10  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-arm.c (NEON_MAX_TYPE_ELS): Increment to account for
instructions that can have 5 arguments.
(enum operand_parse_code): Add new operands.
(parse_operands): Account for new operands.
(S5): New macro.
(enum neon_shape_el): Introduce P suffixes for coprocessor.
(neon_select_shape): Account for P suffix.
(LOW1): Move macro to global position.
(HI4): Move macro to global position.
(vcx_assign_vec_d): New.
(vcx_assign_vec_m): New.
(vcx_assign_vec_n): New.
(enum vcx_reg_type): New.
(vcx_get_reg_type): New.
(vcx_size_pos): New.
(vcx_vec_pos): New.
(vcx_handle_shape): New.
(vcx_ensure_register_in_range): New.
(vcx_handle_register_arguments): New.
(vcx_handle_insn_block): New.
(vcx_handle_common_checks): New.
(do_vcx1): New.
(do_vcx2): New.
(do_vcx3): New.
* testsuite/gas/arm/cde-missing-fp.d: New test.
* testsuite/gas/arm/cde-missing-fp.l: New test.
* testsuite/gas/arm/cde-missing-mve.d: New test.
* testsuite/gas/arm/cde-missing-mve.l: New test.
* testsuite/gas/arm/cde-mve-or-neon.d: New test.
* testsuite/gas/arm/cde-mve-or-neon.s: New test.
* testsuite/gas/arm/cde-mve.s: New test.
* testsuite/gas/arm/cde-warnings.l:
* testsuite/gas/arm/cde-warnings.s:
* testsuite/gas/arm/cde.d:
* testsuite/gas/arm/cde.s:

opcodes/ChangeLog:

2020-02-10  Matthew Malcomson  <matthew.malcomson@arm.com>

* arm-dis.c (print_insn_cde): Define 'V' parse character.
(cde_opcodes): Add VCX* instructions.

4 years ago[binutils][arm] arm support for ARMv8.m Custom Datapath Extension
Matthew Malcomson [Mon, 10 Feb 2020 16:38:00 +0000 (16:38 +0000)] 
[binutils][arm] arm support for ARMv8.m Custom Datapath Extension

This patch is part of a series that adds support for the Armv8.m
ARMv8.m Custom Datapath Extension to binutils.

This patch introduces the Custom Instructions Class 1/2/3 (Single/
Dual, Accumulator/Non-accumulator varianats) to the arm backend.

The following Custom Instructions are added: cx1, cx1a,
cx1d, cx1da, cx2, cx2a, cx2d, cx2da, cx3, cx3a, cx3d, cx3da.

Specification can be found at
https://developer.arm.com/docs/ddi0607/latest

This patch distinguishes between enabling CDE for different coprocessor
numbers by defining multiple architecture flags.  This means that the
parsing of the architecture extension flags is kept entirely in the
existing code path.

We introduce a new IT block state to indicate the behaviour of these
instructions.  This new state allows being used in an IT block or
outside an IT block, but does not allow the instruction to be used
inside a VPT block.
We need this since the CX*A instruction versions can be used in IT
blocks, but they aren't to have the conditional suffixes on them.  Hence
we need to mark an instruction as allowed in either position.

We also need a new flag to objdump, in order to determine whether to
disassemble an instruction as CDE related or not.

Successfully regression tested on arm-none-eabi, and arm-wince-pe.

gas/ChangeLog:

2020-02-10  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
    Matthew Malcomson  <matthew.malcomson@arm.com>

* config/tc-arm.c (arm_ext_cde*): New feature sets for each
CDE coprocessor that can be enabled.
(enum pred_instruction_type): New pred type.
(BAD_NO_VPT): New error message.
(BAD_CDE): New error message.
(BAD_CDE_COPROC): New error message.
(enum operand_parse_code): Add new immediate operands.
(parse_operands): Account for new immediate operands.
(check_cde_operand): New.
(cde_coproc_enabled): New.
(cde_coproc_pos): New.
(cde_handle_coproc): New.
(cxn_handle_predication): New.
(do_custom_instruction_1): New.
(do_custom_instruction_2): New.
(do_custom_instruction_3): New.
(do_cx1): New.
(do_cx1a): New.
(do_cx1d): New.
(do_cx1da): New.
(do_cx2): New.
(do_cx2a): New.
(do_cx2d): New.
(do_cx2da): New.
(do_cx3): New.
(do_cx3a): New.
(do_cx3d): New.
(do_cx3da): New.
(handle_pred_state): Define new IT block behaviour.
(insns): Add newn CX*{,d}{,a} instructions.
(CDE_EXTENSIONS,armv8m_main_ext_table,armv8_1m_main_ext_table):
Define new cdecp extension strings.
* doc/c-arm.texi: Document new cdecp extension arguments.
* testsuite/gas/arm/cde-scalar.d: New test.
* testsuite/gas/arm/cde-scalar.s: New test.
* testsuite/gas/arm/cde-warnings.d: New test.
* testsuite/gas/arm/cde-warnings.l: New test.
* testsuite/gas/arm/cde-warnings.s: New test.
* testsuite/gas/arm/cde.d: New test.
* testsuite/gas/arm/cde.s: New test.

include/ChangeLog:

2020-02-10  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
    Matthew Malcomson  <matthew.malcomson@arm.com>

* opcode/arm.h (ARM_EXT2_CDE): New extension macro.
(ARM_EXT2_CDE0): New extension macro.
(ARM_EXT2_CDE1): New extension macro.
(ARM_EXT2_CDE2): New extension macro.
(ARM_EXT2_CDE3): New extension macro.
(ARM_EXT2_CDE4): New extension macro.
(ARM_EXT2_CDE5): New extension macro.
(ARM_EXT2_CDE6): New extension macro.
(ARM_EXT2_CDE7): New extension macro.

opcodes/ChangeLog:

2020-02-10  Stam Markianos-Wright  <stam.markianos-wright@arm.com>
    Matthew Malcomson  <matthew.malcomson@arm.com>

* arm-dis.c (struct cdeopcode32): New.
(CDE_OPCODE): New macro.
(cde_opcodes): New disassembly table.
(regnames): New option to table.
(cde_coprocs): New global variable.
(print_insn_cde): New
(print_insn_thumb32): Use print_insn_cde.
(parse_arm_disassembler_options): Parse coprocN args.

4 years agox86: Accept Intel64 only instruction by default
H.J. Lu [Mon, 10 Feb 2020 16:37:22 +0000 (08:37 -0800)] 
x86: Accept Intel64 only instruction by default

Commit d835a58baae720 disabled sysenter/sysenter in 64-bit mode by
default.  By default, assembler should accept common, Intel64 only
and AMD64 ISAs since there are no conflicts.

gas/

PR gas/25516
* config/tc-i386.c (intel64): Renamed to ...
(isa64): This.
(match_template): Accept Intel64 only instruction by default.
(i386_displacement): Updated.
(md_parse_option): Updated.
* c-i386.texi: Update -mamd64/-mintel64 documentation.
* testsuite/gas/i386/i386.exp: Run x86-64-sysenter.  Pass
-mamd64 to x86-64-sysenter-amd.
* testsuite/gas/i386/x86-64-sysenter.d: New file.

opcodes/

PR gas/25516
* i386-gen.c (opcode_modifiers): Replace AMD64 and Intel64
with ISA64.
* i386-opc.h (AMD64): Removed.
(Intel64): Likewose.
(AMD64): New.
(INTEL64): Likewise.
(INTEL64ONLY): Likewise.
(i386_opcode_modifier): Replace amd64 and intel64 with isa64.
* i386-opc.tbl (Amd64): New.
(Intel64): Likewise.
(Intel64Only): Likewise.
Replace AMD64 with Amd64.  Update sysenter/sysenter with
Cpu64 and Intel64Only.  Remove AMD64 from sysenter/sysenter.
* i386-tbl.h: Regenerated.

4 years agoAllow objcopy's --set-section-flags options to add or remove the SHF_EXCLUDE flag...
Fangrui Song [Mon, 10 Feb 2020 16:22:00 +0000 (16:22 +0000)] 
Allow objcopy's --set-section-flags options to add or remove the SHF_EXCLUDE flag of ELF sections.

* objcopy.c (parse_flags): Handle "exclude".
* doc/binutils.texi: Document the support.

4 years agoMore debuginfod tests fixes.
Aaron Merey [Mon, 10 Feb 2020 15:24:57 +0000 (15:24 +0000)] 
More debuginfod tests fixes.

Start server before setting environment variable.
Specify tmpdir as the location of the server's
database.
Check additional server metrics at start-up.