]> sourceware.org Git - binutils-gdb.git/log
binutils-gdb.git
4 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

4 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

4 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

4 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.

4 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

4 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.

4 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.

4 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

4 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

4 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

4 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

4 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

4 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

4 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".

4 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.

4 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.

4 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.

4 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

4 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.

4 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.

4 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*.

4 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.

4 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.

4 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".

4 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.

4 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

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 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.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Sep 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoTweak gdbsupport/valid-expr.h for GCC 6, fix build
Pedro Alves [Tue, 29 Sep 2020 19:08:51 +0000 (20:08 +0100)]
Tweak gdbsupport/valid-expr.h for GCC 6, fix build

With GCC 6.4 and 6.5 (at least), unit tests that use
gdbsupport/valid-expr.h's CHECK_VALID fail to compile, with:

 In file included from src/gdb/unittests/offset-type-selftests.c:24:0:
 src/gdb/unittests/offset-type-selftests.c: In substitution of 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename gdb::detection_detail::detector<gdb::nonesuch, void, Op, Args ...>::type> [with Expected = selftests::offset_type::off_A&; Op = selftests::offset_type::check_valid_expr75::archetype; Args = {selftests::offset_type::off_A, selftests::offset_type::off_B}]':
 src/gdb/unittests/offset-type-selftests.c:75:1:   required from here
 src/gdb/../gdbsupport/valid-expr.h:65:20: error: type/value mismatch at argument 2 in template parameter list for 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename gdb::detection_detail::detector<gdb::nonesuch, void, Op, Args ...>::type>'
     archetype, TYPES>::value == VALID,   \
     ^

The important part is the "error: type/value mismatch" error.  Seems
like that GCC doesn't understand that archetype is an alias template,
and is being strict in requiring a template class.

The fix here is then to make archetype a template class, to pacify
GCC.  The resulting code looks like this:

  template <TYPENAMES, typename = decltype (EXPR)>
  struct archetype
  {
  };

  static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>,
   archetype, TYPES>::value == VALID, "");

is_detected_exact<Expected, Op, Args> checks whether Op<Args> is type
Expected:

 - For Expected, we pass the explicit EXPR_TYPE, overriding the
   default parameter type of archetype.

 - For Args we don't pass the last template parameter, so archtype
   defaults to the EXPR's decltype.

So in essence, we're really checking whether EXPR_TYPE is the same as
decltype(EXPR).

We need to do the decltype in a template context in order to trigger
SFINAE instead of failing to compile.

The hunk in unittests/enum-flags-selftests.c becomes necessary,
because unlike with the current alias template version, this new
version makes GCC trigger -Wenum-compare warnings as well:

 src/gdb/unittests/enum-flags-selftests.c:328:33: error: comparison between 'enum selftests::enum_flags_tests::RE' and 'enum selftests::enum_flags_tests::RE2' [-Werror=enum-compare]
  CHECK_VALID (true,  bool, RE () != RE2 ())
  ^
 src/gdb/../gdbsupport/valid-expr.h:61:45: note: in definition of macro 'CHECK_VALID_EXPR_INT'
    template <TYPENAMES, typename = decltype (EXPR)>   \
      ^

Build-tested with:

 - GCC {4.8.5, 6.4, 6.5, 7.3.1, 9.3.0, 11.0.0-20200910}
 - Clang 10.0.0

gdbsupport/ChangeLog:

* valid-expr.h (CHECK_VALID_EXPR_INT): Make archetype a template
class instead of an alias template and adjust static_assert.

gdb/ChangeLog:

* unittests/enum-flags-selftests.c: Check whether __GNUC__ is
defined before using '#pragma GCC diagnostic' instead of checking
__clang__.

4 years agoAdd a note about recent changes to the AArch64 assembler: TRBE, ETE and ETMv4 system...
Przemyslaw Wirkus [Tue, 29 Sep 2020 15:43:57 +0000 (16:43 +0100)]
Add a note about recent changes to the AArch64 assembler: TRBE, ETE and ETMv4 system registers and Cortex-X1 enablement.

gas * NEWS: TRBE, ETE, ETMv4 and Cortex-X1 news updates.

4 years agobinutils: dwarf.c handle DWARF5 DW_LLE_start_end and DW_LLE_start_length.
Mark Wielaard [Mon, 28 Sep 2020 22:02:06 +0000 (00:02 +0200)]
binutils: dwarf.c handle DWARF5 DW_LLE_start_end and DW_LLE_start_length.

display_loclists_list only handled DW_LLE_offset_pair as bounded
location description. Also handle DW_LLE_start_end and DW_LLE_start_lenght.
These don't use the base_address.

binutils/ChangeLog:

      * dwarf.c (display_loclists_list): Handle DW_LLE_start_end and
      DW_LLE_start_length. Only add base_address for DW_LLE_offset_pair.

4 years agoTurn target_have_steppable_watchpoint into function
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Turn target_have_steppable_watchpoint into function

This changes the object-like macro target_have_steppable_watchpoint
into an inline function.

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

* infrun.c (displaced_step_fixup, thread_still_needs_step_over)
(handle_signal_stop): Update.
* procfs.c (procfs_target::insert_watchpoint): Update.
* target.h (target_have_steppable_watchpoint): Now a function.

4 years agoTurn target_can_lock_scheduler into a function
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Turn target_can_lock_scheduler into a function

This changes the object-like macro target_can_lock_scheduler into an
inline function.

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

* infrun.c (set_schedlock_func): Update.
* target.h (target_can_lock_scheduler): Now a function.

4 years agoRemove target_has_execution macro
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Remove target_has_execution macro

This removes the object-like macro target_has_execution, replacing it
with a function call.  target_has_execution_current is also now
handled by this function.

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

* inferior.h (class inferior) <has_execution>: Update.
* windows-tdep.c (windows_solib_create_inferior_hook): Update.
* valops.c (find_function_in_inferior)
(value_allocate_space_in_inferior): Update.
* top.c (kill_or_detach): Update.
* target.c (target_preopen, set_target_permissions): Update.
(target_has_execution_current): Remove.
* sparc64-tdep.c (adi_examine_command, adi_assign_command):
Update.
* solib.c (update_solib_list, reload_shared_libraries): Update.
* solib-svr4.c (svr4_solib_create_inferior_hook): Update.
* solib-dsbt.c (enable_break): Update.
* score-tdep.c (score7_fetch_inst): Update.
* rs6000-nat.c (rs6000_nat_target::xfer_shared_libraries):
Update.
* remote.c (remote_target::start_remote)
(remote_target::remote_check_symbols, remote_target::open_1)
(remote_target::remote_detach_1, remote_target::verify_memory)
(remote_target::xfer_partial, remote_target::read_description)
(remote_target::get_min_fast_tracepoint_insn_len): Update.
* record-full.c (record_full_open_1): Update.
* record-btrace.c (record_btrace_target_open): Update.
* objc-lang.c (lookup_objc_class, lookup_child_selector)
(value_nsstring): Update.
* linux-thread-db.c (add_thread_db_info)
(thread_db_find_new_threads_silently, check_thread_db_callback)
(try_thread_db_load_1, record_thread): Update.
* linux-tdep.c (linux_info_proc, linux_vsyscall_range_raw):
Update.
* linux-fork.c (checkpoint_command): Update.
* infrun.c (set_non_stop, set_observer_mode)
(check_multi_target_resumption, for_each_just_stopped_thread)
(maybe_remove_breakpoints, normal_stop)
(class infcall_suspend_state): Update.
* infcmd.c (ERROR_NO_INFERIOR, kill_if_already_running)
(info_program_command, attach_command): Update.
* infcall.c (call_function_by_hand_dummy): Update.
* inf-loop.c (inferior_event_handler): Update.
* gcore.c (gcore_command, derive_heap_segment): Update.
* exec.c (exec_file_command): Update.
* eval.c (evaluate_subexp): Update.
* compile/compile.c (compile_to_object): Update.
* cli/cli-dump.c (restore_command): Update.
* breakpoint.c (update_watchpoint)
(update_inserted_breakpoint_locations)
(insert_breakpoint_locations, get_bpstat_thread): Update.
* target.h (target_has_execution): Remove macro.
(target_has_execution_current): Don't declare.
(target_has_execution): Rename from target_has_execution_1.  Add
argument default.

4 years agoTurn target_can_execute_reverse into function
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Turn target_can_execute_reverse into function

This changes target_can_execute_reverse from an object-like macro to
an inline function.

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

* mi/mi-main.c (exec_reverse_continue)
(mi_cmd_list_target_features): Update.
* infrun.c (set_exec_direction_func): Update.
* target.c (default_execution_direction): Update.
* reverse.c (exec_reverse_once): Update.
* target.h (target_can_execute_reverse): Now a function.

4 years agoRemove target_has_registers macro
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Remove target_has_registers macro

This removes the target_has_registers object-like macro, replacing it
with the underlying function.

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

* tui/tui-regs.c (tui_get_register)
(tui_data_window::show_registers): Update.
* thread.c (scoped_restore_current_thread::restore)
(scoped_restore_current_thread::scoped_restore_current_thread):
Update.
* regcache-dump.c (regcache_print): Update.
* python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb):
Update.
* mi/mi-main.c (mi_cmd_data_write_register_values): Update.
* mep-tdep.c (current_me_module, current_options): Update.
* linux-thread-db.c (thread_db_load): Update.
* infcmd.c (registers_info, info_vector_command)
(info_float_command): Update.
* ia64-tdep.c (ia64_frame_prev_register)
(ia64_sigtramp_frame_prev_register): Update.
* ia64-libunwind-tdep.c (libunwind_frame_prev_register): Update.
* gcore.c (derive_stack_segment): Update.
* frame.c (get_current_frame, has_stack_frames): Update.
* findvar.c (language_defn::read_var_value): Update.
* arm-tdep.c (arm_pc_is_thumb): Update.
* target.c (target_has_registers): Rename from
target_has_registers_1.
* target.h (target_has_registers): Remove macro.
(target_has_registers): Rename from target_has_registers_1.

4 years agoRemove target_has_stack macro
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Remove target_has_stack macro

This removes the target_has_stack object-like macro, replacing it with
the underlying function.

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

* windows-tdep.c (tlb_make_value): Update.
* tui/tui-regs.c (tui_data_window::show_registers): Update.
* thread.c (scoped_restore_current_thread::restore)
(scoped_restore_current_thread::scoped_restore_current_thread)
(thread_command): Update.
* stack.c (backtrace_command_1, frame_apply_level_command)
(frame_apply_all_command, frame_apply_command): Update.
* infrun.c (siginfo_make_value, restore_infcall_control_state):
Update.
* gcore.c (derive_stack_segment): Update.
* frame.c (get_current_frame, has_stack_frames): Update.
* auxv.c (info_auxv_command): Update.
* ada-tasks.c (ada_build_task_list): Update.
* target.c (target_has_stack): Rename from target_has_stack_1.
* target.h (target_has_stack): Remove macro.
(target_has_stack): Rename from target_has_stack_1.

4 years agoRemove target_has_memory macro
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Remove target_has_memory macro

This removes the target_has_memory object-like macro, replacing it
with the underlying function.

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

* target.c (target_has_memory): Rename from target_has_memory_1.
* tui/tui-regs.c (tui_data_window::show_registers): Update.
* thread.c (scoped_restore_current_thread::restore)
(scoped_restore_current_thread::scoped_restore_current_thread):
Update.
* frame.c (get_current_frame, has_stack_frames): Update.
* target.h (target_has_memory): Remove macro.
(target_has_memory): Rename from target_has_memory_1.

4 years agoRemove target_has_all_memory
Tom Tromey [Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)]
Remove target_has_all_memory

target_has_all_memory isn't used anywhere, so this patch removes it.

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

* target.c (target_has_all_memory_1): Remove.
* target.h (target_has_all_memory): Remove define.
(target_has_all_memory_1): Don't declare.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Sep 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: fix formatting of serial::async_state's enumerators
Simon Marchi [Mon, 28 Sep 2020 18:21:24 +0000 (14:21 -0400)]
gdb: fix formatting of serial::async_state's enumerators

The comments related to these enumerators are placed under the
corresponding enumerator.  This is quite unusual and confusing.  Change
it to have the comments above, as usual.

gdb/ChangeLog:

* ser-base.c: Adjust comments formatting.

Change-Id: If2ea143a7d5217efa5ac088102ddb1933fbcb16a

4 years agoThis patch adds support for Cortex-X1 for ARM.
Przemyslaw Wirkus [Mon, 28 Sep 2020 14:52:24 +0000 (15:52 +0100)]
This patch adds support for Cortex-X1 for ARM.

bfd * cpu-arm.c: (processors) Add Cortex-X1.

gas * config/tc-arm.c: (arm_cpus): Add Cortex-X1.
* doc/c-arm.texi: Document -mcpu=cortex-x1.
* testsuite/gas/arm/cpu-cortex-x1.d: New test.

4 years agoThis patch introduces ETMv4 (Embedded Trace Macrocell) system registers for the AArch...
Przemyslaw Wirkus [Mon, 28 Sep 2020 14:49:11 +0000 (15:49 +0100)]
This patch introduces ETMv4 (Embedded Trace Macrocell) system registers for the AArch64 architecture.

gas           * testsuite/gas/aarch64/etm-ro-invalid.d: New test.
              * testsuite/gas/aarch64/etm-ro-invalid.l: New test.
              * testsuite/gas/aarch64/etm-ro-invalid.s: New test.
              * testsuite/gas/aarch64/etm-ro.s: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.d: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.l: New test.
              * testsuite/gas/aarch64/etm-wo-invalid.s: New test.
              * testsuite/gas/aarch64/etm-wo.s: New test.
              * testsuite/gas/aarch64/etm.s: New test.
              * testsuite/gas/aarch64/sysreg.d: system register s2_1_c0_c3_0 disassembled
              now to trcstatr.

opcodes       * aarch64-opc.c: Added ETMv4 system registers TRCACATRn, TRCACVRn,
              TRCAUTHSTATUS, TRCAUXCTLR, TRCBBCTLR, TRCCCCTLR, TRCCIDCCTLR0, TRCCIDCCTLR1,
              TRCCIDCVRn, TRCCIDR0, TRCCIDR1, TRCCIDR2, TRCCIDR3, TRCCLAIMCLR, TRCCLAIMSET,
              TRCCNTCTLRn, TRCCNTRLDVRn, TRCCNTVRn, TRCCONFIGR, TRCDEVAFF0, TRCDEVAFF1,
              TRCDEVARCH, TRCDEVID, TRCDEVTYPE, TRCDVCMRn, TRCDVCVRn, TRCEVENTCTL0R,
              TRCEVENTCTL1R, TRCEXTINSELR, TRCIDR0, TRCIDR1, TRCIDR2, TRCIDR3, TRCIDR4,
              TRCIDR5, TRCIDR6, TRCIDR7, TRCIDR8, TRCIDR9, TRCIDR10, TRCIDR11, TRCIDR12,
              TRCIDR13, TRCIMSPEC0, TRCIMSPECn, TRCITCTRL, TRCLAR WOTRCLSR, TRCOSLAR
              WOTRCOSLSR, TRCPDCR, TRCPDSR, TRCPIDR0, TRCPIDR1, TRCPIDR2, TRCPIDR3,
              TRCPIDR4, TRCPIDR[5,6,7], TRCPRGCTLR, TRCP,CSELR, TRCQCTLR, TRCRSCTLRn,
              TRCSEQEVRn, TRCSEQRSTEVR, TRCSEQSTR, TRCSSCCRn, TRCSSCSRn, TRCSSPCICRn,
              TRCSTALLCTLR, TRCSTATR, TRCSYNCPR, TRCTRACEIDR,  TRCTSCTLR, TRCVDARCCTLR,
              TRCVDCTLR, TRCVDSACCTLR, TRCVICTLR, TRCVIIECTLR, TRCVIPCSSCTLR, TRCVISSCTLR,
              TRCVMIDCCTLR0, TRCVMIDCCTLR1 and TRCVMIDCVRn.

4 years agoThis patch adds support for Cortex-X1
Przemyslaw Wirkus [Mon, 28 Sep 2020 14:43:51 +0000 (15:43 +0100)]
This patch adds support for Cortex-X1

gas * config/tc-aarch64.c: (aarch64_cpus): Add Cortex-X1.
* doc/c-aarch64.texi: Document -mcpu=cortex-x1.

4 years agoThis patch introduces ETE (Embedded Trace Extension) system registers for the AArch64...
Przemyslaw Wirkus [Mon, 28 Sep 2020 14:41:23 +0000 (15:41 +0100)]
This patch introduces ETE (Embedded Trace Extension) system registers for the AArch64 architecture.

gas           * testsuite/gas/aarch64/ete.d: New test.
              * testsuite/gas/aarch64/ete.s: New test.

opcodes       * aarch64-opc.c: Add ETE system registers TRCEXTINSELR<0-3> and TRCRSR.

4 years agoThis patch introduces TRBE (Trace Buffer Extension) system registers for the AArch64...
Przemyslaw Wirkus [Mon, 28 Sep 2020 14:37:50 +0000 (15:37 +0100)]
This patch introduces TRBE (Trace Buffer Extension) system registers for the AArch64 architecture.

gas           * testsuite/gas/aarch64/trbe-invalid.d: New test.
              * testsuite/gas/aarch64/trbe-invalid.l: New test.
              * testsuite/gas/aarch64/trbe-invalid.s: New test.
              * testsuite/gas/aarch64/trbe.d: New test.
              * testsuite/gas/aarch64/trbe.s: New test.

opcodes       * aarch64-opc.c: Add TRBE system registers TRBIDR_EL1 , TRBBASER_EL1 ,
              TRBLIMITR_EL1 , TRBMAR_EL1 , TRBPTR_EL1, TRBSR_EL1 and TRBTRG_EL1.

4 years agoarm: Add missing Neoverse V1 feature
Alex Coplan [Mon, 28 Sep 2020 12:57:09 +0000 (13:57 +0100)]
arm: Add missing Neoverse V1 feature

This simple follow-on patch adds a feature bit (FP16) that was missing
from the initial Neoverse V1 support.

gas/ChangeLog:

* config/tc-arm.c (arm_cpus): Add FP16 to Neoverse V1.

4 years agoaarch64: Neoverse V1 tweaks
Alex Coplan [Mon, 28 Sep 2020 12:55:08 +0000 (13:55 +0100)]
aarch64: Neoverse V1 tweaks

This simple follow-on patch groups the Neoverse cores together and adds
a missing feature bit (F16) to the entry for Neoverse V1.

gas/ChangeLog:

* config/tc-aarch64.c (aarch64_cpus): Group Neoverse cores
together, add missing F16 bit to Neoverse V1.

4 years agoPR26656 testcases
Alan Modra [Mon, 28 Sep 2020 10:00:26 +0000 (19:30 +0930)]
PR26656 testcases

* testsuite/ld-powerpc/tlsget.d,
* testsuite/ld-powerpc/tlsget.s,
* testsuite/ld-powerpc/tlsget.wf,
* testsuite/ld-powerpc/tlsget2.d.
* testsuite/ld-powerpc/tlsget2.wf: New testcases.
* testsuite/ld-powerpc/powerpc.exp: Run them.

4 years agoRewrite tui_puts
Tom Tromey [Mon, 28 Sep 2020 02:30:30 +0000 (20:30 -0600)]
Rewrite tui_puts

This rewrites tui_puts.  It now writes as many bytes as possible in a
call to waddnstr, letting curses handle multi-byte sequences properly.

Note that tui_puts_internal remains.  It is needed to handle computing
the start line of the readline prompt, which is difficult to do
properly in the case where redisplaying can also cause the command
window to scroll.  This might be possible to implement by reverting to
single "character" output, by using mbsrtowcs for its side effects to
find character boundaries in the input.  I have not attempted this.

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

PR tui/25342:
* tui/tui-io.c (tui_puts): Rewrite.  Move earlier.

4 years agoUse ISCNTRL in tui_copy_source_line
Tom Tromey [Mon, 28 Sep 2020 02:30:30 +0000 (20:30 -0600)]
Use ISCNTRL in tui_copy_source_line

This changes tui_copy_source_line to use ISCNTRL.  This lets it work
more nicely with UTF-8 input.  Note that this still won't work for
stateful multi-byte encodings; for that much more work would be
required.  However, I think this patch does not make gdb any worse in
this scenario.

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

PR tui/25342:
* tui/tui-winsource.c (tui_copy_source_line): Use ISNCTRL.

4 years agoUse a curses pad for source and disassembly windows
Tom Tromey [Mon, 28 Sep 2020 02:30:30 +0000 (20:30 -0600)]
Use a curses pad for source and disassembly windows

This changes the TUI source and disassembly windows to use a curses
pad for their text.  This is an important step toward properly
handling non-ASCII characters, because it makes it easy to scroll
horizontally without needing gdb to also understand multi-byte
character boundaries -- this can be wholly delegated to curses.
Horizontal scrolling is probably also faster now, because no
re-rendering is required.

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

* unittests/tui-selftests.c: Update.
* tui/tui-winsource.h (struct tui_source_window_base)
<extra_margin, show_line_number, refresh_pad>: New methods.
<m_max_length, m_pad>: New members.
(tui_copy_source_line): Update.
* tui/tui-winsource.c (tui_copy_source_line): Remove line_no,
first_col, line_width, ndigits parameters.  Add length.
(tui_source_window_base::show_source_line): Write to pad.  Line
number now 0-based.
(tui_source_window_base::refresh_pad): New method.
(tui_source_window_base::show_source_content): Write to pad.  Call
refresh_pad.
(tui_source_window_base::do_scroll_horizontal): Call refresh_pad,
not refill.
(tui_source_window_base::update_exec_info): Call
show_line_number.
* tui/tui-source.h (struct tui_source_window) <extra_margin>: New
method.
<m_digits>: New member.
* tui/tui-source.c (tui_source_window::set_contents): Set m_digits
and m_max_length.
(tui_source_window::show_line_number): New method.
* tui/tui-io.h (tui_puts): Fix comment.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Set
m_max_length.

4 years agoRemove a call to show_source_line from TUI
Tom Tromey [Mon, 28 Sep 2020 02:30:30 +0000 (20:30 -0600)]
Remove a call to show_source_line from TUI

This removes a call to show_source_line from tui_source_window_base.
This call isn't needed because this function already calls the
'refill' method if the state changed.

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

* tui/tui-winsource.c
(tui_source_window_base::set_is_exec_point_at): Don't call
show_source_line.

4 years agoUse an inner window in tui_py_window
Tom Tromey [Mon, 28 Sep 2020 02:30:30 +0000 (20:30 -0600)]
Use an inner window in tui_py_window

This changes tui_py_window to create an inner curses window.  This
greatly simplifies tui_py_window::output, beacuse it no longer needs
to be careful to avoid overwriting the window's border.  This patch
also makes it a bit easier for a later patch to rewrite
tui_copy_source_line.

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

* python/py-tui.c (class tui_py_window) <refresh_window>: New
method.
<erase>: Update.
<cursor_x, cursor_y>: Remove.
<m_inner_window>: New member.
(tui_py_window::rerender): Create inner window.
(tui_py_window::output): Write to inner window.

4 years agoRemove test duplicate from gdb.tui
Tom Tromey [Mon, 28 Sep 2020 02:30:30 +0000 (20:30 -0600)]
Remove test duplicate from gdb.tui

I noticed a duplicated test in gdb.tui.  This patch removes it by
wrapping a test in with_test_prefix.

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

* gdb.tui/new-layout.exp: Use with_test_prefix.

4 years agoRe: PR26656, power10 libstdc++.so segfault in __cxxabiv1::__cxa_throw
Alan Modra [Mon, 28 Sep 2020 00:00:19 +0000 (09:30 +0930)]
Re: PR26656, power10 libstdc++.so segfault in __cxxabiv1::__cxa_throw

Some missing NULL checks meant a stub for a local symbol used a stub
looking like the __tls_get_addr_opt stub.

PR 26656
* elf64-ppc.c (ppc_build_one_stub, ppc_size_one_stub): Check for
NULL stub_entry->h before calling is_tls_get_addr.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Sep 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Sep 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: Fix from_tty argument to gdb.execute in Python.
Gareth Rees [Sat, 26 Sep 2020 18:01:45 +0000 (11:01 -0700)]
gdb: Fix from_tty argument to gdb.execute in Python.

Prior to commit 56bcdbea2b, the from_tty keyword argument to the
Python function gdb.execute controlled whether the command took input
from the terminal. When from_tty=True, "starti" and similar commands
prompted the user:

    (gdb) python gdb.execute("starti", from_tty=True)
    The program being debugged has been started already.
    Start it from the beginning? (y or n) y
    Starting program: /bin/true

    Program stopped.

When from_tty=False, these commands did not prompt the user, and "yes"
was assumed:

    (gdb) python gdb.execute("starti", from_tty=False)

    Program stopped.

However, after commit 56bcdbea2b, the from_tty keyword argument no
longer had this effect. For example, as of commit 7ade7fba75:

    (gdb) python gdb.execute("starti", from_tty=True)
    The program being debugged has been started already.
    Start it from the beginning? (y or n) [answered Y; input not from terminal]
    Starting program: /bin/true

    Program stopped.

Note the "[answered Y; input not from terminal]" in the output even
though from_tty=True was requested.

Looking at commit 56bcdbea2b, it seems that the behaviour of the
from_tty argument was changed accidentally. The commit message said:

    Let gdb.execute handle multi-line commands

    This changes the Python API so that gdb.execute can now handle
    multi-line commands, like "commands" or "define".

and there was no mention of changing the effect of the from_tty
argument. It looks as though the code for setting the instream to
nullptr was accidentally moved from execute_user_command() to
execute_control_commands() along with the other scoped restores.

Accordingly, the simplest way to fix this is to partially reverse
commit 56bcdbea2b by moving the code for setting the instream to
nullptr back to execute_user_command() where it was to begin with.

Additionally, add a test case to reduce the risk of similar breakage
in future.

gdb/ChangeLog:

PR python/26586
* cli/cli-script.c (execute_control_commands): don't set
instream to nullptr here as this breaks the from_tty argument
to gdb.execute in Python.
(execute_user_command): set instream to nullptr here instead.

gdb/testsuite/ChangeLog:

PR python/26586
* gdb.python/python.exp: add test cases for the from_tty
argument to gdb.execute.

4 years ago[GOLD] PPC64_OPT_LOCALENTRY is incompatible with tail calls
Alan Modra [Sat, 26 Sep 2020 11:04:55 +0000 (20:34 +0930)]
[GOLD] PPC64_OPT_LOCALENTRY is incompatible with tail calls

Gold version of commit 3cd7c7d7ef.

* powerpc.cc (Target_powerpc): Rename power10_stubs_ to
power10_relocs_.
(Target_powerpc::set_power10_relocs): New accessor.
(Target_powerpc::set_power10_stubs): Delete.
(Target_powerpc::power10_stubs): Adjust.
(Target_powerpc::has_localentry0): New accessor.
(ld_0_11): New constant.
(glink_eh_frame_fde_64v1, glink_eh_frame_fde_64v2): Adjust.
(glink_eh_frame_fde_64v2_localentry0): New.
(Output_data_glink::pltresolve_size): Update.
(Output_data_glink::add_eh_frame): Use localentry0 version eh_frame.
(Output_data_glink::do_write): Move r2 save to start of ELFv2 stub
and only emit for has_localentry0.  Don't use r2 in the stub.
(Target_powerpc::Scan::local, global): Adjust for
set_power10_relocs renaming.
(Target_powerpc::scan_relocs): Warn and reset plt_localentry0_.

4 years agoPPC64_OPT_LOCALENTRY is incompatible with tail calls
Alan Modra [Sat, 26 Sep 2020 05:40:09 +0000 (15:10 +0930)]
PPC64_OPT_LOCALENTRY is incompatible with tail calls

The save of r2 in __glink_PLTresolve is the culprit.  Remove it,
unless we know we need it for --plt-localentry.  --plt-localentry
should not be used with power10 pc-relative code that makes tail
calls.

The patch also removes use of r2 as a scratch reg in the ELFv2
__glink_PLTresolve.  Using r2 isn't a problem, this is just reducing
the number of scratch regs.

bfd/
* elf64-ppc.c (GLINK_PLTRESOLVE_SIZE): Depend on has_plt_localentry0.
(LD_R0_0R11, ADD_R11_R0_R11): Define.
(ppc64_elf_tls_setup): Disable params->plt_localentry0 when power10
code detected.
(ppc64_elf_size_stubs): Update __glink_PLTresolve eh_frame.
(ppc64_elf_build_stubs): Move r2 save to start of __glink_PLTresolve,
and only emit for has_plt_localentry0.  Don't use r2 in the stub.
ld/
* testsuite/ld-powerpc/elfv2so.d,
* testsuite/ld-powerpc/notoc2.d,
* testsuite/ld-powerpc/tlsdesc.wf,
* testsuite/ld-powerpc/tlsdesc2.d,
* testsuite/ld-powerpc/tlsdesc2.wf,
* testsuite/ld-powerpc/tlsopt5.d,
* testsuite/ld-powerpc/tlsopt5.wf,
* testsuite/ld-powerpc/tlsopt6.d,
* testsuite/ld-powerpc/tlsopt6.wf: Update __glink_PLTresolve.

4 years agoubsan: opcodes/csky-opc.h:929 shift exponent 536870912
Alan Modra [Fri, 25 Sep 2020 11:22:46 +0000 (20:52 +0930)]
ubsan: opcodes/csky-opc.h:929 shift exponent 536870912

opcodes/
* csky-opc.h: Formatting.
(GENERAL_REG_BANK): Correct spelling.  Update use throughout file.
(get_register_name): Mask arch with CSKY_ARCH_MASK for shift,
and shift 1u.
(get_register_number): Likewise.
* csky-dis.c (get_gr_name, get_cr_name): Don't mask mach_flag.
gas/
* config/tc-csky.c (parse_type_ctrlreg): Don't mask mach_flag
for csky_get_control_regno.
(csky_get_reg_val): Likewise when calling csky_get_general_regno.

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

4 years agogdb: fix formatting of _debug_printf macros
Simon Marchi [Fri, 25 Sep 2020 18:54:16 +0000 (14:54 -0400)]
gdb: fix formatting of _debug_printf macros

The do/while in these macros are not formatted with proper GNU style,
fix that.

gdb/ChangeLog:

* infrun.h (infrun_debug_printf): Fix formatting.
* linux-nat.c (linux_nat_debug_printf): Fix formatting.

Change-Id: I3a723663c76d9091f785941923c2b6cf67459629

4 years agoAdd a missing munmap_list move constructor
Saagar Jha [Fri, 25 Sep 2020 07:05:24 +0000 (00:05 -0700)]
Add a missing munmap_list move constructor

compile_module attempts to request a move constructor, but because
munmap_list doesn't have one it gets implicitly deleted. This is an
warning on clang under -Wdefaulted-function-deleted (which is enabled by
default):

In file included from compile/compile-object-load.c:21:
compile/compile-object-load.h:56:3: error: explicitly defaulted move constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
  compile_module (compile_module &&other) = default;
  ^
compile/compile-object-load.h:86:22: note: move constructor of 'compile_module' is implicitly deleted because field 'munmap_list' has a deleted move constructor
  struct munmap_list munmap_list;
                     ^
compile/compile-object-load.h:30:28: note: 'munmap_list' has been explicitly marked deleted here
  DISABLE_COPY_AND_ASSIGN (munmap_list);
                           ^

gdb/ChangeLog:

* compile/compile-object-load.h: Give munmap_list a move
constructor.

Change-Id: I300c52e27da70087f18c7e359773c2b984073d8b

4 years agoImport mklog.py from gcc repo
Simon Marchi [Fri, 25 Sep 2020 14:24:29 +0000 (10:24 -0400)]
Import mklog.py from gcc repo

I've been using the mklog utility from the gcc repo for a while to
generate skeleton of ChangeLog entries.  It recently got a rewrite as a
Python script.  Unfortunately, to find the repository root, and
eventually to find in which ChangeLog file each entry goes, the new
script assumes it is located in the same git repository that it
generates ChangeLog entries for.

This means that if you make a change in the gcc source tree and run
mklog.py from that same source tree, it works.  But if you make changes
in your ~/src/binutils-gdb tree and run ~/src/gcc/contrib/mklog.py, it
won't work.

IIRC, the old script required that you ran it with the project's root
directory as the CWD.

The simplest way to fix this is to import the script in binutils-gdb and
use it from there.  It's also nice because we can use it without having
a clone of the gcc repo.

I also thought of adding a "--root" switch to the script to override the
project's base directory.  However:

1) It is more work.
2) If the script still lives in the gcc repo, it's less convenient than
   having it in binutils-gdb.

This patch imports contrib/mklog.py from the gcc repo, revision
c560591408440f441b8b327f5b41f9328d20b67b.

contrib/ChangeLog:

* mklog.py: New file, imported from gcc.

Note: the ChangeLog entry above was generated using
`git show | ./mklog.py`!

Change-Id: I955592ce6397681986dc82a09593c32d8b8de54f

4 years agogdb: fix whitespaces in ChangeLog
Simon Marchi [Fri, 25 Sep 2020 14:20:32 +0000 (10:20 -0400)]
gdb: fix whitespaces in ChangeLog

Change-Id: Ie5accb8915341cf9b4ed23162f9503d7ef947fcf

4 years agoFix gdb.base/infcall-nested-structs-c++.exp with Clang
Gary Benson [Fri, 25 Sep 2020 13:44:07 +0000 (14:44 +0100)]
Fix gdb.base/infcall-nested-structs-c++.exp with Clang

gdb.base/infcall-nested-structs-c++.exp failed to build using Clang
with many variations on the following error:

  gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.base/infcall-nested-structs.c:207:46:
    warning: self-comparison always evaluates to true [-Wtautological-compare]

This commit builds this testcase with -Wno-tautological-compare when
using Clang, to avoid this failure.

gdb/testsuite/ChangeLog:

* gdb.base/infcall-nested-structs.exp.tcl: Add
additional_flags=-Wno-tautological-compare for C++
tests when compiling using Clang.

4 years agoFix compilation of .c files as C++ when using Clang
Gary Benson [Fri, 25 Sep 2020 13:29:35 +0000 (14:29 +0100)]
Fix compilation of .c files as C++ when using Clang

In commit 221db974e653659edb280787af1b3efdd1615083, this patch:

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

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

attempted to fix problems with testcases that compile .c files
with the C++ compiler.  They pass the "c++" option to gdb_compile,
resulting in the following error when using Clang:

    gdb compile failed, clang-10: warning: treating 'c' input as 'c++'
    when in C++ mode, this behavior is deprecated [-Wdeprecated]

This fix did not work for gdb.base/infcall-nested-structs-c++.exp,
however: the "-x c++" appeared in the compiler's commandline after
the .c file, so the option was not enabled for that file.

The previous files fixed all used build_executable_from_specs, which
compiles and links in separate steps, using gdb_compile: the compile
step passes $type=object to gdb_compile, while the link step passes
$type=executable.

gdb.base/infcall-nested-structs-c++.exp uses gdb_compile directly
instead, and it passes $type=executable to compile and link all in
one step.  Pedro found that DejaGnu's default_target_compile adds
the sources at the end when $type=object, but at the beginning when
$type=executable:

    # This is obscure: we put SOURCES at the end when building an
    # object, because otherwise, in some situations, libtool will
    # become confused about the name of the actual source file.
    if {$type == "object"} {
        set opts "$add_flags $sources"
    } else {
        set opts "$sources $add_flags"
    }

This commit moves the "-x c++" earlier in the compiler's commandline.
Unfortunately this then broke the testcase that required the original
fix, gdb.compile/compile-cplus.exp: the "-x c++" was being parsed for
the linker pass, causing the compiler to attempt to parse the .o files
as C++.  This commit makes passing "-x c++" conditional on the source
being a .c file.

gdb/testsuite/ChangeLog:

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

4 years agoasan: readelf buffer overflow and abort
Alan Modra [Fri, 25 Sep 2020 00:35:57 +0000 (10:05 +0930)]
asan: readelf buffer overflow and abort

* elfcomm.c (byte_put_little_endian, byte_put_big_endian): Support
more field sizes.
* readelf.c (target_specific_reloc_handling <MSP430>): Limit
allowed reloc_size.  Don't read_leb128 outside of section.

4 years agoRe: Sync libiberty and include with GCC for get_DW_UT_name
Alan Modra [Fri, 25 Sep 2020 00:30:01 +0000 (10:00 +0930)]
Re: Sync libiberty and include with GCC for get_DW_UT_name

* dwarf.h (DW_FIRST_UT, DW_UT, DW_END_UT): Define.

This page took 0.097048 seconds and 5 git commands to generate.