]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 years agogdb: Correct the ChageLog entry
Shahab Vahedi [Wed, 7 Oct 2020 16:20:45 +0000 (18:20 +0200)] 
gdb: Correct the ChageLog entry

Becausae of a copy/paste, I've put myself as the author of the
following patch which was not true:

6d2d7c5668f gdbserver: Add GNU/Linux support for ARC

This change will place the correct date and author in the ChangeLog.

3 years agoarc: Add support for Linux coredump files
Anton Kolesov [Mon, 30 Jan 2017 15:32:10 +0000 (18:32 +0300)] 
arc: Add support for Linux coredump files

With the implemenations in this patch, ARC gdb can handle
coredump related matters.  The binutils counter part of
this patch has already been pushed [1].

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

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

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

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

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

gdb/ChangeLog:

* arc-linux-tdep.h: New file.
* arc-linux-tdep.c (arc_linux_core_reg_offsets,
arc_linux_supply_gregset, arc_linux_supply_v2_regset,
arc_linux_collect_gregset, arc_linux_collect_v2_regset,
arc_linux_gregset, arc_linux_v2_regset,
arc_linux_iterate_over_regset_sections,
arc_linux_core_read_description): Implement.
(arc_linux_init_osabi): Set iterate_over_regset_sections.
* arc-tdep.h (ARC_OFFSET_NO_REGISTER): Declare.
        (arc_gdbarch_features_create): Add.
* arc-tdep.c (arc_gdbarch_features_create): Not static anymore.

3 years agogdbserver: Add GNU/Linux support for ARC
Anton Kolesov [Wed, 6 Jul 2016 17:30:29 +0000 (20:30 +0300)] 
gdbserver: Add GNU/Linux support for ARC

This gdbserver implementation supports ARC ABI v3 and v4 (older ARC ABI
versions are not supported by other modern GNU tools or Linux itself).
Gdbserver supports inspection of ARC HS registers R30, R58 and R59 - feature
that has been added to Linux 4.12.  Whether gdbserver build will actually
support this feature depends on the version of Linux headers used to build
the server.

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

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

gdbserver/ChangeLog:

* configure.srv: Support ARC architecture.
* Makefile.in: Add linux-arc-low.cc and arch/arc.o.
* linux-arc-low.cc: New file.

3 years agoarc: Rename "arc_gdbarch_features" struct
Shahab Vahedi [Mon, 5 Oct 2020 15:10:47 +0000 (17:10 +0200)] 
arc: Rename "arc_gdbarch_features" struct

"arc_gdbarch_features" is a data structure containing information
about the ARC architecture: ISA version, register size, etc.
This name is misleading, because although it carries the phrase
"gdbarch", it has nothing to do with the type/interface in GDB.
Traditionaly, "gdbarch" structures are only used for that purpose.
To rectify this, this patch changes the name to "arc_arch_features".

gdb/ChangeLog:

* arch/arc.h: Rename "arc_gdbarch_features" to
"arc_arch_features".
* arc-tdep.h: Likewise.
* arc-tdep.c: Likewise.

3 years agoStop passing netbsd_process_target to local functions
Kamil Rytarowski [Wed, 7 Oct 2020 14:32:11 +0000 (16:32 +0200)] 
Stop passing netbsd_process_target to local functions

Switch from target->read_memory to netbsd_nat::read_memory and
cleanup the code.

No functional change.

gdbserver/ChangeLog:

        * netbsd-low.cc (get_dynamic, get_r_debug, read_one_ptr)
        (netbsd_qxfer_libraries_svr4): Remove "target" argument and update.
        (netbsd_process_target::qxfer_libraries_svr4): Update.

3 years agogdb/infcmd: remove redundant clear_proceed_status call
Tankut Baris Aktemur [Wed, 7 Oct 2020 14:55:52 +0000 (16:55 +0200)] 
gdb/infcmd: remove redundant clear_proceed_status call

In `attach_command`, there is a call to `init_wait_for_inferior`
followed by a call to `clear_proceed_status`.  However,
`init_wait_for_inferior` already calls `clear_proceed_status`.  Remove
the redundant call.

Regression-tested on X86_64 Linux.

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

* infcmd.c (attach_command): Remove the redundant call to
`clear_proceed_status`.

3 years agoCorrect logical error in NetBSD's read_memory and write_memory
Kamil Rytarowski [Wed, 7 Oct 2020 13:12:59 +0000 (15:12 +0200)] 
Correct logical error in NetBSD's read_memory and write_memory

In case of repeated ptrace PT_IO call and returning the value of
transferred bytes equal to 0, do not return without setting
xfered_len.

gdb/ChangeLog:

        * nat/netbsd-nat.c (write_memory, read_memory): Update.

3 years agoFix whitespace formatting
Kamil Rytarowski [Fri, 2 Oct 2020 01:57:16 +0000 (03:57 +0200)] 
Fix whitespace formatting

gdbserver/ChangeLog:

        * netbsd-low.cc: Fix whitespace formatting.
        * netbsd-amd64-low.cc: Likewise.

3 years agoAdd common write_memory and read_memory NetBSD routines
Kamil Rytarowski [Wed, 7 Oct 2020 03:57:52 +0000 (05:57 +0200)] 
Add common write_memory and read_memory NetBSD routines

Instead of sharing the native-only code with all BSDs with slightly
different semantics of the kernels, share the NetBSD-only behavior beteen
the NetBSD native and gdbserver setup.

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

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

gdb/ChangeLog:

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

gdbserver/ChangeLog:

       * netbsd-low.cc (netbsd_process_target::read_memory)
       (netbsd_process_target::write_memory): Update.

3 years agoAdd ChangeLog for "Add NetBSD/aarch64 gdbserver support"
Kamil Rytarowski [Wed, 7 Oct 2020 12:47:27 +0000 (14:47 +0200)] 
Add ChangeLog for "Add NetBSD/aarch64 gdbserver support"

The support is on par with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

         * netbsd-aarch64-low.cc: Add.
         * Makefile.in (SFILES): Register "netbsd-aarch64-low.c".
         * configure.srv: Add aarch64*-*-netbsd*.

3 years agoAdd NetBSD/aarch64 gdbserver support
Kamil Rytarowski [Tue, 6 Oct 2020 16:10:26 +0000 (18:10 +0200)] 
Add NetBSD/aarch64 gdbserver support

The support is on par with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

         * netbsd-aarch64-low.cc: Add.
         * Makefile.in (SFILES): Register "netbsd-aarch64-low.c".
         * configure.srv: Add aarch64*-*-netbsd*.

3 years agogdb: make signal_catch_counts a static array
Simon Marchi [Wed, 7 Oct 2020 12:13:44 +0000 (08:13 -0400)] 
gdb: make signal_catch_counts a static array

I noticed that signal_catch_counts is a dynamically-allocated array of
constant size, allocated at startup an never freed.  This might as well
be a statically-allocated array.

gdb/ChangeLog:

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

Change-Id: I220321df5ad6c1d2664ec9d483eea2dc1c979afe

3 years agogdb: Fix installation of gcore.1 on some platforms
Michael Forney [Tue, 6 Oct 2020 21:12:57 +0000 (17:12 -0400)] 
gdb: Fix installation of gcore.1 on some platforms

gcore is installed on NetBSD, FreeBSD, Solaris (HAVE_NATIVE_GCORE_HOST=1)
and Linux (HAVE_NATIVE_GCORE_TARGET=1). However, even though gcore.1
is installed conditional on those variables, HAVE_NATIVE_GCORE_HOST
was missing from gdb/doc/Makefile.in, so manual installation was
skipped on NetBSD, FreeBSD, and Solaris.

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

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

Change-Id: I17c3ce2ecdfb806ece17f05ba78356b25ffa865e

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Oct 2020 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agox86: Properly merge -z ibt and -z shstk
H.J. Lu [Tue, 6 Oct 2020 22:38:23 +0000 (15:38 -0700)] 
x86: Properly merge -z ibt and -z shstk

Merge -z ibt and -z shstk only with GNU_PROPERTY_X86_FEATURE_1_AND, not
any GNU_PROPERTY_X86_UINT32_AND_XXX properties.

bfd/

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

ld/

PR ld/26711
* testsuite/ld-i386/i386.exp: Run ld/26711 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr26711-1.d: Likewise.
* testsuite/ld-i386/pr26711-2.d: Likewise.
* testsuite/ld-i386/pr26711-3.d: Likewise.
* testsuite/ld-x86-64/pr26711-1-x32.d: Likewise.
* testsuite/ld-x86-64/pr26711-1.d: Likewise.
* testsuite/ld-x86-64/pr26711-2-x32.d: Likewise.
* testsuite/ld-x86-64/pr26711-2.d: Likewise.
* testsuite/ld-x86-64/pr26711-3-x32.d: Likewise.
* testsuite/ld-x86-64/pr26711-3.d: Likewise.
* testsuite/ld-x86-64/pr26711.s: Likewise.

3 years agogdbserver: Remove unused argument in register_data()
Shahab Vahedi [Tue, 6 Oct 2020 11:15:32 +0000 (13:15 +0200)] 
gdbserver: Remove unused argument in register_data()

The register_data() function in gdbserver/regcache.cc has an
input argument called "fetch".  This argument is not used by this
static function at all.  Therefore, it is time to get rid of it.

gdbserver/ChangeLog:

* regcache.cc (register_data): Remove unused "fetch" argument.

3 years agoaarch64: Fix bogus type punning in parse_barrier() [PR26699]
Alex Coplan [Tue, 6 Oct 2020 14:56:44 +0000 (15:56 +0100)] 
aarch64: Fix bogus type punning in parse_barrier() [PR26699]

This patch fixes a bogus use of type punning in parse_barrier() which
was causing an assembly failure on big endian LP64 hosts when attempting
to assemble "isb sy" for AArch64.

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

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

gas/ChangeLog:

* config/tc-aarch64.c (asm_barrier_opt): Delete.
(parse_barrier): Fix bogus type punning.
* testsuite/gas/aarch64/system.d: Update disassembly.
* testsuite/gas/aarch64/system.s: Add isb sy test.

3 years agoFix a bug in objcopy/strip's ability to merge notes in multiple same-named sections.
Nick Clifton [Tue, 6 Oct 2020 14:49:40 +0000 (15:49 +0100)] 
Fix a bug in objcopy/strip's ability to merge notes in multiple same-named sections.

* objcopy.c (copy_object): Compare input and output sections by
pointer rather than name.

3 years agoFix gdb.base/list.exp with Clang
Gary Benson [Tue, 6 Oct 2020 14:08:37 +0000 (15:08 +0100)] 
Fix gdb.base/list.exp with Clang

Two subtests of gdb.base/list.exp failed when built with Clang
because the unused function "unused" was optimized out.  This
commit adds __attribute__ ((used)) to both definitions.

gdb/testsuite/ChangeLog:

* gdb.base/list0.c (unused): Add __attribute__ ((used)).
* gdb.base/list1.c (unused): Likewise.

3 years agoFix gdb.base/list-ambiguous.exp with Clang
Gary Benson [Tue, 6 Oct 2020 14:08:37 +0000 (15:08 +0100)] 
Fix gdb.base/list-ambiguous.exp with Clang

The ambiguous variable parts of gdb.base/list-ambiguous.exp failed
when built with Clang because the variable in question was unused
and was optimized out.  This commit adds __attribute__ ((used)) to
both definitions.

gdb/testsuite/ChangeLog:

* gdb.base/list-ambiguous0.c (ambiguous_var): Add
__attribute__ ((used)).
* gdb.base/list-ambiguous1.c (ambiguous_var): Likewise.

3 years agoA small set of code improvements for the Z80 assembler.
Sergey Belyashav [Tue, 6 Oct 2020 10:58:57 +0000 (11:58 +0100)] 
A small set of code improvements for the Z80 assembler.

PR 26692
* config/tc-z80.c (md_begin): Ensure that xpressions are empty
before using them.
(unify_indexed): Likewise.
(z80_start_line_hook): Improve hash sign handling when SDCC
compatibility mode enabled.
(md_parse_exp_not_indexed): Improve indirect addressing
detection.
(md_pseudo_table): Accept hd64 as an alias of z810.

3 years agosim: Fix autoreconf errors in sim/ directory
Andrew Burgess [Mon, 5 Oct 2020 08:53:50 +0000 (09:53 +0100)] 
sim: Fix autoreconf errors in sim/ directory

Run autoreconf in sim/ directory and you'll see some errors.  The
problem is that autoreconf (a perl script) does not evaluate the value
passed as an argument to AC_CONFIG_AUX_DIR, so something like:

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

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

  AC_CONFIG_AUX_DIR(../..)

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

sim/testsuite/ChangeLog:

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

sim/testsuite/d10v-elf/ChangeLog:

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

sim/testsuite/frv-elf/ChangeLog:

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

sim/testsuite/m32r-elf/ChangeLog:

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

sim/testsuite/mips64el-elf/ChangeLog:

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

3 years agogdb: handle unmapped overlays in find_pc_line
Andrew Burgess [Sun, 13 Sep 2020 20:53:26 +0000 (21:53 +0100)] 
gdb: handle unmapped overlays in find_pc_line

I configured and built an m32r-elf toolchain, and ran the
gdb.base/overlays.exp test.  I saw a couple of errors where GDB would
place a breakpoint in the wrong place when placing a breakpoint using
a function name, for example in this function:

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

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

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

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

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

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

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

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

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

gdb/ChangeLog:

* symtab.c (find_pc_line): Return unmapped addresses when the
requested address is also unmapped.

3 years agogdb/testsuite: allow gdb.base/overlays.exp to compile for m32r
Andrew Burgess [Sun, 13 Sep 2020 20:53:08 +0000 (21:53 +0100)] 
gdb/testsuite: allow gdb.base/overlays.exp to compile for m32r

The gdb.base/overlays.exp test is only currently supported on m32r
baremetal targets, however, when I configure a toolchain for m32r-elf
the test does not compile.

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

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

gdb/testsuite/ChangeLog:

* gdb.base/m32r.ld: Remove SEARCH_DIR line.  Add MEMORY regions,
make use of regions throughout.
* gdb.base/overlays.exp: Enclose string with variableds in "..",
not {...}.
* gdb.base/ovlymgr.c: Add 'string.h' and 'stdlib.h' includes.

3 years agoFix gas sh-link-zero test for hppa64-hpux
Alan Modra [Tue, 6 Oct 2020 09:52:43 +0000 (20:22 +1030)] 
Fix gas sh-link-zero test for hppa64-hpux

* testsuite/gas/elf/sh-link-zero.s: Don't start directives in
first column.  Don't use numeric labels.

3 years agoPR26667, Add powerpc64le-*-freebsd* support
Brandon Bergren [Mon, 5 Oct 2020 22:49:23 +0000 (09:19 +1030)] 
PR26667, Add powerpc64le-*-freebsd* support

PR 26667
bfd/
* config.bfd: Add powerpc64le-*-freebsd*.
* configure.ac: Add powerpc_elf64_fbsd_le_vec.
* elf64-ppc.c (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Define for
freebsd.
* targets.c (powerpc_elf64_fbsd_le_vec): Declare.
(_bfd_target_vector): Add it.
* configure: Regenerate.
ld/
* Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf64lppc_fbsd.c.
Include $(DEPDIR)/eelf64lppc_fbsd.Pc.
* configure.tgt: Add powerpc64le-*-freebsd*.
* emulparams/elf64lppc_fbsd.sh: New file.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Oct 2020 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: sync tui header files in HFILES_NO_SRCDIR
Simon Marchi [Mon, 5 Oct 2020 16:37:23 +0000 (12:37 -0400)] 
gdb: sync tui header files in HFILES_NO_SRCDIR

I noticed that tui/tui-windata.h didn't exist anymore, and that
tui/tui-out.h wasn't listed.  Fix that.

gdb/ChangeLog:

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

Change-Id: Ic75cc68432b90ba5be857a2852ad52dea326fe36

3 years agogdb: TYPE_VECTOR -> type::is_vector in amd64-windows-tdep.c
Simon Marchi [Mon, 5 Oct 2020 16:21:14 +0000 (12:21 -0400)] 
gdb: TYPE_VECTOR -> type::is_vector in amd64-windows-tdep.c

I get this build failure:

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

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

gdb/ChangeLog:

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

Change-Id: I0ce26c3f7a33625761a8dba351c3158464f21b01

3 years agoFix compile time error building windmc, detected by gcc 11.
Nick Clifton [Mon, 5 Oct 2020 15:09:00 +0000 (16:09 +0100)] 
Fix compile time error building windmc, detected by gcc 11.

PR 26698
* windmc.c (mc_unify_path): Fix typo checking character at end of
pathname.

3 years ago[PATCH][GAS][AArch64] Update Cortex-X1 feature flags
Przemyslaw Wirkus [Mon, 5 Oct 2020 14:43:41 +0000 (15:43 +0100)] 
[PATCH][GAS][AArch64] Update Cortex-X1 feature flags

This is feature flags update for Cortex-X1 CPU.
For more information about this processor, see [0].

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

gas/ChangeLog:

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

* config/tc-aarch64.c: Update Cortex-X1 feature flags.

3 years ago[PATCH][GAS][arm] Update Cortex-X1 feature flags
Przemyslaw Wirkus [Mon, 5 Oct 2020 14:43:32 +0000 (15:43 +0100)] 
[PATCH][GAS][arm] Update Cortex-X1 feature flags

This is feature flags update for Cortex-X1 CPU.
For more information about this processor, see [0].

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

gas/ChangeLog:

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

* config/tc-arm.c: Update Cortex-X1 feature flags.

3 years agoAdd NetBSD AArch64 Little Endian and Big Endian BFD support.
Nick Clifton [Mon, 5 Oct 2020 13:56:42 +0000 (14:56 +0100)] 
Add NetBSD AArch64 Little Endian and Big Endian BFD support.

bfd      * config.bfd (aarch64-*-netbsd*, aarch64_be-*-netbsd*): Add target.

3 years agoAdd NetBSD AArch64 GAS support.
Kamil Rytarowski [Mon, 5 Oct 2020 13:54:00 +0000 (14:54 +0100)] 
Add NetBSD AArch64 GAS support.

gas * configure.tgt (aarch64*-*-netbsd*): Add target.

3 years agoFix spelling mistakes
Samanta Navarro [Mon, 5 Oct 2020 13:20:15 +0000 (14:20 +0100)] 
Fix spelling mistakes

3 years agogdb: avoid unnecessary string copy in auto_load_objfile_script_1
Simon Marchi [Mon, 5 Oct 2020 13:02:42 +0000 (09:02 -0400)] 
gdb: avoid unnecessary string copy in auto_load_objfile_script_1

Assigning the result of STRIP_DRIVE_SPEC to an std::string creates an
unnecessary copy of the string.  STRIP_DRIVE_SPEC is defined as:

  #define STRIP_DRIVE_SPEC(f) ((f) + 2)

So if it is passed a "const char *", it returns a "const char *".  We
could use a "const char *" intermediary variable instead of an
std::string, or (as implemented in this patch) just use it directly in
the concatenation right after.

gdb/ChangeLog:

* auto-load.c (auto_load_objfile_script_1): Don't use
debugfile_holder as temporary variable when stripping drive
letter.

Change-Id: If2ccc7a156b22100754d9cdf6778ac7eeb93da4c

3 years agoi386: Allow non-absolute segment values for lcall/ljmp
T.K. Chia [Mon, 5 Oct 2020 12:46:23 +0000 (05:46 -0700)] 
i386: Allow non-absolute segment values for lcall/ljmp

Allow an unresolved or non-absolute symbol as the segment operand of an
immediate far jump (`ljmp SEG, OFF') or far call (`lcall SEG, OFF').

gas/

2020-10-05  T.K. Chia  <u1049321969@caramail.com>

PR gas/26694
* NEWS: Updated for i386 lcall and ljmp change.
* config/tc-i386.c (output_interseg_jump): Allow non-absolute
segment operand for immediate lcall and ljmp.
* testsuite/gas/i386/jump.d,
* testsuite/gas/i386/jump.s,
* testsuite/gas/i386/jump16.d,
* testsuite/gas/i386/jump16.e,
* testsuite/gas/i386/jump16.s: Add tests for non-absolute
segment operand for immediate ljmp.

ld/

2020-10-05  T.K. Chia  <u1049321969@caramail.com>

PR gas/26694
* testsuite/ld-i386/ljmp.s,
* testsuite/ld-i386/ljmp1.d,
* testsuite/ld-i386/ljmp1.s,
* testsuite/ld-i386/ljmp2.d,
* testsuite/ld-i386/ljmp2.s,
* testsuite/ld-x86-64/ljmp1.d,
* testsuite/ld-x86-64/ljmp2.d: New testcases.
* testsuite/ld-i386/i386.exp,
* testsuite/ld-x86-64/x86-64.exp: Run them.

3 years agoUpdate the BFD linker so that it deprecates grouped short options.
Nick Clifton [Mon, 5 Oct 2020 12:53:59 +0000 (13:53 +0100)] 
Update the BFD linker so that it deprecates grouped short options.

* lexsup.c (parse_args): Generate an error or warning message when
multiple short options are used together.

3 years agoFix function argument and return value locations
Hannes Domani [Tue, 5 May 2020 12:31:26 +0000 (14:31 +0200)] 
Fix function argument and return value locations

Fixes these testsuite fails on Windows:
FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2)
FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4)
FAIL: gdb.base/callfuncs.exp: noproto: p t_float_complex_values(fc1, fc2)
FAIL: gdb.base/callfuncs.exp: noproto: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4)
FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tld
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tld
FAIL: gdb.base/call-sc.exp: zed L for return; return call-sc-tld
FAIL: gdb.base/call-sc.exp: return foo; return call-sc-tld
FAIL: gdb.base/call-sc.exp: return foo; synchronize pc to main() for 'call-sc-tld'
FAIL: gdb.base/call-sc.exp: return foo; synchronize pc to main() for 'call-sc-tld'
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tld
FAIL: gdb.base/call-sc.exp: zed L for finish; return call-sc-tld
FAIL: gdb.base/call-sc.exp: finish foo; return call-sc-tld (the program is no longer running)
FAIL: gdb.base/call-sc.exp: value foo finished; return call-sc-tld

For function arguments (callfuncs.exp), only TYPE_CODE_COMPLEX was
missing in the types passed via integer registers.

For return values, there were a lot more issues:
- TYPE_CODE_DECFLOAT is NOT returned via XMM0.
- long double is NOT returned via XMM0.
- but __int128 IS returned via XMM0.
- the comments for TYPE_CODE_FLT state that __m128, __m128i and __m128d are
  returned by XMM0, and this is correct, but it doesn't actually check for
  them, because they are TYPE_CODE_ARRAY with TYPE_VECTOR

So I had to add TYPE_CODE_DECFLOAT to the arguments passed via XMM register,
but I had to remove it from the values returned via XMM0 register.

gdb/ChangeLog:

2020-10-05  Hannes Domani  <ssbssa@yahoo.de>

* amd64-windows-tdep.c (amd64_windows_passed_by_integer_register):
Add TYPE_CODE_COMPLEX.
(amd64_windows_return_value): Fix types returned via XMM0.

gdb/testsuite/ChangeLog:

2020-10-05  Hannes Domani  <ssbssa@yahoo.de>

* gdb.base/call-sc.c: Fix return struct on stack test case.
* gdb.base/call-sc.exp: Likewise.

3 years agox86-64: Always display suffix for %LQ in 64bit
H.J. Lu [Mon, 5 Oct 2020 12:27:58 +0000 (05:27 -0700)] 
x86-64: Always display suffix for %LQ in 64bit

In 64bit, assembler generates a warning for "sysret":

$ echo sysret | as --64 -o x.o -
{standard input}: Assembler messages:
{standard input}:1: Warning: no instruction mnemonic suffix given and no register operands; using default for `sysret'

Always display suffix for %LQ in 64bit to display "sysretl".

gas/

PR binutils/26704
* testsuite/gas/i386/noreg64-data16.d: Expect sysretl instead of
sysret.
* testsuite/gas/i386/noreg64.d: Likewise.
* testsuite/gas/i386/x86-64-intel64.d: Likewise.
* testsuite/gas/i386/x86-64-opcode.d: Likewise.

opcodes/

PR binutils/26704
* i386-dis.c (putop): Always display suffix for %LQ in 64bit.

3 years agox86: Clear modrm if not needed
H.J. Lu [Mon, 5 Oct 2020 12:23:29 +0000 (05:23 -0700)] 
x86: Clear modrm if not needed

The MODRM byte can be checked to display the instruction name only if the
MODRM byte needed.  Clear modrm if the MODRM byte isn't needed so that
modrm field checks in putop like, modrm.mod == N with N != 0, can be done
without checking need_modrm.

gas/

PR binutils/26705
* testsuite/gas/i386/x86-64-suffix.s: Add "mov %rsp,%rbp" before
sysretq.
* testsuite/gas/i386/x86-64-suffix-intel.d: Updated.
* testsuite/gas/i386/x86-64-suffix.d: Likewise.

opcodes/

PR binutils/26705
* i386-dis.c (print_insn): Clear modrm if not needed.
(putop): Check need_modrm for modrm.mod != 3.  Don't check
need_modrm for modrm.mod == 3.

3 years agoAdd Luis Machado to AArch64/ARM GDB maintainers
Alan Hayward [Fri, 25 Sep 2020 11:13:25 +0000 (12:13 +0100)] 
Add Luis Machado to AArch64/ARM GDB maintainers

gdb/ChangeLog:

* MAINTAINERS (Responsible Maintainers): Add Luis Machado to
  AArch64/ARM maintainers.

3 years agoGAS: Update the .section directive so that a numeric section index can be provided...
Nick Clifton [Mon, 5 Oct 2020 09:40:07 +0000 (10:40 +0100)] 
GAS: Update the .section directive so that a numeric section index can be provided when the "o" flag is used.

PR 26253
gas * config/obj-elf.c (obj_elf_section): Accept a numeric value for
the "o" section flag.  Interpret it as a section index.  Allow an
index of zero.
* doc/as.texi: Document the new behaviour.
* NEWS: Mention the new feature.  Tidy entries.
* testsuite/gas/elf/sh-link-zero.s: New test.
* testsuite/gas/elf/sh-link-zero.d: New test driver.
* testsuite/gas/elf/elf.exp: Run the new test.
* testsuite/gas/elf/section21.l: Updated expected assembler
output.

bfd * elf.c (_bfd_elf_setup_sections): Do not complain about an
sh_link value of zero when the SLF_LINK_ORDER flag is set.
(assign_section_numbers): Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Oct 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: add doc for "set/show debug event-loop"
Simon Marchi [Sun, 4 Oct 2020 16:41:56 +0000 (12:41 -0400)] 
gdb: add doc for "set/show debug event-loop"

I forgot that "set/show debug" commands are listed in the doc and in
NEWS, so here they are.

gdb/doc/ChangeLog:

* gdb.texinfo (Debugging Output): Add set/show debug event-loop.

gdb/ChangeLog:

* NEWS: Mention set/show debug event-loop.

Change-Id: If30b80177049006578280a06912ee2b97bd03a75

3 years agogdb/doc: space out list entries, fix one type
Simon Marchi [Sun, 4 Oct 2020 16:36:02 +0000 (12:36 -0400)] 
gdb/doc: space out list entries, fix one type

I want to add an item to this list, but it's so packed I have trouble
finding where one item ends and the next starts.  Add a few empty lines
to make it a bit more readable.

Doing this, I also noticed that an "aix-thread" should in fact be
"aix-solib".

gdb/doc/ChangeLog:

* gdb.texinfo (Debugging Output): Add empty lines, fix typo.

Change-Id: I7ef211f9e3988cfbc6ec94124d23a5f2412f3c82

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 4 Oct 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agox86: Update register operand check for AddrPrefixOpReg
H.J. Lu [Sat, 3 Oct 2020 11:23:55 +0000 (04:23 -0700)] 
x86: Update register operand check for AddrPrefixOpReg

When the address size prefix applies to both the memory and the register
operand, we need to extract the address size prefix from the register
operand if the memory operand has no real registers, like symbol, DISP
or symbol(%rip).

NB: GCC always generates symbol(%rip) for RIP-relative addressing for
both x32 and x86-64.

Move the .code16 tests in movdir.s to movdir-16bit to show the correct
output from objdump.

PR gas/26685
* config/tc-i386.c (process_suffix): Also check the register
operand for the address size prefix if the memory operand has
no real registers.
* testsuite/gas/i386/enqcmd-16bit.d: New file.
* testsuite/gas/i386/enqcmd-16bit.s: Likewise.
* testsuite/gas/i386/movdir-16bit.d: Likewise.
* testsuite/gas/i386/movdir-16bit.s: Likewise.
* testsuite/gas/i386/enqcmd.s: Add tests with symbol and DISP.
* testsuite/gas/i386/x86-64-enqcmd.s: Likewise.
* testsuite/gas/i386/x86-64-movdir.s: Likewise.
* testsuite/gas/i386/movdir.s: Add tests with symbol and DISP.
Remove the .code16 test.
* testsuite/gas/i386/i386.exp: Run movdir-16bit and enqcmd-16bit.
* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
* testsuite/gas/i386/x86-64-movdir.d: Likewise.
* testsuite/gas/i386/enqcmd-intel.d: Likewise.
* testsuite/gas/i386/enqcmd.d: Likewise.
* testsuite/gas/i386/movdir-intel.d: Likewise.
* testsuite/gas/i386/movdir.d: Likewise.
* testsuite/gas/i386/x86-64-enqcmd-intel.d: Likewise.
* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
* testsuite/gas/i386/x86-64-movdir.d: Likewise.

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

3 years agoUnconditionally use REG_EXTENDED
Tom Tromey [Fri, 2 Oct 2020 16:23:25 +0000 (10:23 -0600)] 
Unconditionally use REG_EXTENDED

skip.c checks whether REG_EXTENDED is defined -- but this should
always be available, and is used unconditionally in other parts of
gdb.  This patch removes this check, then further simplifies this
code, removing a declaration and a repeated assertion.

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

* skip.c (skiplist_entry::skiplist_entry): Unconditionally use
REG_EXTENDED.

3 years agoarm: add support for Cortex-A78 and Cortex-A78AE
Przemyslaw Wirkus [Fri, 2 Oct 2020 19:44:13 +0000 (20:44 +0100)] 
arm: add support for Cortex-A78 and Cortex-A78AE

bfd/ChangeLog:

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

* cpu-arm.c: Add cortex-a78 and cortex-a78ae.

gas/ChangeLog:

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

* config/tc-arm.c: Add cortex-a78 and cortex-a78ae cores.
* doc/c-arm.texi: Update docs.
* NEWS: Update news.
* testsuite/gas/arm/cpu-cortex-a78.d: New test.
* testsuite/gas/arm/cpu-cortex-a78ae.d: New test.

3 years agogdb: fix some inferior_created observer signatures
Simon Marchi [Fri, 2 Oct 2020 19:22:21 +0000 (15:22 -0400)] 
gdb: fix some inferior_created observer signatures

I just noticed that in a7aba2668a7b ("gdb: remove arguments from
inferior_created observable"), I forgot to update
aix_thread_inferior_created and procfs_inferior_created, which are in
files I can't compile.

Remove the parameters from aix_thread_inferior_created.  And simply
remove procfs_inferior_created, since it's empty anyway.

gdb/ChangeLog:

* aix-thread.c (aix_thread_inferior_created): Remove parameters.
* procfs.c (procfs_inferior_created): Remove.
(_initialize_procfs): Don't register procfs_inferior_created.

Change-Id: Ifc7def7c096332033b5d466d32cb873d1df18c2c

3 years agogdb: add debug prints in event loop
Simon Marchi [Fri, 2 Oct 2020 18:44:40 +0000 (14:44 -0400)] 
gdb: add debug prints in event loop

Add debug printouts about event loop-related events:

 - When a file descriptor handler gets invoked
 - When an async event/signal handler gets invoked

gdb/ChangeLog:

* async-event.c (invoke_async_signal_handlers): Add debug
print.
(check_async_event_handlers): Likewise.
* event-top.c (show_debug_event_loop): New function.
(_initialize_event_top): Register "set debug event-loop"
setting.

gdbserver/ChangeLog:

* server.cc (handle_monitor_command): Handle "set
debug-event-loop".
(captured_main): Handle "--debug-event-loop".
(monitor_show_help): Mention new setting.
(gdbserver_usage): Mention new flag.

gdbsupport/ChangeLog:

* event-loop.h (debug_event_loop): New variable declaration.
(event_loop_debug_printf_1): New function declaration.
(event_loop_debug_printf): New macro.
* event-loop.cc (debug_event_loop): New variable.
(handle_file_event): Add debug print.
(event_loop_debug_printf_1): New function.

Change-Id: If78ed3a69179881368e7895b42940ce13b6a1a05

3 years agogdb: move debug_prefixed_vprintf here
Simon Marchi [Fri, 2 Oct 2020 18:44:39 +0000 (14:44 -0400)] 
gdb: move debug_prefixed_vprintf here

The following patch needs to output debug prints from gdbsupport code.
Move debug_prefixed_vprintf so that it is possible to use it from
gdbsupport.

gdb/ChangeLog:

* debug.c (debug_prefixed_vprintf): Move to gdbsupport.
* debug.h: Remove.
* infrun.c: Include gdbsupport/common-debug.h.
* linux-nat.c: Likewise.

gdbsupport/ChangeLog:

* common-debug.cc (debug_prefixed_vprintf): Move here.
* common-debug.h (debug_prefixed_vprintf): Move here.

Change-Id: I5170065fc10a7a49c0f1bba67c691decb2cf3bcb

3 years agogdb: give names to async event/signal handlers
Simon Marchi [Fri, 2 Oct 2020 18:44:38 +0000 (14:44 -0400)] 
gdb: give names to async event/signal handlers

Assign names to async event/signal handlers.  They will be used in debug
messages when file handlers are invoked.

Unlike in the previous patch, the names are not copied in the structure,
since we don't need to (all names are string literals for the moment).

gdb/ChangeLog:

* async-event.h (create_async_signal_handler): Add name
parameter.
(create_async_event_handler): Likewise.
* async-event.c (struct async_signal_handler) <name>: New field.
(struct async_event_handler) <name>: New field.
(create_async_signal_handler): Assign name.
(create_async_event_handler): Assign name.
* event-top.c (async_init_signals): Pass name when creating
handler.
* infrun.c (_initialize_infrun): Likewise.
* record-btrace.c (record_btrace_push_target): Likewise.
* record-full.c (record_full_open): Likewise.
* remote-notif.c (remote_notif_state_allocate): Likewise.
* remote.c (remote_target::open_1): Likewise.
* tui/tui-win.c (tui_initialize_win): Likewise.

Change-Id: Icd9d9f775542ae5fc2cd148c12f481e7885936d5

3 years agogdb: give names to event loop file handlers
Simon Marchi [Fri, 2 Oct 2020 18:45:52 +0000 (14:45 -0400)] 
gdb: give names to event loop file handlers

Assign names to event loop file handlers.  They will be used in debug
messages when file handlers are invoked.

In GDB, each UI used to get its own unique number, until commit
cbe256847e19 ("Remove ui::num").  Re-introduce this field, and use it to
make a unique name for the handler.

I'm not too sure what goes on in ser-base.c, all I know is that it's
what is used when debugging remotely.  I've just named the main handler
"serial".  It would be good to have unique names there too.  For instance
when debugging with two different remote connections, we'd ideally want
the handlers to have unique names.  I didn't do it in this patch though.

gdb/ChangeLog:

* async-event.c (initialize_async_signal_handlers): Pass name to
add_file_handler
* event-top.c (ui_register_input_event_handler): Likewise.
* linux-nat.c (linux_nat_target::async): Likewise.
* run-on-main-thread.c (_initialize_run_on_main_thread):
Likewise
* ser-base.c (reschedule): Likewise.
(ser_base_async): Likewise.
* tui/tui-io.c: Likewise.
* top.h (struct ui) <num>: New field.
* top.c (highest_ui_num): New variable.
(ui::ui): Initialize num.

gdbserver/ChangeLog:

* linux-low.cc (linux_process_target::async): Pass name to
add_file_handler.
* remote-utils.cc (handle_accept_event): Likewise.
(remote_open): Likewise.

gdbsupport/ChangeLog:

* event-loop.h (add_file_handler): Add "name" parameter.
* event-loop.cc (struct file_handler) <name>: New field.
(create_file_handler): Add "name" parameter, assign it to file
handler.
(add_file_handler): Add "name" parameter.

Change-Id: I9f1545f73888ebb6778eb653a618ca44d105f92c

3 years agogdb: remove arguments from inferior_created observable
Simon Marchi [Fri, 2 Oct 2020 14:46:38 +0000 (10:46 -0400)] 
gdb: remove arguments from inferior_created observable

I noticed that non of the listeners of the inferior_created observable
used either of the arguments.  Remove them.  This in turn allows
removing the target parameter of post_create_inferior.

Tested only by rebuilding.

gdb/ChangeLog:

* observable.h <inferior_created>: Remove parameters.  Update all
listeners.
* inferior.h (post_create_inferior): Remove target parameter.
Update all callers.

Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6

3 years agoFix spelling mistake in gdb/testsuite/README.
Gary Benson [Fri, 2 Oct 2020 11:16:55 +0000 (12:16 +0100)] 
Fix spelling mistake in gdb/testsuite/README.

This commit corrects the spelling mistake detailed below.

gdb/testsuite/ChangeLog:

* README: Fix "paralell".

3 years agoFix the mve-vcvtne-it assembler test for the arm-*-pe targets.
Nick Clifton [Fri, 2 Oct 2020 10:14:57 +0000 (11:14 +0100)] 
Fix the mve-vcvtne-it assembler test for the arm-*-pe targets.

* testsuite/gas/arm/mve-vcvtne-it.d: Allow for padding inserted by
PE based targets.

3 years agoAllow note sections to be discarded when they are linked to another discarded secction.
H.J. Lu [Fri, 2 Oct 2020 10:08:19 +0000 (11:08 +0100)] 
Allow note sections to be discarded when they are linked to another discarded secction.

PR 26681
bfd * elflink.c (bfd_elf_gc_sections): Do not arbitrarily keep note
sections which are linked to another section.

ld * testsuite/ld-elf/pr26681.s: New test.
* testsuite/ld-elf/pr26681.d: New test driver.
* testsuite/ld-elf/pr26681.l: New test output.

3 years agoDWARFv5: Handle DW_MACRO_define_strx and DW_MACRO_undef_strx macro entries.
nitachra [Sun, 20 Sep 2020 17:52:59 +0000 (23:22 +0530)] 
DWARFv5: Handle DW_MACRO_define_strx and DW_MACRO_undef_strx macro entries.

GDB complaints "During symbol reading: unrecognized DW_MACFINO
opcode 0xb" with the testcase given below. Clang is emitting
DW_MACRO_define_strx and DW_MACRO_undef_strx entries in .debug_macro
section which are not supported in GDB. This patch handles them.

DW_MACRO_define_strx and DW_MACRO_undef_strx are added in DWARFv5.
They have two operands. The first operand encodes the line number of
the #define or #undef macro directive. The second operand identifies
a string; it is represented using an unsigned LEB128 encoded value,
which is interpreted as a zero-based index into an array of offsets
in the .debug_str_offsets section. This is as per the section 6.3.2.1
of Dwarf Debugging Information Format Version 5.

Test case used:
 #define MAX_SIZE 10
int main(void)
{
   int size = 0;
   size = size + MAX_SIZE;

   printf("\n The value of size is [%d]\n",size);

   return 0;
}

clang -gdwarf-5 -fdebug-macro  macro.c -o macro.out

Before the patch:

gdb/new_gdb/binutils-gdb/build/bin/gdb -q macro.out -ex "set complaints 1" -ex "start"
Reading symbols from macro.out...
During symbol reading: unrecognized DW_MACFINO opcode 0xb
Temporary breakpoint 1 at 0x4004df: file macro.c, line 7.
Starting program: /home/nitika/workspace/macro.out

Temporary breakpoint 1, main () at macro.c:7
7          int size = 0;
(gdb)

Tested by running the testsuite before and after the patch with
 -gdwarf-5 and there is no increase in the number of test cases
that fails. Used clang 11.0.0.

gdb/ChangeLog:

* dwarf2/macro.c (dwarf_decode_macro_bytes): Handle DW_MACRO_define_strx
and DW_MACRO_undef_strx.
(dwarf_decode_macros): Likewise
* dwarf2/read.c (dwarf_decode_macros): Pass str_offsets_base in the parameters
which is the value of DW_AT_str_offsets_base.
* dwarf2/macro.h (dwarf_decode_macros): Modify the definition to include
str_offsets_base.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Oct 2020 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoFix the i386 build
Kamil Rytarowski [Thu, 1 Oct 2020 23:00:22 +0000 (01:00 +0200)] 
Fix the i386 build

Remove old, no longer needed and no longer valid extern.

../../gdb/i386-nbsd-tdep.c:58:12: error: 'i386nbsd_sc_reg_offset' was declared 'extern' and later 'static' [-fpermissive]
   58 | static int i386nbsd_sc_reg_offset[] =
      |            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../gdb/i386-nbsd-tdep.c:31:
../../gdb/i386-tdep.h:480:12: note: previous declaration of 'i386nbsd_sc_reg_offset'
  480 | extern int i386nbsd_sc_reg_offset[];
      |            ^~~~~~~~~~~~~~~~~~~~~~

gdb/ChangeLog:

* i386-tdep.h (i386nbsd_sc_reg_offset): Remove.

3 years agoRemove the old sanity check of sigcontext offsets for NetBSD/i386
Kamil Rytarowski [Wed, 23 Sep 2020 03:54:19 +0000 (05:54 +0200)] 
Remove the old sanity check of sigcontext offsets for NetBSD/i386

NetBSD switched to ucontext, back in 2003 and the sigcontext code
is no longer available for users, except for legacy compat layers.

This code was not available anyway as the pre-processor check
was probably never operational and buildable on NetBSD. The code
inside it does not compile.

Meanwhile, move the offset variable into the ifdef goards and avoid
the error about unused variable.

../../gdb/i386-bsd-nat.c: In function 'void _initialize_i386bsd_nat()':
../../gdb/i386-bsd-nat.c:347:7: error: unused variable 'offset' [-Werror=unused-variable]
  347 |   int offset;
      |       ^~~~~~
cc1plus: all warnings being treated as errors

gdb/ChangeLog:

* i386-bsd-nat.c (_initialize_i386bsd_nat): Update.
* i386-nbsd-tdep.c (i386nbsd_sc_reg_offset): Now static.

3 years agoAdd NetBSD/i386 gdbserver support
Kamil Rytarowski [Wed, 23 Sep 2020 03:31:31 +0000 (05:31 +0200)] 
Add NetBSD/i386 gdbserver support

The support is on part with NetBSD/amd64, thus GPR works,
single step and software breakpoint are operational, and the
SVR4 r_debug integration is functional.

gdbserver/ChangeLog:

* netbsd-i386-low.cc: Add.
* Makefile.in (SFILES): Register "netbsd-i386-low.c".
* configure.srv: Add i[34567]86-*-netbsd*.

3 years agoRefactor the NetBSD amd64 gdbserver support
Kamil Rytarowski [Wed, 23 Sep 2020 02:26:37 +0000 (04:26 +0200)] 
Refactor the NetBSD amd64 gdbserver support

Replace the pre-C++ construct of netbsd_target_ops, netbsd_regset_info
and netbsd_tdesc with C++ inheritance approach found in the Linux
gdbserver code. Add netbsd_amd64_target, that inherits from the
netbsd_process_target class and add proper singleton object for
the_netbsd_target, initialized from netbsd_amd64_target.

Call low_arch_setup () on post process creation, which sets machine
specific properties of the traced process.

Remove global singleton the_netbsd_target object from the generic
gdbserver code.

This refactoring introduces no functional change from the end-user
point of view.

gdbserver/ChangeLog:

* netbsd-amd64-low.cc (netbsd_x86_64_arch_setup): Remove.
(netbsd_target_regsets): Now const.
(the_low_target): Remove.
(class netbsd_amd64_target, the_netbsd_amd64_target)
(the_netbsd_target): Add.
* netbsd-low.cc (netbsd_process_target::post_create_inferior): Call
low_arch_setup ().
(netbsd_process_target::fetch_registers)
(netbsd_process_target::store_registers, initialize_low): Update.
(the_netbsd_target): Remove.
* netbsd-low.h (netbsd_target_regsets, netbsd_target_ops)
(the_low_target, netbsd_tdesc): Remove.
(netbsd_process_target::get_regs_info)
(netbsd_process_target::low_arch_setup): Add.

3 years agoPreinitialize the sockaddr_un variable to zero
Kamil Rytarowski [Wed, 23 Sep 2020 02:20:05 +0000 (04:20 +0200)] 
Preinitialize the sockaddr_un variable to zero

Don't pass random sun_len for the BSD's,
zero the whole structure as recommended for portability.

Reported by Coverity.

gdbsupport/ChangeLog:

* agent.cc (gdb_connect_sync_socket): Preinitialize addr with zeros.

3 years agoInclude the x86-bsd-nat.h header and fix the NetBSD/i386 build
Kamil Rytarowski [Wed, 23 Sep 2020 01:56:46 +0000 (03:56 +0200)] 
Include the x86-bsd-nat.h header and fix the NetBSD/i386 build

In file included from ../../gdb/i386-nbsd-nat.c:26:
../../gdb/i386-bsd-nat.h:34:53: error: expected template-name before '<' token
   34 | class i386_bsd_nat_target : public x86bsd_nat_target<BaseTarget>
      |                                                     ^
../../gdb/i386-bsd-nat.h:34:53: error: expected '{' before '<' token
../../gdb/i386-nbsd-nat.c:74:45: error: aggregate 'i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target' has incomplete type and cannot be defined
   74 | static i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target;
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~

gdb/ChangeLog:

* i386-bsd-nat.c: Include "x86-bsd-nat.h".

3 years agoAdd new directive to GAS: .attach_to_group.
Nick Clifton [Thu, 1 Oct 2020 15:34:05 +0000 (16:34 +0100)] 
Add new directive to GAS: .attach_to_group.

* config/obj-elf (elf_pseudo_table): Add attach_to_group.
        (obj_elf_attach_to_group): New function.
        * doc/as.texi: Document the new directive.
* NEWS: Mention the new feature.
        * testsuite/gas/elf/attach-1.s: New test.
        * testsuite/gas/elf/attach-1.d: New test driver.
        * testsuite/gas/elf/attach-2.s: New test.
        * testsuite/gas/elf/attach-2.d: New test driver.
        * testsuite/gas/elf/attach-err.s: New test.
        * testsuite/gas/elf/attach-err.d: New test driver.
        * testsuite/gas/elf/attach-err.err: New test error output.
        * testsuite/gas/elf/elf.exp: Run the new tests.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Oct 2020 00:00:06 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agox86: Check register operand for AddrPrefixOpReg
H.J. Lu [Wed, 30 Sep 2020 23:33:35 +0000 (16:33 -0700)] 
x86: Check register operand for AddrPrefixOpReg

If the address prefix changes the register operand, we need to check the
register operand when the memory operand is RIP-relative.

PR gas/26685
* config/tc-i386.c (process_suffix): Check the register operand
for the address size prefix if the memory operand is symbol(%rip).
* testsuite/gas/i386/x86-64-enqcmd.s: Add tests with RIP-relative
addressing.
* testsuite/gas/i386/x86-64-movdir.s: Likewise.
* testsuite/gas/i386/x86-64-enqcmd-intel.d: Updated.
* testsuite/gas/i386/x86-64-enqcmd.d: Likewise.
* testsuite/gas/i386/x86-64-movdir-intel.d: Likewise.
* testsuite/gas/i386/x86-64-movdir.d: Likewise.

3 years ago[gdb] Fix regression in dwarf2_name
Tom de Vries [Wed, 30 Sep 2020 19:49:01 +0000 (21:49 +0200)] 
[gdb] Fix regression in dwarf2_name

Since commit 2c830f5475 "Change some uses of DW_STRING to string method" we
have these regressions:
...
FAIL: gdb.base/info-types-c++.exp: info types
FAIL: gdb.cp/anon-struct.exp: print type of t::t
FAIL: gdb.cp/anon-struct.exp: print type of X::t2
FAIL: gdb.cp/anon-struct.exp: print type of X::t2::t2
FAIL: gdb.cp/anon-struct.exp: print type of t3::~t3
...

Fix these in dwarf2_name by updating attr_name each time attr is updated.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-09-30  Tom de Vries  <tdevries@suse.de>

PR symtab/26683
* dwarf2/read.c (dwarf2_name): Update attr_name after attr is updated.

3 years agoFix regression in variant part handling
Tom Tromey [Wed, 30 Sep 2020 15:46:36 +0000 (09:46 -0600)] 
Fix regression in variant part handling

My series to change DWARF attribute handling to be type-safe
introduced a regression in gdb.ada/variant.exp.  handle_variant was
using as_unsigned on an attribute with DW_FORM_sdata.  This patch
changes it to use constant_value instead.

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

* dwarf2/read.c (handle_variant): Use constant_value.

3 years ago[GAS][AArch64] Add support for Cortex-A78 and Cortex-A78AE
Przemyslaw Wirkus [Wed, 30 Sep 2020 13:52:31 +0000 (14:52 +0100)] 
[GAS][AArch64] Add support for Cortex-A78 and Cortex-A78AE

* config/tc-aarch64.c: Add Cortex-A78 and Cortex-A78AE cores.
* doc/c-aarch64.texi: Update docs.
* NEWS: Update news.

3 years agold: Override the IR definition for non-ELF targets
H.J. Lu [Wed, 30 Sep 2020 12:23:20 +0000 (05:23 -0700)] 
ld: Override the IR definition for non-ELF targets

For non-ELF targets, override the IR definition before all LTO symbols
have been read.

PR ld/26675
* plugin.c (plugin_notice): Override the IR definition before
all LTO symbols have been read for non-ELF targets.

3 years agoNEWS: Mention recent Arm CPU support
Alex Coplan [Wed, 30 Sep 2020 11:15:18 +0000 (12:15 +0100)] 
NEWS: Mention recent Arm CPU support

Mentions Armv8-R AArch64, Cortex-R82, Neoverse V1, and Neoverse N2.

gas/ChangeLog:

2020-09-30  Alex Coplan  <alex.coplan@arm.com>

* NEWS: Mention recent Arm processor support.

3 years agoaarch64: Add support for Neoverse N2 CPU
Alex Coplan [Wed, 30 Sep 2020 11:11:56 +0000 (12:11 +0100)] 
aarch64: Add support for Neoverse N2 CPU

This patch adds support for Arm's Neoverse N2 CPU to AArch64 binutils.

gas/ChangeLog:

* config/tc-aarch64.c (aarch64_cpus): Add neoverse-n2.
* doc/c-aarch64.texi: Document support for Neoverse N2.

3 years agoFix gdb.dwarf2/dw2-double-set-die-type.exp with Clang
Gary Benson [Wed, 30 Sep 2020 09:51:58 +0000 (10:51 +0100)] 
Fix gdb.dwarf2/dw2-double-set-die-type.exp with Clang

gdb.dwarf2/dw2-double-set-die-type.exp failed to build with Clang,
because of the following issues:

- One .uleb128 directive was specified with an uppercase U,
  causing Clang to fail with the message:
    error: unknown directive
  This commit converts that directive to all-lowercase.

- The label ".Labbrev1_begin" was referenced but not defined,
  causing Clang to fail with the message:
    <unknown>:0: error: Undefined temporary symbol
  This commit adds the label in the appropriate place.

- The label ".Ldebug_line0" was referenced but not defined,
  causing Clang to fail with the message:
    <unknown>:0: error: Undefined temporary symbol
  This commit removes the reference.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/dw2-double-set-die-type.S (.Ldie_3e0):
Convert directive to lowercase.
(.Labbrev1_begin): Add missing label.
(abbrev code 0x1): Remove DW_AT_stmt_list.
(.Ldie_b): Likewise.

3 years agoAfter preventing creating an import library for an exe when there are no exports...
Jeremy Drake [Wed, 30 Sep 2020 09:50:46 +0000 (10:50 +0100)] 
After preventing creating an import library for an exe when there are no exports, to avoid a crash, it turned out that some projects expected to be able to create an import library for a dll with no exports, so more closely match the condition to the condition around initializing the dll name.

PR 26588
* emultempl/pe.em (_finish): Generate an import library for DLLs,
even if they have no exports.
* emultempl/pep.em (_finish): Likewise.

3 years agogcc-4.4.7 warning fixes
Alan Modra [Wed, 30 Sep 2020 05:01:15 +0000 (14:31 +0930)] 
gcc-4.4.7 warning fixes

* config/obj-elf.c (obj_elf_change_section): Rename variable to
avoid shadowing warning.
* symbols.c (symbol_entry_find): Init all symbol_flags fields.

3 years agoRemove DW_UNSND
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove DW_UNSND

This removes DW_UNSND, replacing uses with either as_unsigned or
constant_value, depending primarily on whether or not the form is
already known to be appropriate.

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

* dwarf2/read.c (lookup_dwo_id, get_type_unit_group)
(read_file_scope, dwarf2_get_pc_bounds)
(dwarf2_record_block_ranges, dwarf2_add_field, get_alignment)
(read_structure_type, handle_struct_member_die)
(read_enumeration_type, read_array_type, read_set_type)
(read_tag_pointer_type, read_tag_reference_type)
(read_subroutine_type, read_base_type, read_subrange_type)
(read_full_die_1, partial_die_info::read)
(partial_die_info::read, by, new_symbol)
(dwarf2_const_value_data, dwarf2_const_value_attr)
(dump_die_shallow, dwarf2_fetch_constant_bytes)
(prepare_one_comp_unit): Update.
* dwarf2/attribute.h (DW_UNSND): Remove.

3 years agoAdd attribute::as_boolean method
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Add attribute::as_boolean method

This adds a new attribute::as_boolean method, and updates the reader
to use it.  The main benefit of this change is that now the code will
respect the attribute's form.

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

* dwarf2/read.c (read_func_scope, prototyped_function_p)
(read_subroutine_type, partial_die_info::read)
(dwarf2_flag_true_p, new_symbol, dump_die_shallow)
(dwarf2_add_member_fn): Update.
* dwarf2/attribute.h (struct attribute) <as_boolean>: Declare.
* dwarf2/attribute.c (attribute::as_boolean): New method.

3 years agoAdd attribute::as_virtuality method
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Add attribute::as_virtuality method

This adds a new attribute::as_virtuality method and changes the DWARF
reader to use it.  This also ensures that the attibute's form will now
be respected.

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

* dwarf2/read.c (dwarf2_add_field, dwarf2_add_member_fn): Update.
* dwarf2/attribute.h (struct attribute) <as_virtuality>: New
method.
* dwarf2/attribute.c (attribute::as_virtuality): New method.

3 years agoChange die_info methods to check the attribute's form
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Change die_info methods to check the attribute's form

This changes two die_info methods to check the form of the attribute
before using it.

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

* dwarf2/die.h (struct die_info) <addr_base, ranges_base>: Check
the attribute's form.

3 years agoChange is_valid_DW_AT_defaulted to a method on attribute
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Change is_valid_DW_AT_defaulted to a method on attribute

This changes is_valid_DW_AT_defaulted to be a method on struct attribute.
Now it correctly respects the form of the attribute.

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

* dwarf2/read.c (is_valid_DW_AT_defaulted): Move to attribute.c.
(dwarf2_add_member_fn): Update.
* dwarf2/attribute.h (struct attribute) <defaulted>: Declare.
* dwarf2/attribute.c (attribute::defaulted): New method, from
is_valid_DW_AT_defaulted.

3 years agoAdd attribute::as_unsigned method
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Add attribute::as_unsigned method

This introduces a new attribute::as_unsigned method and changes a few
spots to use it.

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

* dwarf2/read.c (dw2_get_file_names_reader)
(dwarf2_build_include_psymtabs, handle_DW_AT_stmt_list)
(dwarf2_cu::setup_type_unit_groups, fill_in_loclist_baton)
(dwarf2_symbol_mark_computed): Use as_unsigned.
* dwarf2/attribute.h (struct attribute) <as_unsigned>: New
method.
<form_is_section_offset>: Update comment.

3 years agoChange how accessibility is handled in dwarf2/read.c
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Change how accessibility is handled in dwarf2/read.c

dwarf2/read.c uses dwarf2_default_access_attribute to check for the
default access attribute.  This patch simplifies the code by moving
more of the access processing into this function, changing its name to
reflect the difference.  This also ensures that the attribute's form
is respected, by changing to code to use the constant_value method.

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

* dwarf2/read.c (dwarf2_access_attribute): Rename from
dwarf2_default_access_attribute.  Look up attribute.
(dwarf2_add_field, dwarf2_add_type_defn, dwarf2_add_member_fn):
Update.

3 years agoChange how reprocessing is done
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Change how reprocessing is done

Currently gdb keeps a vector of attributes that require reprocessing.
However, now that there is a reprocessing flag in the attribute, we
can remove the vector and instead simply loop over attributes a second
time.  Normally there are not many attributes, so this should be
reasonably cheap.

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

* dwarf2/read.c (skip_one_die): Update.
(read_full_die_1): Change how reprocessing is done.
(partial_die_info::read): Update.
(read_attribute_value): Remove need_reprocess parameter.
(read_attribute): Likewise.
* dwarf2/attribute.h (struct attribute) <requires_reprocessing_p>:
New method.

3 years agoRemove DW_ADDR
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove DW_ADDR

This removes DW_ADDR in favor of accessor methods.

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

* dwarf2/read.c (read_attribute_reprocess, read_attribute_value)
(dwarf2_const_value_attr, dump_die_shallow)
(dwarf2_fetch_constant_bytes): Update.
* dwarf2/attribute.h (struct attribute) <form_is_ref>: Update
comment.
<set_address>: New method.
(DW_ADDR): Remove.
* dwarf2/attribute.c (attribute::form_is_ref): Update comment.
(attribute::as_string, attribute::as_address): Add assert.

3 years agoAdd reprocessing flag to struct attribute
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Add reprocessing flag to struct attribute

Some forms require "reprocessing" -- a second pass to update their
value appropriately.  In this case, we'll set the unsigned value on
the attribute, and then later set it to the correct value.

To handle this, we introduce a reprocessing flag to attribute.  Then,
we manage this flag to ensure that setting and unsetting is done
properly.

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

* dwarf2/read.c (read_cutu_die_from_dwo): Use OBSTACK_ZALLOC.
(read_attribute_reprocess, read_attribute_value): Update.
(read_attribute): Clear requires_reprocessing.
* dwarf2/attribute.h (struct attribute) <as_unsigned_reprocess,
form_requires_reprocessing>: New methods.
<string_init>: Clear requires_reprocessing.
<set_unsigned_reprocess>: New method.
<name>: Shrink by one bit.
<requires_reprocessing>: New member.
* dwarf2/attribute.c (attribute::form_requires_reprocessing): New
method.

3 years agoUse setter for attribute's unsigned value
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Use setter for attribute's unsigned value

This adds form_is_unsigned and an unsigned setter method to struct
attribute, and updates the remaining code.  Now DW_UNSND is no longer
used as an lvalue.

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

* dwarf2/read.c (read_attribute_value): Update.
* dwarf2/attribute.h (struct attribute) <form_is_unsigned,
set_unsigned>: New methods.
* dwarf2/attribute.c (attribute::form_is_unsigned): New method.

3 years agoRemove DW_SND
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove DW_SND

This removes DW_SND in favor of accessors on struct attribute.
These accessors check that the form is appropriate.

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

* dwarf2/read.c (get_alignment, read_array_order)
(read_attribute_value, dwarf2_const_value_attr)
(dump_die_shallow, dwarf2_fetch_constant_bytes): Update.
* dwarf2/attribute.h (struct attribute) <as_signed, set_signed>:
New methods.
(DW_SND): Remove.

3 years agoRemove DW_SIGNATURE
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove DW_SIGNATURE

This removes DW_SIGNATURE in favor of methods on struct attribute.  As
usual, the methods check the form, which DW_SIGNATURE did not do.

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

* dwarf2/read.c (read_attribute_value, lookup_die_type)
(dump_die_shallow, follow_die_sig, get_DW_AT_signature_type):
Update.
* dwarf2/attribute.h (struct attribute) <as_signature,
set_signature>: New methods.
(DW_SIGNATURE): Remove.

3 years agoRemove DW_BLOCK
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove DW_BLOCK

This removes the DW_BLOCK accessor in favor of methods on struct
attribute.  The methods, unlike the access, check the form.

Note that DW_FORM_data16 had to be handled by form_is_block, because
in practice that is how we store values of this form.

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

* dwarf2/read.c (read_call_site_scope)
(handle_data_member_location, dwarf2_add_member_fn)
(mark_common_block_symbol_computed, attr_to_dynamic_prop)
(partial_die_info::read, read_attribute_value)
(var_decode_location, dwarf2_const_value_attr, dump_die_shallow)
(dwarf2_fetch_die_loc_sect_off, dwarf2_fetch_constant_bytes)
(dwarf2_symbol_mark_computed): Update.
* dwarf2/attribute.h (struct attribute) <as_block, set_block>: New
methods.
(DW_BLOCK): Remove.
* dwarf2/attribute.c (attribute::form_is_block): Add
DW_FORM_data16.

3 years agoRemove DW_STRING and DW_STRING_IS_CANONICAL
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove DW_STRING and DW_STRING_IS_CANONICAL

This removes DW_STRING and DW_STRING_IS_CANONICAL, replacing them with
accessor methods on struct attribute.  The new code ensures that a
string value will only ever be used when the form allows it.

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

* dwarf2/read.c (read_cutu_die_from_dwo)
(read_attribute_reprocess, read_attribute_value, read_attribute)
(dwarf2_const_value_attr, dwarf2_name, dump_die_shallow)
(dwarf2_fetch_constant_bytes): Update.
* dwarf2/attribute.h (struct attribute) <form_is_string>: Declare.
<set_string_noncanonical, set_string_canonical>: New methods.
<string_is_canonical>: Update comment.
<canonical_string_p>: Add assert.
(DW_STRING, DW_STRING_IS_CANONICAL): Remove.
* dwarf2/attribute.c (attribute::form_is_string): New method.
(attribute::string): Use it.

3 years agoRemove some uses of DW_STRING_IS_CANONICAL
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Remove some uses of DW_STRING_IS_CANONICAL

This removes the rvalue uses of DW_STRING_IS_CANONICAL, replacing them
with an accessor method.

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

* dwarf2/read.c (anonymous_struct_prefix, dwarf2_name)
(dump_die_shallow): Use canonical_string_p.
* dwarf2/attribute.h (struct attribute) <canonical_string_p>: New
method.

3 years agoChange some uses of DW_STRING to string method
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Change some uses of DW_STRING to string method

This changes some of the simpler spots to use attribute::string rather
than DW_STRING.

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

* dwarf2/read.c (partial_die_info::read)
(dwarf2_const_value_attr, anonymous_struct_prefix, )
(dwarf2_name, dwarf2_fetch_constant_bytes): Use
attribute::as_string.

3 years agoAvoid using DW_* macros in dwarf2/attribute.c
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Avoid using DW_* macros in dwarf2/attribute.c

There's no need to use the DW_* accessor macros in dwarf2/attribute.c,
and this is a necessary step toward our goal of removing them
entirely.

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

* dwarf2/attribute.c (attribute::address): Don't use DW_UNSND or
DW_ADDR.
(attribute::string): Don't use DW_STRING.
(attribute::get_ref_die_offset): Don't use DW_UNSND.
(attribute::constant_value): Don't use DW_UNSND or DW_SND.

3 years agoRename struct attribute accessors
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Rename struct attribute accessors

This removes the "value_" prefix from the struct value accessors.
This seemed unnecessarily wordy to me.

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

* dwarf2/read.c (dwarf2_find_base_address, read_call_site_scope)
(dwarf2_get_pc_bounds, dwarf2_record_block_ranges)
(partial_die_info::read, dwarf2_string_attr, new_symbol): Update.
* dwarf2/attribute.h (struct attribute): Rename methods.
* dwarf2/attribute.c (attribute::as_address): Rename from
value_as_address.
(attribute::as_string): Rename from value_as_string.

3 years agoAdd attribute::value_as_string method
Tom Tromey [Wed, 30 Sep 2020 00:49:08 +0000 (18:49 -0600)] 
Add attribute::value_as_string method

The full DIE reader checks that an attribute has a "string" form in
some spots, but the partial DIE reader does not.  This patch brings
the two readers in sync for one specific case, namely when examining
the linkage name.  This avoids regressions in an existing DWARF test
case.

A full fix for this problem would be preferable.  An accessor like
DW_STRING should always check the form.  However, I haven't attempted
that in this series.

Also the fact that the partial and full readers can disagree like this
is a design flaw.

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

* dwarf2/read.c (partial_die_info::read) <case
DW_AT_linkage_name>: Use value_as_string.
(dwarf2_string_attr): Use value_as_string.
* dwarf2/attribute.h (struct attribute) <value_as_string>: Declare
method.
* dwarf2/attribute.c (attribute::value_as_string): New method.