binutils-gdb.git
5 years agoRe: Sign-extend start and stop address inputs to objdump
Alan Modra [Fri, 10 May 2019 13:47:45 +0000 (23:17 +0930)]
Re: Sign-extend start and stop address inputs to objdump

git commit 2379f9c475 introduced an rx-elf test failure.  This fixes it.

* testsuite/binutils-all/objdump.exp (test_objdump_disas_limited),
(test_objdump_content_limited): Add text arg, use in place of .text.
(bintest_signed.o): Call get_standard_section_names for name of
text section.

5 years agoTwo minor constifications
Tom Tromey [Fri, 10 May 2019 13:17:48 +0000 (07:17 -0600)]
Two minor constifications

I noticed a couple of spots where a "char *" was used where a
"const char *" made more sense.  This patch fixes both of them.
Tested by rebuilding.

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

* thread.c (print_thread_info): Make "requested_threads" const.
* gdbthread.h (print_thread_info): Make "requested_threads"
const.
* ada-tasks.c (print_ada_task_info): Make "taskno_str" const.
* ada-lang.h (print_ada_task_info): Make "taskno_str" const.

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

5 years agoUpdate printing of optional operands during disassembly.
Peter Bergner [Thu, 9 May 2019 14:09:47 +0000 (09:09 -0500)]
Update printing of optional operands during disassembly.

opcodes/
* ppc-dis.c (skip_optional_operands): Change return type and returns.
(print_insn_powerpc) <skip_optional>: Change type.
Call skip_optional_operands if we have not skipped any operands.
gas/
* testsuite/gas/ppc/476.d: Update expected output.
* testsuite/gas/ppc/power6.d: Likewise.

5 years ago[gas][testsuite] Don't specify arch in testsuite output
Matthew Malcomson [Thu, 9 May 2019 13:52:45 +0000 (14:52 +0100)]
[gas][testsuite] Don't specify arch in testsuite output

My testcase matched against a file format of elf64-littleaarch64 in the
objdump output.  This was unnecessarily restrictive and causes testcase
failures on aarch64_be.

Here we remove that restriction.
Committed as obvious.

Testing done on aarch64_be-none-elf gas to see the failure goes away.

gas/ChangeLog:

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

* testsuite/gas/aarch64/sve2.d: Remove file format restriction.

5 years ago[gdb/testsuite] Fix gdb.arch/amd64-tailcall-self.S
Tom de Vries [Thu, 9 May 2019 10:24:38 +0000 (12:24 +0200)]
[gdb/testsuite] Fix gdb.arch/amd64-tailcall-self.S

The test-case gdb.arch/amd64-tailcall-self.exp fails here:
...
if ![runto b] {
    return -1
}
...
like:
...
(gdb) file build/gdb/testsuite/outputs/gdb.arch/amd64-tailcall-self/\
  amd64-tailcall-self
Reading symbols from build/gdb/testsuite/outputs/gdb.arch/\
  amd64-tailcall-self/amd64-tailcall-self...
Dwarf Error: Cannot find DIE at 0x1f5 referenced from DIE at 0x107 [in \
  module build/gdb/testsuite/outputs/gdb.arch/amd64-tailcall-self/\
  amd64-tailcall-self]
...

The problem is that in amd64-tailcall-self.S, CU-relative references are
assigned .debug_info section relative values.  [ This is similar to the
problem fixed by "Fix gdb.arch/amd64-entry-value-paramref.S". ]

Fix this by assigning CU-relative references instead.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* gdb.arch/amd64-tailcall-self.S: Make DW_FORM_ref4 references
CU-relative.

5 years ago[binutils][aarch64] Add SVE2 tests
Matthew Malcomson [Thu, 9 May 2019 09:29:29 +0000 (10:29 +0100)]
[binutils][aarch64] Add SVE2 tests

Add tests that SVE2 instructions are encoded as they should be, and
tests that invalid instructions have their problems reported.

Also check that each sve2 cryptographic extension is required to use the
corresponding cryptographic instructions.

Finally, test to ensure that sve2 instructions using mnemonics that
exist in sve1 still need the sve2 feature to be used.

gas/ChangeLog:

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

* testsuite/gas/aarch64/illegal-sve2-aes.d: New test.
* testsuite/gas/aarch64/illegal-sve2-bitperm.d: New test.
* testsuite/gas/aarch64/illegal-sve2-sha3.d: Test new instructions.
* testsuite/gas/aarch64/illegal-sve2-sm4.d: Test new instructions.
* testsuite/gas/aarch64/illegal-sve2-sve1ext.d: Test new instructions.
* testsuite/gas/aarch64/illegal-sve2-sve1ext.l: Test new instructions.
* testsuite/gas/aarch64/illegal-sve2.d: Test new instructions.
* testsuite/gas/aarch64/illegal-sve2.l: Test new instructions.
* testsuite/gas/aarch64/illegal-sve2.s: Test new instructions.
* testsuite/gas/aarch64/sve1-extended-sve2.s: New test.
* testsuite/gas/aarch64/sve2.d: Test new instructions.
* testsuite/gas/aarch64/sve2.s: Test new instructions.

5 years ago[binutils][aarch64] Add SVE2 instructions.
Matthew Malcomson [Thu, 9 May 2019 09:29:28 +0000 (10:29 +0100)]
[binutils][aarch64] Add SVE2 instructions.

This patch adds all the SVE2 instructions and their associated qualifier
sets.
Ok for trunk?

opcodes/ChangeLog:

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

* aarch64-dis-2.c: Regenerate.
* aarch64-tbl.h (OP_SVE_BBU): New variant set.
(OP_SVE_BBB): New variant set.
(OP_SVE_DDDD): New variant set.
(OP_SVE_HHH): New variant set.
(OP_SVE_HHHU): New variant set.
(OP_SVE_SSS): New variant set.
(OP_SVE_SSSU): New variant set.
(OP_SVE_SHH): New variant set.
(OP_SVE_SBBU): New variant set.
(OP_SVE_DSS): New variant set.
(OP_SVE_DHHU): New variant set.
(OP_SVE_VMV_HSD_BHS): New variant set.
(OP_SVE_VVU_HSD_BHS): New variant set.
(OP_SVE_VVVU_SD_BH): New variant set.
(OP_SVE_VVVU_BHSD): New variant set.
(OP_SVE_VVV_QHD_DBS): New variant set.
(OP_SVE_VVV_HSD_BHS): New variant set.
(OP_SVE_VVV_HSD_BHS2): New variant set.
(OP_SVE_VVV_BHS_HSD): New variant set.
(OP_SVE_VV_BHS_HSD): New variant set.
(OP_SVE_VVV_SD): New variant set.
(OP_SVE_VVU_BHS_HSD): New variant set.
(OP_SVE_VZVV_SD): New variant set.
(OP_SVE_VZVV_BH): New variant set.
(OP_SVE_VZV_SD): New variant set.
(aarch64_opcode_table): Add sve2 instructions.

5 years ago[binutils][aarch64] New SVE_SHLIMM_UNPRED_22 operand.
Matthew Malcomson [Thu, 9 May 2019 09:29:27 +0000 (10:29 +0100)]
[binutils][aarch64] New SVE_SHLIMM_UNPRED_22 operand.

New operand describes a shift-left immediate encoded in bits
22:20-19:18-16 where UInt(bits) - esize == shift.
This operand is useful for instructions like sshllb.

gas/ChangeLog:

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

* config/tc-aarch64.c (parse_operands): Handle new SVE_SHLIMM_UNPRED_22
operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New SVE_SHLIMM_UNPRED_22
operand.

opcodes/ChangeLog:

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

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
* aarch64-opc.c (operand_general_constraint_met_p): Constraint checking
for SVE_SHLIMM_UNPRED_22.
(aarch64_print_operand): Add printing for SVE_SHLIMM_UNPRED_22.
* aarch64-tbl.h (AARCH64_OPERANDS): Use new SVE_SHLIMM_UNPRED_22
operand.

5 years ago[binutils][aarch64] New sve_size_tsz_bhs iclass.
Matthew Malcomson [Thu, 9 May 2019 09:29:26 +0000 (10:29 +0100)]
[binutils][aarch64] New sve_size_tsz_bhs iclass.

Add sve_size_tsz_bhs iclass needed for sqxtnb and similar instructions.
This iclass encodes one of three variants by the most significant bit
set in a 3-bit value where only one bit may be set.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_insn_class): Add sve_size_tsz_bhs
iclass.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Handle
sve_size_tsz_bhs iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_size_tsz_bhs iclass decode.

5 years ago[binutils][aarch64] New SVE_Zm4_11_INDEX operand.
Matthew Malcomson [Thu, 9 May 2019 09:29:24 +0000 (10:29 +0100)]
[binutils][aarch64] New SVE_Zm4_11_INDEX operand.

This includes defining a new single bit field SVE_i2h at position 20.
SVE_Zm4_11_INDEX handles indexed Zn registers where the index is encoded
in bits 20:11 and the register is chosed from range z0-z15 in bits 19-16.

gas/ChangeLog:

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

* config/tc-aarch64.c (parse_operands): Handle new SVE_Zm4_11_INDEX
operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New SVE_Zm4_11_INDEX operand.

opcodes/ChangeLog:

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

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
* aarch64-opc.c (operand_general_constraint_met_p): Constraint checking
for SVE_Zm4_11_INDEX.
(aarch64_print_operand): Add printing for SVE_Zm4_11_INDEX.
(fields): Handle SVE_i2h field.
* aarch64-opc.h (enum aarch64_field_kind): New SVE_i2h field.
* aarch64-tbl.h (AARCH64_OPERANDS): Use new SVE_Zm4_11_INDEX operand.

5 years ago[binutils][aarch64] New sve_shift_tsz_bhsd iclass.
Matthew Malcomson [Thu, 9 May 2019 09:29:23 +0000 (10:29 +0100)]
[binutils][aarch64] New sve_shift_tsz_bhsd iclass.

This new iclass encodes the variant by which is the most significant bit
used of bits 23-22:20-19, where those bits are usually part of a
given constant operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_insn_class): Add sve_shift_tsz_bhsd
iclass.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Handle
sve_shift_tsz_bhsd iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_shift_tsz_bhsd iclass decode.

5 years ago[binutils][aarch64] New SVE_SHRIMM_UNPRED_22 operand.
Matthew Malcomson [Thu, 9 May 2019 09:29:22 +0000 (10:29 +0100)]
[binutils][aarch64] New SVE_SHRIMM_UNPRED_22 operand.

Include a new iclass to extract the variant from the most significant 3
bits of this operand.

Instructions such as rshrnb include a constant shift amount as an
operand, where the most significant three bits of this operand determine
what size elements the instruction is operating on.

The new SVE_SHRIMM_UNPRED_22 operand denotes this constant encoded in
bits 22:20-19:18-16 while the new sve_shift_tsz_hsd iclass denotes that
the SVE qualifier is encoded in bits 22:20-19.

gas/ChangeLog:

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

* config/tc-aarch64.c (parse_operands): Handle new SVE_SHRIMM_UNPRED_22
operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New SVE_SHRIMM_UNPRED_22
operand.
(enum aarch64_insn_class): Add sve_shift_tsz_hsd iclass.

opcodes/ChangeLog:

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

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
* aarch64-asm.c (aarch64_ins_sve_shrimm):
(aarch64_encode_variant_using_iclass): Handle
sve_shift_tsz_hsd iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_shift_tsz_hsd iclass decode.
* aarch64-opc.c (operand_general_constraint_met_p): Constraint checking
for SVE_SHRIMM_UNPRED_22.
(aarch64_print_operand): Add printing for SVE_SHRIMM_UNPRED_22.
* aarch64-tbl.h (AARCH64_OPERANDS): Use new SVE_SHRIMM_UNPRED_22
operand.

5 years ago[binutils][aarch64] New sve_size_013 iclass.
Matthew Malcomson [Thu, 9 May 2019 09:29:21 +0000 (10:29 +0100)]
[binutils][aarch64] New sve_size_013 iclass.

Add sve_size_013 instruction class

This new iclass handles instructions such as pmullb whose size specifier
can only be encoded as 0, 1, or 3.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_insn_class): Add sve_size_013 iclass.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Handle
sve_size_013 iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_size_013 iclass decode.

5 years ago[binutils][aarch64] New sve_size_bh iclass.
Matthew Malcomson [Thu, 9 May 2019 09:29:20 +0000 (10:29 +0100)]
[binutils][aarch64] New sve_size_bh iclass.

Add new iclass sve_size_bh to handle instructions that have two variants
encoded with the SVE_sz field.
This iclass behaves the same as the sve_size_sd iclass, but it has a
nicer name for those instructions that choose between variants using the
"B" and "H" size qualifiers.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_insn_class): Add sve_size_bh iclass.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Handle
sve_size_bh iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_size_bh iclass decode.

5 years ago[binutils][aarch64] New sve_size_sd2 iclass.
Matthew Malcomson [Thu, 9 May 2019 09:29:19 +0000 (10:29 +0100)]
[binutils][aarch64] New sve_size_sd2 iclass.

Define new sve_size_sd2 iclass to distinguish between the two variants
of ldnt1sb and ldnt1sh.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_insn_class): Add sve_size_sd2 iclass.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Handle
sve_size_sd2 iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_size_sd2 iclass decode.
* aarch64-opc.c (fields): Handle SVE_sz2 field.
* aarch64-opc.h (enum aarch64_field_kind): New SVE_sz2 field.

5 years ago[binutils][aarch64] New SVE_ADDR_ZX operand.
Matthew Malcomson [Thu, 9 May 2019 09:29:18 +0000 (10:29 +0100)]
[binutils][aarch64] New SVE_ADDR_ZX operand.

Add AARCH64_OPND_SVE_ADDR_ZX operand that allows a vector of addresses
in a Zn register, offset by an Xm register.
This is used with scatter/gather SVE2 instructions.

gas/ChangeLog:

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

* config/tc-aarch64.c (REG_ZR): Macro specifying zero register.
(parse_address_main): Account for new addressing mode [Zn.S, Xm].
(parse_operands): Handle new SVE_ADDR_ZX operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New SVE_ADDR_ZX operand.

opcodes/ChangeLog:

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

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
* aarch64-opc.c (operand_general_constraint_met_p): Constraint checking
for SVE_ADDR_ZX.
(aarch64_print_operand): Add printing for SVE_ADDR_ZX.
* aarch64-tbl.h (AARCH64_OPERANDS): Use new SVE_ADDR_ZX operand.

5 years ago[binutils][aarch64] New SVE_Zm3_11_INDEX operand.
Matthew Malcomson [Thu, 9 May 2019 09:29:17 +0000 (10:29 +0100)]
[binutils][aarch64] New SVE_Zm3_11_INDEX operand.

Introduce new operand SVE_Zm3_11_INDEX that indicates a register between
z0-z7 stored in bits 18-16 and an index stored in bits 20-19:11.

gas/ChangeLog:

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

* config/tc-aarch64.c (parse_operands): Handle new SVE_Zm3_11_INDEX
operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New SVE_Zm3_11_INDEX operand.

opcodes/ChangeLog:

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

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
* aarch64-opc.c (operand_general_constraint_met_p): Constraint checking
for SVE_Zm3_11_INDEX.
(aarch64_print_operand): Add printing for SVE_Zm3_11_INDEX.
(fields): Handle SVE_i3l and SVE_i3h2 fields.
* aarch64-opc.h (enum aarch64_field_kind): New SVE_i3l and SVE_i3h2
fields.
* aarch64-tbl.h (AARCH64_OPERANDS): Use new SVE_Zm3_11_INDEX operand.

5 years ago[binutils][aarch64] New iclass sve_size_hsd2.
Matthew Malcomson [Thu, 9 May 2019 09:29:16 +0000 (10:29 +0100)]
[binutils][aarch64] New iclass sve_size_hsd2.

Add "sve_size_hsd2" iclass decode that uses the new FLD_SVE_size field
value to determine the variant of an instruction.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_insn_class): Add sve_size_hsd2 iclass.

opcodes/ChangeLog:

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

* aarch64-asm.c (aarch64_encode_variant_using_iclass): Handle
sve_size_hsd2 iclass encode.
* aarch64-dis.c (aarch64_decode_variant_using_iclass): Handle
sve_size_hsd2 iclass decode.
* aarch64-opc.c (fields): Handle SVE_size field.
* aarch64-opc.h (enum aarch64_field_kind): New SVE_size field.

5 years ago[binutils][aarch64] Introduce SVE_IMM_ROT3 operand.
Matthew Malcomson [Thu, 9 May 2019 09:29:15 +0000 (10:29 +0100)]
[binutils][aarch64] Introduce SVE_IMM_ROT3 operand.

New operand AARCH64_OPND_SVE_IMM_ROT3 handles a single bit rotate
operand encoded at bit position 10.

gas/ChangeLog:

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

* config/tc-aarch64.c (parse_operands): Handle new SVE_IMM_ROT3 operand.

include/ChangeLog:

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

* opcode/aarch64.h (enum aarch64_opnd): New SVE_IMM_ROT3 operand.

opcodes/ChangeLog:

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

* aarch64-asm-2.c: Regenerated.
* aarch64-dis-2.c: Regenerated.
* aarch64-opc-2.c: Regenerated.
* aarch64-opc.c (operand_general_constraint_met_p): Constraint checking
for SVE_IMM_ROT3.
(aarch64_print_operand): Add printing for SVE_IMM_ROT3.
(fields): Handle SVE_rot3 field.
* aarch64-opc.h (enum aarch64_field_kind): New SVE_rot3 field.
* aarch64-tbl.h (AARCH64_OPERANDS): Use new SVE_IMM_ROT3 operand.

5 years ago[binutils][aarch64] Allow movprfx for SVE2 instructions.
Matthew Malcomson [Thu, 9 May 2019 09:29:13 +0000 (10:29 +0100)]
[binutils][aarch64] Allow movprfx for SVE2 instructions.

SVE2 introduces a number of new instructions that work with the movprfx
instruction.  This commit ensures that SVE2 instructions are accounted
for.

opcodes/ChangeLog:

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

* aarch64-opc.c (verify_constraints): Check for movprfx for sve2
instructions.

5 years ago[binutils][aarch64] SVE2 feature extension flags.
Matthew Malcomson [Thu, 9 May 2019 09:29:12 +0000 (10:29 +0100)]
[binutils][aarch64] SVE2 feature extension flags.

Include all feature flag macros.

The "sve2" extension that enables the core sve2 instructions.
This also enables the sve extension, since sve is a requirement of sve2.

Extra optional sve2 features are the bitperm, sm4, aes, and sha3 extensions.
These are all given extra feature flags, "bitperm", "sve2-sm4",
"sve2-aes", and "sve2-sha3" respectively.
The sm4, aes, and sha3 extensions are explicitly marked as sve2
extensions to distinguish them from the corresponding NEON extensions.

Rather than continue extending the current feature flag numbers, I used
some bits that have been skipped.

gas/ChangeLog:

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

* config/tc-aarch64.c: Add command line architecture feature flags
"sve2", "sve2-sm4", "sve2-aes", "sve2-sha3", "bitperm".
* doc/c-aarch64.texi: Document new architecture feature flags.

include/ChangeLog:

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

* opcode/aarch64.h (AARCH64_FEATURE_SVE2
AARCH64_FEATURE_SVE2_AES, AARCH64_FEATURE_SVE2_BITPERM,
AARCH64_FEATURE_SVE2_SM4, AARCH64_FEATURE_SVE2_SHA3): New
feature macros.

opcodes/ChangeLog:

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

* aarch64-tbl.h
(aarch64_feature_sve2, aarch64_feature_sve2aes,
aarch64_feature_sve2sha3, aarch64_feature_sve2sm4,
aarch64_feature_sve2bitperm): New feature sets.
(SVE2, SVE2_AES, SVE2_SHA3, SVE2_SM4, SVE2_BITPERM): New macros
for feature set addresses.
(SVE2_INSN, SVE2_INSNC, SVE2AES_INSN, SVE2SHA3_INSN,
SVE2SM4_INSN, SVE2SM4_INSNC, SVE2BITPERM_INSN): New macros.

5 years agoUse the correct names for the init and fini array start symbols in the default Pru...
Dimitar Dimitrov [Thu, 9 May 2019 09:26:11 +0000 (10:26 +0100)]
Use the correct names for the init and fini array start symbols in the default Pru linker script.

* scripttempl/pru.sc (__init_array_begin, __init_array_begin):
Rename.

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

5 years ago[gdb/testsuite] Fix gdb.arch/amd64-entry-value-paramref.S
Tom de Vries [Wed, 8 May 2019 22:41:26 +0000 (00:41 +0200)]
[gdb/testsuite] Fix gdb.arch/amd64-entry-value-paramref.S

The file gdb.arch/amd64-entry-value-paramref.S contains a DIE for function
bar:
...
DIE29:  .uleb128 0x2    # (DIE (0x29) DW_TAG_subprogram)
        .ascii "bar\0"  # DW_AT_name
        .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
        .byte   0x15    # DW_AT_decl_line
        .long   DIE45   # DW_AT_type
        .byte   0x1     # DW_AT_inline
...
which refers to DIE45:
...
DIE45: .uleb128 0x4 # (DIE (0x45) DW_TAG_base_type)
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.ascii "int\0" # DW_AT_name
...
using a form DW_FORM_ref4:
...
.uleb128 0x2 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
...
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
...

However, the DW_FORM_ref4 is a CU-relative reference, while using a label for
the value will result in a section-relative value.

So, if linked in object files contain dwarf info and are placed in the
.debug_info section before the compilation units generated from
amd64-entry-value-paramref.S, then the referenced type is at 0x108:
...
 <1><108>: Abbrev Number: 4 (DW_TAG_base_type)
    <109>   DW_AT_byte_size   : 4
    <10a>   DW_AT_encoding    : 5       (signed)
    <10b>   DW_AT_name        : int
...
but the reference will point to a non-existing DIE at 0x1cf:
...
 <1><f0>: Abbrev Number: 2 (DW_TAG_subprogram)
    <f1>   DW_AT_name        : bar
    <f5>   DW_AT_decl_file   : 1
    <f6>   DW_AT_decl_line   : 21
    <f7>   DW_AT_type        : <0x1cf>
    <fb>   DW_AT_inline      : 1        (inlined)
...
which happens to cause a GDB internal error described in PR23270 - "GDB
internal error: dwarf2read.c:18656: internal-error: could not find partial
DIE 0x1b7 in cache".

Fix the invalid DWARF by making the reference value CU-relative:
...
-       .long   DIE45   # DW_AT_type
+       .long   DIE45 - .Ldebug_info0   # DW_AT_type
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* gdb.arch/amd64-entry-value-paramref.S: Make DW_FORM_ref4 references
CU-relative.

5 years agoConvert gdbtypes.c to type-safe registry API
Tom Tromey [Thu, 2 May 2019 22:13:50 +0000 (16:13 -0600)]
Convert gdbtypes.c to type-safe registry API

This changes gdbtypes.c to use the type-safe registry API.

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

* gdbtypes.c (objfile_type_data): Change type.
(objfile_type, _initialize_gdbtypes): Update.

5 years agoConvert dwarf2-frame.c to type-safe registry API
Tom Tromey [Thu, 2 May 2019 22:11:22 +0000 (16:11 -0600)]
Convert dwarf2-frame.c to type-safe registry API

This changes dwarf2-frame.c to use the type-safe registry API.

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

* dwarf2-frame.c (dwarf2_frame_objfile_data): Change type.
(dwarf2_frame_find_fde, dwarf2_build_frame_info)
(_initialize_dwarf2_frame): Update.

5 years agoConvert objc-lang.c to type-safe registry API
Tom Tromey [Thu, 2 May 2019 22:08:54 +0000 (16:08 -0600)]
Convert objc-lang.c to type-safe registry API

This changes objc-lang.c to use the type-safe registry API.

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

* objc-lang.c (objc_objfile_data): Change type.
(find_methods): Update.
(_initialize_objc_lang): Remove.

5 years agoConvert stabsread.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:50:33 +0000 (15:50 -0600)]
Convert stabsread.c to type-safe registry API

This changes stabsread.c to use the type-safe registry API.

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

* stabsread.c (rs6000_builtin_type_data): Change type.
(rs6000_builtin_type, _initialize_stabsread): Update.

5 years agoRemove mips_pdr_data
Tom Tromey [Wed, 1 May 2019 21:46:15 +0000 (15:46 -0600)]
Remove mips_pdr_data

mips_pdr_data is unused, so this patch removes it.

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

* mips-tdep.c (mips_pdr_data): Remove.
(_initialize_mips_tdep): Update.

5 years agoConvert hppa-tdep.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:44:00 +0000 (15:44 -0600)]
Convert hppa-tdep.c to type-safe registry API

This changes hppa-tdep.c to use the type-safe registry API.

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

* hppa-tdep.c (hppa_objfile_priv_data): Change type.
(hppa_init_objfile_priv_data, read_unwind_info)
(find_unwind_entry, _initialize_hppa_tdep): Update.

5 years agoConvert elfread.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:41:13 +0000 (15:41 -0600)]
Convert elfread.c to type-safe registry API

This changes elfread.c to use the type-safe registry API.  This also
fixes a potential memory leak, by changing the hash table so that it
is no longer allocated on an obstack.

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

* elfread.c (elf_objfile_gnu_ifunc_cache_data): Change type.
(elf_gnu_ifunc_record_cache): Update.  Don't allocate hash table
on obstack.
(elf_gnu_ifunc_resolve_by_cache, _initialize_elfread): Update.

5 years agoConvert mdebugread.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:31:10 +0000 (15:31 -0600)]
Convert mdebugread.c to type-safe registry API

This changes mdebugread.c to use the type-safe registry API.

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

* mdebugread.c (basic_type_data): Change type.
(basic_type, _initialize_mdebugread): Update.

5 years agoAdd a noop deleter
Tom Tromey [Wed, 1 May 2019 21:28:18 +0000 (15:28 -0600)]
Add a noop deleter

This adds a no-op deleter, which is used in subsequent patches.

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

* common/gdb_unique_ptr.h (struct noop_deleter): New.

5 years agoConvert nto-tdep.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:21:36 +0000 (15:21 -0600)]
Convert nto-tdep.c to type-safe registry API

This changes nto-tdep.c to use the type-safe registry API.

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

* nto-tdep.c (nto_inferior_data_reg): Change type.
(nto_inferior_data): Update.
(nto_inferior_data_cleanup, nto_new_inferior_data)
(_initialize_nto_tdep): Remove.
* nto-tdep.h (struct nto_inferior_data): Add initializers.

5 years agoConvert ada-lang.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:18:31 +0000 (15:18 -0600)]
Convert ada-lang.c to type-safe registry API

This changes ada-lang.c to use the type-safe registry API.

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

* ada-lang.c (struct ada_inferior_data): Add initializers.
(ada_inferior_data): Change type.
(ada_inferior_data_cleanup): Remove.
(get_ada_inferior_data, ada_inferior_exit)
(struct ada_pspace_data): Add initializers, destructor.
(ada_pspace_data_handle): Change type.
(get_ada_pspace_data): Update.
(ada_pspace_data_cleanup): Remove.

5 years agoConvert coffread.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:09:25 +0000 (15:09 -0600)]
Convert coffread.c to type-safe registry API

This changes coffread.c to use the type-safe registry API.

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

* coffread.c (struct coff_symfile_info): Add initializers.
(coff_objfile_data_key): Move lower.  Change type.
(coff_symfile_init, coff_symfile_read, _initialize_coffread):
Update.
(coff_free_info): Remove.

5 years agoConvert fbsd-tdep.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:05:58 +0000 (15:05 -0600)]
Convert fbsd-tdep.c to type-safe registry API

This changes fbsd-tdep.c to use the type-safe registry API.

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

* fbsd-tdep.c (struct fbsd_pspace_data): Add initializers.
(fbsd_pspace_data_handle): Move lower.  Change type.
(get_fbsd_pspace_data): Update.
(fbsd_pspace_data_cleanup): Remove.
(_initialize_fbsd_tdep): Update.

5 years agoConvert ada-tasks.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 21:02:27 +0000 (15:02 -0600)]
Convert ada-tasks.c to type-safe registry API

This changes ada-tasks.c to use the type-safe registry API.

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

* ada-tasks.c (ada_tasks_pspace_data_handle): Change type.
(get_ada_tasks_pspace_data): Update.
(ada_tasks_pspace_data_cleanup): Remove.
(_initialize_tasks): Update.
(ada_tasks_inferior_data_handle): Change type.
(get_ada_tasks_inferior_data): Update.
(ada_tasks_inferior_data_cleanup): Remove.
(struct ada_tasks_pspace_data): Add initializers.

5 years agoConvert probes to type-safe registry API
Tom Tromey [Wed, 1 May 2019 05:47:54 +0000 (23:47 -0600)]
Convert probes to type-safe registry API

This changes the probes code in elfread.c to use the type-safe
registry API.  While doing this, I saw that the caller of get_probes
owns the probes, so I went through the code and changed the vectors to
store unique_ptrs, making the ownership relationship more clear.

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

* symfile.h (struct sym_probe_fns) <sym_get_probes>: Change type.
* symfile-debug.c (debug_sym_get_probes): Change type.
* stap-probe.c (handle_stap_probe):
(stap_static_probe_ops::get_probes): Change type.
* probe.h (class static_probe_ops) <get_probes>: Change type.
* probe.c (class any_static_probe_ops) <get_probes>: Change type.
(parse_probes_in_pspace): Update.
(find_probes_in_objfile, find_probe_by_pc, collect_probes):
Update.
(any_static_probe_ops::get_probes): Change type.
* elfread.c (elfread_data): New typedef.
(probe_key): Change type.
(elf_get_probes): Likewise.  Update.
(probe_key_free): Remove.
(_initialize_elfread): Update.
* dtrace-probe.c (class dtrace_static_probe_ops) <get_probes>:
Change type.
(dtrace_process_dof_probe, dtrace_process_dof)
(dtrace_static_probe_ops::get_probe): Change type.

5 years agoConvert xcoffread.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 04:18:10 +0000 (22:18 -0600)]
Convert xcoffread.c to type-safe registry API

This changes xcoffread.c to use the type-safe registry API.  It also
renames coff_symfile_info to xcoff_symfile_info, to avoid any possible
ODR violation.

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

* xcoffread.c (struct xcoff_symfile_info): Rename from
coff_symfile_info.  Add initializers.
(xcoff_objfile_data_key): Move lower.  Change type.
(XCOFF_DATA): Rewrite.
(xcoff_free_info): Remove.
(xcoff_symfile_init, _initialize_xcoffread, read_xcoff_symtab)
(read_symbol, read_symbol_lineno, find_linenos, init_stringtab)
(xcoff_initial_scan): Update.

5 years agoConvert solib-svr4.c to type-safe registry API
Tom Tromey [Wed, 1 May 2019 03:58:50 +0000 (21:58 -0600)]
Convert solib-svr4.c to type-safe registry API

This changes solib-svr4y.c to use the type-safe registry API.

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

* solib-svr4.c (struct svr4_info): Add initializers and
destructor.
<probes_table>: Now an htab_up.
(solib_svr4_pspace_data): Change type.
(free_probes_table): Simplify.
(~svr4_info): Rename from svr4_pspace_data_cleanup.
(get_svr4_info, probes_table_htab_remove_objfile_probes)
(probes_table_remove_objfile_probes, register_solib_event_probe)
(solib_event_probe_at, svr4_update_solib_event_breakpoint)
(_initialize_svr4_solib): Update.

5 years agoConvert remote.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 18:48:39 +0000 (12:48 -0600)]
Convert remote.c to type-safe registry API

This changes remote.c to use the type-safe registry API.

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

* remote.c (remote_pspace_data): Change type.
(remote_pspace_data_cleanup): Remove.
(get_remote_exec_file, set_pspace_remote_exec_file)
(_initialize_remote): Update.

5 years agoConvert breakpoint.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 18:45:00 +0000 (12:45 -0600)]
Convert breakpoint.c to type-safe registry API

This changes breakpoint.c to use the type-safe registry API.

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

* breakpoint.c (breakpoint_objfile_key): Change type.
(get_breakpoint_objfile_data): Update.
(free_breakpoint_objfile_data): Remove.
(_initialize_breakpoint): Update.

5 years agoConvert linux-tdep.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 18:43:17 +0000 (12:43 -0600)]
Convert linux-tdep.c to type-safe registry API

This changes linux-tdep.c to use the type-safe registry API.

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

* linux-tdep.c (struct linux_info): Add initializers.
(linux_inferior_data): Move.  Change type.
(invalidate_linux_cache_inf): Update.
(linux_inferior_data_cleanup): Remove.
(get_linux_inferior_data, _initialize_linux_tdep): Update.

5 years agoConvert auxv.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 18:41:29 +0000 (12:41 -0600)]
Convert auxv.c to type-safe registry API

This changes auxv.c to use the type-safe registry API.

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

* auxv.c (auxv_inferior_data): Move.  Change type.
(auxv_inferior_data_cleanup): Remove.
(invalidate_auxv_cache_inf): Rewrite.
(get_auxv_inferior_data, _initialize_auxv): Update.

5 years agoConvert symfile-debug.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 18:37:59 +0000 (12:37 -0600)]
Convert symfile-debug.c to type-safe registry API

This changes symfile-debug.c to use the type-safe registry API.

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

* symfile-debug.c (struct debug_sym_fns_data): Add initializers.
(symfile_debug_objfile_data_key): Change type.
(symfile_debug_installed, debug_qf_has_symbols)
(debug_qf_find_last_source_symtab)
(debug_qf_forget_cached_source_info)
(debug_qf_map_symtabs_matching_filename, debug_qf_lookup_symbol)
(debug_qf_print_stats, debug_qf_dump)
(debug_qf_expand_symtabs_for_function)
(debug_qf_expand_all_symtabs)
(debug_qf_expand_symtabs_with_fullname)
(debug_qf_map_matching_symbols)
(debug_qf_expand_symtabs_matching)
(debug_qf_find_pc_sect_compunit_symtab)
(debug_qf_map_symbol_filenames)
(debug_qf_find_compunit_symtab_by_address, debug_sym_get_probes)
(debug_sym_new_init, debug_sym_init, debug_sym_read)
(debug_sym_read_psymbols, debug_sym_finish, debug_sym_offsets)
(debug_sym_read_linetable, debug_sym_relocate): Update.
(symfile_debug_free_objfile): Remove.
(install_symfile_debug_logging, _initialize_symfile_debug):
Update.

5 years agoConvert dwarf2_per_objfile to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 18:32:47 +0000 (12:32 -0600)]
Convert dwarf2_per_objfile to type-safe registry API

This changes dwarf2_per_objfile to use the type-safe registry API.
This also changes dwarf2_per_objfile not to be allocated on an
obstack.  It seemed clearer to me to simply allocate it on the heap;
and I didn't see a drawback from doing so.

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

* dwarf2read.h (struct dwarf2_per_objfile): Don't inherit from
allocate_on_obstack.
* dwarf2read.c (dwarf2_objfile_data_key): Change type.
(get_dwarf2_per_objfile): Update.
(set_dwarf2_per_objfile): Remove.
(dwarf2_has_info, dwarf2_get_section_info): Update.
(dwarf2_free_objfile): Remove.
(_initialize_dwarf2_read): Update.

5 years agoConvert auto-load.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 15:34:16 +0000 (09:34 -0600)]
Convert auto-load.c to type-safe registry API

This changes auto-load.c to use the type-safe registry API.  It also
changes a couple of types to "bool", removing uses of "FALSE".

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

* auto-load.c (struct auto_load_pspace_info): Add destructor and
initializers.
<unsupported_script_warning_printed,
script_not_found_warning_printed>: Now bool.
(auto_load_pspace_data): Change type.
(~auto_load_pspace_info): Rename from
auto_load_pspace_data_cleanup.
(get_auto_load_pspace_data, init_loaded_scripts_info)
(clear_section_scripts, maybe_print_unsupported_script_warning)
(maybe_print_script_not_found_warning, _initialize_auto_load):
Update.

5 years agoConvert objfiles.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 15:29:13 +0000 (09:29 -0600)]
Convert objfiles.c to type-safe registry API

This changes objfiles.c to use the type-safe registry API.

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

* objfiles.c (objfile_pspace_info): Add destructor and
initializers.
(objfiles_pspace_data): Change type.
(~objfile_pspace_info): Rename from objfiles_pspace_data_cleanup.
(get_objfile_pspace_data): Update.
(objfiles_bfd_data): Change type.
(get_objfile_bfd_data): Update.
(objfile_bfd_data_free, _initialize_objfiles): Remove.

5 years agoConvert break-catch-syscall.c to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 15:25:07 +0000 (09:25 -0600)]
Convert break-catch-syscall.c to type-safe registry API

This changes break-catch-syscall.c to use the type-safe registry API.

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

* break-catch-syscall.c (catch_syscall_inferior_data): Move.
Change type.
(get_catch_syscall_inferior_data): Update.
(catch_syscall_inferior_data_cleanup): Remove.
(_initialize_break_catch_syscall): Update.

5 years agoConvert inflow to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 15:20:20 +0000 (09:20 -0600)]
Convert inflow to type-safe registry API

This changes inflow.c to use the type-safe registry API.  This fixes a
latent bug in swap_terminal_info, which previously said:

  terminal_info *info_a
    = (terminal_info *) inferior_data (a, inflow_inferior_data);
  terminal_info *info_b
    = (terminal_info *) inferior_data (a, inflow_inferior_data);

... both of which examine 'a'.

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

* inflow.c (struct terminal_info): Add destructor and
initializers.
(inflow_inferior_data): Change type.
(~terminal_info): Rename from inflow_inferior_data_cleanup.
(get_inflow_inferior_data, inflow_inferior_exit)
(swap_terminal_info, _initialize_inflow): Update.

5 years agoConvert target dcache to type-safe registry API
Tom Tromey [Sun, 21 Apr 2019 15:12:47 +0000 (09:12 -0600)]
Convert target dcache to type-safe registry API

This changes the target dcache to use the type-safe registry API.

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

* target-dcache.c (target_dcache_cleanup): Remove.
(target_dcache_aspace_key): Change type.
(target_dcache_init_p, target_dcache_invalidate)
(target_dcache_get, target_dcache_get_or_init)
(_initialize_target_dcache): Update.
* dcache.h (struct dcache_deleter): New.

5 years agoConvert symbol_cache to type-safe registry API
Tom Tromey [Wed, 10 Apr 2019 03:46:16 +0000 (21:46 -0600)]
Convert symbol_cache to type-safe registry API

This changes the symbol_cache to use the type-safe registry API.

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

* symtab.c (struct symbol_cache): Add destructor and
initializers.
(symbol_cache_key): Move.  Change type.
(make_symbol_cache, free_symbol_cache): Remove.
(get_symbol_cache): Update.
(symbol_cache_cleanup): Remove.
(ALL_PSPACES, symbol_cache_flush)
(maintenance_print_symbol_cache)
(maintenance_print_symbol_cache_statistics, _initialize_symtab):
Update.

5 years agoConvert main_info to type-safe registry API
Tom Tromey [Wed, 10 Apr 2019 02:26:09 +0000 (20:26 -0600)]
Convert main_info to type-safe registry API

This changes main_info to use the type-safe registry API.

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

* symtab.c (struct main_info): Add destructor and initializers.
(main_progspace_key): Move.  Change type.
(get_main_info): Update.
(main_info_cleanup): Remove.
(_initialize_symtab): Update.

5 years agoAdd a type-safe C++ interface to a registry
Tom Tromey [Wed, 10 Apr 2019 02:21:06 +0000 (20:21 -0600)]
Add a type-safe C++ interface to a registry

This changes DECLARE_REGISTRY to add a type-safe interface.  This
interface is a C++ class that handles the details of registering a
key, and provides various useful methods, including policy-based
cleanup.

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

* registry.h (DECLARE_REGISTRY): Define the _key class.

5 years agogdb: Merge two 'New commands' sections in NEWS file
Andrew Burgess [Wed, 8 May 2019 19:59:50 +0000 (20:59 +0100)]
gdb: Merge two 'New commands' sections in NEWS file

Commit 2e62ab400ff9 added a second 'New commands' section to the NEWS
file, this commit merges the two together.

gdb/ChangeLog:

* NEWS: Merge two 'New commands' sections.

5 years agoWhen debugging a mixed Ada/C program using this scenario:
Xavier Roirand [Wed, 8 May 2019 16:55:44 +0000 (12:55 -0400)]
When debugging a mixed Ada/C program using this scenario:

- set print frame-arguements all
- an Ada function named pck.call_me calls a C function named break_me
- you put a breakpoint in break_me and the program reaches this
  breakpoint.

Now display the backtrace:

  (gdb) bt
  #0  break_me () at [...]
  #1  0x000000000040243e in pck.call_me (
      s={P_ARRAY = 0x7fffffffe21c, P_BOUNDS = 0x41e6e8}) at [...]

whereas we should expect:

  (gdb) bt
  #0  break_me () at [...]
  #1  0x000000000040243e in pck.call_me (s="test") at [...]

The problem is that GDB prints the S parameter in the pck.call_me Ada
function using the current language, so the C one, because the program
is stopped in a C function, whereas it should use the pck.call_me frame
one. This behavior is ok when user manually changes the language but it's
not the right one when language is auto.

This patch fixes this problem so now when using auto language, all Ada
frame arguments are printed using Ada like syntax when the frame is part
of Ada code, even if the program is stopped in a frame using a different
language.

If the user explicitly sets a language (using "set language ...") then
no change here, all the Ada frame arguments are printed using this
language.

gdb/ChangeLog:

    * ada-valprint.c (ada_val_print_gnat_array): Remove language
    parameter and use Ada language definition instead.
    (ada_val_print_ptr): Remove unused language parameter.
    (ada_val_print_num): Remove language parameter and use Ada language
    definition instead.
    (ada_val_print_enum, ada_val_print_flt): Remove unused language
    parameter.
    (ada_val_print_struct_union, ada_val_print_ref): Remove language
    parameter and use Ada language definition instead.
    (ada_val_print_1): Update all ada_val_print_xxx calls.
    Remove language parameter.
    (ada_val_print): Update ada_val_print_1 call.

gdb/testsuite/ChangeLog:

    * gdb.ada/frame_arg_lang.exp: New testcase.
    * gdb.ada/frame_arg_lang/bla.adb: New file.
    * gdb.ada/frame_arg_lang/pck.ads: New file.
    * gdb.ada/frame_arg_lang/pck.adb: New file.
    * gdb.ada/frame_arg_lang/foo.c: New file.

Tested on x86_64-linux, no regressions.

5 years agoChange some remote.c globals to "static"
Tom Tromey [Wed, 1 May 2019 18:37:46 +0000 (12:37 -0600)]
Change some remote.c globals to "static"

I noticed a three globals in remote.c that could be static.  This
patch makes this change.

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

* remote.c (remote_hw_watchpoint_limit)
(remote_hw_watchpoint_length_limit, remote_hw_breakpoint_limit):
Now static.

5 years agoMove "watchdog" to remote.c
Tom Tromey [Wed, 1 May 2019 18:35:20 +0000 (12:35 -0600)]
Move "watchdog" to remote.c

The "watchdog" global is only used in remote.c, so this patch moves it
there and makes it static.

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

* maint.c (_initialize_maint_cmds): Move initialization code to
remote.c.
(watchdog, show_watchdog): Move to remote.c.
* remote.c (watchdog, show_watchdog): Move from maint.c.  Make
"watchdog" static.
(_initialize_remote): Move initialization code from maint.c.
* defs.h (watchdog): Don't declare.

5 years agoMove interpreter_p declaration to main.h
Tom Tromey [Wed, 1 May 2019 18:28:45 +0000 (12:28 -0600)]
Move interpreter_p declaration to main.h

This moves the interpreter_p declaration from defs.h to main.h.  I
think this makes more sense, as it is defined in main.c.  Also, this
declaration was in the wrong place -- between a comment and the things
the comment described.

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

* tui/tui-interp.c: Include main.h.
* interps.c: Include main.h.
* main.h (interpreter_p): Declare.
* defs.h (interpreter_p): Don't declare.

5 years agoDon't declare read_unsigned_leb128 in defs.h
Tom Tromey [Wed, 1 May 2019 18:26:34 +0000 (12:26 -0600)]
Don't declare read_unsigned_leb128 in defs.h

I noticed that read_unsigned_leb128 is declared in defs.h.  There's no
reason this should be here, so this patch moves it to dwarf2read.h.

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

* dwarf2loc.c: Include dwarf2read.h.
* defs.h (read_unsigned_leb128): Don't declare.
* dwarf2read.h (read_unsigned_leb128): Declare.

5 years agoFix build problem in fputs_maybe_filtered
Tom Tromey [Wed, 8 May 2019 16:35:09 +0000 (10:35 -0600)]
Fix build problem in fputs_maybe_filtered

When merging commit 99f20f ("Fix style bug when paging") to master, I
had to make some changes to get it to compile again.  Unfortunately, I
must not have added these to the index at the correct time, because
they were not committed.

This patch fixes the problem.

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

* utils.c (fputs_maybe_filtered): Call can_emit_style_escape as a
method.

5 years agoFix style bug when paging
Tom Tromey [Wed, 1 May 2019 17:13:31 +0000 (11:13 -0600)]
Fix style bug when paging

Philippe pointed out a styling bug that would occur in some conditions
when paging:

    https://sourceware.org/ml/gdb-patches/2019-04/msg00101.html

I was finally able to reproduce this, and this patch fixes the bug.

The problem occurred when text overflowed the line, causing a
pagination prompt, but when no wrap column had been set.  In this
case, the current style was reset to show the prompt, but then not
reset back to the previously applied style before emitting the rest of
the line.

The fix is to record the applied style in this case, and re-apply it
afterward -- but only if the pager prompt was emitted, something that
the existing style.exp pointed out on the first, more naive, version
of the patch.

Tested on x86-64 Fedora 29.

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

* utils.c (fputs_maybe_filtered): Reset style after paging, even
when no wrap column is set.

5 years agoCorrectly handle non-C-style arrays in c_get_string
Tom Tromey [Thu, 25 Apr 2019 18:14:58 +0000 (12:14 -0600)]
Correctly handle non-C-style arrays in c_get_string

A user here noticed that the Python Value.string method did not work
for Ada arrays.  I tracked this down to an oddity in value_as_address
-- namely, it calls coerce_array, but that function will not force
array coercion when the language has c_style_arrays=false, as Ada
does.

This patch fixes the problem by changing c_get_string so that arrays
take the "in GDB's memory" branch.  The actual patch is somewhat more
complicated than you might think, because the caller can request more
array elements than the type allows.  This is normal when the type is
using the C struct hack.

Tested on x86-64 Fedora 29.

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

* c-lang.c (c_get_string): Handle non-C-style arrays.

gdb/testsuite/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

* gdb.python/py-value.exp (test_value_in_inferior): Add Ada test.

5 years agoChange ptype/o to print bit offset
Tom Tromey [Mon, 29 Apr 2019 15:55:56 +0000 (09:55 -0600)]
Change ptype/o to print bit offset

Consider this short C example:

    struct inner
    {
      unsigned x;
      unsigned y : 3;
      unsigned z : 3;
    };

    struct outer
    {
      unsigned char o : 3;
      struct inner i __attribute__ ((packed));
    };

When I use "ptype/o" on this, I get:

    (gdb) ptype/o struct outer
    /* offset    |  size */  type = struct outer {
    /*    0: 5   |     1 */    unsigned char o : 3;
    /* XXX  5-bit hole  */
    /*    1      |     8 */    struct inner {
    /*    1      |     4 */        unsigned int x;
    /*    5:29   |     4 */        unsigned int y : 3;
    /*    5:26   |     4 */        unsigned int z : 3;
    /* XXX  2-bit padding  */
    /* XXX  3-byte padding */

   /* total size (bytes):    8 */
       } i;

       /* total size (bytes):    9 */
     }

In the location of "o" ("0: 5"), the "5" means "there are 5 bits left
relative to the size of the underlying type.

I find this very difficult to follow.  On irc, Sergio said that this
choice came because it is what pahole does.  However, I think it's not
very useful, and maybe is just an artifact of the way that
DW_AT_bit_offset was defined in DWARF 3.

This patch changes ptype/o to print the offset of a bitfield in a more
natural way, that is, using the bit number according to the platform's
bit numbering.

With this patch, the output is now:

    (gdb) ptype/o struct outer
    /* offset    |  size */  type = struct outer {
    /*    0: 0   |     1 */    unsigned char o : 3;
    /* XXX  5-bit hole  */
    /*    1      |     8 */    struct inner {
    /*    1      |     4 */        unsigned int x;
    /*    5: 0   |     4 */        unsigned int y : 3;
    /*    5: 3   |     4 */        unsigned int z : 3;
    /* XXX  2-bit padding  */
    /* XXX  3-byte padding */

   /* total size (bytes):    8 */
       } i;

       /* total size (bytes):    9 */
     }

This is better, IMO, because now the "offset" of a bitfield is
consistent with the offset of an ordinary member, referring to its
offset from the start of the structure.

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

* typeprint.c (print_offset_data::update): Print the bit offset,
not the number of bits remaining.

gdb/doc/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

* gdb.texinfo (Symbols): Document change to ptype/o.

gdb/testsuite/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

* gdb.base/ptype-offsets.exp: Update tests.

5 years agoFix ptype/o comment formatting
Tom Tromey [Mon, 29 Apr 2019 18:11:52 +0000 (12:11 -0600)]
Fix ptype/o comment formatting

I noticed that ptype/o will print:

    /*    3: 3   |     1 */    signed char a4 : 2;
    /* XXX  3-bit hole  */

That is, "*/" at the end of the "hole" message does not line up with
the other comment ends.  I thought it would be a bit nicer if this did
line up, so I fixed it.  Then, to my surprise, I found that I could
not make ptype-offsets.exp fail.

I still am not sure why it doesn't fail, but changing the tests to use
string_to_regexp and changing the quoting helped.  This in turn showed
that some of the existing test cases were wrong, so I've also updated
them here.

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

* typeprint.c (print_offset_data::maybe_print_hole): Add extra
padding at end of comment.

gdb/testsuite/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

* gdb.base/ptype-offsets.exp: Use string_to_regexp.  Fix test
cases.
* gdb.base/ptype-offsets.cc (struct abc) <my_int_type>: Now
"short".

5 years agoFix VLA printing for Ada
Tom Tromey [Wed, 24 Apr 2019 18:50:04 +0000 (12:50 -0600)]
Fix VLA printing for Ada

While looking at a different Ada problem, I found that printing a
record containing a VLA did not work properly.

I tracked the problem down to dwarf2_evaluate_property trying, and
failing, to compare two types that differed only in qualifiers.

This patch changes dwarf2_evaluate_property to ignore qualifiers when
comparing types.

Tested on x86-64 Fedora 29.

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

* dwarf2loc.c (dwarf2_evaluate_property) <PROP_ADDR_OFFSET>:
Compare main types.

gdb/testsuite/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

* gdb.ada/vla.exp: New file.
* gdb.ada/vla/vla.adb: New file.

5 years agoSign-extend start and stop address inputs to objdump
Faraz Shahbazker [Sat, 4 May 2019 01:21:49 +0000 (18:21 -0700)]
Sign-extend start and stop address inputs to objdump

For targets that treat addresses as signed (MIPS/SH64), user-specified
start/stop address limits cannot be compared directly to section VMAs.
We must sign-extend user-specified 32-bit address limits which have
bit 31 set for such targets.

binutils/
* objdump.c (sign_extend_address): New function.
(dump_bfd): Sign-extend user-specified start/stop addresses
for targets that need it.
* testsuite/binutils-all/objdump.exp: Add tests for objdump
with start and stop addresses in higher address ranges.

5 years agoFix compile time warning when building the linker in a MinGw32 environment using...
Pekka Sepp?nen [Wed, 8 May 2019 15:54:16 +0000 (16:54 +0100)]
Fix compile time warning when building the linker in a MinGw32 environment using gcc 8.

PR 24536
* ldbuildid.c (generate_build_id): Cast return value from
GetProcAddress in order to avoid a compile time warning.

5 years agoDo not force the m68k-elf linker to fail if it encoutners a non-ELF format file.
Nick Clifton [Wed, 8 May 2019 13:51:32 +0000 (14:51 +0100)]
Do not force the m68k-elf linker to fail if it encoutners a non-ELF format file.

PR 24523
* elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Return TRUE
rather than FALSE if encountering a non-ELF file.

5 years agogas/elf dwarf2 tests
Alan Modra [Tue, 7 May 2019 23:56:56 +0000 (09:26 +0930)]
gas/elf dwarf2 tests

Make them work for tile, by using ".quad 0" as the simulated
instruction and doubling size of aligns.  The larger aligns tripped
over riscv alignment handling, fixed by adding -mno-relax there.
Also disable link-relax for avr, pru and xtensa, allowing these
targets to pass these tests.  With link-time relaxation enabled,
these targets emit alignment relocations rather than aligning at
assembly time.  This means the assembler doesn't see a change in PC
when it is expected over an alignment frag and thus view numbers are
calculated incorrectly.

* testsuite/gas/elf/dwarf2-1.s,
* testsuite/gas/elf/dwarf2-2.s,
* testsuite/gas/elf/dwarf2-5.s,
* testsuite/gas/elf/dwarf2-7.s,
* testsuite/gas/elf/dwarf2-8.s,
* testsuite/gas/elf/dwarf2-9.s,
* testsuite/gas/elf/dwarf2-10.s,
* testsuite/gas/elf/dwarf2-11.s,
* testsuite/gas/elf/dwarf2-12.s,
* testsuite/gas/elf/dwarf2-13.s,
* testsuite/gas/elf/dwarf2-14.s,
* testsuite/gas/elf/dwarf2-15.s,
* testsuite/gas/elf/dwarf2-16.s,
* testsuite/gas/elf/dwarf2-17.s,
* testsuite/gas/elf/dwarf2-18.s,
* testsuite/gas/elf/dwarf2-19.s: Double size of align and simulated
instructions.
* testsuite/gas/elf/dwarf2-1.d,
* testsuite/gas/elf/dwarf2-2.d,
* testsuite/gas/elf/dwarf2-5.d,
* testsuite/gas/elf/dwarf2-7.d,
* testsuite/gas/elf/dwarf2-8.d,
* testsuite/gas/elf/dwarf2-9.d,
* testsuite/gas/elf/dwarf2-10.d,
* testsuite/gas/elf/dwarf2-11.d,
* testsuite/gas/elf/dwarf2-12.d,
* testsuite/gas/elf/dwarf2-13.d,
* testsuite/gas/elf/dwarf2-14.d,
* testsuite/gas/elf/dwarf2-15.d,
* testsuite/gas/elf/dwarf2-16.d,
* testsuite/gas/elf/dwarf2-17.d,
* testsuite/gas/elf/dwarf2-18.d,
* testsuite/gas/elf/dwarf2-19.d: Use xfail rather than notarget.
Remove avr, pru, tile, xtensa from xfails.  Update expected output.
* testsuite/gas/elf/elf.exp: Sort targets.
(dump_opts): Pass {as -mno-relax} for riscv, {as -mno-link-relax}
for avr and pru, and {as --no-link-relax} for xtensa to dwarf tests.
* testsuite/gas/elf/section2.e-miwmmxt: Delete unused file.

5 years agoxtensa ignores option --no-link-relax
Alan Modra [Tue, 7 May 2019 23:56:36 +0000 (09:26 +0930)]
xtensa ignores option --no-link-relax

md_begin happens after md_parse_option.

* config/tc-xtensa.c (opt_linkrelax): New variable.
(md_parse_option): Set it here.
(md_begin): Copy opt_linkrelax to linkrelax.

5 years agoPR24520, gprof fails to read compressed debug data
Alan Modra [Tue, 7 May 2019 23:55:25 +0000 (09:25 +0930)]
PR24520, gprof fails to read compressed debug data

PR 24520
* corefile.c (core_init): Set BFD_DECOMPRESS.

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

5 years agoxfail locview tests on mep that use complex relocs for view numbers
Alexandre Oliva [Tue, 7 May 2019 19:34:19 +0000 (16:34 -0300)]
xfail locview tests on mep that use complex relocs for view numbers

Expressions that compute view numbers that aren't simplified early
enough to a constant end up being selected for representation as
complex relocations, enabled on mep-* targets.

It would be possible to recognize such expressions, that can resolve
to constants, but this problem was hit before, in preexisting tests,
so xfail the new hits similarly.

The new hits were caused by yesterday's patch to dwarf2dbg.c: views in
the beginning of subsections are now computed later, based on the
final views or previous subsections in the same section.

for  gas/ChangeLog

* testsuite/gas/elf/dwarf2-18.d: Xfail mep-*.
* testsuite/gas/elf/dwarf2-19.d: Likewise.

5 years ago[gdb/testsuite] Fix ls_host return in index-cache.exp
Tom de Vries [Tue, 7 May 2019 09:52:17 +0000 (11:52 +0200)]
[gdb/testsuite] Fix ls_host return in index-cache.exp

When adding a debug print here in index-cache.exp:
...
 proc_with_prefix test_cache_disabled { cache_dir } {
     lassign [ls_host $cache_dir] ret files_before
+    puts "before: '$files_before'"
+    exit
...
we have:
...
files_before: ''
...

When further adding:
...
 proc_with_prefix test_cache_disabled { cache_dir } {
+    exec touch $cache_dir/foo.1 $cache_dir/foo.2 $cache_dir/foo.3
...
we have:
...
files_before: 'foo.1'
...
while we're expecting file_before to contain foo.[123].

Fix this by making the return statement in ls_host return a list rather than a
string (in accordance with the ls_host documentation), after which we have:
...
files_before: 'foo.1 foo.2 foo.3'
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-05-07  Tom de Vries  <tdevries@suse.de>

* gdb.base/index-cache.exp (ls_host): Fix return statement.

5 years ago[gdb/testsuite] Fix .debug_aranges in watch-loc.c
Tom de Vries [Tue, 7 May 2019 08:58:57 +0000 (10:58 +0200)]
[gdb/testsuite] Fix .debug_aranges in watch-loc.c

When running gdb.dlang/watch-loc.exp with target board cc-with-debug-names, we
run into:
...
FAIL: gdb.dlang/watch-loc.exp: disassemble _Dmain (GDB internal error)
...
in more detail:
...
(gdb) disassemble _Dmain
gdb/dwarf2read.c:5293: internal-error: \
  compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, \
  bound_minimal_symbol, CORE_ADDR, obj_section*, int): \
  Assertion `result != NULL' failed.
...

The problem is that the .debug_aranges section in watch-loc.c contains a
debug_info_offset which is set to 0:
...
asm (
  "      .pushsection    .debug_aranges,\"\",%progbits\n"
  "      .4byte  .Laranges_end - .Laranges_start\n"
  ".Laranges_start:\n"
  "      .2byte  0x2\n"
  "      .4byte  0\n"
...
while the compilation unit at offset 0 in the .debug_section in the executable
is in fact not the compilation unit generated from watch-loc-dw.S.

[ Note: this is a non-trivial test-case.  The file watch-loc-dw.S contains a
.debug_info section, but not an .debug_aranges section or any actual code.
The file watch-loc.c contains code and a .debug_aranges section, but no other
debug section.  So, the intent for the .debug_aranges section in watch-loc.c
is to refer to a compilation unit in the .debug_info section in
watch-loc-dw.S. ]

This happens when linked in object files contain dwarf info and are placed in
the .debug_info section before the compilation units generated from
watch-loc.c and watch-loc-dw.S.

Fix this by defining the debug_info_offset field using a label .Lcu1_begin
that defines the start of an empty .debug_section compilation unit:
...
 asm (
+  "      .pushsection    .debug_info,\"\",%progbits\n"
+  ".Lcu1_begin:"
+  "      .popsection\n"
   "      .pushsection    .debug_aranges,\"\",%progbits\n"
   "      .4byte  .Laranges_end - .Laranges_start \n"
   ".Laranges_start:\n"
   "      .2byte  0x2\n"
-  "      .4byte  0\n"
+  "      .4byte  .Lcu1_begin\n"
...
which during linking merges with the start of the .debug_info section of
watch-loc-dw.S.

Tested on x86_64-linux with native, cc-with-gdb-index and cc-with-debug-names.

gdb/testsuite/ChangeLog:

2019-05-07  Tom de Vries  <tdevries@suse.de>

PR testsuite/24522
* gdb.dlang/watch-loc.c: Fix debug_info_offset in .debug_aranges
section.

5 years ago[gdb/testsuite] Fix .debug_aranges in dw2-case-insensitive-debug.S
Tom de Vries [Tue, 7 May 2019 08:58:57 +0000 (10:58 +0200)]
[gdb/testsuite] Fix .debug_aranges in dw2-case-insensitive-debug.S

When running gdb.dwarf2/dw2-case-insensitive.exp with target board
cc-with-debug-names, we run into:
...
FAIL: gdb.dwarf2/dw2-case-insensitive.exp: regexp case-sensitive off \
  (GDB internal error)
...
in more detail:
...
(gdb) info functions fUnC_lang
gdb/dwarf2read.c:5293: internal-error: \
  compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, \
  bound_minimal_symbol, CORE_ADDR, obj_section*, int): \
  Assertion `result != NULL' failed.
...

The problem is that the .debug_aranges section in dw2-case-insensitive-debug.S
contains a debug_info_offset which is set to 0:
...
        .section        .debug_aranges,"",@progbits
        .4byte  .Laranges_end - .Laranges_start
.Laranges_start:
        .2byte  0x2
        .4byte  0
...
while the compilation unit at offset 0 in the .debug_section of the executable
is in fact not the compilation unit generated from
dw2-case-insensitive-debug.S.

This happens when linked in object files contain dwarf info and are placed in
the .debug_info section before the compilation unit generated from
dw2-case-insensitive-debug.S.

Fix this by defining the debug_info_offset field using the label .Lcu1_begin
that defines the start of the compilation unit:
...
-       .4byte  0
+       .4byte  .Lcu1_begin
...

Tested on x86_64-linux with native, cc-with-gdb-index and cc-with-debug-names.

gdb/testsuite/ChangeLog:

2019-05-07  Tom de Vries  <tdevries@suse.de>

PR testsuite/24522
* gdb.dwarf2/dw2-case-insensitive-debug.S: Fix debug_info_offset in
.debug_aranges section.

5 years ago[gdb/testsuite] Fix handling of DW_FORM_ref_addr in dwarf assembler
Tom de Vries [Tue, 7 May 2019 08:38:36 +0000 (10:38 +0200)]
[gdb/testsuite] Fix handling of DW_FORM_ref_addr in dwarf assembler

When running gdb.dwarf2/multidictionary.exp with target board cc-with-dwz and
current dwz, we run into a dwz abort:
...
gdb compile failed, gdb/contrib/cc-with-tweaks.sh: line 188: 11484 Aborted \
  (core dumped) $DWZ "$output_file" > /dev/null 2>&1
UNTESTED: gdb.dwarf2/multidictionary.exp: multidictionary.exp
...
The dwz abort (PR dwz/24169) is caused by an invalid DW_FORM_ref_addr in the
multidictionary binary.

The multidictionary binary is build from multidictionary.S which is generated
using the dwarf assembler, and multidictionary.S contains dwarf for 3
compilation units.

In multidictionary0.o (generated from multidictionary.S), we find a concrete
formal parameter DIE:
...
 <2><dc>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <dd>   DW_AT_abstract_origin: <0xa6>
...
referring to an abstract formal parameter DIE at 0xa6:
...
 <2><a6>: Abbrev Number: 8 (DW_TAG_formal_parameter)
    <a7>   DW_AT_name        : msg
    <ab>   DW_AT_type        : <0x92>
...
but in the multidictionary binary the concrete formal parameter DIE is still
referring to 0xa6:
...
 <2><1a3>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <1a4>   DW_AT_abstract_origin: <0xa6>
...
while the abstract formal parameter DIE has moved to 0x16d:
...
 <2><16d>: Abbrev Number: 8 (DW_TAG_formal_parameter)
    <16e>   DW_AT_name        : msg
    <172>   DW_AT_type        : <0x159>
...

The concrete formal parameter DIE is specified in multidictionary.S like this:
...
.Llabel21:
        .uleb128        4
        .4byte        .Llabel17 - .Lcu1_begin
...

The problem is that the .Lcu1_begin label is assumed to mark the start of the
.debug_info section in the executable, but in fact it marks the start of the
first compilation unit from multidictionary.S in the executable.  Usually
these two entities are the same, but they are not when linked in object files
contain dwarf info and are placed in the .debug_info section before the
compilation units generated from multidictionary.S.

Fix this in the dwarf assembler by generating instead the label itself:
...
.Llabel21:
        .uleb128        4
        .4byte        .Llabel17
...
resulting in a relocation in the object file:
...
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
0000000000dd  00040000000a R_X86_64_32       0000000000000000 .debug_info + a6
...
and resulting in the correct offset in the executable:
...
 <2><1a3>: Abbrev Number: 4 (DW_TAG_formal_parameter)
    <1a4>   DW_AT_abstract_origin: <0x16d>
...

Tested on x86_64-linux with native and cc-with-dwz.

gdb/testsuite/ChangeLog:

2019-05-07  Tom de Vries  <tdevries@suse.de>

PR testsuite/24159
* lib/dwarf.exp: Fix handling of DW_FORM_ref_addr.

5 years agoTidy use_complex_relocs_for
Alan Modra [Mon, 6 May 2019 11:53:45 +0000 (21:23 +0930)]
Tidy use_complex_relocs_for

Since I was looking at this I decided to fix the formatting, and
used an old C switch statements trick to factor out common code.

* symbols.c (use_complex_relocs_for): Formatting.  Factor out
X_add_symbol tests.

5 years agoFix scoped_mmap includes
Tom Tromey [Tue, 7 May 2019 01:54:53 +0000 (19:54 -0600)]
Fix scoped_mmap includes

I noticed that scoped_mmap.h included config.h, and that scoped_mmap.c
included defs.h.  This patch fixes both of these problems.

Tested by the buildbot.

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

* common/scoped_mmap.c: Include common-defs.h.
* common/scoped_mmap.h: Don't include config.h.

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

5 years agoFix regression caused by recently added syscall restart code
Kevin Buettner [Mon, 6 May 2019 17:28:44 +0000 (10:28 -0700)]
Fix regression caused by recently added syscall restart code

This line of code...

       *(int64_t *) ptr = *(int32_t *) ptr;

...in linux-x86-low.c is not needed (and does not work correctly)
within a 32-bit executable.  I added an __x86_64__ ifdef (which is
used extensively elsewhere in the file for like purposes) to prevent
this code from being included in 32-bit builds.

It fixes the following regressions when running on native
i686-pc-linux-gnu:

FAIL: gdb.server/abspath.exp: continue to main
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=auto: continue to main
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=off: continue to main
FAIL: gdb.server/ext-restart.exp: restart: run to main
FAIL: gdb.server/ext-restart.exp: run to main
FAIL: gdb.server/ext-run.exp: continue to main
FAIL: gdb.server/ext-wrapper.exp: print d
FAIL: gdb.server/ext-wrapper.exp: restart: print d
FAIL: gdb.server/ext-wrapper.exp: restart: run to marker
FAIL: gdb.server/ext-wrapper.exp: run to marker
FAIL: gdb.server/no-thread-db.exp: continue to breakpoint: after tls assignment
FAIL: gdb.server/reconnect-ctrl-c.exp: first: stop with control-c
FAIL: gdb.server/reconnect-ctrl-c.exp: second: stop with control-c
FAIL: gdb.server/run-without-local-binary.exp: run test program until the end
FAIL: gdb.server/server-kill.exp: continue to breakpoint: after server_pid assignment
FAIL: gdb.server/server-kill.exp: tstatus
FAIL: gdb.server/server-run.exp: continue to main

gdb/gdbserver/ChangeLog:

* linux-x86-low.c (x86_fill_gregset): Don't compile 64-bit
sign extension code on 32-bit builds.

5 years agoAdd load-link, store-conditional paired EVA instructions
Faraz Shahbazker [Mon, 29 Apr 2019 01:21:00 +0000 (18:21 -0700)]
Add load-link, store-conditional paired EVA instructions

Add paired load-link and store-conditional instructions to the
EVA ASE for MIPS32R6[1].  These instructions are optional within
the EVA ASE.  Their presence is indicated by the XNP bit in the
Config5 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. 230-231, pp. 357-360.

gas/
* config/tc-mips.c (mips_set_ase): Handle ASE_EVA_R6.
(macro) <M_LLWPE_AB, M_SCWPE_AB>: New cases.
(mips_after_parse_args): Translate EVA to EVA_R6.
* testsuite/gas/mips/ase-errors-1.s: Add new instructions.
* testsuite/gas/mips/eva.s: Likewise.
* testsuite/gas/mips/ase-errors-1.l: Check errors for
 new instructions.
* testsuite/gas/mips/mipsr6@eva.d: Check new test cases.

include/
* opcode/mips.h (ASE_EVA_R6): New macro.
(M_LLWPE_AB, M_SCWPE_AB): New enum values.

opcodes/
* mips-dis.c (mips_calculate_combination_ases): Add ISA
argument and set ASE_EVA_R6 appropriately.
(set_default_mips_dis_options): Pass ISA to above.
(parse_mips_dis_option): Likewise.
* mips-opc.c (EVAR6): New macro.
(mips_builtin_opcodes): Add llwpe, scwpe.

Derived from patch authored by Andrew Bennett <andrew.bennett@imgtec.com>

5 years agosym->sy_value is not valid for struct local_symbol
Alan Modra [Mon, 6 May 2019 05:08:24 +0000 (14:38 +0930)]
sym->sy_value is not valid for struct local_symbol

Fixes this mep-elf error:
gas/elf/dwarf2-19.s: Error: Unknown expression operator (enum 0)
gas/elf/dwarf2-19.s: Error: cannot convert expression symbol .L2 to complex relocation

* symbols.c (symbol_relc_make_sym): Do not access sym->sy_value
directly.

5 years ago[gdb/testsuite] Fix index-cache.exp with cc-with-{gdb-index,debug-names}
Tom de Vries [Mon, 6 May 2019 06:42:24 +0000 (08:42 +0200)]
[gdb/testsuite] Fix index-cache.exp with cc-with-{gdb-index,debug-names}

In gdb.base/index-cache.exp, handle the case that binfile contains either a
.gdb_index or .debug_names index section.

Tested on x86_64-linux with native, cc-with-gdb-index and cc-with-debug-names.

gdb/testsuite/ChangeLog:

2019-05-06  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (exec_has_index_section): New proc.
* gdb.base/index-cache.exp: Handle case that binfile contains an index
section.

5 years agoPicoJava weak undefined symbols
Alan Modra [Sun, 5 May 2019 23:43:53 +0000 (09:13 +0930)]
PicoJava weak undefined symbols

This fixes the recently added ld-elf/pr24511 test failure on pj-elf.
Incidentally, pj-elf has failed its gas "pj" test since 2005-12-22
(git commit 54758c3e39).  I think that makes the target ripe for
obsolescence.

bfd/
* elf32-pj.c (pj_elf_reloc): Don't report undefined weak as an error.
ld/
* testsuite/ld-undefined/weak-undef.exp: Don't xfail pj.

5 years agoPowerPC reloc symbols that shouldn't be adjusted
Alan Modra [Sun, 5 May 2019 23:13:32 +0000 (08:43 +0930)]
PowerPC reloc symbols that shouldn't be adjusted

GOT and PLT relocs shouldn't have their symbols replaced with a
section symbol plus added.  Nor should the HIGHA TLS relocations,
which failed to be caught by the range test in ppc_fix_adjustable.

bfd/
* reloc.c (BFD_RELOC_PPC64_TPREL16_HIGH, BFD_RELOC_PPC64_TPREL16_HIGHA),
(BFD_RELOC_PPC64_DTPREL16_HIGH, BFD_RELOC_PPC64_DTPREL16_HIGHA):
Sort before BFD_RELOC_PPC64_DTPREL16_HIGHESTA entry.
gas/
* config/tc-ppc.c (ppc_fix_adjustable): Exclude all GOT and PLT
relocs, and VLE sdarel relocs.
* testsuite/gas/ppc/power4.d: Adjust.

5 years ago[LVu] base subseg head view on prev subseg's tail
Alexandre Oliva [Mon, 6 May 2019 02:07:20 +0000 (23:07 -0300)]
[LVu] base subseg head view on prev subseg's tail

Location views at borders between subsegments/subsections in the same
segment/section are computed as if each new subsegment/subsection
started with a forced view reset to zero, but the line number program
does not introduce resets that are not explicitly requested, so if a
subsegment ends at the same address another starts, the line number
program will have a continuity of views at the border address, whereas
the initial view number label in the latter subsegment will be
miscomputed as zero.

This patch delays the assignment of view expressions at subsegment
heads to the time of chaining the frags of subsegments into a single
segment, so that they are set based on the view at the end of the
previous subsegment in the same segment.

The line number program created for the test program had an
unnecessary DW_LNS_advance_pc at the end.  This patch also arranges
for us not to emit it.

for  gas/ChangeLog

* dwarf2dbg.c (set_or_check_view): Skip heads when assigning
views of prior locs.
(dwarf2_gen_line_info_1): Skip heads.
(size_inc_line_addr, emit_inc_line_addr): Drop
DW_LNS_advance_pc for zero addr delta.
(dwarf2_finish): Assign views for heads of segments.
* testsuite/gas/elf/dwarf2-19.d: New.
* testsuite/gas/elf/dwarf2-19.s: New.
* testsuite/gas/elf/elf.exp: Test it.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 6 May 2019 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

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

5 years agoRemove a VEC from aarch64-tdep.c
Tom Tromey [Tue, 24 Jul 2018 01:51:58 +0000 (19:51 -0600)]
Remove a VEC from aarch64-tdep.c

This removes a VEC from aarch64-tdep.c, replacing it with a
std::vector.

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

* aarch64-tdep.c (stack_item_t): Remove typedef and DEF_VEC.
(struct aarch64_call_info): Add initializers.
<si>: Now a std::vector.
(pass_on_stack, aarch64_push_dummy_call): Update.

5 years agoRemove a VEC from ppc-linux-nat.c
Tom Tromey [Sun, 22 Jul 2018 16:28:23 +0000 (10:28 -0600)]
Remove a VEC from ppc-linux-nat.c

This replaces a VEC in ppc-linux-nat.c with a std::vector.

gdb/ChangeLog
2019-05-04  Simon Marchi  <simon.marchi@efficios.com>
    Tom Tromey  <tom@tromey.com>

* ppc-linux-nat.c (thread_points_p): Remove typedef and DEF_VEC.
(ppc_threads): Now a std::vector.  Now static.
(hwdebug_find_thread_points_by_tid)
(ppc_linux_nat_target::low_new_thread, ppc_linux_thread_exit):
Update.

5 years agoChange arc_tdesc_init to return bool
Tom Tromey [Wed, 24 Apr 2019 22:24:05 +0000 (16:24 -0600)]
Change arc_tdesc_init to return bool

This changes arc_tdesc_init to return bool.

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

* arc-tdep.c (arc_tdesc_init): Return bool.

5 years agoUse gdb_assert_not_reached in arm-linux-nat.c
Tom Tromey [Wed, 24 Apr 2019 22:22:57 +0000 (16:22 -0600)]
Use gdb_assert_not_reached in arm-linux-nat.c

This changes arm-linux-nat.c to use gdb_assert_not_reached rather than
an assert of false.

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

* arm-linux-nat.c (arm_linux_nat_target::can_use_hw_breakpoint):
Use gdb_assert_not_reached.

5 years agoUse "false" in compile_cplus_convert_enum
Tom Tromey [Wed, 24 Apr 2019 22:19:51 +0000 (16:19 -0600)]
Use "false" in compile_cplus_convert_enum

This changes compile_cplus_convert_enum to use "false".

Note that this variable is never modified, which seems like an error.
I filed PR compile/24473 for this.

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

* compile/compile-cplus-types.c (compile_cplus_convert_enum): Use
"false".

5 years agoUse bool, true, and false in arc-tdep.c
Tom Tromey [Wed, 24 Apr 2019 22:18:41 +0000 (16:18 -0600)]
Use bool, true, and false in arc-tdep.c

This changes arc-tdep.c to use bool, true, and false.

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

* arc-tdep.c (arc_tdesc_init): Use bool.

5 years agoUse "false" in select_frame_for_mi
Tom Tromey [Mon, 22 Apr 2019 02:24:05 +0000 (20:24 -0600)]
Use "false" in select_frame_for_mi

This changes select_frame_for_mi to use "false" rather than "FALSE".

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

* stack.c (select_frame_for_mi): Use "false", not "FALSE".

5 years agoChange valid_command_p to return bool
Tom Tromey [Mon, 22 Apr 2019 02:21:36 +0000 (20:21 -0600)]
Change valid_command_p to return bool

This changes valid_command_p to return bool.

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

* cli/cli-cmds.c (valid_command_p): Return bool.