platform/upstream/binutils.git
5 years agogdb: Fix alignment computation for structs with only static fields
Andrew Burgess [Sat, 6 Apr 2019 10:02:04 +0000 (11:02 +0100)]
gdb: Fix alignment computation for structs with only static fields

The current code in gdbtypes.c:type_align incorrectly returns 0 as the
alignment for a structure containing only static fields.  After this
patch the correct value of 1 is returned.  The gdb.base/align.exp test
is extended to cover this case.

gdb/ChangeLog:

* gdbtypes.c (type_align): A struct with no non-static fields also
has alignment of 1.

gdb/testsuite/ChangeLog:

* gdb.base/align.exp: Extend test to cover structures containing
only static fields.

5 years agogdb/riscv: Handle empty C++ structs during argument passing
Andrew Burgess [Fri, 5 Apr 2019 12:50:19 +0000 (13:50 +0100)]
gdb/riscv: Handle empty C++ structs during argument passing

This commit resolves a large number of failures in the test script
gdb.base/infcall-nested-structs.exp which were caused by GDB (for
RISC-V) incorrectly handling empty C++ structures when preparing
arguments for a dummy call, or collecting a return value.

The issue is further complicated in that there was a bug in GCC, such
that in some cases GCC would generate incorrect code when passing a
small structure that contained empty sub-structures.  This was fixed
in GCC trunk on 5-March-2019, so in order to see the best results with
this patch you'll need a recent version of GCC.

Anything that used to work should continue to work after this patch,
regardless of GCC version being used.

The fix in this commit is that GDB now pays more attention to the
offset of fields within a structure when preparing arguments as in C++
an empty structure has a non-zero size, this is an example:

  struct s1 { struct s2 { } empty; int f; };

We previously assumed that 'f' was at offset 0 inside type 's1',
however this is not the case in C++ as 's2' has size 1, and with
alignment 'f' is likely at some even bigger offset inside 's1'.

gdb/ChangeLog:

* riscv-tdep.c (riscv_call_arg_complex_float): Fix offset of first
component to 0.
(riscv_struct_info::riscv_struct_info): Initialise m_offsets
member.
(riscv_struct_info::analyse): New implementation using new
analyse_inner member function.
(riscv_struct_info::field_offset): New member function.
(riscv_struct_info::m_offsets): New member variable.
(riscv_struct_info::analyse_inner): New private member function,
takes the old implementation of riscv_struct_info::analyse but
extended to track field offsets.
(riscv_call_arg_struct): Update the struct folding special cases
to handle cases where empty C++ structs, which are non-zero
length, are found.
(riscv_arg_location): Initialise the length of each location, a
non-zero length now indicates the location is in use.
(riscv_push_dummy_call): Allow for the first location having a
non-zero offset when setting up arguments.
(riscv_return_value): Likewise, but for return values.

5 years agoMake "msg" const in internal_vproblem
Tom Tromey [Thu, 11 Apr 2019 19:00:48 +0000 (13:00 -0600)]
Make "msg" const in internal_vproblem

I noticed that the "msg" variable in internal_vproblem could be
"const".  This seems like an improvement because it can wind up in
rodata.

Tested by rebuilding.

gdb/ChangeLog
2019-04-11  Tom Tromey  <tromey@adacore.com>

* utils.c (internal_vproblem): Make "msg" const.

5 years agoxtensa: gas: add relaxations tests
Max Filippov [Fri, 5 Apr 2019 00:06:57 +0000 (17:06 -0700)]
xtensa: gas: add relaxations tests

gas/
2019-04-11  Max Filippov  <jcmvbkbc@gmail.com>

* testsuite/gas/xtensa/loop-relax-2.d: New test definition.
* testsuite/gas/xtensa/loop-relax.d: New test definition.
* testsuite/gas/xtensa/loop-relax.s: New test source.
* testsuite/gas/xtensa/text-section-literals-1a.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-2.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-2.s: New test
source.
* testsuite/gas/xtensa/text-section-literals-2a.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-3.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-3.s: New test
source.
* testsuite/gas/xtensa/text-section-literals-4.d: New test
definition.
* testsuite/gas/xtensa/text-section-literals-4.s: New test
source.
* testsuite/gas/xtensa/text-section-literals-4a.d: New test
definition.

5 years agoxtensa: gas: convert tests to run_dump_tests
Max Filippov [Fri, 5 Apr 2019 00:51:00 +0000 (17:51 -0700)]
xtensa: gas: convert tests to run_dump_tests

gas/
2019-04-11  Max Filippov  <jcmvbkbc@gmail.com>

* testsuite/gas/xtensa/all.exp: Remove all expect-based
tests and all explicit run_dump_test / run_list_test
invocations. Add run_dump_tests for all .d files in the
test subdirectory.
* testsuite/gas/xtensa/entry_align.d: New test definition.
* testsuite/gas/xtensa/entry_align.l: New test output.
* testsuite/gas/xtensa/entry_misalign.d: New test definition.
* testsuite/gas/xtensa/entry_misalign2.d: New test definition.
* testsuite/gas/xtensa/j_too_far.d: New test definition.
* testsuite/gas/xtensa/j_too_far.l: New test output.
* testsuite/gas/xtensa/loop_align.d: New test definition.
* testsuite/gas/xtensa/loop_misalign.d: New test definition.
* testsuite/gas/xtensa/trampoline-2.d: New test definition.
* testsuite/gas/xtensa/trampoline-2.l: Remove empty output.
* testsuite/gas/xtensa/xtensa-err.exp: Use positive logic.

5 years agoxtensa: gas: clean up literal management code
Max Filippov [Wed, 10 Apr 2019 08:18:01 +0000 (01:18 -0700)]
xtensa: gas: clean up literal management code

gas/
2019-04-11  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (xtensa_literal_pseudo): Drop code that has
no effect.
(get_literal_pool_location): Only search for the literal pool
when auto litpools is used, otherwise take one recorded in the
tc_segment_info_data.
(xtensa_assign_litpool_addresses): New function.
(xtensa_move_literals): Don't duplicate 'literal pool location
required...' error message. Call xtensa_assign_litpool_addresses.

5 years agoxtensa: gas: put .literal_position at section start
Max Filippov [Mon, 8 Apr 2019 20:47:18 +0000 (13:47 -0700)]
xtensa: gas: put .literal_position at section start

Provide literal position at the beginning of each section for literal
space reserved by relaxations when text-section-literals or
auto-litpools options are used. Remove code that adds fill frag to the
literal section for every .literal_position directive to avoid creation
of empty literal sections.

Fix auto-litpools tests that got literal pool address changes.

gas/
2019-04-11  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (xtensa_is_init_fini): Add declaration.
(xtensa_mark_literal_pool_location): Don't add fill frag to literal
section that records literal pool location.
(md_begin): Call xtensa_mark_literal_pool_location when text
section literals or auto litpools are used.
(xtensa_elf_section_change_hook): Call
xtensa_mark_literal_pool_location when text section literals or
auto litpools are used, there's no literal pool location defined
for the current section and it's not .init or .fini.
* testsuite/gas/xtensa/auto-litpools-first1.d: Fix up addresses.
* testsuite/gas/xtensa/auto-litpools-first2.d: Likewise.
* testsuite/gas/xtensa/auto-litpools.d: Likewise.

5 years agold: Add --no-print-map-discarded option
Faraz Shahbazker [Tue, 2 Apr 2019 20:17:16 +0000 (20:17 +0000)]
ld: Add --no-print-map-discarded option

Add a new option to disable the listing of discarded sections
in map file output.  The use case stems from a large application
built with -ffunction-sections --gc-sections where the list of
discarded sections blows up the map file output.  The default
behaviour remains to print discarded sections,  but the new option
allows us to disable it.

ld/
* NEWS: Mention new option --no-print-map-discarded.
* ld.h (ld_config_type) <print_map_discarded>: New field.
* ldlang.c (lang_map): Conditionally output discarded sections
in map files based on configuration option.
* ldlex.h (option_values) <OPTION_PRINT_MAP_DISCARDED,
OPTION_NO_PRINT_MAP_DISCARDED>: New.
* ldmain.c (main): Enabled print_map_discarded by default.
* lexsup.c (ld_options): Add new command-line options.
(parse_args) <OPTION_NO_PRINT_MAP_DISCARDED,
OPTION_PRINT_MAP_DISCARDED>: New cases.
* ld.texi: Document new options.
* testsuite/ld-gc/gc.exp: Add new test.
* testsuite/ld-gc/skip-map-discarded.s: New file.
* testsuite/ld-gc/skip-map-discarded.d: New file.
* testsuite/ld-gc/skip-map-discarded.map: New file.

5 years ago[gdb/testsuite] Add cc-with-dwz.exp and cc-with-dwz-m.exp
Tom de Vries [Thu, 11 Apr 2019 17:13:05 +0000 (19:13 +0200)]
[gdb/testsuite] Add cc-with-dwz.exp and cc-with-dwz-m.exp

We can use CC_WITH_TWEAKS_FLAGS when cd-ing into the gdb build subdir and
invoking make check:
...
$ cd $objdir/gdb
$ make check \
    RUNTESTFLAGS='--target_board=cc-with-tweaks' \
    CC_WITH_TWEAKS_FLAGS='-z'
...

But when cd-ing into the top-level build dir and invoking make check-gdb
instead:
...
$ cd $objdir
$ make check-gdb \
    RUNTESTFLAGS='--target_board=cc-with-tweaks' \
    CC_WITH_TWEAKS_FLAGS='-z'
...
using CC_WITH_TWEAKS_FLAGS has no effect, because CC_WITH_TWEAKS_FLAGS is not
passed down from the top level Makefile.

Add cc-with-dwz.exp and cc-with-dwz-m.exp, that don't require
CC_WITH_TWEAKS_FLAGS to be set in the make invocation, allowing us to run these
test configurations from the toplevel build dir:
...
$ cd $objdir
$ make check-gdb \
    RUNTESTFLAGS='--target_board=cc-with-dwz'
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-04-11  Tom de Vries  <tdevries@suse.de>

* boards/cc-with-dwz-m.exp: New file.
* boards/cc-with-dwz.exp: New file.
* boards/cc-with-tweaks.exp: Note that check-gdb doesn't work.

5 years agox86: Add -z cet-report=[none|warning|error]
H.J. Lu [Thu, 11 Apr 2019 15:18:51 +0000 (08:18 -0700)]
x86: Add -z cet-report=[none|warning|error]

Add -z cet-report=[none|warning|error] to report the missing Intel
Indirect Branch Tracking (IBT) and Shadow Stack (SHSTK) properties
in input .note.gnu.property section.  -z cet-report=none, which is
the default, will make the linker not report missing properties in
input files.  -z cet-report=warning will make the linker issue a
warning for missing properties in input files.  -z cet-report=error
will make the linker issue an error for missing properties in input
files.  Note that -z ibt will turn off the missing IBT property report
and -z shstk will turn off the missing SHSTK property report.
Supported for Linux/i386 and Linux/x86_64.

bfd/

* elf-linker-x86.h (elf_x86_cet_report): New.
(elf_linker_x86_params): Add cet_report.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
missing IBT and SHSTK properties if needed.

ld/

* ld.texi: Document -z cet-report=[none|warning|error].
* emulparams/cet.sh: Add -z cet-report=[none|warning|error].
* testsuite/ld-i386/i386.exp: Run -z cet-report=[warning|error]
tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/property-x86-cet1.d: New file.
* testsuite/ld-i386/property-x86-cet2a.d: Likewise.
* testsuite/ld-i386/property-x86-cet2b.d: Likewise.
* testsuite/ld-i386/property-x86-cet3a.d: Likewise.
* testsuite/ld-i386/property-x86-cet3b.d: Likewise.
* testsuite/ld-i386/property-x86-cet4a.d: Likewise.
* testsuite/ld-i386/property-x86-cet4b.d: Likewise.
* testsuite/ld-i386/property-x86-cet5a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5b.d: Likewise.
* testsuite/ld-i386/property-x86-cet6.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet.s: Likewise.
* testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet4b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet6-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet6.d: Likewise.

5 years agoAdd PR ld/24436 to ChangeLog entry
H.J. Lu [Thu, 11 Apr 2019 14:53:55 +0000 (07:53 -0700)]
Add PR ld/24436 to ChangeLog entry

5 years agold: Add -static-pie tests
H.J. Lu [Thu, 11 Apr 2019 13:52:03 +0000 (06:52 -0700)]
ld: Add -static-pie tests

Add -static-pie tests for DT_INIT_ARRAY, DT_FINI_ARRAY, DT_PREINIT_ARRAY
and IFUNC.

* testsuite/config/default.exp (STATIC_PIE_LDFLAGS): New.  Set
to "-static-pie" if target compiler supports it.
* testsuite/ld-elf/elf.exp: Run -static-pie tests if
$STATIC_PIE_LDFLAGS isn't empty.
* testsuite/ld-ifunc/ifunc.exp: Likewise.

5 years agoCheck corrupt VTENTRY entry in bfd_elf_gc_record_vtentry
H.J. Lu [Thu, 11 Apr 2019 13:44:53 +0000 (06:44 -0700)]
Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry

Instead of BFD_ASSERT (h != NULL) with

ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562
ld: bad.o: invalid string offset 50331648 >= 371 for section `nterp'

check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with

ld: bad.o: section 'g': corrupt VTENTRY entry

* elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of
"h != NULL".  Don't check "h != NULL" before calling.
bfd_elf_gc_record_vtentry.
* elf32-arm.c (elf32_arm_check_relocs): Likewise.
* elf32-bfin.c (bfin_check_relocs): Likewise.
* elf32-cris.c (cris_elf_check_relocs): Likewise.
* elf32-csky.c (csky_elf_check_relocs): Likewise.
* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
* elf32-frv.c (elf32_frv_check_relocs): Likewise.
* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
* elf32-i386.c (elf_i386_check_relocs): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
* elf32-metag.c (elf_metag_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
* elf32-s390.c (elf_s390_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Likewise.
* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
* elf64-s390.c (elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_s390_check_relocs): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt
VTENTRY entry.

5 years agoPR24435, buffer overflow reading dynamic entries
Alan Modra [Thu, 11 Apr 2019 10:12:31 +0000 (19:42 +0930)]
PR24435, buffer overflow reading dynamic entries

PR 24435
* elflink.c (elf_link_add_object_symbols): Don't read partial
dynamic entries from fuzzed objects.

5 years agoAArch64: When DF_BIND_NOW don't use TLSDESC GOT value.
Tamar Christina [Thu, 11 Apr 2019 10:27:28 +0000 (11:27 +0100)]
AArch64: When DF_BIND_NOW don't use TLSDESC GOT value.

When using DF_BIND_NOW on AArch64 we don't reserve the GOT slot for a TLSDESC,
but we still emitted DT_TLSDESC_GOT and DT_TLSDESC_PLT.  This caused random
memory corruption as the "special" value of (bfd_vma)-1 would be set for
dt_tlsdesc_got.

Since we don't have a value of dt_tlsdesc_got I also don't emit DT_TLSDESC_PLT
now becuase it would point to an incomplete PLT. To be able to write the PLT
entry DT_TLSDESC_GOT is needed and since we don't have one we can't write the
PLT entry either.

It is my understanding that GLIBC doesn't need these two entries when not lazy
loading.  Conversely AArch32 does not reserve neither the GOT not the PLT slot
when doing DF_BIND_NOW.

AArch32 does not need these checks because these values are initialized to 0
and so the if (...) checks don't pass, but on AArch64 these are initialized
to (bfd_vma)-1 and thus we need some extra checks.

bfd/ChangeLog:

PR ld/24302
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Don't emit
DT_TLSDESC_GOT and DT_TLSDESC_PLT when DF_BIND_NOW.
(elfNN_aarch64_finish_dynamic_sections): Don't write PLT if DF_BIND_NOW.

ld/ChangeLog:

PR ld/24302
* testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
* testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: New test.

5 years ago[BINUTILS, AArch64, 2/2] Update Store Allocation Tag instructions
Sudakshina Das [Thu, 11 Apr 2019 09:19:37 +0000 (10:19 +0100)]
[BINUTILS, AArch64, 2/2] Update Store Allocation Tag instructions

This patch updates the Store allocation tags instructions in
Armv8.5-A Memory Tagging Extension. This is part of the changes
that have been introduced recently in the 00bet10 release

All of these instructions have an updated register operand (Xt -> <Xt|SP>)

- STG <Xt|SP>, [<Xn|SP>, #<simm>]
- STG <Xt|SP>, [<Xn|SP>, #<simm>]!
- STG <Xt|SP>, [<Xn|SP>], #<simm>
- STZG <Xt|SP>, [<Xn|SP>, #<simm>]
- STZG <Xt|SP>, [<Xn|SP>, #<simm>]!
- STZG <Xt|SP>, [<Xn|SP>], #<simm>
- ST2G <Xt|SP>, [<Xn|SP>, #<simm>]
- ST2G <Xt|SP>, [<Xn|SP>, #<simm>]!
- ST2G <Xt|SP>, [<Xn|SP>], #<simm>
- STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]
- STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]!
- STZ2G <Xt|SP>, [<Xn|SP>], #<simm>

In order to accept <Rt|SP> a new operand type Rt_SP is introduced which has
the same field as FLD_Rt but follows other semantics of Rn_SP.

*** gas/ChangeLog ***

2019-04-11  Sudakshina Das  <sudi.das@arm.com>

* config/tc-aarch64.c (process_omitted_operand): Add case for
AARCH64_OPND_Rt_SP.
(parse_operands): Likewise.
* testsuite/gas/aarch64/armv8_5-a-memtag.d: Update tests.
* testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise.
* testsuite/gas/aarch64/illegal-memtag.l: Likewise.
* testsuite/gas/aarch64/illegal-memtag.s: Likewise.

*** include/ChangeLog ***

2019-04-11  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_Rt_SP.

*** opcodes/ChangeLog ***

2019-04-11  Sudakshina Das  <sudi.das@arm.com>

* aarch64-opc.c (aarch64_print_operand): Add case for
AARCH64_OPND_Rt_SP.
(verify_constraints): Likewise.
* aarch64-tbl.h (QL_LDST_AT): Update to add SP qualifier.
(struct aarch64_opcode): Update stg, stzg, st2g, stz2g instructions
to accept Rt|SP as first operand.
(AARCH64_OPERANDS): Add new Rt_SP.
* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.

5 years ago[BINUTILS, AArch64, 1/2] Add new LDGM/STGM instruction
Sudakshina Das [Thu, 11 Apr 2019 09:13:23 +0000 (10:13 +0100)]
[BINUTILS, AArch64, 1/2] Add new LDGM/STGM instruction

This patch adds the new LDGM/STGM instructions of the
Armv8.5-A Memory Tagging Extension. This is part of the changes
that have been introduced recently in the 00bet10 release

The instructions are as follows:
LDGM Xt, [<Xn|SP>]
STGM Xt, [<Xn|SP>]

*** gas/ChangeLog ***

2019-04-11  Sudakshina Das  <sudi.das@arm.com>

* testsuite/gas/aarch64/armv8_5-a-memtag.d: New tests for ldgm and stgm.
* testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise.
* testsuite/gas/aarch64/illegal-memtag.l: Likewise.
* testsuite/gas/aarch64/illegal-memtag.s: Likewise.

*** opcodes/ChangeLog ***

2019-04-11  Sudakshina Das  <sudi.das@arm.com>

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-tbl.h (aarch64_opcode): Add new ldgm and stgm.

5 years agoAArch64: Ensure regcache is reset between tests
Alan Hayward [Wed, 10 Apr 2019 14:58:27 +0000 (15:58 +0100)]
AArch64: Ensure regcache is reset between tests

A recent change made the AArch64 self tests resuse the saved regs
cache, rather than creating a new one.  Ensure it is reset to default
values between tests.

Do this by splitting the reset functionality from trad_frame_alloc_saved_regs
into a new function.

Fixes selftest on AArch64.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_analyze_prologue_test): Reset saved regs.
* trad-frame.c (trad_frame_reset_saved_regs): New function.
(trad_frame_alloc_saved_regs): Call trad_frame_reset_saved_regs.
* trad-frame.h (trad_frame_reset_saved_regs): New declaration.

5 years agold: Don't define __rel[a]_iplt_start/__rel[a]_iplt_end in PIE
H.J. Lu [Thu, 11 Apr 2019 01:36:05 +0000 (18:36 -0700)]
ld: Don't define __rel[a]_iplt_start/__rel[a]_iplt_end in PIE

__rel[a]_iplt_start and __rel[a]_iplt_end are defined to handle IFUNC in
static executables.  For PIE, since IFUNC is handled as the part of the
normal dynamic relocation processing, there is no need to define these
symbols in PIE.

* scripttempl/elf.sc (CREATE_PIC): New.  Set for CREATE_SHLIB or
CREATE_PIE.
(__rel_iplt_start): Don't define for CREATE_PIC.
(__rel_iplt_end): Likewise.
(__rela_iplt_start): Likewise.
(__rela_iplt_end): Likewise.

5 years agoFix amd64->i386 linux syscall restart problem
Kevin Buettner [Sat, 16 Mar 2019 19:40:01 +0000 (12:40 -0700)]
Fix amd64->i386 linux syscall restart problem

This commit fixes some failures in gdb.base/interrupt.exp
when debugging a 32-bit i386 linux inferior from an amd64 host.

When running the following test...

  make check RUNTESTFLAGS="--target_board unix/-m32 interrupt.exp"

... without this commit, I see the following output:

FAIL: gdb.base/interrupt.exp: continue (the program exited)
FAIL: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: Send Control-C, second time
FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running)
ERROR: Undefined command "".
ERROR: GDB process no longer exists

=== gdb Summary ===

When the test is run with this commit in place, we see 12 passes
instead.  This is the desired behavior.

Analysis:

On Linux, when a syscall is interrupted by a signal, the syscall
may return -ERESTARTSYS when a signal occurs.  Doing so indicates that
the syscall is restartable.  Then, depending on settings associated
with the signal handler, and after the signal handler is called, the
kernel can then either return -EINTR or can cause the syscall to be
restarted.  In this discussion, we are concerned with the latter
case.

On i386, the kernel returns this status via the EAX register.

When debugging a 32-bit (i386) process from a 64-bit (amd64)
GDB, the debugger fetches 64-bit registers even though the
process being debugged is 32-bit.  Since we're debugging a 32-bit
target, only 32 bits are being saved in the register cache.
Now, ideally, GDB would save all 64-bits in the regcache and
then would be able to restore those same values when it comes
time to continue the target.  I've looked into doing this, but
it's not easy and I don't see many benefits to doing so.  One
benefit, however, would be that EAX would appear as a negative
value for doing syscall restarts.

At the moment, GDB is setting the high 32 bits of RAX (and other
registers too) to 0.  So, when GDB restores EAX just prior to
a syscall restart, the high 32 bits of RAX are zeroed, thus making
it look like a positive value.  For this particular purpose, we
need to sign extend EAX so that RAX will appear as a negative
value when EAX is set to -ERESTARTSYS.  This in turn will cause
the signal handling code in the kernel to recognize -ERESTARTSYS
which will in turn cause the syscall to be restarted.

This commit is based on work by Jan Kratochvil from 2009:

https://sourceware.org/ml/gdb-patches/2009-11/msg00592.html

Jan's patch had the sign extension code in amd64-nat.c.  Several
other native targets make use of this code, so it seemed better
to move the sign extension code to a linux specific file.  I
also added similar code to gdbserver.

Another approach is to fix the problem in the kernel.  Hui Zhu
tried to get a fix into the kernel back in 2014, but it was not
accepted.  Discussion regarding this approach may be found here:

https://lore.kernel.org/patchwork/patch/457841/

Even if a fix were to be put into the kernel, we'd still need
some kind of fix in GDB in order to support older kernels.

Finally, I'll note that Fedora has been carrying a similar patch for
at least nine years.  Other distributions, including RHEL and CentOS
have picked up this change and have been using it too.

gdb/ChangeLog:

* amd64-linux-nat.c (amd64_linux_collect_native_gregset): New
function.
(fill_gregset): Call amd64_linux_collect_native_gregset instead
of amd64_collect_native_gregset.
(amd64_linux_nat_target::store_registers): Likewise.

gdb/gdbserver/ChangeLog:

* linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
when using a 64-bit gdbserver.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Apr 2019 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoPull in patch for libiberty that fixes a stack exhaustion bug when demangling a patha...
Nick Clifton [Wed, 10 Apr 2019 14:49:36 +0000 (15:49 +0100)]
Pull in patch for libiberty that fixes a stack exhaustion bug when demangling a pathalogically constructed mangled name.

PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter.  Adjust
body of the function accordingly.  Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.

5 years agoIntroduce a separate debug objfile iterator
Tom Tromey [Sun, 10 Mar 2019 21:37:20 +0000 (15:37 -0600)]
Introduce a separate debug objfile iterator

This introduces a new iterator and range adapter for iteration over
the separate debug files of a given objfile.  As in the current
approach, the requested objfile is returned first, followed by the
separate debug objfiles.

gdb/ChangeLog
2019-04-10  Tom Tromey  <tom@tromey.com>

* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_in_objfile_from_linkage_name): Use the iterator.
* objfiles.h (class separate_debug_iterator): New.
(class separate_debug_range): New.
(struct objfile) <separate_debug_objfiles>: New method.
(objfile_separate_debug_iterate): Don't declare.
* objfiles.c (separate_debug_iterator::operator++): Rename from
objfile_separate_debug_iterate.
(objfile_relocate, objfile_rebase, objfile_has_symbols): Use the
iterator.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Use the
iterator.

5 years agoFix a couple of comments
Tom Tromey [Sun, 10 Mar 2019 21:01:26 +0000 (15:01 -0600)]
Fix a couple of comments

While working on objfiles I noticed a typo in one comment, and another
comment that, as far as I can tell, has been obsolete for a very long
time.

gdb/ChangeLog
2019-04-10  Tom Tromey  <tom@tromey.com>

* symfile.c (reread_symbols): Remove old comment.
* objfiles.c (free_all_objfiles): Fix a typo.

5 years agoRemove some uses of "object_files"
Tom Tromey [Sun, 20 Jan 2019 04:30:36 +0000 (21:30 -0700)]
Remove some uses of "object_files"

The "object_files" macro is sometimes used when iterating over
objfiles.  This patch removes a few such uses in favor of the new
range adapter.

gdb/ChangeLog
2019-04-10  Tom Tromey  <tom@tromey.com>

* ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
* minsyms.c (lookup_minimal_symbol): Use foreach.
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline): Likewise.
* symfile.c (reread_symbols): Use foreach.

5 years agoPR24427, bfd/doc/chew.c reads uninitialized memory and subtracts from function pointer
Michael Forney [Wed, 10 Apr 2019 08:47:37 +0000 (18:17 +0930)]
PR24427, bfd/doc/chew.c reads uninitialized memory and subtracts from function pointer

PR 24427
* doc/chew.c (free_words): Correctly free "push_text" strings.

5 years agoDisable R_X86_64_PLT32 generation as branch marker on Solaris/x86
Rainer Orth [Wed, 10 Apr 2019 07:48:43 +0000 (09:48 +0200)]
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86

The fix H.J. implemented for PR gas/22791 in the thread starting at

[PATCH] x86-64: Treat PC32 relocation with branch as PLT32
https://sourceware.org/ml/binutils/2018-02/msg00065.html

is causing problems on Solaris/x86.  The native linker is strongly
preferred there, and there's no intention of implementing the linker
optimization he plans there.  Besides, the kernel runtime linker,
otherwise has no need to deal with that reloc at all, and instead of
adding (possibly even more) workarounds with no benefit, it seems
appropriate to disable the R_X86_64_PLT32 generation as branch marker on
Solaris/x86 in the first place.

The patch itself is trivial, the only complication is adapting the
testsuite.  Since I've found no way to have conditional sections in the
.d files, I've instead used the solution already found elsewhere of
having separate .d files for the affected tests in an i386/solaris
subdirectory and skipping the original ones.

Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without
regressions.

* config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.
* testsuite/gas/i386/solaris/solaris.exp: New driver.
* testsuite/gas/i386/solaris/reloc64.d,
testsuite/gas/i386/solaris/x86-64-jump.d,
testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d,
testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d,
testsuite/gas/i386/solaris/x86-64-nop-3.d,
testsuite/gas/i386/solaris/x86-64-nop-4.d,
testsuite/gas/i386/solaris/x86-64-nop-5.d,
testsuite/gas/i386/solaris/x86-64-relax-2.d,
testsuite/gas/i386/solaris/x86-64-relax-3.d: New tests.
* testsuite/gas/i386/reloc64.d,
testsuite/gas/i386/x86-64-jump.d,
testsuite/gas/i386/x86-64-mpx-branch-1.d,
testsuite/gas/i386/x86-64-mpx-branch-2.d,
testsuite/gas/i386/x86-64-nop-3.d,
testsuite/gas/i386/x86-64-nop-4.d,
testsuite/gas/i386/x86-64-nop-5.d,
testsuite/gas/i386/x86-64-relax-2.d,
testsuite/gas/i386/x86-64-relax-3.d: Skip on *-*-solaris*.

5 years agoRe: XFAIL PR ld/20995 tests for lynxos and nto targets
Alan Modra [Wed, 10 Apr 2019 06:00:37 +0000 (15:30 +0930)]
Re: XFAIL PR ld/20995 tests for lynxos and nto targets

* testsuite/ld-elf/shared.exp: Don't xfail PR ld/20995 for
powerpc-nto.

5 years agocskyelf.em branch stub handling
Alan Modra [Wed, 10 Apr 2019 02:28:15 +0000 (11:58 +0930)]
cskyelf.em branch stub handling

This fixes the csky-elf ld-elf/pr21884 and ld-unique/pr21529 failures,
by disabling branch stubs for binary (and other non-csky) output.
The csky-linux target gets branch stubs off by default because
presumably there are reasons why branch stubs were disabled, but
rather than killing the support completely it can be enabled by
--branch-stub.

* emultempl/cskyelf.em (csk_elf_before_parse): New function,
setting use_branch_stub false for linux.
(csky_elf_create_output_section_statements): Do emit this
function and all others in the file for linux, plus the branch
option control.  Disable branch stubs when non-ELF.

5 years agoFix some ld dependencies
Alan Modra [Wed, 10 Apr 2019 02:05:48 +0000 (11:35 +0930)]
Fix some ld dependencies

In looking at the csky-elf vs. csky-linux differences, the first thing
I compared was csky_elf.sh and cskyelf_linux.sh.  Those files are
mostly the same but besides the real differences, annoyingly have some
lines ordered differently.  It's better in such cases to have one file
source the other, making differences plain.  This patch does that for
csky and microblaze, removes an unused variable defined in a few
places, and fixes ld makefile dependencies.

* Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em.
(ecskyelf_linux.c): Depend on cskyelf.sh.
(eelf32microblazeel.c): Depend on elf32microblaze.sh.
* Makefile.in: Regenerate.
* emulparams/cskyelf.sh: Comment regarding cskelf_linux.sh.
(PAGE_SIZE): Don't define.
* emulparams/cskyelf_linux.sh: Source sckyelf.sh, leaving just
the differing variable defs/undefs.
* emulparams/elf32mcore.sh (PAGE_SIZE): Don't define.
* emulparams/elf32microblaze.sh: Comment re. elf32microblazeel.sh.
(OUTPUT_FORMAT): Use BIG_OUTPUT_FORMAT.
(PAGE_SIZE): Don't define.
* emulparams/elf32microblazeel.sh: Source elf32microblaze.sh,
leaving just the differing OUTPUT_FORMAT.

5 years agoRegen BLD-POTFILES.in
Alan Modra [Wed, 10 Apr 2019 02:27:00 +0000 (11:57 +0930)]
Regen BLD-POTFILES.in

* po/BLD-POTFILES.in: Regenerate.

5 years agote-cloudabi.h
Alan Modra [Mon, 8 Apr 2019 07:27:51 +0000 (16:57 +0930)]
te-cloudabi.h

This patch is aimed a fixing large numbers of x86_64-cloudabi failures
caused by gas selecting the wrong target name.

* config/te-cloudabi.h: New file.
* config/tc-aarch64.c (aarch64_after_parse_args): Use TE_CLOUDABI
rather than TARGET_OS to select cloudabi.
* config/tc-i386.h (ELF_TARGET_FORMAT64): Define for TE_CLOUDABI.
* configure.tgt (*-*-cloudabi*): Set em=cloudabi.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Apr 2019 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoFix Rust lexer buglet
Tom Tromey [Tue, 9 Apr 2019 19:19:28 +0000 (13:19 -0600)]
Fix Rust lexer buglet

PR rust/24414 points out that the Rust lexer uses strtoul when lexing
an integer, and that this can give the wrong results in some
situations.

This patch changes it to use strtoulst, like most of the rest of gdb.
It also adds a self test.

Tested on x86-64 Fedora 29 using an i686 build.

gdb/ChangeLog
2019-04-09  Ivan Begert  <ivanbegert@gmail.com>
    Tom Tromey  <tromey@adacore.com>

PR rust/24414:
* rust-exp.y (rust_parser::lex_number): Use strtoulst.
(rust_lex_int_test): Change "value" to be LONGEST.
(rust_lex_tests): Add test for long integer literal.

5 years agoUse find_thread_in_random in select_event_lwp
Tom Tromey [Thu, 4 Apr 2019 22:57:11 +0000 (16:57 -0600)]
Use find_thread_in_random in select_event_lwp

I noticed that find_thread_in_random duplicates the code in
find_thread_in_random, so this patch changes the latter to use the
former.

There are two other spots in gdb that do this, but to unify all of
them would require switching some code from using the "iterate over"
idiom to using iterators.

Another possible improvement is that find_thread_in_random could be
made single-pass using reservoir sampling.

Tested by the buildbot.

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

* linux-low.c (select_event_lwp): Use find_thread_in_random.

5 years agoConsistently use bool for fake_pid_p
Tom Tromey [Thu, 4 Apr 2019 23:03:27 +0000 (17:03 -0600)]
Consistently use bool for fake_pid_p

I noticed a few spots where fake_pid_p is handled as an int, whereas
the field in struct inferior has type bool.  This patch changes the
remaining places to use bool as well.

Tested by the buildbot.

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

* remote.c (remote_target::remote_add_inferior): Change fake_pid_p
to bool.
(extended_remote_target::attach): Update.
(remote_target::remote_notice_new_inferior): Update.
(remote_target::add_current_inferior_and_thread): Update.
* inferior.c (exit_inferior_1): Use "false".
* corelow.c (add_to_thread_list): Make fake_pid_p bool.

5 years agoFix typo in latest ChangeLog entry
Simon Marchi [Tue, 9 Apr 2019 16:35:29 +0000 (12:35 -0400)]
Fix typo in latest ChangeLog entry

5 years agoUse -qualified flag when setting temporary breakpoint in start command
Simon Marchi [Tue, 9 Apr 2019 16:32:26 +0000 (12:32 -0400)]
Use -qualified flag when setting temporary breakpoint in start command

When using the "start" command, GDB puts a temporary breakpoint on the
"main" symbol (we literally invoke the tbreak command).  However, since
it does wild matching by default, it also puts a breakpoint on any C++
method or "main" function in a namespace.  For example, when debugging
GDB, it creates a total of 24 locations:

  (gdb) start
  Temporary breakpoint 1 at 0x198c1e9: main. (24 locations)

as there are a bunch of methods called main in the selftests, such as

  selftests::string_view::capacity_1::main()

If such method was called in the constructor of a global object, or a
function marked with the attribute "constructor", then we would stop at
the wrong place.  Also, this causes a few extra symtabs (those that
contain the "wrong" mains) to be expanded for nothing.

The dummiest, most straightforward solution is to add -qualified when
invoking tbreak.  With this patch, "start" creates a single-location
breakpoint, as expected.

I copied the start.exp test to start-cpp.exp and made it use a C++ test
file, which contains two main functions.  The new test verifies that the
output of "start" is the output we get when we set a single-location
breakpoint.

gdb/ChangeLog:

* infcmd.c (run_command_1): Pass -qualified to tbreak when usind
the "start" command.

gdb/testsuite/ChangeLog:

* gdb.base/start-cpp.exp: New file.
* gdb.base/start-cpp.cc: New file.

5 years ago[MIPS] Add RDHWR with the SEL field for MIPS R6.
Robert Suchanek [Tue, 9 Apr 2019 09:30:26 +0000 (17:30 +0800)]
[MIPS] Add RDHWR with the SEL field for MIPS R6.

In Release 6 of the MIPS architecture [1], instruction RDHWR supports
a 3rd operand to serve as the 3-bit select field for the hardware
register.

[1] "MIPS Architecture for Programmers Volume II-A: The MIPS32
    Instruction Set Manual", Imagination Technologies Ltd., Document
    Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2
    "Alphabetical List of Instructions", pp. 332-334

opcodes/
* mips-opc.c (mips_builtin_opcodes): Add RDHWR rt rd sel.

gas/
* testsuite/gas/mips/mips.exp: Run hwr-names test.
* testsuite/gas/mips/hwr-names.s: Add test cases for RDHWR with
the SEL field.
* testsuite/gas/mips/mipsr6@hwr-names.d: New file.

5 years agoRename python function thread_from_thread_handle to thread_from_handle
Kevin Buettner [Thu, 21 Mar 2019 03:38:33 +0000 (20:38 -0700)]
Rename python function thread_from_thread_handle to thread_from_handle

This renaming was done to stay consistent with the naming of the new
gdb.InferiorThread.handle method.  I had initially named it "thread_handle"
but Tom Tromey suggested just "handle".

The old name (thread_from_thread_handle) still works, but is marked as
deprecated in comments in the code as well as in the documentation.

I have some code which uses these functions.  I very much like the
brevity of the new names.

gdb/doc/ChangeLog:

* python.texi (Inferiors In Python): Rename
Inferior.thread_from_thread_handle to Inferior.thread_from_handle.
Add note about the former being deprecated.

gdb/ChangeLog:

* python/py-inferior.c (infpy_thread_from_thread_handle):
Adjust comments to reflect renaming of thread_from_thread_handle
to thread_from_handle.  Adjust keywords.  Fix type error message.
(inferior_object_methods): Add thread_from_handle.  Retain
thread_from_thread_handle, but mark it as deprecated.

testsuite/ChangeLog:

* gdb.python/py-thrhandle.exp: Adjust tests to call
thread_from_handle instead of thread_from_thread_handle.

5 years agoDocumentation for python method InferiorThread.handle
Kevin Buettner [Sun, 16 Sep 2018 04:53:38 +0000 (21:53 -0700)]
Documentation for python method InferiorThread.handle

gdb/doc/ChangeLog:

* python.texi (Threads In Python): Add description for method
InferiorThread.handle.

5 years agoTests for gdb.InferiorThread.handle
Kevin Buettner [Sun, 16 Sep 2018 04:15:49 +0000 (21:15 -0700)]
Tests for gdb.InferiorThread.handle

gdb/testsuite/ChangeLog:

* gdb.python/py-thrhandle.exp: Add tests for
gdb.InferiorThread.handle.

5 years agoSupport buffer objects as handles in Inferior.thread_from_thread_handle()
Kevin Buettner [Wed, 27 Feb 2019 22:06:28 +0000 (15:06 -0700)]
Support buffer objects as handles in Inferior.thread_from_thread_handle()

InferiorThread.handle() returns a python bytes object.  We'd like to
be able to pass the output of this function, a thread handle, to
Inferior.thread_from_thread_handle().  Up to now,
thread_from_thread_handle() expects to receive a gdb.Value input.
This commit adds support to also allow a python buffer object to be
passed as the handle.

infpy_thread_from_thread_handle() calls find_thread_by_handle() which
has the obvious functionality.  It used to pass the thread handle via
a struct value pointer.  I've revised this interface to instead pass a
gdb::array_view<const gdb_byte> object.  (Thanks to Tom Tromey for
suggesting this data structure over an earlier version which passed a
gdb_byte pointer and length.)

gdb/ChangeLog:

* gdbthread.h (find_thread_by_handle): Revise declaration.
* thread.c (find_thread_by_handle): Likewise.  Adjust
implementation too.
* python/py-inferior.c (infpy_thread_from_thread_handle): Add
support for buffer objects as handles.

5 years agoAdd python method InferiorThread.handle
Kevin Buettner [Wed, 27 Feb 2019 21:59:02 +0000 (14:59 -0700)]
Add python method InferiorThread.handle

gdb/ChangeLog:

* python/py-infthread.c (thpy_thread_handle): New function.
(thread_object_methods): Register thpy_thread_handle.

5 years agoIntroduce target_ops method thread_info_to_thread_handle
Kevin Buettner [Fri, 8 Feb 2019 02:16:04 +0000 (19:16 -0700)]
Introduce target_ops method thread_info_to_thread_handle

This patch adds a thread_info_to_thread_handle method to the target_ops
struct.  It also implements this functionality for remote targets and
linux native threads.

gdb/ChangeLog:

* gdbthread.h (thread_to_thread_handle): Declare.
* thread.c (gdbtypes.h): Include.
(thread_to_thread_handle): New function.

* target.h (struct target_ops): Add thread_info_to_thread_handle.
(target_thread_info_to_thread_handle): Declare.
* target.c (target_thread_info_to_thread_handle): New function.
* target-debug.h (target_debug_print_gdb_byte_vector): Define.
* target-delegates.c: Regenerate.

* linux-thread-db.c (class thread_db_target): Add method
thread_info_to_thread_handle.
(thread_db_target::thread_info_to_thread_handle): Define.
* remote.c (class remote_target): Add new method
thread_info_to_thread_handle.
(remote_target::thread_info_to_thread_handle): Define.

5 years agox86: Define GNU_PROPERTY_X86_ISA_1_AVX512_BF16
H.J. Lu [Tue, 9 Apr 2019 00:04:01 +0000 (17:04 -0700)]
x86: Define GNU_PROPERTY_X86_ISA_1_AVX512_BF16

Update assembler and readelf to support

 #define GNU_PROPERTY_X86_ISA_1_AVX512_BF16  (1U << 24)

for AVX512_BF16.

binutils/

* readelf.c (decode_x86_isa): Handle
GNU_PROPERTY_X86_ISA_1_AVX512_BF16.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.

gas/

* config/tc-i386.c (output_insn): Support
GNU_PROPERTY_X86_ISA_1_AVX512_BF16.
* testsuite/gas/i386/property-2.s: Add AVX512_BF16 test.
* testsuite/gas/i386/property-2.d: Updated.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.

include/

* elf/common.h (GNU_PROPERTY_X86_ISA_1_AVX512_BF16): New.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Apr 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoXFAIL PR ld/20995 tests for lynxos and nto targets
H.J. Lu [Mon, 8 Apr 2019 20:54:20 +0000 (13:54 -0700)]
XFAIL PR ld/20995 tests for lynxos and nto targets

lynxos and nto targets don't support RELRO.

* testsuite/ld-elf/shared.exp: XFAIL PR ld/20995 tests for
lynxos and nto targets.

5 years agoSome gdb_exception{,error,quit} tweaks
Pedro Alves [Mon, 8 Apr 2019 12:03:54 +0000 (13:03 +0100)]
Some gdb_exception{,error,quit} tweaks

- Explicitly include <string> for std::string.

- Use std::make_shared to construct gdb_exception::message instead of
  operator new, avoiding one heap allocation (2 instead of 3).  Add
  'const char *fmt, va_list ap' parameters to
  gdb_exception{,error,quit}'s ctors, and do the std::make_shared in
  the gdb_exception ctor.

- gdb_exception_error's constructor does not need to have an 'enum
  return_reason' parameter, since it is always RETURN_ERROR, by
  definition.

- Similarly, gdb_exception_quit's contructor does not need to have
  'enum return_reason'/'enum errors' parameters.

- In the gdb_exception_{quit,_error} ctors that take a gdb_exception
  as argument, assert that they're being passed a gdb_exception object
  of the right 'reason'.

gdb/ChangeLog:
2019-04-08  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.c (throw_exception): Don't create
named object to throw; throw directly.
(throw_it): Likewise.  Don't initialize gdb_exception::message
here, with new; pass FMT and AP to the ctor instead.
* common/common-exceptions.h: Include <string>.
(gdb_exception::gdb_exception(enum return_reason, enum errors,
const char *, va_list)): New ctor.  Use std::make_shared.
(gdb_exception_error::gdb_exception_error(enum return_reason, enum
errors)): Delete.
(gdb_exception_error::gdb_exception_error(enum errors, const char
*, va_list)): New.
(gdb_exception_error::gdb_exception_error(const gdb_exception &)):
Add assertion.
(gdb_exception_quit::gdb_exception_quit(enum return_reason, enum
errors)): Delete.
(gdb_exception_quit::gdb_exception_quit(const char *, va_list)): New.
(gdb_exception_quit::gdb_exception_quit(const gdb_exception &)):
Add assertion.

5 years agox86: Remove i386-*-kaos* and i386-*-chaos targets
H.J. Lu [Mon, 8 Apr 2019 18:58:51 +0000 (11:58 -0700)]
x86: Remove i386-*-kaos* and i386-*-chaos targets

Remove i386-*-kaos* and i386-*-chaos targets since they are no longer
supported by config.sub:

$ .../config.sub i386-kaos
Invalid configuration `i386-kaos': system `kaos' not recognized
$ .../config.sub i386-chaos
Invalid configuration `i386-chaos': system `chaos' not recognized
$

bfd/

* config.bfd: Remove i[3-7]86-*-kaos* and i[3-7]86-*-chaos targets.

gas/

* configure.tgt: Remove i386-*-kaos* and i386-*-chaos targets.
* testsuite/gas/i386/i386.exp: Remove *-*-caos* and "*-*-kaos*
check.

ld/

* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_chaos.c.
(eelf_i386_chaos.c): Removed.
* Makefile.in: Regenerated.
* configure.tgt: Remove i[3-7]86-*-kaos*.
* emulparams/elf_i386_chaos.sh: Removed.

5 years agoCount i386-moss as ELF
H.J. Lu [Mon, 8 Apr 2019 18:34:32 +0000 (11:34 -0700)]
Count i386-moss as ELF

* testsuite/binutils-all/nm.exp: Count i386-moss as ELF.

5 years agoUse elf-x86.em for i386-moss and i386-beos
H.J. Lu [Mon, 8 Apr 2019 18:27:57 +0000 (11:27 -0700)]
Use elf-x86.em for i386-moss and i386-beos

* emulparams/elf_i386_be.sh (EXTRA_EM_FILE): New.
* emulparams/i386moss.sh (EXTRA_EM_FILE): Likewise.

5 years agox86: Consolidate AVX512 BF16 entries in i386-opc.tbl
H.J. Lu [Mon, 8 Apr 2019 18:06:04 +0000 (11:06 -0700)]
x86: Consolidate AVX512 BF16 entries in i386-opc.tbl

1. Use single entry for vcvtne2ps2bf16 and vdpbf16ps with Disp8ShiftVL.
2. Use 5 entries, instead of 8, for vcvtneps2bf16.

* i386-opc.tbl: Consolidate AVX512 BF16 entries.
* i386-init.h: Regenerated.

5 years agoReplace throw_exception with throw in some cases
Tom Tromey [Mon, 28 Jan 2019 17:45:45 +0000 (10:45 -0700)]
Replace throw_exception with throw in some cases

This replaces throw_exception with "throw;" when possible.  This was
written by script.  The rule that is followed is that uses of the
form:

   catch (... &name)
     {
       ...
       throw_exception (name);
     }

... can be rewritten.  This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* valops.c (value_rtti_indirect_type): Replace throw_exception
with throw.
* tracefile-tfile.c (tfile_target_open): Replace throw_exception
with throw.
* thread.c (thr_try_catch_cmd): Replace throw_exception with
throw.
* target.c (target_translate_tls_address): Replace throw_exception
with throw.
* stack.c (frame_apply_command_count): Replace throw_exception
with throw.
* solib-spu.c (append_ocl_sos): Replace throw_exception with
throw.
* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
with throw.
* rs6000-tdep.c (rs6000_frame_cache)
(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
* remote.c: Replace throw_exception with throw.
* record-full.c (record_full_message, record_full_wait_1)
(record_full_restore): Replace throw_exception with throw.
* record-btrace.c:
(get_thread_current_frame_id, record_btrace_start_replaying)
(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
(cmd_record_btrace_start): Replace throw_exception with throw.
* parse.c (parse_exp_in_context_1): Replace throw_exception with
throw.
* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
(resume_stopped_resumed_lwps): Replace throw_exception with throw.
* linespec.c:
(find_linespec_symbols): Replace throw_exception with throw.
* infrun.c (displaced_step_prepare, resume): Replace
throw_exception with throw.
* infcmd.c (post_create_inferior): Replace throw_exception with
throw.
* inf-loop.c (inferior_event_handler): Replace throw_exception
with throw.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Replace throw_exception with throw.
* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
(get_prev_frame_always, get_frame_pc_if_available)
(get_frame_address_in_block_if_available, get_frame_language):
Replace throw_exception with throw.
* frame-unwind.c (frame_unwind_try_unwinder): Replace
throw_exception with throw.
* eval.c (fetch_subexp_value, evaluate_var_value)
(evaluate_funcall, evaluate_subexp_standard): Replace
throw_exception with throw.
* dwarf2loc.c (call_site_find_chain)
(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
Replace throw_exception with throw.
* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
with throw.
* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
throw.
* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
* completer.c (complete_line_internal): Replace throw_exception
with throw.
* compile/compile-object-run.c (compile_object_run): Replace
throw_exception with throw.
* cli/cli-script.c (process_next_line): Replace throw_exception
with throw.
* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
(btrace_enable, btrace_maint_update_pt_packets): Replace
throw_exception with throw.
* breakpoint.c (create_breakpoint, save_breakpoints): Replace
throw_exception with throw.
* break-catch-throw.c (re_set_exception_catchpoint): Replace
throw_exception with throw.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Replace throw_exception with throw.
* aarch64-tdep.c (aarch64_make_prologue_cache)
(aarch64_make_stub_cache): Replace throw_exception with throw.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
throw.
(linux_resume_one_lwp): Likewise.

5 years agoMake exception throwing a bit more efficient
Tom Tromey [Mon, 28 Jan 2019 17:56:58 +0000 (10:56 -0700)]
Make exception throwing a bit more efficient

This makes exception throwing a bit more efficient, by removing some
copies.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* common/common-exceptions.c (throw_exception): Rename from
throw_exception_cxx.  Remove old copy.  Make argument const.
(throw_it): Create and throw exception objects directly.
* common/common-exceptions.h (throw_exception): Make argument
const.
(struct gdb_exception_error): Add constructor.
(struct gdb_exception_quit): Add constructor.

5 years agoRemove some now-dead exception code
Tom Tromey [Mon, 28 Jan 2019 17:29:42 +0000 (10:29 -0700)]
Remove some now-dead exception code

After the rewriting to use try/catch, some of the exception code is
now unused.  This patch removes that code.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* common/common-exceptions.h (exception_rethrow): Don't declare.
(TRY_SJLJ): Update comment.
(TRY, CATCH, END_CATCH): Remove.
* common/common-exceptions.c (exception_rethrow): Remove.

5 years agoRename gdb exception types
Tom Tromey [Wed, 3 Apr 2019 21:59:07 +0000 (15:59 -0600)]
Rename gdb exception types

This renames the gdb exception types.  The old types were only needed
due to the macros in common-exception.h that are now gone.

The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem
needed, so this patch removes it entirely.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL):
Remove.
(gdb_exception_error): Rename from
gdb_exception_RETURN_MASK_ERROR.
(gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT.
(gdb_quit_bad_alloc): Update.
* aarch64-tdep.c: Update.
* ada-lang.c: Update.
* ada-typeprint.c: Update.
* ada-valprint.c: Update.
* amd64-tdep.c: Update.
* arch-utils.c: Update.
* break-catch-throw.c: Update.
* breakpoint.c: Update.
* btrace.c: Update.
* c-varobj.c: Update.
* cli/cli-cmds.c: Update.
* cli/cli-interp.c: Update.
* cli/cli-script.c: Update.
* common/common-exceptions.c: Update.
* common/new-op.c: Update.
* common/selftest.c: Update.
* compile/compile-c-symbols.c: Update.
* compile/compile-cplus-symbols.c: Update.
* compile/compile-object-load.c: Update.
* compile/compile-object-run.c: Update.
* completer.c: Update.
* corelow.c: Update.
* cp-abi.c: Update.
* cp-support.c: Update.
* cp-valprint.c: Update.
* darwin-nat.c: Update.
* disasm-selftests.c: Update.
* dtrace-probe.c: Update.
* dwarf-index-cache.c: Update.
* dwarf-index-write.c: Update.
* dwarf2-frame-tailcall.c: Update.
* dwarf2-frame.c: Update.
* dwarf2loc.c: Update.
* dwarf2read.c: Update.
* eval.c: Update.
* event-loop.c: Update.
* event-top.c: Update.
* exec.c: Update.
* f-valprint.c: Update.
* fbsd-tdep.c: Update.
* frame-unwind.c: Update.
* frame.c: Update.
* gdbtypes.c: Update.
* gnu-v3-abi.c: Update.
* guile/guile-internal.h: Update.
* guile/scm-block.c: Update.
* guile/scm-breakpoint.c: Update.
* guile/scm-cmd.c: Update.
* guile/scm-disasm.c: Update.
* guile/scm-frame.c: Update.
* guile/scm-lazy-string.c: Update.
* guile/scm-math.c: Update.
* guile/scm-param.c: Update.
* guile/scm-ports.c: Update.
* guile/scm-pretty-print.c: Update.
* guile/scm-symbol.c: Update.
* guile/scm-symtab.c: Update.
* guile/scm-type.c: Update.
* guile/scm-value.c: Update.
* i386-linux-tdep.c: Update.
* i386-tdep.c: Update.
* inf-loop.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* jit.c: Update.
* language.c: Update.
* linespec.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* main.c: Update.
* mi/mi-cmd-break.c: Update.
* mi/mi-cmd-stack.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* objc-lang.c: Update.
* p-valprint.c: Update.
* parse.c: Update.
* ppc-linux-tdep.c: Update.
* printcmd.c: Update.
* python/py-arch.c: Update.
* python/py-breakpoint.c: Update.
* python/py-cmd.c: Update.
* python/py-finishbreakpoint.c: Update.
* python/py-frame.c: Update.
* python/py-framefilter.c: Update.
* python/py-gdb-readline.c: Update.
* python/py-inferior.c: Update.
* python/py-infthread.c: Update.
* python/py-lazy-string.c: Update.
* python/py-linetable.c: Update.
* python/py-objfile.c: Update.
* python/py-param.c: Update.
* python/py-prettyprint.c: Update.
* python/py-progspace.c: Update.
* python/py-record-btrace.c: Update.
* python/py-record.c: Update.
* python/py-symbol.c: Update.
* python/py-type.c: Update.
* python/py-unwind.c: Update.
* python/py-utils.c: Update.
* python/py-value.c: Update.
* python/python.c: Update.
* record-btrace.c: Update.
* record-full.c: Update.
* remote-fileio.c: Update.
* remote.c: Update.
* riscv-tdep.c: Update.
* rs6000-aix-tdep.c: Update.
* rs6000-tdep.c: Update.
* rust-exp.y: Update.
* rust-lang.c: Update.
* s390-tdep.c: Update.
* selftest-arch.c: Update.
* solib-dsbt.c: Update.
* solib-frv.c: Update.
* solib-spu.c: Update.
* solib-svr4.c: Update.
* solib.c: Update.
* sparc64-linux-tdep.c: Update.
* stack.c: Update.
* symfile-mem.c: Update.
* symmisc.c: Update.
* target.c: Update.
* thread.c: Update.
* top.c: Update.
* tracefile-tfile.c: Update.
* tui/tui.c: Update.
* typeprint.c: Update.
* unittests/cli-utils-selftests.c: Update.
* unittests/parse-connection-spec-selftests.c: Update.
* valops.c: Update.
* valprint.c: Update.
* value.c: Update.
* varobj.c: Update.
* windows-nat.c: Update.
* x86-linux-nat.c: Update.
* xml-support.c: Update.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* gdbreplay.c: Update.
* linux-low.c: Update.
* server.c: Update.

5 years agoRewrite TRY/CATCH
Tom Tromey [Wed, 3 Apr 2019 22:02:42 +0000 (16:02 -0600)]
Rewrite TRY/CATCH

This rewrites gdb's TRY/CATCH to plain C++ try/catch.  The patch was
largely written by script, though one change (to a comment in
common-exceptions.h) was reverted by hand.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* xml-support.c: Use C++ exception handling.
* x86-linux-nat.c: Use C++ exception handling.
* windows-nat.c: Use C++ exception handling.
* varobj.c: Use C++ exception handling.
* value.c: Use C++ exception handling.
* valprint.c: Use C++ exception handling.
* valops.c: Use C++ exception handling.
* unittests/parse-connection-spec-selftests.c: Use C++ exception
handling.
* unittests/cli-utils-selftests.c: Use C++ exception handling.
* typeprint.c: Use C++ exception handling.
* tui/tui.c: Use C++ exception handling.
* tracefile-tfile.c: Use C++ exception handling.
* top.c: Use C++ exception handling.
* thread.c: Use C++ exception handling.
* target.c: Use C++ exception handling.
* symmisc.c: Use C++ exception handling.
* symfile-mem.c: Use C++ exception handling.
* stack.c: Use C++ exception handling.
* sparc64-linux-tdep.c: Use C++ exception handling.
* solib.c: Use C++ exception handling.
* solib-svr4.c: Use C++ exception handling.
* solib-spu.c: Use C++ exception handling.
* solib-frv.c: Use C++ exception handling.
* solib-dsbt.c: Use C++ exception handling.
* selftest-arch.c: Use C++ exception handling.
* s390-tdep.c: Use C++ exception handling.
* rust-lang.c: Use C++ exception handling.
* rust-exp.y: Use C++ exception handling.
* rs6000-tdep.c: Use C++ exception handling.
* rs6000-aix-tdep.c: Use C++ exception handling.
* riscv-tdep.c: Use C++ exception handling.
* remote.c: Use C++ exception handling.
* remote-fileio.c: Use C++ exception handling.
* record-full.c: Use C++ exception handling.
* record-btrace.c: Use C++ exception handling.
* python/python.c: Use C++ exception handling.
* python/py-value.c: Use C++ exception handling.
* python/py-utils.c: Use C++ exception handling.
* python/py-unwind.c: Use C++ exception handling.
* python/py-type.c: Use C++ exception handling.
* python/py-symbol.c: Use C++ exception handling.
* python/py-record.c: Use C++ exception handling.
* python/py-record-btrace.c: Use C++ exception handling.
* python/py-progspace.c: Use C++ exception handling.
* python/py-prettyprint.c: Use C++ exception handling.
* python/py-param.c: Use C++ exception handling.
* python/py-objfile.c: Use C++ exception handling.
* python/py-linetable.c: Use C++ exception handling.
* python/py-lazy-string.c: Use C++ exception handling.
* python/py-infthread.c: Use C++ exception handling.
* python/py-inferior.c: Use C++ exception handling.
* python/py-gdb-readline.c: Use C++ exception handling.
* python/py-framefilter.c: Use C++ exception handling.
* python/py-frame.c: Use C++ exception handling.
* python/py-finishbreakpoint.c: Use C++ exception handling.
* python/py-cmd.c: Use C++ exception handling.
* python/py-breakpoint.c: Use C++ exception handling.
* python/py-arch.c: Use C++ exception handling.
* printcmd.c: Use C++ exception handling.
* ppc-linux-tdep.c: Use C++ exception handling.
* parse.c: Use C++ exception handling.
* p-valprint.c: Use C++ exception handling.
* objc-lang.c: Use C++ exception handling.
* mi/mi-main.c: Use C++ exception handling.
* mi/mi-interp.c: Use C++ exception handling.
* mi/mi-cmd-stack.c: Use C++ exception handling.
* mi/mi-cmd-break.c: Use C++ exception handling.
* main.c: Use C++ exception handling.
* linux-thread-db.c: Use C++ exception handling.
* linux-tdep.c: Use C++ exception handling.
* linux-nat.c: Use C++ exception handling.
* linux-fork.c: Use C++ exception handling.
* linespec.c: Use C++ exception handling.
* language.c: Use C++ exception handling.
* jit.c: Use C++ exception handling.
* infrun.c: Use C++ exception handling.
* infcmd.c: Use C++ exception handling.
* infcall.c: Use C++ exception handling.
* inf-loop.c: Use C++ exception handling.
* i386-tdep.c: Use C++ exception handling.
* i386-linux-tdep.c: Use C++ exception handling.
* guile/scm-value.c: Use C++ exception handling.
* guile/scm-type.c: Use C++ exception handling.
* guile/scm-symtab.c: Use C++ exception handling.
* guile/scm-symbol.c: Use C++ exception handling.
* guile/scm-pretty-print.c: Use C++ exception handling.
* guile/scm-ports.c: Use C++ exception handling.
* guile/scm-param.c: Use C++ exception handling.
* guile/scm-math.c: Use C++ exception handling.
* guile/scm-lazy-string.c: Use C++ exception handling.
* guile/scm-frame.c: Use C++ exception handling.
* guile/scm-disasm.c: Use C++ exception handling.
* guile/scm-cmd.c: Use C++ exception handling.
* guile/scm-breakpoint.c: Use C++ exception handling.
* guile/scm-block.c: Use C++ exception handling.
* guile/guile-internal.h: Use C++ exception handling.
* gnu-v3-abi.c: Use C++ exception handling.
* gdbtypes.c: Use C++ exception handling.
* frame.c: Use C++ exception handling.
* frame-unwind.c: Use C++ exception handling.
* fbsd-tdep.c: Use C++ exception handling.
* f-valprint.c: Use C++ exception handling.
* exec.c: Use C++ exception handling.
* event-top.c: Use C++ exception handling.
* event-loop.c: Use C++ exception handling.
* eval.c: Use C++ exception handling.
* dwarf2read.c: Use C++ exception handling.
* dwarf2loc.c: Use C++ exception handling.
* dwarf2-frame.c: Use C++ exception handling.
* dwarf2-frame-tailcall.c: Use C++ exception handling.
* dwarf-index-write.c: Use C++ exception handling.
* dwarf-index-cache.c: Use C++ exception handling.
* dtrace-probe.c: Use C++ exception handling.
* disasm-selftests.c: Use C++ exception handling.
* darwin-nat.c: Use C++ exception handling.
* cp-valprint.c: Use C++ exception handling.
* cp-support.c: Use C++ exception handling.
* cp-abi.c: Use C++ exception handling.
* corelow.c: Use C++ exception handling.
* completer.c: Use C++ exception handling.
* compile/compile-object-run.c: Use C++ exception handling.
* compile/compile-object-load.c: Use C++ exception handling.
* compile/compile-cplus-symbols.c: Use C++ exception handling.
* compile/compile-c-symbols.c: Use C++ exception handling.
* common/selftest.c: Use C++ exception handling.
* common/new-op.c: Use C++ exception handling.
* cli/cli-script.c: Use C++ exception handling.
* cli/cli-interp.c: Use C++ exception handling.
* cli/cli-cmds.c: Use C++ exception handling.
* c-varobj.c: Use C++ exception handling.
* btrace.c: Use C++ exception handling.
* breakpoint.c: Use C++ exception handling.
* break-catch-throw.c: Use C++ exception handling.
* arch-utils.c: Use C++ exception handling.
* amd64-tdep.c: Use C++ exception handling.
* ada-valprint.c: Use C++ exception handling.
* ada-typeprint.c: Use C++ exception handling.
* ada-lang.c: Use C++ exception handling.
* aarch64-tdep.c: Use C++ exception handling.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* server.c: Use C++ exception handling.
* linux-low.c: Use C++ exception handling.
* gdbreplay.c: Use C++ exception handling.

5 years agoMake exceptions use std::string and be self-managing
Tom Tromey [Mon, 28 Jan 2019 17:11:10 +0000 (10:11 -0700)]
Make exceptions use std::string and be self-managing

This changes the exception's "message" member to be a shared_ptr
wrapping a std::string.  This allows removing the stack of exception
messages, because now exceptions will self-destruct when needed.  This
also adds a noexcept copy constructor and operator= to gdb_exception,
plus a "what" method.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* xml-support.c (gdb_xml_parser::parse): Update.
* x86-linux-nat.c (x86_linux_nat_target::enable_btrace): Update.
* value.c (show_convenience): Update.
* unittests/cli-utils-selftests.c (test_number_or_range_parser)
(test_parse_flags_qcs): Update.
* thread.c (thr_try_catch_cmd): Update.
* target.c (target_translate_tls_address): Update.
* stack.c (print_frame_arg, read_frame_local, read_frame_arg)
(info_frame_command_core, frame_apply_command_count): Update.
* rust-exp.y (rust_lex_exception_test): Update.
* riscv-tdep.c (riscv_print_one_register_info): Update.
* remote.c (remote_target::enable_btrace): Update.
* record-btrace.c (record_btrace_enable_warn): Update.
* python/py-utils.c (gdbpy_convert_exception): Update.
* printcmd.c (do_one_display, print_variable_and_value): Update.
* mi/mi-main.c (mi_print_exception): Update.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Use SCOPE_EXIT.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* linux-nat.c (linux_nat_target::attach): Update.
* linux-fork.c (class scoped_switch_fork_info): Update.
* infrun.c (displaced_step_prepare): Update.
* infcall.c (call_function_by_hand_dummy): Update.
* guile/scm-exception.c (gdbscm_scm_from_gdb_exception): Update.
* gnu-v3-abi.c (print_one_vtable): Update.
* frame.c (get_prev_frame_always): Update.
* f-valprint.c (info_common_command_for_block): Update.
* exec.c (try_open_exec_file): Update.
* exceptions.c (print_exception, exception_print)
(exception_fprintf, exception_print_same): Update.
* dwarf2-frame.c (dwarf2_build_frame_info): Update.
* dwarf-index-cache.c (index_cache::store)
(index_cache::lookup_gdb_index): Update.
* darwin-nat.c (maybe_cache_shell): Update.
* cp-valprint.c (cp_print_value_fields): Update.
* compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol)
(gcc_cplus_symbol_address): Update.
* compile/compile-c-symbols.c (gcc_convert_symbol)
(gcc_symbol_address, generate_c_for_for_one_variable): Update.
* common/selftest.c: Update.
* common/common-exceptions.h (struct gdb_exception) <message>: Now
a std::string.
(exception_try_scope_entry, exception_try_scope_exit): Don't
declare.
(struct exception_try_scope): Remove.
(TRY): Don't use exception_try_scope.
(struct gdb_exception): Add constructor, operator=.
<what>: New method.
(struct gdb_exception_RETURN_MASK_ALL)
(struct gdb_exception_RETURN_MASK_ERROR)
(struct gdb_exception_RETURN_MASK_QUIT): Add constructor.
(struct gdb_quit_bad_alloc): Update.
* common/common-exceptions.c (exception_none): Change
initializer.
(struct catcher) <state, exception>: Initialize inline.
<prev>: Remove member.
(current_catcher): Remove.
(catchers): New global.
(exceptions_state_mc_init): Simplify.
(catcher_pop): Remove.
(exceptions_state_mc, exceptions_state_mc_catch): Update.
(try_scope_depth, exception_try_scope_entry)
(exception_try_scope_exit): Remove.
(throw_exception_sjlj): Update.
(exception_messages, exception_messages_size): Remove.
(throw_it): Simplify.
(gdb_exception_sliced_copy): Remove.
(throw_exception_cxx): Update.
* cli/cli-script.c (script_from_file): Update.
* breakpoint.c (insert_bp_location, update_breakpoint_locations):
Update.
* ada-valprint.c (ada_val_print): Update.
* ada-lang.c (ada_to_fixed_type_1, ada_exception_name_addr)
(create_excep_cond_exprs): Update.

gdb/gdbserver/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* server.c (handle_btrace_general_set, handle_qxfer_btrace)
(handle_qxfer_btrace_conf, detach_or_kill_for_exit_cleanup)
(captured_main, main): Update.
* gdbreplay.c (main): Update.

5 years agoSimplify exception handling
Tom Tromey [Fri, 25 Jan 2019 00:31:21 +0000 (17:31 -0700)]
Simplify exception handling

Now that cleanups have been removed, TRY/CATCH can't be SJLJ-based any
more.  This patch simplifies the exception handling code, by removing
the non-working variants.

Note that the "pure" C++ exception handling code is removed as well; I
think the route forward must be to change exceptions to be
self-destructing, so that try_scope_depth can simply be removed.

Some longjmp-based code remains, as it is needed to throw an exception
through readline.

gdb/ChangeLog
2019-04-08  Tom Tromey  <tom@tromey.com>

* common/common-exceptions.h (GDB_XCPT_SJMP, GDB_XCPT_TRY)
(GDB_XCPT_RAW_TRY, GDB_XCPT): Remove.
(TRY, CATCH, END_CATCH): Remove some definitions.
* common/common-exceptions.c: Don't use GDB_XCPT.
(catcher_list_size): Remove.
(throw_exception, throw_it): Simplify.

5 years agoFix i386-lynxos and other runtime linker fails
Alan Modra [Mon, 8 Apr 2019 04:37:35 +0000 (14:07 +0930)]
Fix i386-lynxos and other runtime linker fails

Segfaults due to htab->params being NULL.

* emulparams/elf64rdos.sh (EXTRA_EM_FILE): Define.
* emulparams/i386lynx.sh (EXTRA_EM_FILE): Define.
* emulparams/i386nto.sh (EXTRA_EM_FILE): Define.

5 years agoFix x86_64-rdos build fail
Alan Modra [Mon, 8 Apr 2019 04:31:17 +0000 (14:01 +0930)]
Fix x86_64-rdos build fail

x86_64-rdos is one of the few x86_64 targets that is 64-bit only and
the x86_64 configure entries don't depend on elf-vxworks.lo.  This
results in undefined references from elfxx-x86.o.

* configure.ac (elfxx_x86): Define and use.
* configure: Regenerate.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Apr 2019 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMake "all" depend on "info"
Tom Tromey [Sat, 20 Oct 2018 18:30:00 +0000 (12:30 -0600)]
Make "all" depend on "info"

I've broken "make info" a couple of times now, because I sometimes
forget to run "make info" after modifying a Texinfo file.

I don't know why gdb's "make all" doesn't build the info pages.  I
suspect this was some Cygnus-local oddity back in the day.

This patch changes doc/Makefile.in so that the info pages are built by
"make all".  As a point of reference, Automake has essentially always
worked this way.  According to the Automake manual (I didn't
double-check) this is required by the GNU coding standards.

The first time I sent this patch, I mentioned that I wanted to look
into some existing bugs in bugzilla about missing "makeinfo".
However, today I tried and I discovered that BFD requires makeinfo,
and builds its info file as part of "all".  So, I think this change
doesn't worsen the situation for users in any way, and can simply go
in.

gdb/doc/ChangeLog
2019-04-07  Tom Tromey  <tom@tromey.com>

* Makefile.in (all): Depend on "info".

5 years agoprint_insn_powerpc tidy
Alan Modra [Sun, 7 Apr 2019 11:17:06 +0000 (20:47 +0930)]
print_insn_powerpc tidy

* ppc-dis.c (print_insn_powerpc): Use a tiny state machine
op_separator to control printing of spaces, comma and parens
rather than need_comma, need_paren and spaces vars.

5 years agoPR24421, Wrong brackets in opcodes/arm-dis.c
Alan Modra [Sun, 7 Apr 2019 11:12:16 +0000 (20:42 +0930)]
PR24421, Wrong brackets in opcodes/arm-dis.c

PR 24421
* arm-dis.c (print_insn_coprocessor): Correct bracket placement.
(print_insn_neon, print_insn_arm): Likewise.

5 years agoMerge libiberty from gcc
Alan Modra [Sun, 7 Apr 2019 11:11:49 +0000 (20:41 +0930)]
Merge libiberty from gcc

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

5 years agoRevert the header-sorting patch
Tom Tromey [Sat, 6 Apr 2019 19:38:10 +0000 (13:38 -0600)]
Revert the header-sorting patch

Andreas Schwab and John Baldwin pointed out some bugs in the header
sorting patch; and I noticed that the output was not correct when
limited to a subset of files (a bug in my script).

So, I'm reverting the patch.  I may try again after fixing the issues
pointed out.

gdb/ChangeLog
2019-04-05  Tom Tromey  <tom@tromey.com>

Revert the header-sorting patch.
* ft32-tdep.c: Revert.
* frv-tdep.c: Revert.
* frv-linux-tdep.c: Revert.
* frame.c: Revert.
* frame-unwind.c: Revert.
* frame-base.c: Revert.
* fork-child.c: Revert.
* findvar.c: Revert.
* findcmd.c: Revert.
* filesystem.c: Revert.
* filename-seen-cache.h: Revert.
* filename-seen-cache.c: Revert.
* fbsd-tdep.c: Revert.
* fbsd-nat.h: Revert.
* fbsd-nat.c: Revert.
* f-valprint.c: Revert.
* f-typeprint.c: Revert.
* f-lang.c: Revert.
* extension.h: Revert.
* extension.c: Revert.
* extension-priv.h: Revert.
* expprint.c: Revert.
* exec.h: Revert.
* exec.c: Revert.
* exceptions.c: Revert.
* event-top.c: Revert.
* event-loop.c: Revert.
* eval.c: Revert.
* elfread.c: Revert.
* dwarf2read.h: Revert.
* dwarf2read.c: Revert.
* dwarf2loc.c: Revert.
* dwarf2expr.h: Revert.
* dwarf2expr.c: Revert.
* dwarf2-frame.c: Revert.
* dwarf2-frame-tailcall.c: Revert.
* dwarf-index-write.h: Revert.
* dwarf-index-write.c: Revert.
* dwarf-index-common.c: Revert.
* dwarf-index-cache.h: Revert.
* dwarf-index-cache.c: Revert.
* dummy-frame.c: Revert.
* dtrace-probe.c: Revert.
* disasm.h: Revert.
* disasm.c: Revert.
* disasm-selftests.c: Revert.
* dictionary.c: Revert.
* dicos-tdep.c: Revert.
* demangle.c: Revert.
* dcache.h: Revert.
* dcache.c: Revert.
* darwin-nat.h: Revert.
* darwin-nat.c: Revert.
* darwin-nat-info.c: Revert.
* d-valprint.c: Revert.
* d-namespace.c: Revert.
* d-lang.c: Revert.
* ctf.c: Revert.
* csky-tdep.c: Revert.
* csky-linux-tdep.c: Revert.
* cris-tdep.c: Revert.
* cris-linux-tdep.c: Revert.
* cp-valprint.c: Revert.
* cp-support.c: Revert.
* cp-namespace.c: Revert.
* cp-abi.c: Revert.
* corelow.c: Revert.
* corefile.c: Revert.
* continuations.c: Revert.
* completer.h: Revert.
* completer.c: Revert.
* complaints.c: Revert.
* coffread.c: Revert.
* coff-pe-read.c: Revert.
* cli-out.h: Revert.
* cli-out.c: Revert.
* charset.c: Revert.
* c-varobj.c: Revert.
* c-valprint.c: Revert.
* c-typeprint.c: Revert.
* c-lang.c: Revert.
* buildsym.c: Revert.
* buildsym-legacy.c: Revert.
* build-id.h: Revert.
* build-id.c: Revert.
* btrace.c: Revert.
* bsd-uthread.c: Revert.
* breakpoint.h: Revert.
* breakpoint.c: Revert.
* break-catch-throw.c: Revert.
* break-catch-syscall.c: Revert.
* break-catch-sig.c: Revert.
* blockframe.c: Revert.
* block.c: Revert.
* bfin-tdep.c: Revert.
* bfin-linux-tdep.c: Revert.
* bfd-target.c: Revert.
* bcache.c: Revert.
* ax-general.c: Revert.
* ax-gdb.h: Revert.
* ax-gdb.c: Revert.
* avr-tdep.c: Revert.
* auxv.c: Revert.
* auto-load.c: Revert.
* arm-wince-tdep.c: Revert.
* arm-tdep.c: Revert.
* arm-symbian-tdep.c: Revert.
* arm-pikeos-tdep.c: Revert.
* arm-obsd-tdep.c: Revert.
* arm-nbsd-tdep.c: Revert.
* arm-nbsd-nat.c: Revert.
* arm-linux-tdep.c: Revert.
* arm-linux-nat.c: Revert.
* arm-fbsd-tdep.c: Revert.
* arm-fbsd-nat.c: Revert.
* arm-bsd-tdep.c: Revert.
* arch-utils.c: Revert.
* arc-tdep.c: Revert.
* arc-newlib-tdep.c: Revert.
* annotate.h: Revert.
* annotate.c: Revert.
* amd64-windows-tdep.c: Revert.
* amd64-windows-nat.c: Revert.
* amd64-tdep.c: Revert.
* amd64-sol2-tdep.c: Revert.
* amd64-obsd-tdep.c: Revert.
* amd64-obsd-nat.c: Revert.
* amd64-nbsd-tdep.c: Revert.
* amd64-nbsd-nat.c: Revert.
* amd64-nat.c: Revert.
* amd64-linux-tdep.c: Revert.
* amd64-linux-nat.c: Revert.
* amd64-fbsd-tdep.c: Revert.
* amd64-fbsd-nat.c: Revert.
* amd64-dicos-tdep.c: Revert.
* amd64-darwin-tdep.c: Revert.
* amd64-bsd-nat.c: Revert.
* alpha-tdep.c: Revert.
* alpha-obsd-tdep.c: Revert.
* alpha-nbsd-tdep.c: Revert.
* alpha-mdebug-tdep.c: Revert.
* alpha-linux-tdep.c: Revert.
* alpha-linux-nat.c: Revert.
* alpha-bsd-tdep.c: Revert.
* alpha-bsd-nat.c: Revert.
* aix-thread.c: Revert.
* agent.c: Revert.
* addrmap.c: Revert.
* ada-varobj.c: Revert.
* ada-valprint.c: Revert.
* ada-typeprint.c: Revert.
* ada-tasks.c: Revert.
* ada-lang.c: Revert.
* aarch64-tdep.c: Revert.
* aarch64-ravenscar-thread.c: Revert.
* aarch64-newlib-tdep.c: Revert.
* aarch64-linux-tdep.c: Revert.
* aarch64-linux-nat.c: Revert.
* aarch64-fbsd-tdep.c: Revert.
* aarch64-fbsd-nat.c: Revert.
* aarch32-linux-nat.c: Revert.

5 years agox86: Move x86-specific linker options to elf_linker_x86_params
H.J. Lu [Sat, 6 Apr 2019 14:25:10 +0000 (07:25 -0700)]
x86: Move x86-specific linker options to elf_linker_x86_params

Remove x86-specific linker options from bfd_link_info and put them in
elf_linker_x86_params.  Add _bfd_elf_linker_x86_set_options to pass
x86-specific linker options from ld to bfd.

bfd/

* elf-linker-x86.h: New file.
* elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params
to get x86-specific linker options.
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
(elf_x86_64_check_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_link_setup_gnu_properties): Likewise.
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise.
(_bfd_x86_elf_link_setup_gnu_properties): Likewise.
(_bfd_elf_linker_x86_set_options): New function.
* elfxx-x86.h: Include "elf-linker-x86.h".
(elf_x86_link_hash_table): Add params.

include/

* bfdlink.h (bfd_link_info): Remove x86-specific linker options.

ld/

* Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em.
(eelf_i386_sol2.c): Also depend on
$(srcdir)/emultempl/solaris2-x86.em.
(eelf_x86_64_sol2.c): Likewise.
* Makefile.in: Regenerated.
* emulparams/call_nop.sh: Set x86-specific linker options via
params.
* emulparams/cet.sh: Likewise.
* emulparams/reloc_overflow.sh: Likewise.
* emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New.  Set to
"elf-x86".
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_i386_be.sh: Likewise.
* emulparams/elf_i386_chaos.sh: Likewise.
* emulparams/elf_i386_ldso.sh: Likewise.
* emulparams/elf_i386_vxworks.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_k1om.sh: Likewise.
* emulparams/elf_l1om.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to
"solaris2-x86".
* emulparams/elf_x86_64_sol2.sh: Likewise.
* emultempl/elf-x86.em: New file.
* emultempl/solaris2-x86.em: Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't
set link_info.call_nop_byte.

5 years agoSort includes for files gdb/[a-f]*.[chyl].
Tom Tromey [Wed, 3 Apr 2019 02:04:24 +0000 (20:04 -0600)]
Sort includes for files gdb/[a-f]*.[chyl].

This patch sorts the include files for the files [a-f]*.[chyl].
The patch was written by a script.

Tested by the buildbot.

I will follow up with patches to sort the remaining files, by sorting
a subset, testing them, and then checking them in.

gdb/ChangeLog
2019-04-05  Tom Tromey  <tom@tromey.com>

* ft32-tdep.c: Sort headers.
* frv-tdep.c: Sort headers.
* frv-linux-tdep.c: Sort headers.
* frame.c: Sort headers.
* frame-unwind.c: Sort headers.
* frame-base.c: Sort headers.
* fork-child.c: Sort headers.
* findvar.c: Sort headers.
* findcmd.c: Sort headers.
* filesystem.c: Sort headers.
* filename-seen-cache.h: Sort headers.
* filename-seen-cache.c: Sort headers.
* fbsd-tdep.c: Sort headers.
* fbsd-nat.h: Sort headers.
* fbsd-nat.c: Sort headers.
* f-valprint.c: Sort headers.
* f-typeprint.c: Sort headers.
* f-lang.c: Sort headers.
* extension.h: Sort headers.
* extension.c: Sort headers.
* extension-priv.h: Sort headers.
* expprint.c: Sort headers.
* exec.h: Sort headers.
* exec.c: Sort headers.
* exceptions.c: Sort headers.
* event-top.c: Sort headers.
* event-loop.c: Sort headers.
* eval.c: Sort headers.
* elfread.c: Sort headers.
* dwarf2read.h: Sort headers.
* dwarf2read.c: Sort headers.
* dwarf2loc.c: Sort headers.
* dwarf2expr.h: Sort headers.
* dwarf2expr.c: Sort headers.
* dwarf2-frame.c: Sort headers.
* dwarf2-frame-tailcall.c: Sort headers.
* dwarf-index-write.h: Sort headers.
* dwarf-index-write.c: Sort headers.
* dwarf-index-common.c: Sort headers.
* dwarf-index-cache.h: Sort headers.
* dwarf-index-cache.c: Sort headers.
* dummy-frame.c: Sort headers.
* dtrace-probe.c: Sort headers.
* disasm.h: Sort headers.
* disasm.c: Sort headers.
* disasm-selftests.c: Sort headers.
* dictionary.c: Sort headers.
* dicos-tdep.c: Sort headers.
* demangle.c: Sort headers.
* dcache.h: Sort headers.
* dcache.c: Sort headers.
* darwin-nat.h: Sort headers.
* darwin-nat.c: Sort headers.
* darwin-nat-info.c: Sort headers.
* d-valprint.c: Sort headers.
* d-namespace.c: Sort headers.
* d-lang.c: Sort headers.
* ctf.c: Sort headers.
* csky-tdep.c: Sort headers.
* csky-linux-tdep.c: Sort headers.
* cris-tdep.c: Sort headers.
* cris-linux-tdep.c: Sort headers.
* cp-valprint.c: Sort headers.
* cp-support.c: Sort headers.
* cp-namespace.c: Sort headers.
* cp-abi.c: Sort headers.
* corelow.c: Sort headers.
* corefile.c: Sort headers.
* continuations.c: Sort headers.
* completer.h: Sort headers.
* completer.c: Sort headers.
* complaints.c: Sort headers.
* coffread.c: Sort headers.
* coff-pe-read.c: Sort headers.
* cli-out.h: Sort headers.
* cli-out.c: Sort headers.
* charset.c: Sort headers.
* c-varobj.c: Sort headers.
* c-valprint.c: Sort headers.
* c-typeprint.c: Sort headers.
* c-lang.c: Sort headers.
* buildsym.c: Sort headers.
* buildsym-legacy.c: Sort headers.
* build-id.h: Sort headers.
* build-id.c: Sort headers.
* btrace.c: Sort headers.
* bsd-uthread.c: Sort headers.
* breakpoint.h: Sort headers.
* breakpoint.c: Sort headers.
* break-catch-throw.c: Sort headers.
* break-catch-syscall.c: Sort headers.
* break-catch-sig.c: Sort headers.
* blockframe.c: Sort headers.
* block.c: Sort headers.
* bfin-tdep.c: Sort headers.
* bfin-linux-tdep.c: Sort headers.
* bfd-target.c: Sort headers.
* bcache.c: Sort headers.
* ax-general.c: Sort headers.
* ax-gdb.h: Sort headers.
* ax-gdb.c: Sort headers.
* avr-tdep.c: Sort headers.
* auxv.c: Sort headers.
* auto-load.c: Sort headers.
* arm-wince-tdep.c: Sort headers.
* arm-tdep.c: Sort headers.
* arm-symbian-tdep.c: Sort headers.
* arm-pikeos-tdep.c: Sort headers.
* arm-obsd-tdep.c: Sort headers.
* arm-nbsd-tdep.c: Sort headers.
* arm-nbsd-nat.c: Sort headers.
* arm-linux-tdep.c: Sort headers.
* arm-linux-nat.c: Sort headers.
* arm-fbsd-tdep.c: Sort headers.
* arm-fbsd-nat.c: Sort headers.
* arm-bsd-tdep.c: Sort headers.
* arch-utils.c: Sort headers.
* arc-tdep.c: Sort headers.
* arc-newlib-tdep.c: Sort headers.
* annotate.h: Sort headers.
* annotate.c: Sort headers.
* amd64-windows-tdep.c: Sort headers.
* amd64-windows-nat.c: Sort headers.
* amd64-tdep.c: Sort headers.
* amd64-sol2-tdep.c: Sort headers.
* amd64-obsd-tdep.c: Sort headers.
* amd64-obsd-nat.c: Sort headers.
* amd64-nbsd-tdep.c: Sort headers.
* amd64-nbsd-nat.c: Sort headers.
* amd64-nat.c: Sort headers.
* amd64-linux-tdep.c: Sort headers.
* amd64-linux-nat.c: Sort headers.
* amd64-fbsd-tdep.c: Sort headers.
* amd64-fbsd-nat.c: Sort headers.
* amd64-dicos-tdep.c: Sort headers.
* amd64-darwin-tdep.c: Sort headers.
* amd64-bsd-nat.c: Sort headers.
* alpha-tdep.c: Sort headers.
* alpha-obsd-tdep.c: Sort headers.
* alpha-nbsd-tdep.c: Sort headers.
* alpha-mdebug-tdep.c: Sort headers.
* alpha-linux-tdep.c: Sort headers.
* alpha-linux-nat.c: Sort headers.
* alpha-bsd-tdep.c: Sort headers.
* alpha-bsd-nat.c: Sort headers.
* aix-thread.c: Sort headers.
* agent.c: Sort headers.
* addrmap.c: Sort headers.
* ada-varobj.c: Sort headers.
* ada-valprint.c: Sort headers.
* ada-typeprint.c: Sort headers.
* ada-tasks.c: Sort headers.
* ada-lang.c: Sort headers.
* aarch64-tdep.c: Sort headers.
* aarch64-ravenscar-thread.c: Sort headers.
* aarch64-newlib-tdep.c: Sort headers.
* aarch64-linux-tdep.c: Sort headers.
* aarch64-linux-nat.c: Sort headers.
* aarch64-fbsd-tdep.c: Sort headers.
* aarch64-fbsd-nat.c: Sort headers.
* aarch32-linux-nat.c: Sort headers.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Apr 2019 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agox86: Add assembler -mx86-used-note=yes test
H.J. Lu [Fri, 5 Apr 2019 19:41:58 +0000 (12:41 -0700)]
x86: Add assembler -mx86-used-note=yes test

Check assembler -mx86-used-note=yes option and readelf -n output.

* testsuite/gas/i386/i386.exp: Run -mx86-used-note=yes tests.
* testsuite/gas/i386/property-2.d: New file.
* testsuite/gas/i386/property-2.s: Likewise.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.

5 years agox86: Support Intel AVX512 BF16
Xuepeng Guo [Fri, 5 Apr 2019 18:03:01 +0000 (11:03 -0700)]
x86: Support Intel AVX512 BF16

Add assembler and disassembler support Intel AVX512 BF16:

https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

gas/

2019-04-05  Xuepeng Guo  <xuepeng.guo@intel.com>

* config/tc-i386.c (cpu_arch): Add .avx512_bf16.
(cpu_noarch): Add noavx512_bf16.
* doc/c-i386.texi: Document avx512_bf16.
* testsuite/gas/i386/avx512_bf16.d: New file.
* testsuite/gas/i386/avx512_bf16.s: Likewise.
* testsuite/gas/i386/avx512_bf16_vl-inval.l: Likewise.
* testsuite/gas/i386/avx512_bf16_vl-inval.s: Likewise.
* testsuite/gas/i386/avx512_bf16_vl.d: Likewise.
* testsuite/gas/i386/avx512_bf16_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16_vl-inval.l: Likesie.
* testsuite/gas/i386/x86-64-avx512_bf16_vl-inval.s: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512_bf16_vl.s: Likewise.
* testsuite/gas/i386/i386.exp: Add BF16 related tests.

opcodes/

2019-04-05  Xuepeng Guo  <xuepeng.guo@intel.com>

* i386-dis-evex.h (evex_table): Updated to support BF16
instructions.
* i386-dis.c (enum): Add EVEX_W_0F3852_P_1, EVEX_W_0F3872_P_1
and EVEX_W_0F3872_P_3.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_BF16_FLAGS.
(cpu_flags): Add bitfield for CpuAVX512_BF16.
* i386-opc.h (enum): Add CpuAVX512_BF16.
(i386_cpu_flags): Add bitfield for cpuavx512_bf16.
* i386-opc.tbl: Add AVX512 BF16 instructions.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

5 years agoUse linux_get_auxv to get AT_PHDR in the PPC stub
Pedro Franco de Carvalho [Fri, 5 Apr 2019 17:19:08 +0000 (14:19 -0300)]
Use linux_get_auxv to get AT_PHDR in the PPC stub

This patch fixes a build error due to a call to ppc_get_auxv that was
left over after linux_get_hwcap and linux_get_hwcap2 were introduced
in:

974c89e0882ddb03e294eca76a9e3d3bef90eacf gdbserver: Add
linux_get_hwcap

Because the missing call fetched AT_PHDR and not AT_HWCAP,
linux_get_auxv is now visible.

This use also required ppc_get_auxv to return a status variable
indicating that the AT_PHDR entry was not found separately from the
actual value of of the auxv entry.  Therefore, the new linux_get_auxv
function is changed to return a status variable and write the entry
value to a pointer passed as an argument.

Note that linux_get_hwcap and linux_get_hwcap2 still use the return
value as both an indicator of that the entry wasn't found and as the
actual value of the entry.

gdb/gdbserver/ChangeLog:
2019-04-05  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* linux-low.c (linux_get_auxv): Remove static.  Return auxv entry
value in argument pointer, return 1 if the entry is found and 0
otherwise.  Move comment.
(linux_get_hwcap, linux_get_hwcap2): Use modified linux_get_auxv.
* linux-low.h (linux_get_auxv): Declare.
* linux-ppc-low.c (is_elfv2_inferior): Use linux_get_auxv.

5 years agoUse upper-case for metasyntactic in gdbserver help
Tom Tromey [Thu, 4 Apr 2019 22:48:28 +0000 (16:48 -0600)]
Use upper-case for metasyntactic in gdbserver help

I noticed that "gdbserver --help" contains a few metasyntactic
variables that aren't in upper-case.  This patch fixes them to conform
to the GNU standard.

gdb/gdbserver/ChangeLog
2019-04-05  Tom Tromey  <tromey@adacore.com>

* server.c (gdbserver_usage): Use upper-case for metasyntactic
variables.

5 years agoMove innermost_block_tracker global to parse_state
Tom Tromey [Sun, 31 Mar 2019 23:20:24 +0000 (17:20 -0600)]
Move innermost_block_tracker global to parse_state

This changes the parsing API so that callers that are interested in
tracking the innermost block must instantiate an
innermost_block_tracker and pass it in.  Then, a pointer to this
object is stored in the parser_state.

2019-04-04  Tom Tromey  <tom@tromey.com>

* varobj.c (varobj_create): Update.
* rust-exp.y (struct rust_parser) <update_innermost_block,
lookup_symbol>: New methods.
(rust_parser::update_innermost_block, rust_parser::lookup_symbol):
Rename.
(rust_parser::rust_lookup_type)
(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
* printcmd.c (display_command, do_one_display): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add
"tracker" parameter.
(block_tracker): New member.
(class innermost_block_tracker) <innermost_block_tracker>: Add
"types" parameter.
<reset>: Remove method.
(innermost_block): Don't declare.
(null_post_parser): Update.
* parse.c (innermost_block): Remove global.
(write_dollar_variable): Update.
(parse_exp_1, parse_exp_in_context): Add "tracker" parameter.
Remove "tracker_types" parameter.
(parse_expression): Add "tracker" parameter.
(parse_expression_for_completion): Update.
(null_post_parser): Add "tracker" parameter.
* p-exp.y: Update rules.
* m2-exp.y: Update rules.
* language.h (struct language_defn) <la_post_parser>: Add
"tracker" parameter.
* go-exp.y: Update rules.
* f-exp.y: Update rules.
* expression.h (parse_expression, parse_exp_1): Add "tracker"
parameter.
* d-exp.y: Update rules.
* c-exp.y: Update rules.
* breakpoint.c (set_breakpoint_condition): Create an
innermost_block_tracker.
(watch_command_1): Likewise.
* ada-lang.c (resolve): Add "tracker" parameter.
(resolve_subexp): Likewise.
* ada-exp.y (write_var_from_sym): Update.

5 years agoMove type stack handling to a new class
Tom Tromey [Sun, 31 Mar 2019 19:43:54 +0000 (13:43 -0600)]
Move type stack handling to a new class

This introduces a new "type_stack" class, and moves all the parser
type stack handling to this class.  Parsers that wish to use this
facility must now instantiate this class somehow.  I chose this
approach because a minority of the existing parsers require this.

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

* type-stack.h: New file.
* type-stack.c: New file.
* parser-defs.h (enum type_pieces, union type_stack_elt): Move to
type-stack.h.
(insert_into_type_stack, insert_type, push_type, push_type_int)
(insert_type_address_space, pop_type, pop_type_int)
(pop_typelist, pop_type_stack, append_type_stack)
(push_type_stack, get_type_stack, push_typelist)
(follow_type_instance_flags, follow_types): Don't declare.
* parse.c (type_stack): Remove global.
(parse_exp_in_context): Update.
(insert_into_type_stack, insert_type, push_type, push_type_int)
(insert_type_address_space, pop_type, pop_type_int)
(pop_typelist, pop_type_stack, append_type_stack)
(push_type_stack, get_type_stack, push_typelist)
(follow_type_instance_flags, follow_types): Remove (moved to
type-stack.c).
* f-exp.y (type_stack): New global.
Update rules.
(push_kind_type, f_parse): Update.
* d-exp.y (type_stack): New global.
Update rules.
(d_parse): Update.
* c-exp.y (struct c_parse_state) <type_stack>: New member.
Update rules.
* Makefile.in (COMMON_SFILES): Add type-stack.c.
(HFILES_NO_SRCDIR): Add type-stack.h.

5 years agoMove completion parsing to parser_state
Tom Tromey [Mon, 25 Mar 2019 04:50:14 +0000 (22:50 -0600)]
Move completion parsing to parser_state

This moves the globals and functions related to parsing for completion
to parser_state.  A new structure is introduced in order to return
completion results from the parse back to
parse_expression_for_completion.

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

* rust-exp.y (rust_parser::lex_identifier, rustyylex)
(rust_parser::convert_ast_to_expression, rust_parse)
(rust_lex_test_completion, rust_lex_tests): Update.
* parser-defs.h (struct expr_completion_state): New.
(struct parser_state) <parser_state>: Add completion parameter.
<mark_struct_expression, mark_completion_tag>: New methods.
<parse_completion, m_completion_state>: New members.
(prefixify_expression, null_post_parser): Update.
(mark_struct_expression, mark_completion_tag): Don't declare.
* parse.c (parse_completion, expout_last_struct)
(expout_tag_completion_type, expout_completion_name): Remove
globals.
(parser_state::mark_struct_expression)
(parser_state::mark_completion_tag): Now methods.
(prefixify_expression): Add last_struct parameter.
(prefixify_subexp): Likewise.
(parse_exp_1): Update.
(parse_exp_in_context): Add cstate parameter.  Update.
(parse_expression_for_completion): Create an
expr_completion_state.
(null_post_parser): Add "completion" parameter.
* p-exp.y: Update rules.
(yylex): Update.
* language.h (struct language_defn) <la_post_parser>: Add
"completing" parameter.
* go-exp.y: Update rules.
(lex_one_token): Update.
* expression.h (parse_completion): Don't declare.
* d-exp.y: Update rules.
(lex_one_token): Update rules.
* c-exp.y: Update rules.
(lex_one_token): Update.
* ada-lang.c (resolve): Add "parse_completion" parameter.
(resolve_subexp): Likewise.
(ada_resolve_function): Likewise.

5 years agoMove arglist_len et al to parser_state
Tom Tromey [Mon, 25 Mar 2019 03:38:40 +0000 (21:38 -0600)]
Move arglist_len et al to parser_state

This moves arglist_len, start_arglist, and end_arglist to
parser_state.

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

* parser-defs.h (struct parser_state) <start_arglist,
end_arglist>: New methods.
<arglist_len, m_funcall_chain>: New members.
(arglist_len, start_arglist, end_arglist): Don't declare.
* parse.c (arglist_len, funcall_chain): Remove global.
(start_arglist, end_arglist): Remove functions.
(parse_exp_in_context): Update.
* p-exp.y: Update rules.
* m2-exp.y: Update rules.
* go-exp.y: Update rules.
* f-exp.y: Update rules.
* d-exp.y: Update rules.
* c-exp.y: Update rules.

5 years agoMove lexptr and prev_lexptr to parser_state
Tom Tromey [Mon, 25 Mar 2019 03:30:56 +0000 (21:30 -0600)]
Move lexptr and prev_lexptr to parser_state

This removes the lexptr and prev_lexptr globals, in favor of members
of parser_state.  prev_lexptr could be isolated to each parser, but
since every parser uses it, that did not seem necessary.

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

* rust-exp.y (struct rust_parser) <lex_hex, lex_escape,
lex_operator, push_back>: New methods.
Update all rules.
(rust_parser::lex_hex, lex_escape): Rename and update.
(rust_parser::lex_string, rust_parser::lex_identifier): Update.
(rust_parser::lex_operator): Rename and update.
(rust_parser::lex_number, rustyylex, rustyyerror)
(rust_lex_test_init, rust_lex_test_sequence)
(rust_lex_test_push_back, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add "input"
parameter.
<lexptr, prev_lexptr>: New members.
(lexptr, prev_lexptr): Don't declare.
* parse.c (lexptr, prev_lexptr): Remove globals.
(parse_exp_in_context): Update.
* p-exp.y (yylex, yyerror): Update.
* m2-exp.y (parse_number, yylex, yyerror): Update.
* go-exp.y (lex_one_token, yyerror): Update.
* f-exp.y (match_string_literal, yylex, yyerror): Update.
* d-exp.y (lex_one_token, yyerror): Update.
* c-exp.y (scan_macro_expansion, finished_macro_expansion)
(lex_one_token, yyerror): Update.
* ada-lex.l (YY_INPUT): Update.
(rewind_to_char): Update.
* ada-exp.y (yyerror): Update.

5 years agoMove comma_terminates global to parser_state
Tom Tromey [Mon, 25 Mar 2019 00:07:00 +0000 (18:07 -0600)]
Move comma_terminates global to parser_state

This moves the comma_terminates global to parser_state.

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

* rust-exp.y (rustyylex, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add new
parameter.
<comma_terminates>: New member.
(comma_terminates): Don't declare global.
* parse.c (comma_terminates): Remove global.
(parse_exp_in_context): Update.
* p-exp.y (yylex): Update.
* m2-exp.y (yylex): Update.
* go-exp.y (lex_one_token): Update.
* f-exp.y (yylex): Update.
* d-exp.y (lex_one_token): Update.
* c-exp.y (lex_one_token): Update.
* ada-lex.l: Update.

5 years agoRemove paren_depth global
Tom Tromey [Sun, 24 Mar 2019 17:33:10 +0000 (11:33 -0600)]
Remove paren_depth global

This removes the "paren_depth" global.  In most cases, it is made into
a static global in a given parser.  I consider this a slight
improvement, because it makes it clear that the variable isn't used
for communication between different modules of gdb.  The one exception
is the Rust parser, which already incorporates all local state into a
transient object; in this case the parser depth is now a member.

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

* rust-exp.y (struct rust_parser) <paren_depth>: New member.
(rustyylex, rust_lex_test_init, rust_lex_test_one)
(rust_lex_test_sequence, rust_lex_test_push_back): Update.
* parser-defs.h (paren_depth): Don't declare.
* parse.c (paren_depth): Remove global.
(parse_exp_in_context): Update.
* p-exp.y (paren_depth): New global.
(pascal_parse): Initialize it.
* m2-exp.y (paren_depth): New global.
(m2_parse): Initialize it.
* go-exp.y (paren_depth): New global.
(go_parse): Initialize it.
* f-exp.y (paren_depth): New global.
(f_parse): Initialize it.
* d-exp.y (paren_depth): New global.
(d_parse): Initialize it.
* c-exp.y (paren_depth): New global.
(c_parse): Initialize it.
* ada-lex.l (paren_depth): New global.
(lexer_init): Initialize it.

5 years agoMove expression_context_* globals to parser_state
Tom Tromey [Sun, 24 Mar 2019 17:20:05 +0000 (11:20 -0600)]
Move expression_context_* globals to parser_state

This moves the expression_context_block and expression_context_pc
globals to be members of parser_state and updates the parsers.

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

* rust-exp.y (rust_parser::crate_name, rust_parser::super_name)
(rust_parser::convert_ast_to_type)
(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
* parser-defs.h (struct parser_state) <parser_state>: Add
parameters.  Initialize new members.
<expression_context_block, expression_context_pc>: New members.
* parse.c (expression_context_block, expression_context_pc):
Remove globals.
(parse_exp_in_context): Update.
* p-exp.y: Update all rules.
(yylex): Update.
* m2-exp.y: Update all rules.
(yylex): Update.
* go-exp.y (yylex): Update.
* f-exp.y (yylex): Update.
* d-exp.y: Update all rules.
(yylex): Update.
* c-exp.y: Update all rules.
(lex_one_token, classify_name, yylex, c_parse): Update.
* ada-exp.y (write_var_or_type, write_name_assoc): Update.

5 years agoMake base class for parser_state
Tom Tromey [Sun, 24 Mar 2019 16:28:42 +0000 (10:28 -0600)]
Make base class for parser_state

This makes a new base class, expr_builder, for parser_state.  This
separates the state needed to construct an expression from the state
needed by the parsers.

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

* gdbarch.h, gdbarch.c: Rebuild.
* gdbarch.sh (dtrace_parse_probe_argument): Change type.
* stap-probe.h:
(struct stap_parse_info): Replace "parser_state" with
"expr_builder".
* parser-defs.h (struct expr_builder): Rename from "parser_state".
(parser_state): New class.
* parse.c (expr_builder): Rename.
(expr_builder::release): Rename.
(write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym)
(write_exp_elt_msym, write_exp_elt_block, write_exp_elt_objfile)
(write_exp_elt_longcst, write_exp_elt_floatcst)
(write_exp_elt_type, write_exp_elt_intern, write_exp_string)
(write_exp_string_vector, write_exp_bitstring)
(write_exp_msymbol, mark_struct_expression)
(write_dollar_variable)
(insert_type_address_space, increase_expout_size): Replace
"parser_state" with "expr_builder".
* dtrace-probe.c: Replace "parser_state" with "expr_builder".
* amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Replace
"parser_state" with "expr_builder".

5 years agoTurn parse_language into a method
Tom Tromey [Sun, 24 Mar 2019 15:01:18 +0000 (09:01 -0600)]
Turn parse_language into a method

This changes parse_language into a method of parser_state.  This patch
was written by a script.

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

* rust-exp.y: Replace "parse_language" with method call.
* p-exp.y:
(yylex): Replace "parse_language" with method call.
* m2-exp.y:
(yylex): Replace "parse_language" with method call.
* go-exp.y (classify_name): Replace "parse_language" with method
call.
* f-exp.y (yylex): Replace "parse_language" with method call.
* d-exp.y (lex_one_token): Replace "parse_language" with method
call.
* c-exp.y:
(lex_one_token, classify_name, yylex): Replace "parse_language"
with method call.
* ada-exp.y (find_primitive_type, type_char)
(type_system_address): Replace "parse_language" with method call.

5 years agoTurn parse_gdbarch into a method
Tom Tromey [Sun, 24 Mar 2019 14:56:33 +0000 (08:56 -0600)]
Turn parse_gdbarch into a method

This changes parse_gdbarch into a method of parser_state.  This patch
was written by a script.

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

* rust-exp.y: Replace "parse_gdbarch" with method call.
* parse.c (write_dollar_variable, insert_type_address_space):
Replace "parse_gdbarch" with method call.
* p-exp.y (parse_type, yylex): Replace "parse_gdbarch" with method
call.
* objc-lang.c (end_msglist): Replace "parse_gdbarch" with method
call.
* m2-exp.y (parse_type, parse_m2_type, yylex): Replace
"parse_gdbarch" with method call.
* go-exp.y (parse_type, classify_name): Replace "parse_gdbarch"
with method call.
* f-exp.y (parse_type, parse_f_type, yylex): Replace
"parse_gdbarch" with method call.
* d-exp.y (parse_type, parse_d_type, lex_one_token): Replace
"parse_gdbarch" with method call.
* c-exp.y (parse_type, parse_number, classify_name): Replace
"parse_gdbarch" with method call.
* ada-lex.l: Replace "parse_gdbarch" with method call.
* ada-exp.y (parse_type, find_primitive_type, type_char)
(type_system_address): Replace "parse_gdbarch" with method call.

5 years agoRemove parser_state "initial_size" parameter
Tom Tromey [Sun, 24 Mar 2019 14:40:32 +0000 (08:40 -0600)]
Remove parser_state "initial_size" parameter

All the real (not test) uses of parser_state pass 10 as the
"initial_size" parameter, and it seems to me that there's no real
reason to require callers to set this.  This patch removes this
parameter.

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

* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
* stap-probe.c (stap_parse_argument): Update.
* stap-probe.h (struct stap_parse_info) <stap_parse_info>: Remove
initial_size parameter.
* rust-exp.y (rust_lex_tests): Update.
* parse.c (parser_state): Update.
(parse_exp_in_context): Update.
* parser-defs.h (struct parser_state) <parser_state>: Remove
"initial_size" parameter.

5 years agoMake increase_expout_size static
Tom Tromey [Sun, 24 Mar 2019 14:25:58 +0000 (08:25 -0600)]
Make increase_expout_size static

increase_expout_size is only called from parse.c, and probably only
should be.  This makes it "static".  Tested by rebuilding.

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

* parser-defs.h (increase_expout_size): Don't declare.
* parse.c (increase_expout_size): Now static.

5 years agoPowerPC conditional branch test
Alan Modra [Thu, 4 Apr 2019 01:32:31 +0000 (12:02 +1030)]
PowerPC conditional branch test

Adds a new test checking conditional branch BO values.

* testsuite/gas/ppc/bc.s,
* testsuite/gas/ppc/bcat.d,
* testsuite/gas/ppc/bcaterr.d,
* testsuite/gas/ppc/bcaterr.l,
* testsuite/gas/ppc/bcy.d,
* testsuite/gas/ppc/bcyerr.d,
* testsuite/gas/ppc/bcyerr.l: New tests.
* testsuite/gas/ppc/ppc.exp: Run them.

5 years agoPowerPC bc extended branch mnemonics and "y" hints
Alan Modra [Thu, 4 Apr 2019 07:49:03 +0000 (18:19 +1030)]
PowerPC bc extended branch mnemonics and "y" hints

This patch fixes a problem with disassembly of branch instructions
for processors complying with PowerPC ISA versions prior to version
2.0, ie. those that use "y" bit branch taken hints.  Many of the
extended bcctr and bclr mnemonics that should have disassembled with a
"-" suffix, ie. not taken, did not display the "-" due to the ordering
in powerpc_opcodes.  I believe it's been that way from the original
85dcf36d72b commit of ppc-opc.c.

I've also added a BH field (optional) to a few opcodes.  This gives
better disassembly in raw mode, showing the branch taken hint in the
mnemonic as is done for bc.  It would be reasonable to add a BH
field to all bcctr, bclr, and bctar extended mnemonics but that runs
into a small difficulty:  Currently we print all or none of the
optional operands.  That means for example that "bgectr cr2" would
display as "bgectr cr2,0" if a BH field is added to bgectr.

* ppc-opc.c (XLBH_MASK): Subtract off BH field from BB_MASK.
(powerpc_opcodes): Reorder bcctr and bclr extended mnemonics
to favour printing of "-" branch hint when using the "y" bit.
Allow BH field on bc{ctr,lr,tar}{,l}{-,+}.

5 years agoPowerPC disassembler: Don't emit trailing spaces
Alan Modra [Thu, 4 Apr 2019 22:50:16 +0000 (09:20 +1030)]
PowerPC disassembler: Don't emit trailing spaces

When an instruction has operands, the PowerPC disassembler prints
spaces after the opcode so as to line up operands.  If the operands
are all optional and all default value, then no operands are printed,
leaving trailing spaces.  This patch fixes that.

opcodes/
* ppc-dis.c (print_insn_powerpc): Delay printing spaces after
opcode until first operand is output.
gas/
* testsuite/gas/ppc/476.d: Remove trailing spaces.
* testsuite/gas/ppc/a2.d: Likewise.
* testsuite/gas/ppc/booke.d: Likewise.
* testsuite/gas/ppc/booke_xcoff.d: Likewise.
* testsuite/gas/ppc/e500.d: Likewise.
* testsuite/gas/ppc/e500mc.d: Likewise.
* testsuite/gas/ppc/e6500.d: Likewise.
* testsuite/gas/ppc/htm.d: Likewise.
* testsuite/gas/ppc/power6.d: Likewise.
* testsuite/gas/ppc/power8.d: Likewise.
* testsuite/gas/ppc/power9.d: Likewise.
* testsuite/gas/ppc/vle.d: Likewise.
ld/
* testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces.
* testsuite/ld-powerpc/tlsopt5.d: Likewise.
* testsuite/ld-powerpc/tlsopt5_32.d: Likewise.

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

5 years agoAdd extended mnemonics for bctar. Fix setting of 'at' branch hints.
Peter Bergner [Thu, 4 Apr 2019 14:00:29 +0000 (09:00 -0500)]
Add extended mnemonics for bctar. Fix setting of 'at' branch hints.

opcodes/
PR gas/24349
* ppc-opc.c (valid_bo_pre_v2): Add comments.
(valid_bo_post_v2): Add support for 'at' branch hints.
(insert_bo): Only error on branch on ctr.
(get_bo_hint_mask): New function.
(insert_boe): Add new 'branch_taken' formal argument.  Add support
for inserting 'at' branch hints.
(extract_boe): Add new 'branch_taken' formal argument.  Add support
for extracting 'at' branch hints.
(insert_bom, extract_bom, insert_bop, extract_bop): New functions.
(BOE): Delete operand.
(BOM, BOP): New operands.
(RM): Update value.
(XLYLK, XLYLK_MASK, XLYBB_MASK): Delete.
(powerpc_opcodes) <bc-, bcl-, bca-, bcla-, bclr-, bclrl-, bcctr-,
bcctrl-, bctar-, bctarl->: Replace BOE with BOM.
(powerpc_opcodes) <bc+, bcl+, bca+, bcla+, bclr+, bclrl+, bcctr+,
bcctrl+, bctar+, bctarl+>: Replace BOE with BOP.
<bdnztar, bdnztarl, bdztar, bdztarl, btar, btarl, bdnztar-, bdnztarl-,
bdnztar+, bdnztarl+, bdztar-, bdztarl-, bdztar+, bdztarl+, bgetar,
bnltar, bgetarl, bnltarl, bletar, bngtar, bletarl, bngtarl, bnetar,
bnetarl, bnstar, bnutar, bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-,
bnltarl-, bletar-, bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-,
bnstar-, bnutar-, bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+,
bnltarl+, bletar+, bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+,
bnstar+, bnutar+, bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl,
beqtar, beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-,
bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-,
buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+,
bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar,
bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar,
bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+,
bttarl+>: New extended mnemonics.

gas/
PR gas/24349
* testsuite/gas/ppc/power8.s: (bdnztar, bdnztarl, bdztar, bdztarl,
btar, btarl, bdnztar-, bdnztarl-, bdnztar+, bdnztarl+, bdztar-,
bdztarl-, bdztar+, bdztarl+, bgetar, bnltar, bgetarl, bnltarl,
bletar, bngtar, bletarl, bngtarl, bnetar, bnetarl, bnstar, bnutar,
bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-, bnltarl-, bletar-,
bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-, bnstar-, bnutar-,
bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+, bnltarl+, bletar+,
bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+, bnstar+, bnutar+,
bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl, beqtar,
beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-,
bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-,
buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+,
bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar,
bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar,
bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+,
bttarl+): Add tests of extended mnemonics.
* testsuite/gas/ppc/power8.d: Likewise.  Update previous bctar tests
to expect new extended mnemonics.
* testsuite/gas/ppc/a2.s: <bc, bc-, bc+, bcl, bcl-, bcl+>: Update test
to not use illegal BO value.  Use a more convenient BI value.
* testsuite/gas/ppc/a2.d: Update tests for new expect output.

5 years ago[GDB, Hurd] Fix build; 'target_waitstatus_to_string' call
Thomas Schwinge [Thu, 4 Apr 2019 09:20:09 +0000 (11:20 +0200)]
[GDB, Hurd] Fix build; 'target_waitstatus_to_string' call

Recent commit c29705b71a8ec966478c0dc4712194a95291c6de removed an incomplete
local implementation in favor of 'target_waitstatus_to_string' (thanks!), but
introduced a small typing error:

    In file included from [...]/gdb/gnu-nat.c:24:0:
    [...]/gdb/gnu-nat.c: In member function 'virtual ptid_t gnu_nat_target::wait(ptid_t, target_waitstatus*, int)':
    [...]/gdb/gnu-nat.c:1652:43: error: cannot convert 'target_waitstatus**' to 'const target_waitstatus*' for argument '1' to 'std::__cxx11::string target_waitstatus_to_string(const target_waitstatus*)'
           target_waitstatus_to_string (&status).c_str ());
                                               ^
    [...]/gdb/gnu-nat.h:119:32: note: in definition of macro 'debug'
            __FILE__ , __LINE__ , ##args); } while (0)
                                    ^~~~
    [...]/gdb/gnu-nat.c:1650:3: note: in expansion of macro 'inf_debug'
       inf_debug (inf, "returning ptid = %s, %s",
       ^~~~~~~~~

gdb/
* gnu-nat.c (gnu_nat_target::wait): Fix
target_waitstatus_to_string call.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 4 Apr 2019 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agogas: use literals/const16 for xtensa loop relaxation
Max Filippov [Tue, 2 Apr 2019 21:32:42 +0000 (14:32 -0700)]
gas: use literals/const16 for xtensa loop relaxation

Loop opcode relaxation that uses addi/addmi doesn't work well with other
relaxations that may cause code movement. Instead of encoding fixed loop
end offset in the relaxed sequence use l32r or a pair of const16 to load
loop end address. This way the address of the loop end gets a relocation
record and it gets updated appropriately.

gas/
2019-04-03  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (convert_frag_immed): Drop
convert_frag_immed_finish_loop invocation.
(convert_frag_immed_finish_loop): Drop declaration and
definition.
* config/xtensa-relax.c (widen_spec_list): Replace loop
widening that uses addi/addmi with widening that uses l32r
and const16.

5 years agoPR24411, Division is not accepted in MEMORY length expression
Alan Modra [Wed, 3 Apr 2019 00:51:36 +0000 (11:21 +1030)]
PR24411, Division is not accepted in MEMORY length expression

Let's hope no one has section names starting with '/' in scripts.  If
they do, this change to fix parsing of '/' in expressiongs will break
their project.

PR 24411
ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
(<EXPRESSION>"/DISCARD/"): New.

5 years agoldlex.l tidy
Alan Modra [Wed, 3 Apr 2019 00:58:17 +0000 (11:28 +1030)]
ldlex.l tidy

Underscore was specified twice in all these patterns, and backslash
twice in some.  Flex warned about the $SYSROOT rule, which is covered
by earlier rules:  "ldlex.l:386: warning, rule cannot be matched".

* ldlex.l: Formatting.
(CMDFILENAMECHAR, CMDFILENAMECHAR1): Delete.
(FILENAMECHAR1, SYMBOLNAMECHAR1, FILENAMECHAR, WILDCHAR),
(NOCFILENAMECHAR): Remove duplicate chars.  Reorder.
(SYMBOLCHARN): Likewise.  Rename to SYMBOLNAMECHAR.
(<INPUTLIST>"$SYSROOT"..): Delete rule.

5 years agoBFD whitespace fixes
Alan Modra [Tue, 2 Apr 2019 06:08:20 +0000 (16:38 +1030)]
BFD whitespace fixes

* coff-i386.c, * coff-x86_64.c, * coffgen.c, * dwarf2.c,
* elf-m10200.c, * elf.c, * elf32-arm.c, * elf32-bfin.c,
* elf32-csky.c, * elf32-m32r.c, * elf32-microblaze.c, * elf32-pru.c,
* elf32-rx.c, * elf32-xgate.c, * elf64-sparc.c, * elfnn-ia64.c,
* elfxx-riscv.c, * elfxx-sparc.c, * linker.c, * mach-o.c,
* pe-x86_64.c, * pei-x86_64.c, * plugin.c: Whitespace fixes.