binutils-gdb.git
5 years agoRemove gdb_usleep.c
Tom Tromey [Sun, 17 Feb 2019 18:23:20 +0000 (11:23 -0700)]
Remove gdb_usleep.c

I noticed that gdb_usleep is unused, so this patch removes it.

gdb/ChangeLog
2019-09-26  Tom Tromey  <tom@tromey.com>

* Makefile.in (COMMON_SFILES): Remove gdb_usleep.c.
(HFILES_NO_SRCDIR): Remove gdb_usleep.h.
* gdb_usleep.h: Remove.
* gdb_usleep.c: Remove.
* utils.c: Don't include gdb_usleep.h.

5 years agoDo not expose stub types to Python
Tom Tromey [Mon, 19 Aug 2019 19:41:34 +0000 (13:41 -0600)]
Do not expose stub types to Python

dwarf2read.c will create stub types for Ada "Taft Amendment" types.
These stub types can currently be exposed to Python code, where they
show up as TYPE_CODE_VOID types (but that, mysteriously, can sometimes
be used in other ways).

While it's possible to work with such types by using strip_typedefs,
this seemed unpleasant to me.  This patch takes another approach
instead, which is to try not to expose stub types to Python users.

gdb/ChangeLog
2019-09-26  Tom Tromey  <tromey@adacore.com>

* python/py-type.c (type_to_type_object): Call check_typedef
for stub types.

gdb/testsuite/ChangeLog
2019-09-26  Tom Tromey  <tromey@adacore.com>

* gdb.ada/py_taft.exp: New file.
* gdb.ada/py_taft/main.adb: New file.
* gdb.ada/py_taft/pkg.adb: New file.
* gdb.ada/py_taft/pkg.ads: New file.

5 years agoRemove initialize_utils
Tom Tromey [Tue, 24 Sep 2019 23:52:08 +0000 (17:52 -0600)]
Remove initialize_utils

initialize_utils only registers some commands, so it isn't necessary
to run it at any particular time during startup.  This patch removes
it and merges its contents into _initialize_utils.

Tested by the buildbot.

gdb/ChangeLog
2019-09-26  Tom Tromey  <tom@tromey.com>

* utils.h (initialize_utils): Don't declare.
* top.c (gdb_init): Don't call initialize_utils.
* utils.c (initialize_utils): Remove.  Move contents...
(_initialize_utils): ... here.

5 years agoPR24262, plugin search dir doesn't respect --libdir
Alan Modra [Thu, 26 Sep 2019 06:50:35 +0000 (16:20 +0930)]
PR24262, plugin search dir doesn't respect --libdir

bfd/
PR 24262
* Makefile.am (AM_CPPFLAGS): Add -DLIBDIR.
* plugin.c (load_plugin): Search both ${libdir}/bfd-plugins and
${bindir}/../lib/bfd-plugins if different.
* Makefile.in: Regenerate.
ld/
PR 24262
* ld.texi (-plugin): Revert 2019-03-15 change.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 26 Sep 2019 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoRemove make_hex_string
Tom Tromey [Tue, 24 Sep 2019 23:36:07 +0000 (17:36 -0600)]
Remove make_hex_string

I noticed that make_hex_string does essentially the same thing as
bin2hex, and furthermore is only called in a single spot.  This patch
removes make_hex_string.

Tested by the builtbot.

gdb/ChangeLog
2019-09-25  Tom Tromey  <tom@tromey.com>

* python/py-objfile.c (objfpy_get_build_id): Use bin2hex.
* utils.h (make_hex_string): Don't declare.
* utils.c (make_hex_string): Remove.

5 years agoSORT_BY_INIT_PRIORITY
Alan Modra [Wed, 25 Sep 2019 06:00:53 +0000 (15:30 +0930)]
SORT_BY_INIT_PRIORITY

I was looking at the implementation of this script keyword today and
couldn't remember why we do what we do in get_init_priority, because
the comments explain how the init_priority is encoded but don't say
why it is necessary to extract the priority and sort on that.  So
after figuring out why (again), I wrote some more comments.

Then I simplified get_init_priority a little, adding some sanity
checking on the strtoul result.  This actually makes get_init_priority
support sorting by numerical suffix more generally, but I figure this
feature would be better as a new keyword (without the .ctors/.dtors
special case), so haven't documented the extension.

* ld.texi (SORT_BY_ALIGNMENT): Reword slightly.
(SORT_BY_INIT_PRIORITY): Elucidate.
* ldlang.c: Include limits.h.
(get_init_priority): Comment.  Change param to a section,
return an int.  Sanity check priority digits.  Support sorting
more sections with trailing digits.  Return -1 on error.
(compare_section): Adjust.

5 years agoSilence a build-time warning about constant comparisons when building with clang,
Nick Clifton [Wed, 25 Sep 2019 13:34:23 +0000 (14:34 +0100)]
Silence a build-time warning about constant comparisons when building with clang,

 * emultempl/avrelf.em (_before_allocation): Silence build warning
 using clang.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 25 Sep 2019 00:00:43 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb/tdep] Handle mxcsr kernel bug on Intel Skylake CPUs
Tom de Vries [Tue, 24 Sep 2019 21:38:49 +0000 (23:38 +0200)]
[gdb/tdep] Handle mxcsr kernel bug on Intel Skylake CPUs

On my openSUSE Leap 15.1 x86_64 Skylake system with the default (4.12) kernel,
I run into:
...
FAIL: gdb.base/gcore.exp: corefile restored all registers
...

The problem is that there's a difference in the mxcsr register value before
and after the gcore command:
...
- mxcsr          0x0                 [ ]
+ mxcsr          0x400440            [ DAZ OM ]
...

This can be traced back to amd64_linux_nat_target::fetch_registers, where
xstateregs is partially initialized by the ptrace call:
...
          char xstateregs[X86_XSTATE_MAX_SIZE];
          struct iovec iov;

          amd64_collect_xsave (regcache, -1, xstateregs, 0);
          iov.iov_base = xstateregs;
          iov.iov_len = sizeof (xstateregs);
          if (ptrace (PTRACE_GETREGSET, tid,
                      (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
            perror_with_name (_("Couldn't get extended state status"));

          amd64_supply_xsave (regcache, -1, xstateregs);
...
after which amd64_supply_xsave is called.

The amd64_supply_xsave call is supposed to only use initialized parts of
xstateregs, but due to a kernel bug on intel skylake (fixed from 4.14 onwards
by commit 0852b374173b "x86/fpu: Add FPU state copying quirk to handle XRSTOR
failure on Intel Skylake CPUs") it can happen that the mxcsr part of
xstateregs is not initialized, while amd64_supply_xsave expects it to be
initialized, which explains the FAIL mentioned above.

Fix the undetermined behaviour by initializing xstateregs before calling
ptrace, which makes sure we get a 0x0 for mxcsr when this kernel bug occurs,
and which also happens to fix the FAIL.

Furthermore, add an xfail for this FAIL which triggers the same kernel bug:
...
FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_mxcsr_before_enable: \
  check new value of MXCSR is still in place
...

Both FAILs pass when using a 5.3 kernel instead on the system mentioned above.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-09-24  Tom de Vries  <tdevries@suse.de>

PR gdb/23815
* amd64-linux-nat.c (amd64_linux_nat_target::fetch_registers):
Initialize xstateregs before ptrace PTRACE_GETREGSET call.

gdb/testsuite/ChangeLog:

2019-09-24  Tom de Vries  <tdevries@suse.de>

PR gdb/24598
* gdb.arch/amd64-init-x87-values.exp: Add xfail.

5 years agoArm: Fix out of range conditional branch (PR/24991)
Tamar Christina [Tue, 24 Sep 2019 13:46:17 +0000 (14:46 +0100)]
Arm: Fix out of range conditional branch (PR/24991)

The fix for PR12848 introduced an off by one error in the mask, this corrected
the negative overflows but not the positive overflows.  As a result the
conditional branch instructions accepted a too wide positive immediate which
resulted in it corrupting the instruction during encoding.

The relocation I believe has been incorrectly named, to be consistent with the
other relocations it should have been named BRANCH21 which is why the masks for
it are confusing.

I've replaced the masks with a function out_of_range_p which should make it
harder to make such mistakes.

The mask for BL/BLX on Armv6t+ is also wrong, the extended range is 25-bits
and so the mask should be checking for 24-bits for positive overflow.

gas/ChangeLog:

PR gas/24991
* config/tc-arm.c (out_of_range_p): New.
(md_apply_fix): Use it in BFD_RELOC_THUMB_PCREL_BRANCH9,
BFD_RELOC_THUMB_PCREL_BRANCH12, BFD_RELOC_THUMB_PCREL_BRANCH20,
BFD_RELOC_THUMB_PCREL_BRANCH23, BFD_RELOC_THUMB_PCREL_BRANCH25
* testsuite/gas/arm/pr24991.d: New test.
* testsuite/gas/arm/pr24991.l: New test.
* testsuite/gas/arm/pr24991.s: New test.

5 years agoPR25031, nm reports wrong address on 32bit
Alan Modra [Tue, 24 Sep 2019 13:17:13 +0000 (22:47 +0930)]
PR25031, nm reports wrong address on 32bit

Using saved_format breaks when nm is presented with multiple object
files, some 32-bit and some 64-bit.

PR 25031
* nm.c (print_format_string): New.
(get_print_format): Delete saved_format.  Move earlier.
(set_print_width): Call get_print_format.
(print_value): Use print_format_string.

5 years ago[ARM]: Modify assembler to accept floating and signless datatypes for MVE instruction...
Srinath Parvathaneni [Tue, 24 Sep 2019 09:18:12 +0000 (10:18 +0100)]
[ARM]: Modify assembler to accept floating and signless datatypes for MVE instruction VLDR.

This patch modifies assembler to accept the equivalent sized floating
and signless datatypes for VLDR instruction but as alias for the unsigned version.

gas/ChangeLog:

2019-09-23  Srinath Parvathaneni  <srinath.parvathaneni@arm.com>

* config/tc-arm.c (do_mve_vstr_vldr_RQ): Modify function to allow float
* and signless datatypes for few cases of VLDR instruction.
* testsuite/gas/arm/mve-vldr-bad-3.l: Modify.
* testsuite/gas/arm/mve-vldr-bad-3.s: Likewise.
* testsuite/gas/arm/mve-vstrldr-1.d: Likewise.
* testsuite/gas/arm/mve-vstrldr-1.s: Likewise.

5 years agoFix building gold with gcc-10.
Nick Clifton [Tue, 24 Sep 2019 09:07:56 +0000 (10:07 +0100)]
Fix building gold with gcc-10.

   * descriptors.cc: Include <string>

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 24 Sep 2019 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agogdb/readline: Fix date in last ChangeLog entry
Andrew Burgess [Mon, 23 Sep 2019 21:36:42 +0000 (22:36 +0100)]
gdb/readline: Fix date in last ChangeLog entry

Fixes the date in the last ChangeLog entry.

5 years agogdb/readline: fix use of an undefined variable
Andrew Burgess [Wed, 18 Sep 2019 19:13:25 +0000 (15:13 -0400)]
gdb/readline: fix use of an undefined variable

This commit in binutils-gdb:

  commit 830b67068cebe7db0eb0db3fa19244e03859fae0
  Date:   Fri Jul 12 09:53:02 2019 +0200

      [readline] Fix heap-buffer-overflow in update_line

Which corresponds to this commit in upstream readline:

  commit 31547b4ea4a1a904e1b08e2bc4b4ebd5042aedaa
  Date:   Mon Aug 5 10:24:27 2019 -0400

      commit readline-20190805 snapshot

Introduced a use of an undefined variable, which can be seen using
valgrind:

  $ valgrind --tool=memcheck gdb
  GNU gdb (GDB) 8.3.50.20190918-git
  Copyright (C) 2019 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  Type "show copying" and "show warranty" for details.
  This GDB was configured as "x86_64-pc-linux-gnu".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <http://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
      <http://www.gnu.org/software/gdb/documentation/>.

  For help, type "help".
  Type "apropos word" to search for commands related to "word".
  ==24924== Conditional jump or move depends on uninitialised value(s)
  ==24924==    at 0x9986C3: rl_redisplay (display.c:710)
  ==24924==    by 0x9839CE: readline_internal_setup (readline.c:447)
  ==24924==    by 0x9A1C2B: _rl_callback_newline (callback.c:100)
  ==24924==    by 0x9A1C85: rl_callback_handler_install (callback.c:111)
  ==24924==    by 0x6195EB: gdb_rl_callback_handler_install(char const*) (event-top.c:319)
  ==24924==    by 0x61975E: display_gdb_prompt(char const*) (event-top.c:409)
  ==24924==    by 0x4FBFE3: cli_interp_base::pre_command_loop() (cli-interp.c:286)
  ==24924==    by 0x6E53DA: interp_pre_command_loop(interp*) (interps.c:321)
  ==24924==    by 0x731F30: captured_command_loop() (main.c:334)
  ==24924==    by 0x733568: captured_main(void*) (main.c:1182)
  ==24924==    by 0x7335CE: gdb_main(captured_main_args*) (main.c:1197)
  ==24924==    by 0x41325D: main (gdb.c:32)
  ==24924==
  (gdb)

The problem can be traced back to init_line_structures.  The very
first time this function is ever called its MINSIZE parameter is
always 0 and the global LINE_SIZE is 1024.  Prior to the above
mentioned commits we spot that the line_state variables have not yet
been initialised, and allocate them some new buffer, then we enter
this loop:

  for (n = minsize; n < line_size; n++)
    {
      visible_line[n] = 0;
      invisible_line[n] = 1;
    }

which would initialise everything from the incoming minimum up to the
potentially extended upper line size.

The problem is that the above patches added a new condition that would
bump up the minsize like this:

  if (minsize <= _rl_screenwidth) /* XXX - for gdb */
    minsize = _rl_screenwidth + 1;

So, the first time this function is called the incoming MINSIZE is 0,
the LINE_SIZE global is 1024, and if the _rl_screenwidth is 80, we see
that MINSIZE will be pushed up to 80.  We still notice that the line
state is uninitialised and allocate some buffers, then we enter the
initialisation loop:

  for (n = minsize; n < line_size; n++)
    {
      visible_line[n] = 0;
      invisible_line[n] = 1;
    }

And initialise from 80 to 1023 i the newly allocated buffers, leaving
0 to 79 uninitialised.

To confirm this is an issue, if we then look at rl_redisplay we see
that a call to init_line_structures is followed first by a call to
rl_on_new_line, which does initialise visible_line[0], but not
invisible_line[0].  Later in rl_redisplay we have this logic:

  if (visible_line[0] != invisible_line[0])
    rl_display_fixed = 0;

The use of invisible_line[0] here will be undefined.

Considering how this variable was originally initialised before the
above patches, this patch modifies the initialisation loop in
init_line_structures, to use the original value of MINSIZE.  With this
change the valgrind warning goes away.

readline/ChangeLog:

PR cli/24980
* display.c (init_line_structures): Initialise line_state using
original minsize value.

5 years agoAdd testsuite for the PRU simulator port
Dimitar Dimitrov [Mon, 23 Sep 2019 16:55:43 +0000 (17:55 +0100)]
Add testsuite for the PRU simulator port

sim/testsuite/ChangeLog:

* configure: Regenerate.

sim/testsuite/sim/pru/ChangeLog:

* add.s: New test.
* allinsn.exp: New file.
* dmem-zero-pass.s: New test.
* dmem-zero-trap.s: New test.
* dram.s: New test.
* jmp.s: New test.
* loop-imm.s: New test.
* loop-reg.s: New test.
* mul.s: New test.
* subreg.s: New test.
* testutils.inc: New file.

5 years agosim: Add PRU simulator port
Dimitar Dimitrov [Mon, 23 Sep 2019 16:54:42 +0000 (17:54 +0100)]
sim: Add PRU simulator port

A simulator port for the TI PRU I/O processor.

v1: https://sourceware.org/ml/gdb-patches/2016-12/msg00143.html
v2: https://sourceware.org/ml/gdb-patches/2017-02/msg00397.html
v3: https://sourceware.org/ml/gdb-patches/2017-02/msg00516.html
v4: https://sourceware.org/ml/gdb-patches/2018-06/msg00484.html
v5: https://sourceware.org/ml/gdb-patches/2019-08/msg00584.html
v6: https://sourceware.org/ml/gdb-patches/2019-09/msg00036.html

gdb/ChangeLog:

* NEWS: Mention new simulator port for PRU.

sim/ChangeLog:

* MAINTAINERS: Add myself as PRU maintainer.
* configure: Regenerated.
* configure.tgt: Add PRU.

sim/common/ChangeLog:

* gennltvals.sh: Add PRU libgloss target.
* nltvals.def: Regenerate from the latest libgloss sources.

sim/pru/ChangeLog:

* Makefile.in: New file.
* aclocal.m4: Regenerated.
* config.in: Regenerated.
* configure: Regenerated.
* configure.ac: New file.
* interp.c: New file.
* pru.h: New file.
* pru.isa: New file.
* sim-main.h: New file.

5 years agoMake ada_decode not use a static buffer
Christian Biesinger [Wed, 28 Aug 2019 20:40:31 +0000 (15:40 -0500)]
Make ada_decode not use a static buffer

This makes it safer to use in general, and also allows using it on a
background thread in the future.

Inspired by tromey's patch at:
https://github.com/tromey/gdb/commit/1226cbdfa436297a5dec054d94592c45891afa93
(however, implemented in a different way)

gdb/ChangeLog:

2019-09-23  Christian Biesinger  <cbiesinger@google.com>

* ada-exp.y (write_object_remaining): Update.
* ada-lang.c (ada_decode): Return a std::string instead of a char*
and eliminate the static buffer.
(ada_decode_symbol): Update.
(ada_la_decode): Update.
(ada_sniff_from_mangled_name): Update.
(is_valid_name_for_wild_match): Update.
(ada_lookup_name_info::matches): Update and simplify.
(name_matches_regex): Update.
(ada_add_global_exceptions): Update.
* ada-lang.h (ada_decode): Update signature.
* ada-varobj.c (ada_varobj_describe_simple_array_child): Update.
* dwarf-index-write.c (debug_names::insert): Update.

5 years agold-plugin/pr24406-1.c: Correct buffer size to read
H.J. Lu [Mon, 23 Sep 2019 15:51:36 +0000 (08:51 -0700)]
ld-plugin/pr24406-1.c: Correct buffer size to read

* testsuite/ld-plugin/pr24406-1.c (main): Correct buffer size
to read.

5 years agoPowerPC64 dynamic symbol tweaks
Alan Modra [Mon, 23 Sep 2019 06:36:22 +0000 (16:06 +0930)]
PowerPC64 dynamic symbol tweaks

In check_relocs, bfd_link_pic true means ld is producing a shared
library or a position independent executable.  !bfd_link_pic means a
fixed position (ie. static) executable since the relocatable linking
case is excluded.  So it is appropriate to continue using bfd_link_pic
when testing whether non-pcrelative relocations should be dynamic, and
!bfd_link_pic for the special case of ifunc in static executables.
However, -Bsymbolic shouldn't affect PIEs (they are executables so
none of their symbols should be overridden) and PIEs can support copy
relocations, thus bfd_link_executable should be used in those cases
rather than bfd_link_pic.

I've also removed the test of ELIMINATE_COPY_RELOCS in check_relocs.
We can sort out what to do regarding copy relocs later, which allows
the code in check_relocs to be simplified.

* elf64-ppc.c (ppc64_elf_check_relocs): Use bfd_link_executable
in choosing between different actions for shared library and
non-shared library cases.  Delete ELIMINATE_COPY_RELOCS test.
(dec_dynrel_count): Likewise.  Account for ifunc special case.
(ppc64_elf_adjust_dynamic_symbol): Copy relocs are for executables,
not non-pic.
(allocate_dynrelocs): Comment fixes.  Delete ELIMINATE_COPY_RELOCS
test.

5 years agoimplicit conversion from enum ld_plugin_level to enum ld_plugin_status
Alan Modra [Mon, 23 Sep 2019 11:00:22 +0000 (20:30 +0930)]
implicit conversion from enum ld_plugin_level to enum ld_plugin_status

This is a gcc10 warning fix.

gold/
* testsuite/plugin_new_section_layout.c (new_input_hook): Correct
return status enum values.

5 years agobfd Makefile update
Alan Modra [Mon, 23 Sep 2019 00:45:02 +0000 (10:15 +0930)]
bfd Makefile update

* Makefile.am (SOURCE_HFILES): Add many missing .h files.
* Makefile.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.

5 years agolinker bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:44:20 +0000 (10:14 +0930)]
linker bfd.h tidy

bfd/
* bfd-in.h (bfd_symbol, bfd_section_already_linked),
(bfd_elf_version_tree): Delete forward declarations.
Move other forward decls and remaining elf function decl later.
(bfd_section_already_linked_table_init),
(bfd_section_already_linked_table_free),
(_bfd_handle_already_linked, _bfd_nearby_section),
(_bfd_fix_excluded_sec_syms): Move to bfdlink.h.
include/
* bfdlink.h (struct bfd_section_already_linked): Forward declare.
(bfd_section_already_linked_table_init),
(bfd_section_already_linked_table_free),
(_bfd_handle_already_linked, _bfd_nearby_section),
(_bfd_fix_excluded_sec_syms): Declare.

5 years agoecoff bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:43:26 +0000 (10:13 +0930)]
ecoff bfd.h tidy

bfd/
* bfd-in.h: Move ecoff function declarations..
* ecoff-bfd.h: ..to here, new file.
* ecoff.c: Include ecoff-bfd.h.
* ecofflink.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
gas/
* config/obj-ecoff.c: Include ecoff-bfd.h.
* config/obj-elf.c: Likewise.

5 years agoelf bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:42:31 +0000 (10:12 +0930)]
elf bfd.h tidy

bfd/
* bfd-in.h (enum notice_asneeded_action): Move to bfdlink.h.
Move most other elf declarations..
* elf-bfd.h: ..to here.
* bfd-in2.h: Regenerate.
include/
* bfdlink.h (enum notice_asneeded_action): Define.
ld/
* deffilep.y: Include bfdlink.h.
* ldelf.c: Likewise.
* ldelfgen.c: Likewise.
* ldver.c: Likewise.
* mri.c: Likewise.
* emultempl/irix.em: Don't include ld.h, ldmain.h, libiberty.h.
Comment.

5 years agom68k bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:41:29 +0000 (10:11 +0930)]
m68k bfd.h tidy

bfd/
* bfd-in.h: Move m68k function declaration..
* cpu-m68k.h: ..to here, new file..
* elf32-m68k.h: ..and here, new file.
* elf32-m68k.c: Include cpu-m68k.h and elf32-m68k.h.
* bfd-in2.h: Regenerate.
ld/
* emultempl/m68kelf.em: Include elf32-m68k.h.
opcodes/
* m68k-dis.c: Include cpu-m68k.h

5 years agobfin bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:40:28 +0000 (10:10 +0930)]
bfin bfd.h tidy

bfd/
* bfd-in.h: Move bfin function declaration..
* elf32-bfin.h: ..to here, new file.
* elf32-bfin.c: Include elf32-bfin.h.
* bfd-in2.h: Regenerate.
ld/
* emultempl/bfin.em: Include elf32-bfin.h.

5 years agocr16 bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:39:47 +0000 (10:09 +0930)]
cr16 bfd.h tidy

bfd/
* bfd-in.h: Move cr16 function declaration..
* elf32-cr16.h: ..to here, new file.
* elf32-cr16.c: Include elf32-cr16.h.
* bfd-in2.h: Regenerate.
ld/
* emultempl/cr16elf.em: Include elf32-cr16.h.

5 years agoobsoleted bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:39:07 +0000 (10:09 +0930)]
obsoleted bfd.h tidy

* bfd-in.h (bfd_sunos_get_needed_list),
(bfd_sunos_record_link_assignment),
(bfd_sunos_size_dynamic_sections),
(bfd_i386linux_size_dynamic_sections),
(bfd_sparclinux_size_dynamic_sections): Delete obsolete decls.
* bfd-in2.h: Regenerate.

5 years agoxcoff bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:38:33 +0000 (10:08 +0930)]
xcoff bfd.h tidy

bfd/
* bfd-in.h: Move xcoff function declarations..
* xcofflink.h: ..to here, new file.
* xcofflink.c: Include xcofflink.h.
* coff-rs6000.c (bfd_xcoff_ar_archive_set_magic): Delete unused func.
* bfd-in2.h: Regenerate.
ld/
* emultempl/aix.em: Include xcofflink.h.

5 years agocoff bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:37:40 +0000 (10:07 +0930)]
coff bfd.h tidy

bfd/
* bfd-in.h: Delete coff forward refs and move coff declaration..
* coff-bfd.h: ..to here.
* bfd-in2.h: Regenerate.
binutils/
* dlltool.c: Include coff-bfd.h.

5 years agoarm bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:36:45 +0000 (10:06 +0930)]
arm bfd.h tidy

bfd/
* bfd-in.h: Move arm declaraions..
* cpu-arm.h: ..to here, new file..
* coff-arm.h: ..and here, new file..
* elf32-arm.h: ..and here, new file.
* cpu-arm.c: Include cpu-arm.h.
* coff-arm.c: Include cpu-arm.h and coff-arm.h.
* elf32-arm.c: Include cpu-arm.h and elf32-arm.h.
* pe-arm.c: Move function rename defines later.
* pe-arm-wince.c: Likewise and include sysdep.h and bfd.h early.
* bfd-in2.h: Regenerate.
gas/
* config/tc-arm.c: Include cpu-arm.h.
ld/
* emultempl/armelf.em: Include elf32-arm.h.
* emultempl/pe.em: Move func defines later and include coff-arm.h.

5 years agotic6x bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:35:43 +0000 (10:05 +0930)]
tic6x bfd.h tidy

* bfd-in.h: Move tic6x function declaration..
* elf32-tic6x.h: ..to here.
* bfd-in2.h: Regenerate.

5 years agoaarch64 bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:34:50 +0000 (10:04 +0930)]
aarch64 bfd.h tidy

bfd/
* bfd-in.h: Move aarch64 declarations and defines..
* cpu-aarch64.h: ..to here, new file..
* elfxx-aarch64.h: ..and here.
* cpu-aarch64.c: Include cpu-aarch64.h.
* elfnn-aarch64.c: Likewise.
* bfd-in2.h: Regenerate.
ld/
* emultempl/aarch64elf.em: Include elfxx-aarch64.h.

5 years agotic54x bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:33:37 +0000 (10:03 +0930)]
tic54x bfd.h tidy

* bfd-in.h: Delete ticoff function declarations.
* coff-tic54x.c (bfd_ticoff_set_section_load_page),
(bfd_ticoff_get_section_load_page): Make static.
* bfd-in2.h: Regenerate.

5 years agoh8300 bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:33:04 +0000 (10:03 +0930)]
h8300 bfd.h tidy

* bfd-in.h: Move h8300 function declaration to..
* cpu-h8300.h: ..here, new file.
* cpu-h8300.c: Include cpu-h8300.h.
* elf32-h8300.c: Likewise.
* bfd-in2.h: Regenerate.

5 years agoia64 bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:32:25 +0000 (10:02 +0930)]
ia64 bfd.h tidy

bfd/
* bfd-in.h: Move ia64 function declarations..
* elfxx-ia64.h: ..to here.
* bfd-in2.h: Regenerate.
ld/
* emultempl/ia64elf.em: Include elfxx-ia64.h.

5 years agov850 bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:31:31 +0000 (10:01 +0930)]
v850 bfd.h tidy

bfd/
* bfd-in.h: Move v850 function declarations..
* elf32-v850.h: ..to here, new file.
* elf32-v850.c: Include elf32-v850.h.
* bfd-in2.h: Regenerate.
ld/
* emultempl/v850elf.em: Include elf32-v850.h.

5 years agomips bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:30:21 +0000 (10:00 +0930)]
mips bfd.h tidy

bfd/
* bfd-in.h: Move mips function declaration to..
* elfxx-mips.h: ..here.
* bfd-in2.h: Regenerate.
opcodes/
* mips-dis.c: Include elfxx-mips.h.  Move "elf-bfd.h" and
"elf/mips.h" earlier.

5 years agocsky bfd.h tidy
Alan Modra [Mon, 23 Sep 2019 00:28:42 +0000 (09:58 +0930)]
csky bfd.h tidy

bfd/
* bfd-in.h: Move csky function declarations to..
* elf32-csky.h: ..here, new file.
* elf32-csky.c: Include elf32-csky.h.
* bfd-in2.h: Regenerate.
ld/
* emultempl/cskyelf.em: Include elf32-csky.h.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 23 Sep 2019 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoPR25018, readelf crash on 32bits
Alan Modra [Sun, 22 Sep 2019 23:23:07 +0000 (08:53 +0930)]
PR25018, readelf crash on 32bits

Pointer comparisons after adding an offset just don't work to catch
overflow when the offset is a larger type than the pointer.

PR 25018
* dwarf.c (get_type_signedness): Delete ineffective pointer
comparison check.  Properly range check uvalue offset on
recursive call.
(read_and_display_attr_value): Range check uvalue offset before
calling get_type_signedness.

5 years agoWork around gcc10 FAIL: S-records with constructors
Alan Modra [Sat, 21 Sep 2019 08:43:52 +0000 (18:13 +0930)]
Work around gcc10 FAIL: S-records with constructors

gcc10 on x86_64 and powerpc64le recognises that the loop in
Foo::operator= can be turned into a call to memmove, which then
results in an undefined symbol when linking.  Avoid that by making the
loop smaller.

* testsuite/ld-srec/sr3.cc (FOO_MSG_LEN): Set to 4.

5 years ago[gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported
Tom de Vries [Sun, 22 Sep 2019 04:14:29 +0000 (06:14 +0200)]
[gdb/testsuite] Allow some tests in gdb.base/restore.exp to be unsupported

We currently run into:
...
248       n = callee1 (n + l5);
(gdb) PASS: gdb.base/restore.exp: caller5 calls callee1; return callee now
print l1
$51 = <optimized out>
(gdb) FAIL: gdb.base/restore.exp: caller5 calls callee1; return restored l1 \
  to 32492
...

The problem is that we try to access the value of l1 in function caller5, but
variable l1 has no DW_AT_location attribute.  Since l1 is declared using the
register keyword, it's valid for gcc to emit no DW_AT_location at -O0.

Change the FAIL into an UNSUPPORTED.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-22  Tom de Vries  <tdevries@suse.de>

* gdb.base/restore.exp: Allow register variables to be optimized out at
-O0.

5 years agogdb: fix formatting in solib-svr4.c
Simon Marchi [Sun, 22 Sep 2019 02:13:49 +0000 (22:13 -0400)]
gdb: fix formatting in solib-svr4.c

gdb/ChangeLog:

* solib-svr4.c (svr4_iterate_over_objfiles_in_search_order): Fix
formatting.

5 years agogdb: make watchpoint::val_valid a bool
Simon Marchi [Sat, 21 Sep 2019 23:50:40 +0000 (19:50 -0400)]
gdb: make watchpoint::val_valid a bool

gdb/ChangeLog:

* breakpoint.h (struct watchpoint) <val_valid>: Change type to
bool.
* breakpoint.c (update_watchpoint): Assign false instead of 0,
true instead of 1.
(breakpoint_init_inferior): Likewise.
(watchpoint_check): Likewise.
(watch_command_1): Likewise.
(invalidate_bp_value_on_memory_change): Likewise.

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 22 Sep 2019 00:01:11 +0000 (00:01 +0000)]
Automatic date update in version.in

5 years agogdb: change "nonzero" to "true" in comments
Simon Marchi [Sat, 21 Sep 2019 23:45:12 +0000 (19:45 -0400)]
gdb: change "nonzero" to "true" in comments

These int fields have been converted to bool, so their doc should say
"true" and not "nonzero".

gdb/ChangeLog:

* breakpoint.h (bp_location) <inserted, permanent, duplicate>:
Change "nonzero" to "true" in documentation.

5 years agoReplace solib_global_lookup with gdbarch_iterate_over_objfiles_in_search_order
Christian Biesinger [Thu, 1 Aug 2019 16:53:03 +0000 (11:53 -0500)]
Replace solib_global_lookup with gdbarch_iterate_over_objfiles_in_search_order

All implementations of either function use it for the same purpose (except
Darwin, which is a no-op): to prefer a symbol in the current objfile over
symbols with the same name in other objfiles. There does not seem to be a
reason to have both mechanisms for that purpose.

gdb/ChangeLog:

2019-09-20  Christian Biesinger  <cbiesinger@google.com>

* solib-darwin.c (darwin_lookup_lib_symbol): Remove.
(_initialize_darwin_solib): Don't set
darwin_so_ops.lookup_lib_global_symbol.
* solib-svr4.c (set_solib_svr4_fetch_link_map_offsets): Call
set_gdbarch_iterate_over_objfiles_in_search_order.
(elf_lookup_lib_symbol): Rename to...
(svr4_iterate_over_objfiles_in_search_order): this, and update
to iterate semantics.
(_initialize_svr4_solib): Don't set lookup_lib_global_symbol.
* solib.c (solib_global_lookup): Remove.
* solist.h (struct target_so_ops): Remove lookup_lib_global_symbol.
(solib_global_lookup): Remove.
* symtab.c (lookup_global_or_static_symbol): Remove call to
solib_global_lookup.

5 years agotc-i386.c gcc10 warning fix
Alan Modra [Sat, 21 Sep 2019 01:29:50 +0000 (10:59 +0930)]
tc-i386.c gcc10 warning fix

.../gas/config/tc-i386.c: In function â€˜md_parse_option’:
.../gas/config/tc-i386.c:11441:9: error: implicit conversion from â€˜enum <anonymous>’ to â€˜enum <anonymous>’ [-Werror=enum-conversion]
11441 |  vexwig = evexw0;
      |         ^
.../gas/config/tc-i386.c:11443:9: error: implicit conversion from â€˜enum <anonymous>’ to â€˜enum <anonymous>’ [-Werror=enum-conversion]
11443 |  vexwig = evexw1;
      |         ^

* config/tc-i386.c (md_parse_option): Fix warning on vexwig assignment.

5 years agoMove declarations of debug_threads and using_threads to header
Christian Biesinger [Fri, 20 Sep 2019 02:40:09 +0000 (11:40 +0900)]
Move declarations of debug_threads and using_threads to header

Instead of declaring debug_threads and using_threads in several
.c files, declare them in debug.h.

gdb/gdbserver/ChangeLog:

2019-09-20  Christian Biesinger  <cbiesinger@google.com>

* debug.c (debug_threads): Remove comment in favor of the header.
* debug.h (using_threads): Add declaration.
(debug_threads): Add comment.
* linux-aarch64-low.c: Include debug.h and remove declaration of
debug_threads.
* nto-low.c: Likewise.
* remote-utils.c: Likewise.
* thread-db.c: Likewise.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 21 Sep 2019 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agogdb/NEWS: Move entries about MI v3 and multi-loc breakpoints after GDB 8.3
Joel Brobecker [Fri, 20 Sep 2019 23:23:15 +0000 (16:23 -0700)]
gdb/NEWS: Move entries about MI v3 and multi-loc breakpoints after GDB 8.3

This is a followup on the following commit...

    commit b4be1b0648608a2578bbed39841c8ee411773edd
    Date:   Wed Mar 13 15:13:03 2019 -0400
    Subject: Fix MI output for multi-location breakpoints

... which mistakenly added NEWS entries in the "in gdb-8.3" section,
rather than in the "since gdb-8.3" one.

gdb/ChangeLog:

* NEWS: Move entries about default MI version now being
        version 3, and about the GDB/MI fix for multi-location
        breakpoints to the "since GDB 8.3" section.

5 years agoDocument the GDB 8.3.1 release in gdb/ChangeLog
Joel Brobecker [Fri, 20 Sep 2019 22:20:53 +0000 (15:20 -0700)]
Document the GDB 8.3.1 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 8.3.1 released.

5 years agoRISC-V: Optimize lui and auipc relaxations for undefweak symbol.
Jim Wilson [Fri, 20 Sep 2019 22:01:20 +0000 (15:01 -0700)]
RISC-V: Optimize lui and auipc relaxations for undefweak symbol.

For the lui and auipc relaxations, since the symbol value of an undefined weak
symbol is always be zero, we can optimize the patterns into a single LI/MV/ADDI
instruction.

bfd/
* elfnn-riscv.c (riscv_pcgp_hi_reloc): Add new field undefined_weak.
(riscv_record_pcgp_hi_reloc): New parameter undefined_weak.
Set undefined_weak field from it.
(relax_func_t): New parameter undefined_weak.
(_bfd_riscv_relax_call): New ignored parameter undefined_weak.
(_bfd_riscv_relax_tls_le): Likewise.
(_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_delete): Likewise.
(_bfd_riscv_relax_lui): New parameter undefined_weak.  If true,
allow relaxing.  For LO12* relocs, set rs1 to x0 when undefined_weak.
(_bfd_riscv_relax_pc): New parameter undefined_weak.  For LO12* relocs,
set undefined_weak from hi_reloc.  If true, allow relaxing.  For LO12*
relocs, set rs1 to x0 when undefined_weak and change to non-pcrel
reloc.
(_bfd_riscv_relax_section): New local undefined_weak.  Set for
undef weak relocs that can be relaxed.  Pass to relax_func call.

ld/
* testsuite/ld-riscv-elf/weakref32.s: Add relaxable undef weak code.
* testsuite/ld-riscv-elf/weakref64.s: Likewise.
* testsuite/ld-riscv-elf/weakref32.d: Updated.
* testsuite/ld-riscv-elf/weakref64.d: Updated.

5 years agoRemove Cell Broadband Engine debugging support
Ulrich Weigand [Fri, 20 Sep 2019 21:06:57 +0000 (23:06 +0200)]
Remove Cell Broadband Engine debugging support

This patch implements removal of Cell/B.E. support, including
- Support for the spu-*-* target
- Support for native stand-alone SPU debugging
- Support for integrated debugging of combined PPU/SPU applications
- Remote debugging (gdbserver) support for all the above.

The patch also removes the TARGET_OBJECT_SPU target object type,
as this is available only on Cell/B.E. targets, including
- Native Linux support
- Core file support (including core file generation)
- Remote target support, including removal of the qXfer:spu:read
  and qXfer:spu:write remote protocal packets and associated
  support in gdbserver.

gdb/ChangeLog
2019-09-20  Ulrich Weigand  <uweigand@de.ibm.com>

* NEWS: Mention that Cell/B.E. debugging support was removed.
* MAINTAINERS: Remove spu target.

* config/djgpp/fnchange.lst: Remove entries for removed files.

* Makefile.in (ALL_TARGET_OBS): Remove solib-spu.o,
spu-multiarch.o, and spu-tdep.o.
(HFILES_NO_SRCDIR): Remove solib-spu.h and spu-tdep.h.
(ALLDEPFILES): Remove solib-spu.c, spu-linux-nat.c,
spu-multiarch.c, and spu-tdep.c.
* spu-linux-nat.c: Remove file.
* spu-multiarch.c: Remove file.
* spu-tdep.c: Remove file.
* spu-tdep.h: Remove file.
* solib-spu.c: Remove file.
* solib-spu.h: Remove file.

* configure.host (powerpc64*-*-linux*): Remove Cell/B.E. support.
* configure.nat (spu-linux): Remove.
* configure.tgt (powerpc*-*-linux*): Remove solib-spu.o and
solib-multiarch.o from gdb_target_obs.
(spu*-*-*): Remove.

* arch/ppc-linux-common.h (struct ppc_linux_features): Remove "cell"
feature flag.
(ppc_linux_no_features): Update.
* arch/ppc-linux-common.c (ppc_linux_match_description): Remove
Cell/B.E. support.
* arch/ppc-linux-tdesc.h (tdesc_powerpc_cell32l): Remove declaration.
(tdesc_powerpc_cell64l): Likewise.
* nat/ppc-linux.h (PPC_FEATURE_CELL): Remove.
* ppc-linux-nat.c (ppc_linux_nat_target::read_description): Remove
Cell/B.E. support.
* ppc-linux-tdep.h: Do not include "solib-spu.h" or "spu-tdep.h".
Do not include "features/rs6000/powerpc-cell32l.c" or
"features/rs6000/powerpc-cell64l.c".
(ppc_linux_spu_section): Remove.
(ppc_linux_core_read_description): Remove Cell/B.E. support.
(spe_context_objfile, spe_context_lm_addr, spe_context_offset,
spe_context_cache_ptid, spe_context_cache_ptid): Remove.
(ppc_linux_spe_context_lookup): Remove.
(ppc_linux_spe_context_inferior_created): Remove.
(ppc_linux_spe_context_solib_loaded): Remove.
(ppc_linux_spe_context_solib_unloaded): Remove.
(ppc_linux_spe_context): Remove.
(struct ppu2spu_cache): Remove.
(ppu2spu_prev_arch, ppu2spu_this_id, ppu2spu_prev_register): Remove.
(struct ppu2spu_data): Remove.
(ppu2spu_unwind_register, ppu2spu_sniffer, ppu2spu_dealloc_cache,
ppu2spu_unwind): Remove.
(ppc_linux_init_abi): Remove Cell/B.E. support.
* rs6000-tdep.h (rs6000_gdbarch_init): Remove Cell/B.E. support.

* features/Makefile (rs6000/powerpc-cell32l-expedite): Remove.
(rs6000/powerpc-cell64l-expedite): Likewise
(WHICH): Remove rs6000/powerpc-cell32l and rs6000/powerpc-cell64l.
(XMLTOC): Remove rs6000/powerpc-cell32l.xml and
rs6000/powerpc-cell64l.xml.
* features/rs6000/powerpc-cell32l.xml: Remove.
* features/rs6000/powerpc-cell64l.xml: Likewise.
* features/rs6000/powerpc-cell32l.c: Remove generated file.
* features/rs6000/powerpc-cell64l.c: Likewise.
* regformats/rs6000/powerpc-cell32l.dat: Remove generated file.
* regformats/rs6000/powerpc-cell64l.dat: Likewise.
* regformats/reg-spu.dat: Remove.

* target.h (enum target_object): Remove TARGET_OBJECT_SPU.
* corelow.c (struct spuid_list): Remove.
(add_to_spuid_list): Remove.
(core_target::xfer_partial): Remove support for TARGET_OBJECT_SPU.
* remote.c (PACKET_qXfer_spu_read, PACKET_qXfer_spu_write): Remove.
(remote_protocol_features): Remove associated entries.
(_initialize_remote): No longer initialize them.
(remote_target::xfer_partial): Remove support for TARGET_OBJECT_SPU.
* linux-nat.c (SPUFS_MAGIC): Remove.
(linux_proc_xfer_spu): Remove.
(spu_enumerate_spu_ids): Remove.
(linux_nat_target::xfer_partial): Remove support for TARGET_OBJECT_SPU.
* linux-tdep.c (-linux_spu_make_corefile_notes): Remove.
(linux_make_corefile_notes): No longer call it.

* regcache.c (cooked_read_test): Remove bfd_arch_spu special case.
(cooked_write_test): Likewise.

gdb/doc/ChangeLog
2019-09-20  Ulrich Weigand  <uweigand@de.ibm.com>

* doc/gdb.texinfo (Remote Configuration): Remove documentation for
qXfer:spu:read and qXfer:spu:write.
(General Query Packets): Likewise.
(Cell Broadband Engine SPU architecture): Remove subsection.

gdb/gdbserver/ChangeLog
2019-09-20  Ulrich Weigand  <uweigand@de.ibm.com>

* configure.srv (ipa_ppc_linux_regobj): Remove powerpc-cell32l-ipa.o
and powerpc-cell64l-ipa.o.
(powerpc*-*-linux*): Remove powerpc-cell32l.o and powerpc-cell64l.o
from srv_regobj.  Remove rs6000/powerpc-cell32l.xml and
rs6000/powerpc-cell64l.xml from srv_xmlfiles.
(spu*-*-*): Remove.

* spu-low.c: Remove file.

* linux-ppc-low.c (INSTR_SC, NR_spu_run): Remove.
(parse_spufs_run): Remove.
(ppc_get_pc): Remove Cell/B.E. support.
(ppc_set_pc): Likewise.
(ppc_breakpoint_at): Likewise.
(ppc_arch_setup): Likewise.
(ppc_get_ipa_tdesc_idx): Do not handle tdesc_powerpc_cell64l or
tdesc_powerpc_cell32l.
(initialize_low_arch): Do not call init_registers_powerpc_cell64l
or init_registers_powerpc_cell32l.
* linux-ppc-ipa.c (get_ipa_tdesc): Do not handle PPC_TDESC_CELL.
(initialize_low_tracepoint): Do not call init_registers_powerpc_cell64l
or init_registers_powerpc_cell32l.
* linux-ppc-tdesc-init.h (PPC_TDESC_CELL): Mark as unused.
(init_registers_powerpc_cell32l): Remove prototype.
(init_registers_powerpc_cell64l): Likewise.

* target.h (struct target_ops): Remove qxfer_spu member.
* server.c (handle_qxfer_spu): Remove.
(qxfer_packets): Remove entry for "spu".
(handle_query): No longer support qXfer:spu:read or qXfer:spu:write.
* linux-low.c (SPUFS_MAGIC): Remove.
(spu_enumerate_spu_ids): Remove.
(linux_qxfer_spu): Remove.
(linux_target_ops): Remove qxfer_spu member.
* lynx-low.c (lynx_target_ops): Remove qxfer_spu member.
* nto-low.c (nto_target_ops): Remove qxfer_spu member.
* win32-low.c (win32_target_ops): Remove qxfer_spu member.

gdb/testsuite/ChangeLog
2019-09-20  Ulrich Weigand  <uweigand@de.ibm.com>

* gdb.arch/spu-info.exp: Remove file.
* gdb.arch/spu-info.c: Remove file.
* gdb.arch/spu-ls.exp: Remove file.
* gdb.arch/spu-ls.c: Remove file.

* gdb.asm/asm-source.exp: Remove support for spu*-*-*.
* gdb.asm/spu.inc: Remove file.

* gdb.base/dump.exp: Remove support for spu*-*-*.
* gdb.base/stack-checking.exp: Likewise.
* gdb.base/overlays.exp: Likewise.
* gdb.base/ovlymgr.c: Likewise.
* gdb.base/spu.ld: Remove file.

* gdb.cp/bs15503.exp: Remove support for spu*-*-*.
* gdb.cp/cpexprs.exp: Likewise.
* gdb.cp/exception.exp: Likewise.
* gdb.cp/gdb2495.exp: Likewise.
* gdb.cp/mb-templates.exp: Likewise.
* gdb.cp/pr9167.exp: Likewise.
* gdb.cp/userdef.exp: Likewise.

* gdb.xml/tdesc-regs.exp: Remove support for spu*-*-*.

* gdb.cell: Remove directory.
* lib/cell.exp: Remove file.

5 years agoChange TUI window commands to be case-sensitive
Tom Tromey [Tue, 23 Jul 2019 22:01:03 +0000 (16:01 -0600)]
Change TUI window commands to be case-sensitive

The TUI window-related commands like "focus" are case insensitive.
This is not the norm in gdb, and I don't see a good reason to have it
here.  This patch changes the TUI to be case sensitive, like the rest
of gdb.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* NEWS: Mention case-sensitivity of TUI commands.
* tui/tui-win.c (tui_set_focus_command): Now case-sensitive.
(tui_set_win_height_command, parse_scrolling_args): Likewise.
* tui/tui-layout.c (tui_layout_command): Now case-sensitive.

5 years agoUse make_unique_xstrdup in TUI
Tom Tromey [Tue, 10 Sep 2019 18:56:09 +0000 (12:56 -0600)]
Use make_unique_xstrdup in TUI

This changes a couple of spots in the TUI to use make_unique_xstrdup.
This simplifies the code slightly.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-source.c (tui_source_window::set_contents): Use
make_unique_xstrdup.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Use
make_unique_xstrdup.

5 years agoRemove separator comments from TUI
Tom Tromey [Tue, 10 Sep 2019 18:41:29 +0000 (12:41 -0600)]
Remove separator comments from TUI

This removes various separator comments from the TUI.  These aren't
used elsewhere in gdb, and they were incorrect in some cases as well.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-data.c: Remove separator comments.
* tui/tui-layout.c: Remove separator comments.
* tui/tui-win.c: Remove separator comments.
* tui/tui-wingeneral.c: Remove separator comments.

5 years agoRemove strcat_to_buf
Tom Tromey [Mon, 2 Sep 2019 15:07:02 +0000 (09:07 -0600)]
Remove strcat_to_buf

An earlier patch in the series removed the last call to strcat_to_buf,
so this patch removes the function entirely.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui.h (strcat_to_buf): Don't declare.
* tui/tui.c (strcat_to_buf): Remove.

5 years agoRename a private data member in tui_source_window
Tom Tromey [Mon, 2 Sep 2019 14:10:44 +0000 (08:10 -0600)]
Rename a private data member in tui_source_window

This renames tui_source_window::fullname to add the "m_" prefix, as it
is a private data member.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-source.h (struct tui_source_window) <m_fullname>: Rename
from "fullname".
* tui/tui-source.c (tui_source_window::set_contents)
(tui_source_window::location_matches_p)
(tui_source_window::maybe_update): Update.

5 years agoRename private data members of tui_data_window
Tom Tromey [Mon, 2 Sep 2019 14:09:37 +0000 (08:09 -0600)]
Rename private data members of tui_data_window

As Pedro suggested, this patch renames the private data members of
tui_data_window to use the "m_" prefix.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window) <get_current_group>:
Update.
<m_regs_content, m_regs_column_count, m_current_group>: Add "m_"
prefix.
* tui/tui-regs.c (tui_data_window::last_regs_line_no)
(tui_data_window::line_from_reg_element_no)
(tui_data_window::first_reg_element_no_inline)
(tui_data_window::show_registers)
(tui_data_window::show_register_group)
(tui_data_window::display_registers_from)
(tui_data_window::display_registers_from_line)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_data_window::erase_data_content)
(tui_data_window::do_scroll_vertical)
(tui_data_window::refresh_window)
(tui_data_window::check_register_values): Update.

5 years agoChange members of tui_locator_window to std::string
Tom Tromey [Sun, 1 Sep 2019 14:13:24 +0000 (08:13 -0600)]
Change members of tui_locator_window to std::string

This changes two members of tui_locator_window to have type
std::string.  This removes a static limit.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN): Remove define.
(struct tui_locator_window) <full_name, proc_name>: Now
std::string.
* tui/tui-stack.c (tui_locator_window::make_status_line)
(tui_locator_window::set_locator_fullname)
(tui_locator_window::set_locator_info): Update.
* tui/tui-source.c (tui_source_window::set_contents)
(tui_source_window::showing_source_p): Update.

5 years agoRemove a call to tui_locator_win_info_ptr
Tom Tromey [Sun, 1 Sep 2019 14:10:18 +0000 (08:10 -0600)]
Remove a call to tui_locator_win_info_ptr

Commit e594a5d1 ("Turn two locator functions into methods") turned
set_locator_fullname into a method on tui_locator_window.  I missed it
at the time, but this change allows for the removal of a call to
tui_locator_win_info_ptr.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
Don't call tui_locator_win_info_ptr.

5 years agoDon't call refresh in tui_resize_all
Tom Tromey [Thu, 25 Jul 2019 03:05:10 +0000 (21:05 -0600)]
Don't call refresh in tui_resize_all

There's no reason to call refresh in tui_resize_all.  This call
flushes the curses window contents to the terminal -- but, because
we're about the resize all the windows, we're going to be sending more
data to the terminal momentarily.  This patch removes the call.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_resize_all): Don't call refresh.

5 years agoSet TUI locator height to 1
Tom Tromey [Wed, 24 Jul 2019 22:37:48 +0000 (16:37 -0600)]
Set TUI locator height to 1

The TUI has long had code to resize the locator, using 2 as the
height.  However the code has "1" in a comment, like:

    locator->resize (2 /* 1 */ ,

This patch fixes the resizing code to set the height to 1.  Doing this
revealed what was probably the reason for setting the height to 2 in
the first place: this caused the locator window to scroll.  However,
this is easily handled by calling scrollok on the locator window.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use 1 as
height for locator.
* tui/tui-stack.c (tui_locator_window::rerender): Call scrollok.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Use 1 as height for locator.

5 years agoChange "win_resized" to bool
Tom Tromey [Wed, 24 Jul 2019 21:43:40 +0000 (15:43 -0600)]
Change "win_resized" to bool

This changes the "win_resized" global to be a bool and then updates
the uses.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui.c (tui_enable): Update.
* tui/tui-win.c (tui_sigwinch_handler, tui_async_resize_screen):
Update.
* tui/tui-data.h (tui_win_resized, tui_set_win_resized_to):
Update.
* tui/tui-data.c (win_resized): Now bool.
(tui_win_resized): Return bool.
(tui_set_win_resized_to): Accept a bool.

5 years agoUse "bool" in tui_data_window::show_register_group
Tom Tromey [Wed, 24 Jul 2019 21:42:27 +0000 (15:42 -0600)]
Use "bool" in tui_data_window::show_register_group

This changes tui_data_window::show_register_group to use "bool" rather
than "int".

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_window) <show_register_group>:
Change type of "refresh_values_only".
* tui/tui-regs.c (tui_data_window::show_register_group): Change
type of "refresh_values_only".

5 years agoSimplify TUI disassembly
Tom Tromey [Tue, 23 Jul 2019 23:37:48 +0000 (17:37 -0600)]
Simplify TUI disassembly

This simplifies TUI disassembly somewhat, by removing manual memory
management.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-disasm.c (struct tui_asm_line) <addr_string, insn>: Now
std::string.
(tui_disassemble): Add "pos" parameter.
(tui_disasm_window::set_contents): Simplify.

5 years agoSimplify tui_source_window_base::show_source_content
Tom Tromey [Tue, 23 Jul 2019 23:16:56 +0000 (17:16 -0600)]
Simplify tui_source_window_base::show_source_content

tui_source_window_base::show_source_content is not used outside the
class any more, so this makes it private.  Examining the callers shows
that it can't be called without source contents, so it can be
simplified as well.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<show_source_content>: Now private.
* tui/tui-winsource.c
(tui_source_window_base::show_source_content): Don't handle empty
content case.

5 years agoRemove some explicit re-rendering from the TUI
Tom Tromey [Tue, 23 Jul 2019 23:14:37 +0000 (17:14 -0600)]
Remove some explicit re-rendering from the TUI

A couple of spots in tui-layout.c still call the show_source_content
method.  However, now that re-rendering is done by the resize method,
these calls are no longer needed.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (show_source_disasm_command)
(show_source_or_disasm_and_command): Don't call
show_source_content.

5 years agoChange tui_make_status_line to be a method
Tom Tromey [Tue, 23 Jul 2019 22:43:20 +0000 (16:43 -0600)]
Change tui_make_status_line to be a method

This changes tui_make_status_line to be a method on
tui_locator_window.  This is a minor cleanup.

This also changes the new method to use the locator's width, rather
than the terminal width.  This is important if we ever want to allow
windows to be made more narrow.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.h (struct tui_locator_window) <make_status_line>:
Declare.
* tui/tui-stack.c (tui_locator_window::make_status_line): Rename
from tui_make_status_line.
(tui_locator_window::rerender): Update.

5 years agoChange tui_make_status_line to return std::string
Tom Tromey [Tue, 23 Jul 2019 22:36:59 +0000 (16:36 -0600)]
Change tui_make_status_line to return std::string

This changes tui_make_status_line to return std::string.  This cleans
it up a bit, and removes some explicit memory management.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.c (tui_make_status_line): Return std::string.
(tui_locator_window::rerender): Update.

5 years agoMove "fullname" to tui_source_window
Tom Tromey [Tue, 23 Jul 2019 21:37:18 +0000 (15:37 -0600)]
Move "fullname" to tui_source_window

The "fullname" field in tui_source_window_base is only used by one
subclass.  This patch moves the field to that subclass, and changes it
to be a unique_xmalloc_ptr.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (struct tui_source_window_base)
<~tui_source_window_base>: Don't declare.
<fullname>: Remove.
* tui/tui-winsource.c (~tui_source_window_base): Remove.
* tui/tui-source.h (struct tui_source_window) <fullname>: New
member.
* tui/tui-source.c (tui_source_window::set_contents): Update.
(tui_source_window::location_matches_p)
(tui_source_window::maybe_update): Update.

5 years agoChange tui_source_element::line to be a unique_xmalloc_ptr
Tom Tromey [Tue, 23 Jul 2019 21:34:40 +0000 (15:34 -0600)]
Change tui_source_element::line to be a unique_xmalloc_ptr

This changes tui_source_element::line to be a unique_xmalloc_ptr,
removing some manual memory management.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.h (~tui_source_element): Remove.
(tui_source_element): Update.
(struct tui_source_element) <line>: Now a unique_xmalloc_ptr.
* tui/tui-winsource.c (tui_show_source_line): Update.
* tui/tui-source.c (tui_source_window::set_contents): Update.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.

5 years agoRemove tui_clear_source_windows_detail
Tom Tromey [Fri, 19 Jul 2019 18:59:35 +0000 (12:59 -0600)]
Remove tui_clear_source_windows_detail

The calls to tui_clear_source_windows_detail in tui_add_win_to_layout
aren't needed, because (after the resize unification) resizing will
update the window contents.  Removing these calls lets us remove
several other things as well.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (tui_clear_source_windows_detail): Don't
declare.
* tui/tui-layout.c (tui_add_win_to_layout): Don't call
tui_clear_source_windows_detail.
* tui/tui-winsource.h (struct tui_source_window_base)
<clear_detail>: Don't declare.
* tui/tui-winsource.c (tui_source_window_base::clear_detail):
Remove.
* tui/tui-data.c (tui_clear_source_windows_detail): Remove.

5 years agoFix crash in Ada "catch exception"
Tom Tromey [Fri, 20 Sep 2019 17:34:21 +0000 (11:34 -0600)]
Fix crash in Ada "catch exception"

PR ada/24919 concerns a crash that Tom de Vries noticed when running
the "catch_ex" Ada test case.  He sent a test executable and tracked
this down to commit f21c2bd7b7 ("Fix Fortran regression with variables
in nested functions").

Looking at that patch, you can see the obvious error:

    -  return 0;
    +  return true;

Oops!  This patch fixes the bug.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tromey@adacore.com>

PR ada/24919:
* block.c (contained_in): Fix final return value.

5 years agobfd macro conversion to inline functions, section
Alan Modra [Mon, 16 Sep 2019 23:29:25 +0000 (08:59 +0930)]
bfd macro conversion to inline functions, section

This one exposed a bug in tic6x gas, found with inline function
parameter type checking.  struct bfd_section and struct bfd_symbol
both have a flags field, so bfd_is_com_section (symbol) compiled OK
when bfd_is_com_section was a macro but didn't special case common
symbols.

bfd/
* bfd-in.h (bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment, bfd_section_flags),
(bfd_section_userdata, bfd_is_com_section, discarded_section),
(bfd_get_section_limit_octets, bfd_get_section_limit): Delete macros.
* bfd.c (bfd_get_section_limit_octets, bfd_get_section_limit),
(bfd_section_list_remove, bfd_section_list_append),
(bfd_section_list_prepend, bfd_section_list_insert_after),
(bfd_section_list_insert_before, bfd_section_removed_from_list):
New inline functions.
* section.c (bfd_is_und_section, bfd_is_abs_section),
(bfd_is_ind_section, bfd_is_const_section, bfd_section_list_remove),
(bfd_section_list_append, bfd_section_list_prepend),
(bfd_section_list_insert_after, bfd_section_list_insert_before),
(bfd_section_removed_from_list): Delete macros.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment, bfd_section_flags),
(bfd_section_userdata, bfd_is_com_section, bfd_is_und_section),
(bfd_is_abs_section, bfd_is_ind_section, bfd_is_const_section),
(discarded_section): New inline functions.
* bfd-in2.h: Regenerate.
gas/
* config/tc-tic6x.c (tc_gen_reloc): Correct common symbol check.
ld/
* emultempl/xtensaelf.em (xtensa_get_section_deps): Comment.
Use bfd_section_userdata.
(xtensa_set_section_deps): Use bfd_set_section_userdata.
* ldlang.c (lang_output_section_get): Use bfd_section_userdata.
(sort_def_symbol): Likewise, and bfd_set_section_userdata.
(init_os): Use bfd_set_section_userdata.
(print_all_symbols): Use bfd_section_userdata.
* ldlang.h (get_userdata): Delete.

5 years agobfd macro conversion to inline functions, asymbol
Alan Modra [Thu, 19 Sep 2019 02:45:16 +0000 (12:15 +0930)]
bfd macro conversion to inline functions, asymbol

* bfd-in.h (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_asymbol_flavour, bfd_set_asymbol_name): Delete.
* bfd.c (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name),
(bfd_asymbol_bfd, bfd_set_asymbol_name): New inline functions.
* targets.c (bfd_asymbol_flavour): Likewise.
* bfd-in2.h: Regenerate.

5 years agobfd macro conversion to inline functions
Alan Modra [Thu, 19 Sep 2019 02:21:04 +0000 (11:51 +0930)]
bfd macro conversion to inline functions

This converts some of the macros that access struct bfd fields to
inline functions.

bfd/
* archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive.
* bfd-in.h (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
(bfd_get_target, bfd_get_flavour, bfd_family_coff, bfd_big_endian),
(bfd_little_endian, bfd_header_big_endian, bfd_header_little_endian),
(bfd_get_file_flags, bfd_applicable_file_flags),
(bfd_applicable_section_flags, bfd_has_map, bfd_is_thin_archive),
(bfd_valid_reloc_types, bfd_usrdata, bfd_get_start_address),
(bfd_get_symcount, bfd_get_outsymbols, bfd_count_sections),
(bfd_get_dynamic_symcount, bfd_get_symbol_leading_char): Delete.
* bfd/bfd.c (bfd_get_filename, bfd_get_cacheable, bfd_get_format),
(bfd_get_file_flags, bfd_get_start_address, bfd_get_symcount),
(bfd_get_dynamic_symcount, bfd_get_outsymbols, bfd_count_sections),
(bfd_has_map, bfd_is_thin_archive, bfd_set_thin_archive),
(bfd_usrdata, bfd_set_usrdata): New inline functions.
* targets.c (bfd_get_target, bfd_get_flavour),
(bfd_applicable_file_flags, bfd_family_coff, bfd_big_endian),
(bfd_little_endian, bfd_header_big_endian),
(bfd_header_little_endian, bfd_applicable_section_flags),
(bfd_get_symbol_leading_char): New inline functions.
* bfd-in2.h: Regenerate.
binutils/
* ar.c (write_archive): Use bfd_set_thin_archive.
gdb/
* gdb_bfd.c (gdb_bfd_ref, gdb_bfd_unref): Use bfd_set_usrdata.
* dwarf2read.c (dwarf2_read_gdb_index, dwarf2_read_debug_names),
(read_indirect_string_from_dwz): Use bfd accessor.
* dwarf2read.h (struct dwz_file <filename>): Likewise.
* machoread.c (macho_symfile_read_all_oso): Likewise.
* solib.c (solib_bfd_open): Likewise.
ld/
* ldelf.c (ldelf_after_open, ldelf_place_orphan
* ldlang.c (walk_wild_file, lang_process): Use bfd_usrdata.
(load_symbols, ldlang_add_file): Use bfd_set_usrdata.
* ldmain.c (add_archive_element): Use bfd_usrdata.
* ldlang.h (bfd_input_just_syms): New inline function.
* emultempl/aarch64elf.em (build_section_lists): Use it.
* emultempl/mmo.em (mmo_place_orphan): Likewise.
* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
* emultempl/ppc64elf.em (build_section_lists): Likewise.
sim/
* ppc/emul_generic.c (emul_add_tree_options): Delete old bfd code.

5 years agox86-64: fix handling of PUSH/POP of segment register
Jan Beulich [Fri, 20 Sep 2019 08:18:15 +0000 (10:18 +0200)]
x86-64: fix handling of PUSH/POP of segment register

Commit 21df382b91 ("x86: fold SReg{2,3}") went too far: Folding 64-bit
PUSH/POP templates into non-64-bit ones isn't correct, due to the
different operand widths, and hence suffixes permitted. Restore the
separate templates.

Add tests of PUSH/POP with q suffix and %fs/%gs operands to the
testsuite. While doing so also add PUSHF/POPF ones _without_ suffix.

5 years ago[GOLD] Fix spurious "plugin needed to handle lto object" warnings
Alan Modra [Fri, 20 Sep 2019 05:22:54 +0000 (14:52 +0930)]
[GOLD] Fix spurious "plugin needed to handle lto object" warnings

lto_slim_object_ was unitialized.  I also thought it worth adding
a sanity check on the .gnu.lto_.lto.* section size, and made some
other tidies.

PR 24768
* layout.cc (Layout::Layout): Init lto_slim_object_.
* object.cc (Sized_relobj_file::do_layout): Wrap overlong line.
Don't use C cast.  Validate section size.  Don't copy contents.

5 years agoPowerPC64, error on unsupported dynamic relocation
Alan Modra [Fri, 20 Sep 2019 02:51:50 +0000 (12:21 +0930)]
PowerPC64, error on unsupported dynamic relocation

This patch corrects the set of dynamic relocations recognised by gold
as supported by glibc, and teaches ld.bfd to report an error similar
to the gold error.  Note that ld --noinhibit-exec can be used to
produce an output, supporting older ld with newer glibc if the set of
supported glibc dynamic relocations changes.

bfd/
* elf64-ppc.c (ppc64_glibc_dynamic_reloc): New function.
(ppc64_elf_relocate_section): Error if emitting unsupported
dynamic relocations.
gold/
* powerpc.cc (Target_powerpc::Scan::check_non_pic): Move REL24
to 32-bit supported.

5 years agoMove declaration of overload_resolution to value.h
Christian Biesinger [Thu, 19 Sep 2019 04:40:15 +0000 (13:40 +0900)]
Move declaration of overload_resolution to value.h

The variable is defined in valops.c and has an extern decl in
eval.c; move it to the header file.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

* eval.c: Move declaration of overload_resolution to...
* value.h: ...here.

5 years agoMove arm_apcs_32 extern declaration to header
Christian Biesinger [Thu, 19 Sep 2019 04:33:35 +0000 (13:33 +0900)]
Move arm_apcs_32 extern declaration to header

Instead of having several extern declarations for arm_apcs_32
in a few .c files, declare it in arm-tdep.h. This file is already
included from these .c files.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

* arm-linux-nat.c: Remove extern declaration for arm_apcs_32.
* arm-linux-tdep.c: Likewise.
* arm-nbsd-nat.c: Likewise.
* arm-tdep.h: Declare arm_apcs_32.

5 years agoDeclare dwarf_always_disassemble in dwarf2read.h
Christian Biesinger [Thu, 19 Sep 2019 04:26:55 +0000 (13:26 +0900)]
Declare dwarf_always_disassemble in dwarf2read.h

And remove the declaration from dwarf2loc.c, for better typesafety.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

* dwarf2loc.c: Remove extern declaration of dwarf_always_disassemble.
* dwarf2read.h: Declare dwarf_always_disassemble.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Sep 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb/testsuite] Don't use FOOBAR pattern in gdb_test
Tom de Vries [Thu, 19 Sep 2019 17:54:15 +0000 (19:54 +0200)]
[gdb/testsuite] Don't use FOOBAR pattern in gdb_test

If gdb_test is used with fewer than five arguments, then the question_string
defaults to "^FOOBAR$":
...
    if [llength $args]==5 {
       set question_string [lindex $args 3]
       set response_string [lindex $args 4]
    } else {
       set question_string "^FOOBAR$"
    }
...

This can however match "FOOBAR", so perhaps "\$FOOBAR^" would have been a
better choice.

Eliminate the FOOBAR pattern from gdb_test by instead of defining a default
regexp, conditionally appending the regexp matching to a user_code variable.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern.

5 years ago[gdb] Catch exception when constructing the highlighter
Tom de Vries [Thu, 19 Sep 2019 17:49:39 +0000 (19:49 +0200)]
[gdb] Catch exception when constructing the highlighter

Currently in source_cache::ensure we catch the exception that triggers when
highlighter->highlight is called:
...
         try
           {
             std::istringstream input (contents);
             std::ostringstream output;
             highlighter->highlight (input, output, lang_name, fullname);
...
and the file used earlier in the construction of the highlighter:
...
             highlighter = new srchilite::SourceHighlight ("esc.outlang");
...
is missing.

The fact that this exception triggers when highlighter->highlight is called is
an implementation artefact of libsource-highlight.so though, and this could be
different for older or newer versions.

Make things more robust by also catching exceptions thrown during construction
of the highlighter.  This makes the handling on master equivalent with what
has been committed for 8.3.1.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

PR gdb/25009
* source-cache.c (source_cache::ensure): Catch exception thrown during
construction of the highlighter.

5 years ago[gas][news] NEWS (2.33) note new SVE2 and TME instructions for AArch64
Matthew Malcomson [Thu, 19 Sep 2019 13:34:14 +0000 (14:34 +0100)]
[gas][news] NEWS (2.33) note new SVE2 and TME instructions for AArch64

These NEWS entries had been missed when the instructions were added.

gas/ChangeLog:

2019-09-19  Matthew Malcomson  <matthew.malcomson@arm.com>

* NEWS: Add SVE2 and TME entries.

5 years agoAArch64: Fix objdump tests
Tamar Christina [Thu, 19 Sep 2019 12:15:02 +0000 (13:15 +0100)]
AArch64: Fix objdump tests

The newly added objdump -S tests check for source line mapping of a static
variable.  But the test doesn't dump any data sections so this should never
pass.

This changes the test to dump all sections so the source mapping can be found.

binutils/ChangeLog:

* testsuite/binutils-all/objdump.exp (objdump -S): Update testcases.

5 years agobfd_section_* macros
Alan Modra [Mon, 16 Sep 2019 10:55:17 +0000 (20:25 +0930)]
bfd_section_* macros

This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Sep 2019 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb/testsuite] Fix gdb_target_cmd
Tom de Vries [Wed, 18 Sep 2019 23:14:19 +0000 (01:14 +0200)]
[gdb/testsuite] Fix gdb_target_cmd

In commit 81dc3ab594 "[gdb/testsuite] Handle unreachable network in
server-connect.exp" a regression was introduced in gdb_target_cmd, causing
ERRORs like this:
...
ERROR: tcl error sourcing src/gdb/testsuite/gdb.server/abspath.exp.
ERROR: wrong # args: should be "gdb_target_cmd {$args}"
    while executing
"gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport"
...

Fix the argument passing in gdb_target_cmd.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

* lib/gdbserver-support.exp (gdb_target_cmd): Fix argument passing.

5 years ago[gdb/testsuite] Handle unreachable network in server-connect.exp
Tom de Vries [Wed, 18 Sep 2019 22:23:54 +0000 (00:23 +0200)]
[gdb/testsuite] Handle unreachable network in server-connect.exp

When running gdb.server/server-connect.exp I run into:
...
FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \
  using tcp6:[::1]
FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1
FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \
  using udp6:[::1]
...

The FAIL is caused by the fact that the ipv6 loopback address is not available:
...
PASS: gdb.server/server-connect.exp: tcp6: start gdbserver
target remote tcp6:::1:2347^M
A program is being debugged already.  Kill it? (y or n) y^M
tcp6:::1:2347: Network is unreachable.^M
(gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1
...
This should be marked UNSUPPORTED rather than FAIL.

Furthermore, the test-case takes about 4 minutes, because the 'Network is
unreachable' response is not explicitly handled in gdb_target_cmd, so instead
it runs into the timeout case.

Fix this by handling the 'Network is unreachable' response as UNSUPPORTED.
This reduces testing time from 4 minutes to about 2 seconds.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-19  Tom de Vries  <tdevries@suse.de>

* lib/gdbserver-support.exp (gdb_target_cmd_ext): Return 2 (meaning
UNSUPPORTED) for 'Network is unreachable' message.  Factor out of ...
(gdb_target_cmd): ... here.
* gdb.server/server-connect.exp: Use gdb_target_cmd_ext, handle return
value 2.

5 years agoUpdate ChangeLog entry of commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0...
Joel Brobecker [Wed, 18 Sep 2019 21:42:24 +0000 (14:42 -0700)]
Update ChangeLog entry of commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0...

... to include PR breakpoints/24541 (for documentation purposes).

For the reader's convenience, the commit in question was the following:

    commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0
    Author: Sergio Durigan Junior <sergiodj@redhat.com>
    Date:   Thu May 16 16:23:24 2019 -0400
    Subject: Make stap-probe.c:stap_parse_register_operand's "regname"
       an std::string

5 years agoGive a name to the TUI SingleKey keymap
Tom Tromey [Tue, 10 Sep 2019 23:25:35 +0000 (17:25 -0600)]
Give a name to the TUI SingleKey keymap

Readline 8.0 has a feature that lets an application name a keymap.
This in turn makes it simpler for users to bind keys in keymaps in
their .inputrc.

This patch gives a name to the TUI SingleKey keymap, so that
additional bindings can be made there.  For example:

    $if gdb
    set keymap SingleKey
    "X": "echo hello\\n\n"
    $endif

The call to rl_initialize, in tui_initialize_readline, had to be
removed so that .inputrc was not read too early.  Note that Readline
explicitly documents that this call is not needed.

gdb/ChangeLog
2019-09-18  Tom Tromey  <tom@tromey.com>

* NEWS: Add entry.
* tui/tui.c (tui_initialize_readline): Set name of keymap.  Do not
call rl_initialize.
(tui_enable): Do not call rl_initialize.

gdb/doc/ChangeLog
2019-09-18  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Editing): Document readline application name.
(TUI Single Key Mode): Document TUI SingleKey keymap name.

5 years agogdb: Fix native build on Linux/Alpha.
Christian Groessler [Wed, 11 Sep 2019 22:19:45 +0000 (22:19 +0000)]
gdb: Fix native build on Linux/Alpha.

Fixes:

  CXX    alpha-linux-nat.o
alpha-linux-nat.c: In member function 'virtual CORE_ADDR alpha_linux_nat_target::register_u_offset(gdbarch*, int, int)':
alpha-linux-nat.c:93:16: error: 'gdbarch_pc_regnum' was not declared in this scope
   if (regno == gdbarch_pc_regnum (gdbarch))
                ^~~~~~~~~~~~~~~~~
alpha-linux-nat.c:93:16: note: suggested alternative: 'gdbarch_info'
   if (regno == gdbarch_pc_regnum (gdbarch))
                ^~~~~~~~~~~~~~~~~
                gdbarch_info
alpha-linux-nat.c:97:15: error: 'gdbarch_fp0_regnum' was not declared in this scope
   if (regno < gdbarch_fp0_regnum (gdbarch))
               ^~~~~~~~~~~~~~~~~~
alpha-linux-nat.c:97:15: note: suggested alternative: 'gdbarch_info'
   if (regno < gdbarch_fp0_regnum (gdbarch))
               ^~~~~~~~~~~~~~~~~~
               gdbarch_info
make[2]: *** [Makefile:1638: alpha-linux-nat.o] Error 1
make[2]: Leaving directory '/home/chris/tmp/binutils-gdb/gdb'

2019-09-12  Christian Groessler  <chris@groessler.org>

       * alpha-linux-nat.c: Include gdbarch.h.