binutils-gdb.git
5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 28 May 2019 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoFix typo in gdb/NEWS
Tom Tromey [Mon, 27 May 2019 20:53:12 +0000 (14:53 -0600)]
Fix typo in gdb/NEWS

I noticed a typo in gdb/NEWS.  This fixes it.

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

* NEWS: Fix typo.

5 years agoFix failure on powerpc 32-bit only targets
Alan Modra [Mon, 27 May 2019 02:07:51 +0000 (11:37 +0930)]
Fix failure on powerpc 32-bit only targets

Targets that lack ppc64 support were failing the new prefix-reloc
test.  This patch adds some test infrastructure to deal with that, and
changes the powerpc gas usage info so that "-a64" is omitted when
unsupported.

I've been meaning to break up the usage message for a long time;
While doing so causes translators some work now, it should make it
easier next time a new powerpc option is added.

* config/tc-ppc.c (is_ppc64_target): New function.
(md_show_usage): Split up usage message.  Don't show -a64 when
unsupported.
testsuite/gas/ppc/ppc.exp (supports_ppc64): New.
(prefix-reloc): Only run for ppc64.

5 years agoreadelf group errors/warnings
Alan Modra [Mon, 27 May 2019 01:07:37 +0000 (10:37 +0930)]
readelf group errors/warnings

I noticed that one of the readelf errors stopped processing of further
group sections.  This patch makes readelf continue on to other groups,
like it does with the other errors.

* readelf.c (process_section_groups): Continue processing groups
when sh_entsize exceeds group size.

5 years agoAnother generic ELF target assertion failure
Alan Modra [Mon, 27 May 2019 00:59:22 +0000 (10:29 +0930)]
Another generic ELF target assertion failure

After fixing the ld-elf/pr22836-1a segmentation fault we run into an
assertion failure due to the generic ELF target not removing empty
SHT_GROUP sections.  Avoid that.

* elf.c (bfd_elf_set_group_contents): Exit on zero size section.

5 years agoGeneric ELF target group signature symbol
Alan Modra [Mon, 27 May 2019 00:08:42 +0000 (09:38 +0930)]
Generic ELF target group signature symbol

Even though the generic ELF target doesn't handle groups correctly,
this helps avoid a segfault in bfd_elf_set_group_contents seen on
d30v-elf, dlx-elf, pj-elf, and xgate-elf when linking the pr22836
testcase.

PR 24596
bfd/
* linker.c (_bfd_generic_link_output_symbols): Heed BSF_KEEP.
ld/
* emultempl/genelf.em (gld${EMULATION_NAME}_after_open): Set
BFS_KEEP on group signature symbol.

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

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

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

5 years agoaarch64: handle STO_AARCH64_VARIANT_PCS in bfd
Szabolcs Nagy [Thu, 25 Apr 2019 14:07:14 +0000 (15:07 +0100)]
aarch64: handle STO_AARCH64_VARIANT_PCS in bfd

Propagate STO_AARCH64_VARIANT_PCS st_other attribute to the output and
add DT_AARCH64_VARIANT_PCS dynamic tag if necessary.

Mismatching attributes are not diagnosed.

bfd/ChangeLog:

* elfnn-aarch64.c (elfNN_aarch64_merge_symbol_attribute): New function.
(struct elf_aarch64_link_hash_table): Add variant_pcs member.
(elfNN_aarch64_allocate_dynrelocs): Update variant_pcs.
(elfNN_aarch64_size_dynamic_sections): Add DT_AARCH64_VARIANT_PCS.
(elf_backend_merge_symbol_attribute): Define.

ld/ChangeLog:

* testsuite/ld-aarch64/aarch64-elf.exp: Add new tests.
* testsuite/ld-aarch64/variant_pcs-1.s: New asm for tests.
* testsuite/ld-aarch64/variant_pcs-2.s: New asm for tests.
* testsuite/ld-aarch64/variant_pcs-now.d: New test.
* testsuite/ld-aarch64/variant_pcs-r.d: New test.
* testsuite/ld-aarch64/variant_pcs-shared.d: New test.
* testsuite/ld-aarch64/variant_pcs.ld: New linker script for tests.

5 years agoaarch64: override default elf .set handling in gas
Szabolcs Nagy [Thu, 25 Apr 2019 14:07:10 +0000 (15:07 +0100)]
aarch64: override default elf .set handling in gas

Allow st_other values such as STO_AARCH64_VARIANT_PCS to be set for alias
symbols independently.  This is needed for ifunc symbols which are
aliased to the resolver using .set and don't expect resolver attributes
to override the ifunc symbol attributes.  This means .variant_pcs must be
added explicitly to aliases.

gas/ChangeLog:

* config/tc-aarch64.c (aarch64_elf_copy_symbol_attributes): Define.
* config/tc-aarch64.h (aarch64_elf_copy_symbol_attributes): Declare.
(OBJ_COPY_SYMBOL_ATTRIBUTES): Define.
* testsuite/gas/aarch64/symbol-variant_pcs-3.d: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-3.s: New test.

5 years agoaarch64: handle .variant_pcs directive in gas
Szabolcs Nagy [Thu, 25 Apr 2019 14:06:53 +0000 (15:06 +0100)]
aarch64: handle .variant_pcs directive in gas

In ELF objects the specified symbol is marked with STO_AARCH64_VARIANT_PCS.

gas/ChangeLog:

* config/tc-aarch64.c (s_variant_pcs): New function.
* doc/c-aarch64.texi: Document .variant_pcs.
* testsuite/gas/aarch64/symbol-variant_pcs-1.d: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-1.s: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-2.d: New test.
* testsuite/gas/aarch64/symbol-variant_pcs-2.s: New test.

5 years agoaarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS
Szabolcs Nagy [Thu, 25 Apr 2019 12:46:01 +0000 (13:46 +0100)]
aarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS

The bottom 2 bits of st_other are used for visibility, the top 6 bits are
de facto reserved for processor specific use.  This patch defines a
bits to mark function symbols that follow a variant procedure call standard
with different register usage convention.

A dynamic tag is also defined that marks modules with R_<CLS>_JUMP_SLOT
relocations referencing symbols marked with STO_AARCH64_VARIANT_PCS.
This can be used by dynamic linkers that support lazy binding to decide
what registers need to be preserved during symbol resolution.

binutils/ChangeLog:

* readelf.c (get_aarch64_dynamic_type): Handle DT_AARCH64_VARIANT_PCS.
(get_aarch64_symbol_other): New, handles STO_AARCH64_VARIANT_PCS.
(get_symbol_other): Call get_aarch64_symbol_other.

include/ChangeLog:

* elf/aarch64.h (DT_AARCH64_VARIANT_PCS): Define.
(STO_AARCH64_VARIANT_PCS): Define.

5 years agoRegen POTFILES for bpf
Alan Modra [Fri, 24 May 2019 13:39:56 +0000 (23:09 +0930)]
Regen POTFILES for bpf

bfd/
* po/SRC-POTFILES.in: Regenerate.
gas/
* po/POTFILES.in: Regenerate.
ld/
* po/BLD-POTFILES.in: Regenerate.
opcodes/
* po/POTFILES.in: Regenerate.

5 years ago[gdb/testsuite] Add test-case for gdb-add-index.sh
Tom de Vries [Fri, 24 May 2019 12:25:33 +0000 (14:25 +0200)]
[gdb/testsuite] Add test-case for gdb-add-index.sh

Add a test-case gdb.dwarf2/gdb-add-index.exp to test
gdb/contrib/gdb-add-index.sh.

Tested with x86_64-linux.

gdb/testsuite/ChangeLog:

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

* gdb.dwarf2/gdb-add-index.exp: New file.

5 years agoPowerPC notoc linkage stubs
Alan Modra [Thu, 9 Aug 2018 13:23:00 +0000 (22:53 +0930)]
PowerPC notoc linkage stubs

Use pcrel addressing instructions in linkage stubs.

bfd/
* elf64-ppc.c: Comment on powerxx _notoc stub variants.
(LI_R11_0, LIS_R11, ORI_R11_R11_0, SLDI_R11_R11_34): Define.
(PADDI_R12_PC, PLD_R12_PC, D34, HA34): Define.
(struct ppc_link_hash_table): Add powerxx_stubs.
(ppc64_elf_check_relocs): Set powerxx_stubs.
(build_powerxx_offset, size_powerxx_offset),
(num_relocs_for_powerxx_offset),
(emit_relocs_for_powerxx_offset): New functions.
(plt_stub_size): Size powerxx stubs.
(ppc_build_one_stub): Emit powerxx stubs.
(ppc_size_one_stub): Size powerxx stubs.  Omit .eh_frame for
powerxx stubs.
ld/
* testsuite/ld-powerpc/notoc2.d,
* testsuite/ld-powerpc/notoc2.s: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.

5 years agoPowerPC GOT_PCREL34 optimisation
Alan Modra [Tue, 30 Apr 2019 07:03:25 +0000 (16:33 +0930)]
PowerPC GOT_PCREL34 optimisation

bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Set has_gotrel for
R_PPC64_GOT_PCREL34.
(xlate_pcrel_opt): New function.
(ppc64_elf_edit_toc): Handle R_PPC64_GOT_PCREL34.
(ppc64_elf_relocate_section): Edit GOT indirect to GOT relative
for R_PPC64_GOT_PCREL34.  Implement R_PPC64_PCREL_OPT optimisation.
ld/
* testsuite/ld-powerpc/pcrelopt.s,
* testsuite/ld-powerpc/pcrelopt.d,
* testsuite/ld-powerpc/pcrelopt.sec: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.

5 years agoPowerPC relocations for prefix insns
Alan Modra [Wed, 29 Aug 2018 04:52:34 +0000 (14:22 +0930)]
PowerPC relocations for prefix insns

include/
* elf/ppc64.h (R_PPC64_PLTSEQ_NOTOC, R_PPC64_PLTCALL_NOTOC),
(R_PPC64_PCREL_OPT, R_PPC64_D34, R_PPC64_D34_LO, R_PPC64_D34_HI30),
(R_PPC64_D34_HA30, R_PPC64_PCREL34, R_PPC64_GOT_PCREL34),
(R_PPC64_PLT_PCREL34, R_PPC64_PLT_PCREL34_NOTOC),
(R_PPC64_ADDR16_HIGHER34, R_PPC64_ADDR16_HIGHERA34),
(R_PPC64_ADDR16_HIGHEST34, R_PPC64_ADDR16_HIGHESTA34),
(R_PPC64_REL16_HIGHER34, R_PPC64_REL16_HIGHERA34),
(R_PPC64_REL16_HIGHEST34, R_PPC64_REL16_HIGHESTA34),
(R_PPC64_D28, R_PPC64_PCREL28): Define.
bfd/
* reloc.c (BFD_RELOC_PPC64_D34, BFD_RELOC_PPC64_D34_LO),
(BFD_RELOC_PPC64_D34_HI30, BFD_RELOC_PPC64_D34_HA30),
(BFD_RELOC_PPC64_PCREL34, BFD_RELOC_PPC64_GOT_PCREL34),
(BFD_RELOC_PPC64_PLT_PCREL34),
(BFD_RELOC_PPC64_ADDR16_HIGHER34, BFD_RELOC_PPC64_ADDR16_HIGHERA34),
(BFD_RELOC_PPC64_ADDR16_HIGHEST34, BFD_RELOC_PPC64_ADDR16_HIGHESTA34),
(BFD_RELOC_PPC64_REL16_HIGHER34, BFD_RELOC_PPC64_REL16_HIGHERA34),
(BFD_RELOC_PPC64_REL16_HIGHEST34, BFD_RELOC_PPC64_REL16_HIGHESTA34),
(BFD_RELOC_PPC64_D28, BFD_RELOC_PPC64_PCREL28): New reloc enums.
* elf64-ppc.c (PNOP): Define.
(ppc64_elf_howto_raw): Add reloc howtos for new relocations.
(ppc64_elf_reloc_type_lookup): Translate new bfd reloc numbers.
(ppc64_elf_ha_reloc): Adjust addend for highera34 and highesta34
relocs.
(ppc64_elf_prefix_reloc): New function.
(struct ppc_link_hash_table): Add notoc_plt.
(is_branch_reloc): Add R_PPC64_PLTCALL_NOTOC.
(is_plt_seq_reloc): Add R_PPC64_PLT_PCREL34,
R_PPC64_PLT_PCREL34_NOTOC, and R_PPC64_PLTSEQ_NOTOC.
(ppc64_elf_check_relocs): Handle pcrel got and plt relocs.  Set
has_pltcall for section on seeing R_PPC64_PLTCALL_NOTOC.  Handle
possible need for dynamic relocs on non-pcrel powerxx relocs.
(dec_dynrel_count): Handle non-pcrel powerxx relocs.
(ppc64_elf_inline_plt): Handle R_PPC64_PLTCALL_NOTOC.
(toc_adjusting_stub_needed): Likewise.
(ppc64_elf_tls_optimize): Handle R_PPC64_PLTSEQ_NOTOC.
(ppc64_elf_relocate_section): Handle new powerxx relocs.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.c (ppc_elf_suffix): Support @pcrel, @got@pcrel,
@plt@pcrel, @higher34, @highera34, @highest34, and @highesta34.
(fixup_size): Handle new powerxx relocs.
(md_assemble): Warn for @pcrel on non-prefix insns.
Accept @l, @h and @ha on prefix insns, and infer reloc without
any @ suffix.  Translate powerxx relocs to suit DQ and DS field
instructions.  Include operand tests as well as opcode test to
translate BFD_RELOC_HI16_S to BFD_RELOC_PPC_16DX_HA.
(ppc_fix_adjustable): Return false for pcrel GOT and PLT relocs.
(md_apply_fix): Handle new powerxx relocs.
* config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): Accept
BFD_RELOC_PPC64_ADDR16_HIGHER34, BFD_RELOC_PPC64_ADDR16_HIGHERA34,
BFD_RELOC_PPC64_ADDR16_HIGHEST34, BFD_RELOC_PPC64_ADDR16_HIGHESTA34,
BFD_RELOC_PPC64_D34, and BFD_RELOC_PPC64_D28.
* testsuite/gas/ppc/prefix-reloc.d,
* testsuite/gas/ppc/prefix-reloc.s: New test.
* testsuite/gas/ppc/ppc.exp: Run it.

5 years agoPowerPC D-form prefixed loads and stores
Peter Bergner [Sat, 28 Jul 2018 03:21:43 +0000 (22:21 -0500)]
PowerPC D-form prefixed loads and stores

opcodes/
* ppc-opc.c (insert_d34, extract_d34, insert_nsi34, extract_nsi34),
(insert_pcrel, extract_pcrel, extract_pcrel0): New functions.
(extract_esync, extract_raq, extract_tbr, extract_sxl): Comment.
(powerpc_operands <D34, SI34, NSI34, PRA0, PRAQ, PCREL, PCREL0,
XTOP>): Define and add entries.
(P8LS, PMLS, P_D_MASK, P_DRAPCREL_MASK): Define.
(prefix_opcodes): Add pli, paddi, pla, psubi, plwz, plbz, pstw,
pstb, plhz, plha, psth, plfs, plfd, pstfs, pstfd, plq, plxsd,
plxssp, pld, plwa, pstxsd, pstxssp, pstxv, pstd, and pstq.
gas/
* config/tc-ppc.c (ppc_insert_operand): Only sign extend fields that
are 32-bits or smaller.
* messages.c (as_internal_value_out_of_range): Do not truncate
variables and use BFD_VMA_FMT to print them.
* testsuite/gas/ppc/prefix-pcrel.s,
* testsuite/gas/ppc/prefix-pcrel.d: New test.
* testsuite/gas/ppc/ppc.exp: Run it.

5 years agoPowerPC add initial -mfuture instruction support
Peter Bergner [Tue, 15 May 2018 21:48:14 +0000 (16:48 -0500)]
PowerPC add initial -mfuture instruction support

This patch adds initial 64-bit insn assembler/disassembler support.
The only instruction added is "pnop" along with the automatic aligning
of prefix instruction so they do not cross 64-byte boundaries.

include/
* dis-asm.h (WIDE_OUTPUT): Define.
* opcode/ppc.h (prefix_opcodes, prefix_num_opcodes): Declare.
(PPC_OPCODE_POWERXX, PPC_GET_PREFIX, PPC_GET_SUFFIX),
(PPC_PREFIX_P, PPC_PREFIX_SEG): Define.
opcodes/
* ppc-dis.c (ppc_opts): Add "future" entry.
(PREFIX_OPCD_SEGS): Define.
(prefix_opcd_indices): New array.
(disassemble_init_powerpc): Initialize prefix_opcd_indices.
(lookup_prefix): New function.
(print_insn_powerpc): Handle 64-bit prefix instructions.
* ppc-opc.c (PREFIX_OP, PREFIX_FORM, SUFFIX_MASK, PREFIX_MASK),
(PMRR, POWERXX): Define.
(prefix_opcodes): New instruction table.
(prefix_num_opcodes): New constant.
binutils/
* objdump.c (disassemble_bytes): Set WIDE_OUTPUT in flags.
gas/
* config/tc-ppc.c (ppc_setup_opcodes): Handle prefix_opcodes.
(struct insn_label_list): New.
(insn_labels, free_insn_labels): New variables.
(ppc_record_label, ppc_clear_labels, ppc_start_line_hook): New funcs.
(ppc_frob_label, ppc_new_dot_label): Move functions earlier in file
and call ppc_record_label.
(md_assemble): Handle 64-bit prefix instructions.  Align labels
that are on the same line as a prefix instruction.
* config/tc-ppc.h (tc_frob_label, ppc_frob_label): Move to
later in the file.
(md_start_line_hook): Define.
(ppc_start_line_hook): Declare.
* testsuite/gas/ppc/prefix-align.d,
* testsuite/gas/ppc/prefix-align.s: New test.
* testsuite/gas/ppc/ppc.exp: Run new test.

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

5 years agobfd: fix build with --enable-targets=all in 32-bit hosts
Jose E. Marchesi [Thu, 23 May 2019 21:17:39 +0000 (23:17 +0200)]
bfd: fix build with --enable-targets=all in 32-bit hosts

This patch avoids for bpf_elf64_le_vec to be referenced in targmatch.h
when building a BFD without BFD64, resulting in an undefined symbol.
This was a regression introduced along with the BPF target.

bfd/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* config.bfd (targ_cpu): Process bpf-*-none only if BFD64.
* configure.ac: Set target_size=64 for bpf_elf64_le_vec and
bpf_elf64_be_vec.
* configure: Regenerate.

5 years agobinutils: add myself as the maintainer for BPF
Jose E. Marchesi [Thu, 23 May 2019 17:07:07 +0000 (19:07 +0200)]
binutils: add myself as the maintainer for BPF

binutils/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* MAINTAINERS: Add myself as the maintainer for BPF.

5 years agobinutils: add support for eBPF
Jose E. Marchesi [Thu, 23 May 2019 17:06:17 +0000 (19:06 +0200)]
binutils: add support for eBPF

This patch adds support for ELF64 eBPF to readelf, and fixes a `nm'
test to run properly in bpf-*-* targets.

binutils/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* readelf.c: Include elf/bpf.h.
(guess_is_rela): Hanle EM_BPF.
(dump_relocations): Likewise.
(is_32bit_abs_reloc): Likewise.
* testsuite/binutils-all/nm.exp: Add bpf-*-* to the list of
ELF targets.

5 years agold: add support for eBPF
Jose E. Marchesi [Thu, 23 May 2019 17:05:42 +0000 (19:05 +0200)]
ld: add support for eBPF

This patch adds support to the linker for the Linux eBPF architecture.
A minimal testsuite is included.

ld/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf64bpf.c.
* Makefile.in (prefix): Regenerate.
* configure.tgt (targ_extra_ofiles): Add case for bpf-*-* targets.
* emulparams/elf64bpf.sh: New file.
* testsuite/lib/ld-lib.exp (check_gc_sections_available): Add
bpf-*-* to the list of targets not supporting gc-sections.
* testsuite/ld-bpf/bar.s: New file.
* testsuite/ld-bpf/jump-1.d: Likewise.
* testsuite/ld-bpf/foo.s: Likewise.
* testsuite/ld-bpf/call-1.d: Likewise.
* testsuite/ld-bpf/bpf.exp: Likewise.
* testsuite/ld-bpf/baz.s: Likewise.

5 years agogas: add support for eBPF
Jose E. Marchesi [Thu, 23 May 2019 17:05:12 +0000 (19:05 +0200)]
gas: add support for eBPF

This patch adds a port for the Linux kernel eBPF to the GNU assembler.
A testsuite and documentation updates are included.

gas/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* configure.ac: Handle bpf-*-* targets.
* configure.tgt (generic_target): Likewise.
* configure: Regenerate.
* Makefile.am (TARGET_CPU_CFILES): Add tc-bpf.c.
(TARGET_CPU_HFILES): Add tc-bpf.h.
* Makefile.in: Regenerated.
* config/tc-bpf.c: New file.
* config/tc-bpf.h: Likewise.
* doc/Makefile.am (CPU_DOCS): Add c-bpf.texi.
* doc/Makefile.in: Regenerated.
* doc/all.texi: set BPF.
* doc/as.texi: Add eBPF contents.
* doc/c-bpf.texi: New file.
* testsuite/gas/bpf/alu.d: New file.
* testsuite/gas/bpf/mem-be.d: Likewise.
* testsuite/gas/bpf/mem.s: Likewise.
* testsuite/gas/bpf/mem.d: Likewise.
* testsuite/gas/bpf/lddw-be.d: Likewise.
* testsuite/gas/bpf/lddw.s: Likewise.
* testsuite/gas/bpf/lddw.d: Likewise.
* testsuite/gas/bpf/jump-be.d: Likewise.
* testsuite/gas/bpf/jump.s: Likewise.
* testsuite/gas/bpf/jump.d: Likewise.
* testsuite/gas/bpf/exit-be.d: Likewise.
* testsuite/gas/bpf/exit.s: Likewise.
* testsuite/gas/bpf/exit.d: Likewise.
* testsuite/gas/bpf/call-be.d: Likewise.
* testsuite/gas/bpf/call.s: Likewise.
* testsuite/gas/bpf/call.d: Likewise.
* testsuite/gas/bpf/bpf.exp: Likewise.
* testsuite/gas/bpf/atomic-be.d: Likewise.
* testsuite/gas/bpf/atomic.s: Likewise.
* testsuite/gas/bpf/atomic.d: Likewise.
* testsuite/gas/bpf/alu-be.d: Likewise.
* testsuite/gas/bpf/alu32-be.d: Likewise.
* testsuite/gas/bpf/alu32.s: Likewise.
* testsuite/gas/bpf/alu32.d: Likewise.
* testsuite/gas/bpf/alu.s: Likewise.
* testsuite/gas/all/gas.exp: Introduce a nop_type for eBPF.
* testsuite/gas/all/org-1.s: Support nop_type 6.
* testsuite/gas/all/org-1.l: Updated to reflect changes in
org-1.s.

5 years agoopcodes: add support for eBPF
Jose E. Marchesi [Thu, 23 May 2019 17:04:36 +0000 (19:04 +0200)]
opcodes: add support for eBPF

This patch adds support for the Linux kernel eBPF architecture to the
opcodes.  The port is based on CGEN.

opcodes/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* configure.ac (SHARED_DEPENDENCIES): Add case for bfd_bpf_arch.
* configure: Regenerated.
* Makefile.am: Add rules for the files generated from cpu/bpf.cpu
and cpu/bpf.opc.
(HFILES): Add bpf-desc.h and bpf-opc.h.
(TARGET_LIBOPCODES_CFILES): Add bpf-asm.c, bpf-desc.c, bpf-dis.c,
bpf-ibld.c and bpf-opc.c.
(BPF_DEPS): Define.
* Makefile.in: Regenerated.
* disassemble.c (ARCH_bpf): Define.
(disassembler): Add case for bfd_arch_bpf.
(disassemble_init_for_target): Likewise.
(enum epbf_isa_attr): Define.
* disassemble.h: extern print_insn_bpf.
* bpf-asm.c: Generated.
* bpf-opc.h: Likewise.
* bpf-opc.c: Likewise.
* bpf-ibld.c: Likewise.
* bpf-dis.c: Likewise.
* bpf-desc.h: Likewise.
* bpf-desc.c: Likewise.

5 years agocpu: add eBPF cpu description
Jose E. Marchesi [Thu, 23 May 2019 17:03:59 +0000 (19:03 +0200)]
cpu: add eBPF cpu description

This patch adds a CPU description for the Linux kernel eBPF virtual
machine, plus supporting code for disassembler and assembler.

cpu/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* bpf.cpu: New file.
* bpf.opc: Likewise.

5 years agobfd: add support for eBPF
Jose E. Marchesi [Thu, 23 May 2019 17:33:41 +0000 (19:33 +0200)]
bfd: add support for eBPF

This patch adds support to BFD for elf64-bpf, in both little-endian
and big-endian variants.

bfd/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* configure.ac: Add bpf_elf64_le_vec and bpf_elf64_be_vec.
* configure: Regenerated.
* Makefile.am (ALL_MACHINES): Add cpu-bpf.lo.
(ALL_MACHINES_CFILES): Add cpu-bpf.c.
(BFD64_BACKENDS): Add elf64-bpf.lo.
(BFD64_BACKENDS_CFILES): Add elf64-bpf.c.
* Makefile.in (SOURCE_HFILES): Regenerate.
* config.bfd (targ_cpu): Handle bpf-*-* targets.
* cpu-bpf.c: New file.
* elf64-bpf.c: Likewise.
* targets.c (_bfd_target_vector): Add bpf_elf64_be_vec and
bpf_elf64_le_vec.
* archures.c: Define architecture bfd_arch_bpf and machine
bfd_arch_bpf.
* reloc.c: Define BFD relocations used by the BPF target.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

5 years agoinclude: add elf/bpf.h
Jose E. Marchesi [Thu, 23 May 2019 16:30:42 +0000 (18:30 +0200)]
include: add elf/bpf.h

This patch adds a header file with BPF-specific ELF definitions.  In
particular, the architecture relocations.

include/ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* elf/bpf.h: New file.

5 years agoconfig.guess,config.sub: synchronize with config project master sources
Jose E. Marchesi [Thu, 23 May 2019 16:19:56 +0000 (18:19 +0200)]
config.guess,config.sub: synchronize with config project master sources

This is to bring in the newly introduced support for bpf-*-* targets.

ChangeLog:

2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>

* config.guess: Synchronize with config project master sources.
* config.sub: Likewise.
* readline/support/config.guess: Likewise.
* readline/support/config.sub: Likewise.

5 years agoRe: Have the linker report an error if the same script is used twice
Alan Modra [Thu, 23 May 2019 00:52:56 +0000 (10:22 +0930)]
Re: Have the linker report an error if the same script is used twice

git commit 6ec6968b1b2 results in
... error: linker script file '/usr/local/lib64/libgcc_s.so' appears multiple times
collect2: error: ld returned 1 exit status
FAIL: bootstrap

This patch changes things so that an error is given only when a -T
script or the default script is invoked more than once.  I'm still a
little nervous that we match script file names, not the entire path.

PR 24576
* ldfile.c (enum script_open_style): New.
(struct script_name_list): New.
(ldfile_open_command_file_1): Take a script_open_style param
rather than booleans.  Adjust callers.  Only fail when -T or
default -T script is invoked twice.
(ldfile_try_open_bfd): Revert last change.

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

5 years agoConstify target_ops::follow_exec
Tom Tromey [Wed, 22 May 2019 19:41:28 +0000 (15:41 -0400)]
Constify target_ops::follow_exec

I noticed that target_ops::follow_exec took a "char *" parameter,
where "const char *" would be more correct.  This patch changes this
(and related functions) to be constified.

Tested by rebuilding.

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

* target.c (target_follow_exec): Constify parameter.
* target-delegates.c: Rebuild.
* remote.c (remote_target::follow_exec): Constify parameter.
* infrun.c (follow_exec): Constify parameter.
* target.h (struct target_ops) <follow_exec>: Constify parameter.
(target_follow_exec): Likewise.

5 years agoAdd "style" proc to the test suite
Tom Tromey [Tue, 14 May 2019 14:04:22 +0000 (08:04 -0600)]
Add "style" proc to the test suite

This adds a "style" helper proc to the test suite, and updates
existing style tests to use it.  Thanks to Sergio for the idea.

Tested on x86-64 Fedora 29.

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

* gdb.base/info-shared.exp (check_info_shared): Use "style".
* gdb.base/style.exp: Use "style".
* lib/gdb-utils.exp (style): New proc.

5 years ago[gdb/testsuite] Require c++11 for gdb.base/align.exp
Tom de Vries [Wed, 22 May 2019 16:13:04 +0000 (18:13 +0200)]
[gdb/testsuite] Require c++11 for gdb.base/align.exp

When building gdb on ubuntu 16.04 with gcc 5.4.0, and running the gdb
testsuite we run into a failure due align.exp requiring at least c++11.

Fix this by adding -std=c++11.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* gdb.base/align.exp: Require c++11.

5 years ago[gdb/testsuite] Add missing mi_skip_python_tests to py-mi-var-info-path-expression.exp
Tom de Vries [Wed, 22 May 2019 15:55:44 +0000 (17:55 +0200)]
[gdb/testsuite] Add missing mi_skip_python_tests to py-mi-var-info-path-expression.exp

Fix gdb.python/py-mi-var-info-path-expression.exp for a gdb build without
python support.

gdb/testsuite/ChangeLog:

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

PR testsuite/24586
* gdb.python/py-mi-var-info-path-expression.exp: Call
mi_skip_python_tests to check if python is supported.

5 years agoHave the linker report an error if the same script is used twice.
Nick Clifton [Wed, 22 May 2019 14:58:57 +0000 (15:58 +0100)]
Have the linker report an error if the same script is used twice.

PR 24576
* ld/ldfile.c: (ldfile_open_command_file_1): Add new parameter -
is_script.  If true check that the file has not already been
parsed as a linker script.
(ldfile_open_script_file): New function.
(ldfile_try_open_bfd): Use the new function in place of
ldfile_open_command_line.
* ldmain.c (main): Likewise.
* lexsup.c (parse_args): Use the new function for opening linker
scripts with the -T option.
* ldfile.h (ldfile_open_script_file): Add prototype.

5 years agoAArch64: Treat pauth ops as nops on non-pauth systems
Alan Hayward [Wed, 22 May 2019 13:02:17 +0000 (14:02 +0100)]
AArch64: Treat pauth ops as nops on non-pauth systems

Running an address signed binary through GDB on a non pauth system
gives the following error:
Call Frame Instruction op 45 in vendor extension space is not handled on this architecture.

Instead GDB should ignore the op, treating it as a nop.

Add test case for pauth binaries, regardless of whether the target
supports it.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_execute_dwarf_cfa_vendor_op): Treat
DW_CFA_AARCH64_negate_ra_state as nop on non pauth targets.

gdb/testsuite/ChangeLog:

* gdb.arch/aarch64-pauth.c: New test.
* gdb.arch/aarch64-pauth.exp: New file.

5 years agoDocument gdb.in/gdb.cmd files and debugredirect cli command
Alan Hayward [Wed, 22 May 2019 12:40:20 +0000 (13:40 +0100)]
Document gdb.in/gdb.cmd files and debugredirect cli command

Add missing documentation for the debugredirect setting.

Add description and uses of gdb.in/gdb.cmd to the testsuite README.

Mention this in the NEWS file.

gdb/ChangeLog:

* NEWS: Add debugredirect and testsuite sections.

gdb/doc/ChangeLog:

* gdb.texinfo (Shell Commands): Add debugredirect.

gdb/testsuite/ChangeLog:

* README (Re-running Tests Outside The Testsuite): New section.

5 years agogdb/riscv: Improve flen length determination
Simon Cook [Wed, 22 May 2019 11:59:58 +0000 (12:59 +0100)]
gdb/riscv: Improve flen length determination

This solves an assertion failure when a remote provides a target
description which only refers to floating point registers by their
hardware name (e.g. f0), rather than their ABI name (e.g. ft0). GDB
assumed that should the floating point register feature be presented,
it would contain a register called ft0.

The floating point length is now instead determined by searching for
the same register, but looking for any of its aliases.

gdb/ChangeLog:

* riscv-tdep.c (riscv_gdbarch_init): Support determining flen from
target descriptions using exclusively floating point register name
aliases.

5 years agogdb/doc: Minor formatting fixes in documentation of -complete
Jan Vrany [Wed, 22 May 2019 11:48:26 +0000 (12:48 +0100)]
gdb/doc: Minor formatting fixes in documentation of -complete

gdb/doc/Changelog:

* gdb.texinfo: Minor formatting fixes.

5 years agoARM STM32L4XX erratum test failure with MALLOC_PERTURB_
Alan Modra [Wed, 22 May 2019 08:59:20 +0000 (18:29 +0930)]
ARM STM32L4XX erratum test failure with MALLOC_PERTURB_

* elf32-arm.c (arm_allocate_glue_section_space): Clear section
contents.

5 years agovms-alpha gas segfault
Alan Modra [Wed, 22 May 2019 08:30:16 +0000 (18:00 +0930)]
vms-alpha gas segfault

* vms-alpha.c (_bfd_vms_write_etir): Don't attempt further
processing on "size error in section".

5 years agobfdtest1 segfaults on hppa-hp-hpux10
Alan Modra [Wed, 22 May 2019 08:22:59 +0000 (17:52 +0930)]
bfdtest1 segfaults on hppa-hp-hpux10

The archive element cache needs tidying when closing an archive element.
This patch fixes these failures:
-FAIL: ar long file names (bfdtest1)
-FAIL: ar thin archive (bfdtest1)
-FAIL: ar thin archive with nested archive (bfdtest1)

* som.c (som_bfd_free_cached_info): Call
_bfd_generic_close_and_cleanup.

5 years agoS12Z: GAS: New option --mdollar-hex.
John Darrington [Wed, 22 May 2019 05:16:14 +0000 (07:16 +0200)]
S12Z: GAS: New option --mdollar-hex.

This option (also implied by --traditional) causes '$' to introduce
literal hexadecimal constants, rather than the modern convention '0x'.

gas/
* config/tc-s12z.c (s12z_strtol): New function. (md_show_usage): Update.
(md_parse_option): new case OPTION_DOLLAR_HEX. (s12z_init_after_args):
(<global>): Use s12z_strtol instead of strtol.
* doc/c-s12z.texi (S12Z Options): Document new option -mdollar-hex.
* testsuite/gas/s12z/dollar-hex.d: New file.
* testsuite/gas/s12z/dollar-hex.s: New file.
* testsuite/gas/s12z/s12z.exp: Add them.

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

5 years agogdb/fortran: Handle gdbarch_floatformat_for_type returning nullptr
Andrew Burgess [Tue, 21 May 2019 21:14:05 +0000 (22:14 +0100)]
gdb/fortran: Handle gdbarch_floatformat_for_type returning nullptr

In this commit:

  commit 34d11c682fd96c7dbe3ebd6cd9033e65d51ec7a3
  Date:   Fri May 3 15:23:55 2019 +0100

      gdb/fortran: Use floatformats_ia64_quad for fortran 16-byte floats

GDB was changed such that the Fortran's 16-byte float format was
obtained by calling gdbarch_floatformat_for_type instead of just using
gdbarch_long_double_format as it was before.

The problem with this default_floatformat_for_type can return NULL in
some cases, and the code introduced in 34d11c682f didn't consider
this.

This commit introduces several alternative strategies for finding a
suitable 16-byte floating point type.  First GDB calls
gdbarch_floatformat_for_type (this was what 34d11c682f added), if this
returns null GDB will use gdbarch_long_double_format if it is the
correct size (this was the format used before 34d11c682f).  Finally,
if neither of the above provides a suitable type then GDB will create
a new dummy type.

This final dummy type is unlikely to provide an correct debug
experience as far as examining the 16-byte floats, but it should
prevent GDB crashing.

gdb/ChangeLog:

PR gdb/18644:
* f-lang.c (build_fortran_types): Handle the case where
gdbarch_floatformat_for_type returns a nullptr.

5 years agoMIPS/LD: Reject tprel_hi and tprel_lo relocations in shared library
Faraz Shahbazker [Sat, 18 May 2019 08:19:04 +0000 (01:19 -0700)]
MIPS/LD: Reject tprel_hi and tprel_lo relocations in shared library

bfd/
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Generate error
for TLS_TPREL_HI16(/LO16) relocations in shared library.

ld/
* testsuite/ld-mips-elf/pic-reloc-5.s: Add tests for
%tprel_hi and %tprel_lo relocations.
* testsuite/ld-mips-elf/pic-reloc-6.s: Likewise.
* testsuite/ld-mips-elf/pic-reloc-5.d: Update accordingly.
* testsuite/ld-mips-elf/pic-reloc-6.d: Likewise.
* testsuite/ld-mips-elf/pic-reloc-tls.ld: New test linker
script file.

5 years agoMIPS/LD: Fix memory fault linking non-PIC object in to shared library
Faraz Shahbazker [Sat, 18 May 2019 08:19:03 +0000 (01:19 -0700)]
MIPS/LD: Fix memory fault linking non-PIC object in to shared library

bfd/
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Add NULL pointer
checks.  Search the RELA table for n64 relocations.

ld/
* testsuite/ld-mips-elf/pic-reloc-5.d: New test.
* testsuite/ld-mips-elf/pic-reloc-6.d: New test.
* testsuite/ld-mips-elf/pic-reloc-7.d: New test.
* testsuite/ld-mips-elf/pic-reloc-5.s: New test source.
* testsuite/ld-mips-elf/pic-reloc-6.s: New test source.
* testsuite/ld-mips-elf/pic-reloc-7.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

5 years ago[binutils, ARM] <spec_reg> changes for VMRS and VMSR instructions
Sudakshina Das [Tue, 21 May 2019 17:20:48 +0000 (18:20 +0100)]
[binutils, ARM] <spec_reg> changes for VMRS and VMSR instructions

This patch makes changes to the <spec_reg> operand for VMRS and VMSR
instructions as per the Armv8.1-M Mainline.
New <spec_reg> options to support are:

0b0010: FPSCR_nzcvqc, access to FPSCR condition and saturation flags.
0b1100: VPR, privileged only access to the VPR register.
0b1101: P0, access to VPR.P0 predicate fields
0b1110: FPCXT_NS, enables saving and restoring of Non-secure floating
point context.
0b1111: FPCXT_S, enables saving and restoring of Secure floating point
context

*** gas/ChangeLog ***

2019-05-21  Sudakshina Das  <sudi.das@arm.com>

* config/tc-arm.c (parse_operands): Update case OP_RVC to
parse p0 and P0.
(do_vmrs): Add checks for valid operands with respect to
cpu and fpu options.
(do_vmsr): Likewise.
(reg_names): New reg_names for FPSCR_nzcvqc, VPR, FPCXT_NS
and FPCXT_S.
* testsuite/gas/arm/armv8_1-m-spec-reg.d: New.
* testsuite/gas/arm/armv8_1-m-spec-reg.s: New.
* testsuite/gas/arm/armv8_1-m-spec-reg-bad1.d: New.
* testsuite/gas/arm/armv8_1-m-spec-reg-bad2.d: New.
* testsuite/gas/arm/armv8_1-m-spec-reg-bad3.d: New.
* testsuite/gas/arm/armv8_1-m-spec-reg-bad1.l: New.
* testsuite/gas/arm/armv8_1-m-spec-reg-bad2.l: New.
* testsuite/gas/arm/armv8_1-m-spec-reg-bad3.l: New.
* testsuite/gas/arm/vfp1xD.d: Updated to allow new valid values.
* testsuite/gas/arm/vfp1xD_t2.d: Likewise.

*** opcodes/ChangeLog ***

2019-05-21  Sudakshina Das  <sudi.das@arm.com>

* arm-dis.c (coprocessor_opcodes): New instructions for VMRS
and VMSR with the new operands.

5 years ago[binutils, Arm] Add support for conditional instructions in Armv8.1-M Mainline
Sudakshina Das [Tue, 21 May 2019 17:15:13 +0000 (18:15 +0100)]
[binutils, Arm] Add support for conditional instructions in Armv8.1-M Mainline

This patch adds the following instructions which are part of the
Armv8.1-M Mainline:
CINC
CINV
CNEG
CSINC
CSINV
CSNEG
CSET
CSETM
CSEL

gas/ChangeLog:

2019-05-21  Sudakshina Das  <sudi.das@arm.com>

* config/tc-arm.c (TOGGLE_BIT): New.
(T16_32_TAB): New entries for cinc, cinv, cneg, csinc,
csinv, csneg, cset, csetm and csel.
(operand_parse_code): New OP_RR_ZR.
(parse_operand): Handle case for OP_RR_ZR.
(do_t_cond): New.
(insns): New instructions for cinc, cinv, cneg, csinc,
csinv, csneg, cset, csetm, csel.
* testsuite/gas/arm/armv8_1-m-cond-bad.d: New test.
* testsuite/gas/arm/armv8_1-m-cond-bad.l: New test.
* testsuite/gas/arm/armv8_1-m-cond-bad.s: New test.
* testsuite/gas/arm/armv8_1-m-cond.d: New test.
* testsuite/gas/arm/armv8_1-m-cond.s: New test.

opcodes/ChangeLog:

2019-05-21  Sudakshina Das  <sudi.das@arm.com>

* arm-dis.c (enum mve_instructions): New enum
for csinc, csinv, csneg, csel, cset, csetm, cinv, cinv
and cneg.
(mve_opcodes): New instructions as above.
(is_mve_encoding_conflict): Add cases for csinc, csinv,
csneg and csel.
(print_insn_mve): Accept new %<bitfield>c and %<bitfield>C.

5 years ago[binutils, Arm] Add support for shift instructions in MVE
Sudakshina Das [Tue, 21 May 2019 17:11:08 +0000 (18:11 +0100)]
[binutils, Arm] Add support for shift instructions in MVE

This patch adds the following instructions which are part of
Armv8.1-M MVE:
ASRL (imm)
ASRL (reg)
LSLL (imm)
LSLL (reg)
LSRL
SQRSHRL
SRQSHR
SQSHLL
SQSHL
SRSHRL
SRSHR
UQRSHLL
UQRSHL
UQSHLL
UQSHL
URSHLL
URSHL

*** gas/ChangeLog ***

2019-05-21  Sudakshina Das  <sudi.das@arm.com>

* config/tc-arm.c (operand_parse_code): New entries for
OP_RRnpcsp_I32 (register or integer operands).
(do_mve_scalar_shift): New.
(insns): New instructions for asrl, lsll, lsrl, sqrshrl, sqrshr, sqshl
sqshll, srshr, srshrl, uqrshll, uqrshl, uqshll, uqshl, urshrl and urshr.
* testsuite/gas/arm/mve-shift.d: New.
* testsuite/gas/arm/mve-shift.s: New.
* testsuite/gas/arm/mve-shift-bad.d: New.
* testsuite/gas/arm/mve-shift-bad.s: New.
* testsuite/gas/arm/mve-shift-bad.l: New.

*** opcodes/ChangeLog ***

2019-05-21  Sudakshina Das  <sudi.das@arm.com>

* arm-dis.c (emun mve_instructions): Updated for new instructions.
(mve_opcodes): New instructions for asrl, lsll, lsrl, sqrshrl,
sqrshr, sqshl, sqshll, srshr, srshrl, uqrshll, uqrshl, uqshll,
uqshl, urshrl and urshr.
(is_mve_okay_in_it): Add new instructions to TRUE list.
(is_mve_unpredictable): Add cases for UNPRED_R13 and UNPRED_R15.
(print_insn_mve): Updated to accept new %j,
%<bitfield>m and %<bitfield>n patterns.

5 years agoMIPS/gas: Reject $0 as source register for DAUI instruction
Faraz Shahbazker [Tue, 14 May 2019 00:19:37 +0000 (17:19 -0700)]
MIPS/gas: Reject $0 as source register for DAUI instruction

The MIPS64R6 TRM requires that the source register for DAUI
not be r0.

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

gas/
* testsuite/gas/mips/r6-branch-constraints.s: Rename to ...
* testsuite/gas/mips/r6-reg-constraints.s: this and add test
case for DAUI.
* testsuite/gas/mips/r6-branch-constraints.l: Rename to ...
* testsuite/gas/mips/r6-reg-constraints.l: this and add test
for DAUI.
* testsuite/gas/mips/mips.exp: Rename test from
r6-branch-constraints to r6-reg-constraints.

opcodes/
* mips-opc.c (mips_builtin_opcodes): Change source register
constraint for DAUI.

5 years ago[MIPS] Add generation of PLT entries with compact jumps for MIPS R6
Matthew Fortune [Tue, 14 May 2019 00:03:19 +0000 (17:03 -0700)]
[MIPS] Add generation of PLT entries with compact jumps for MIPS R6

Add a new option to get the linker to emit PLTs that use compact
branches instead of delay slot branches.

bfd/
* elfxx-mips.c (LA25_BC): New macro.
(mips_elf_link_hash_table)<compact_branches>: New field.
(STUB_JALRC): New macro.
(mipsr6_o32_exec_plt0_entry_compact): New array.
(mipsr6_n32_exec_plt0_entry_compact): Likewise.
(mipsr6_n64_exec_plt0_entry_compact): Likewise.
(mipsr6_exec_plt_entry_compact): Likewise.
(mips_elf_create_la25_stub): Use BC instead of J for stubs
when compact_branches is true.
(_bfd_mips_elf_finish_dynamic_symbol): Choose the compact
PLT for MIPSR6 with compact_branches.  Do not reorder the
compact branches PLT.  Switch the lazy stub for MIPSR6
with compact_branches to use JALRC.
(mips_finish_exec_plt): Choose the compact PLT0 for MIPSR6
when compact_branches is true.
(_bfd_mips_elf_compact_branches): New function.
* elfxx-mips.h (_bfd_mips_elf_compact_branches): New prototype.

ld/
* emultempl/mipself.em (compact_branches): New static variable.
(mips_create_output_section_statements): Call
_bfd_mips_elf_compact_branches.
(PARSE_AND_LIST_PROLOGUE): Add OPTION_COMPACT_BRANCHES and
OPTION_NO_COMPACT_BRANCHES.
(PARSE_AND_LIST_LONGOPTS): Add compact-branches,
no-compact-branches.
(PARSE_AND_LIST_OPTIONS): Add --compact-branches,
--no-compact-branches.
(PARSE_AND_LIST_ARGS_CASES): Handle the above.
* ld.texinfo: Document --compact-branches, --no-compact-branches.
* testsuite/ld-mips-elf/pic-and-nonpic-1-r6.dd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-1-r6.nd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.dd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.gd: New test.
* testsuite/ld-mips-elf/pic-and-nonpic-1a-r6.s: New test source.
* testsuite/ld-mips-elf/pic-and-nonpic-3a-r6.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.

5 years agoAArch64: Fix -Werror on build
Tamar Christina [Tue, 21 May 2019 16:15:36 +0000 (17:15 +0100)]
AArch64: Fix -Werror on build

This patch fixes a hardcoded `l` specifier on a `bfd_signed_vma`.
Instead this now uses BFD_VMA_FMT which fixes the build on 32 bit
hosts.

Committed under the obvious rule.

bfd/ChangeLog:

PR ld/24373
* elfnn-aarch64.c (_bfd_aarch64_erratum_843419_branch_to_stub):
Fix print formatter.

5 years ago[gdb/cli] Fix use of uninitialized variable in complete_command
Tom de Vries [Tue, 21 May 2019 14:32:41 +0000 (16:32 +0200)]
[gdb/cli] Fix use of uninitialized variable in complete_command

When building gdb on ubuntu 16.04 with gcc 5.4.0, and running the gdb
testsuite we run into:
...
FAIL: gdb.linespec/explicit.exp: complete after -line: \
  cmd complete "b -line argument " (timeout)
...

The failure is reproducible outside the testsuite like this:
...
$ gdb -q build/gdb/testsuite/outputs/gdb.linespec/explicit/explicit \
  -ex "complete b -line argument"
Reading symbols from \
  build/gdb/testsuite/outputs/gdb.linespec/explicit/explicit...
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create
  Aborted (core dumped)
...

The problem is here in complete_command:
...
  completion_result result = complete (arg, &word, &quote_char);

  std::string arg_prefix (arg, word - arg);

  if (result.number_matches != 0)
...
The problem is that the word variable is not initialized when
result.number_matches == 0, but the variable is still used in the arg_prefix
initialization.

Fix this by guarding the arg_prefix initialization with the
'result.number_matches != 0' test.

Build and tested on x86_64-linux.

gdb/ChangeLog:

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

PR cli/24587
* cli/cli-cmds.c (complete_command): Fix use of unitialized variable.

5 years ago[gdb/testsuite] Require c++11 where necessary
Tom de Vries [Tue, 21 May 2019 14:32:41 +0000 (16:32 +0200)]
[gdb/testsuite] Require c++11 where necessary

When building gdb on ubuntu 16.04 with gcc 5.4.0, and running the gdb
testsuite we run into failures due test-cases requiring at least c++1.

Fix this by adding -std=c++11 to those test-cases.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* gdb.arch/amd64-eval.exp: Require c++11.
* gdb.base/max-depth.exp: Same.
* gdb.compile/compile-cplus-array-decay.exp: Same.
* gdb.cp/meth-typedefs.exp: Same.
* gdb.cp/subtypes.exp: Same.
* gdb.cp/temargs.exp: Same.

5 years ago[GAS, Arm] PR24559: Fix pseudo load-operations for Armv8-M Baseline
Andre Vieira [Tue, 21 May 2019 13:51:43 +0000 (14:51 +0100)]
[GAS, Arm] PR24559: Fix pseudo load-operations for Armv8-M Baseline

gas/ChangeLog:
2019-05-21  Andre Vieira  <andre.simoesdiasvieira@arm.com>

PR 24559
* config/tc-arm.c (move_or_literal_pool): Set size_req to 0
for MOVW replacement.
* testsuite/gas/arm/load-pseudo.s: New test input.
* testsuite/gas/arm/m0-load-pseudo.d: New test.
* testsuite/gas/arm/m23-load-pseudo.d: New test.
* testsuite/gas/arm/m33-load-pseudo.d: New test.

5 years ago[binutils][Arm] Fix Branch Future relocation handling and testisms
Andre Vieira [Tue, 21 May 2019 13:49:03 +0000 (14:49 +0100)]
[binutils][Arm] Fix Branch Future relocation handling and testisms

bfd/ChangeLog:
2019-05-21  Andre Vieira  <andre.simoesdiasvieira@arm.com>

PR/target 24460
* elf32-arm.c (get_value_helper): Remove.
(elf32_arm_final_link_relocate): Fix branch future relocations.

gas/ChangeLog:
2019-05-21  Andre Vieira  <andre.simoesdiasvieira@arm.com>

* testsuite/gas/arm/armv8_1-m-bf.d: Allow different branch target naming
conventions.
* testsuite/gas/arm/armv8_1-m-bfl.d: Likewise.
* testsuite/gas/arm/armv8_1-m-bfcsel.d: Likewise.
* testsuite/gas/arm/armv8_1-m-loloop.d: Likewise.
* testsuite/gas/arm/armv8_1-m-bf-rel.d: Skip for vxworks.
* testsuite/gas/arm/armv8_1-m-bf-rela.d: New test.
* testsuite/gas/arm/armv8_1-m-bfl-rel.d: Skip for vxworks.
* testsuite/gas/arm/armv8_1-m-bfl-rela.d: New test.

ld/ChangeLog:
2019-05-21  Andre Vieira  <andre.simoesdiasvieira@arm.com>

* testsuite/ld-arm/arm-elf.exp: Add tests
* testsuite/ld-arm/bfs-0.s: New test.
* testsuite/ld-arm/bfs-1.s: New test.
* testsuite/ld-arm/branch-futures.d: New test.

5 years agoAArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373)
Tamar Christina [Tue, 21 May 2019 12:04:08 +0000 (13:04 +0100)]
AArch64: Implement choice between Cortex-A53 erratum workarounds. (PR ld/24373)

The Cortex-A53 erratum currently has two ways it can resolve the erratum when
using the flag --fix-cortex-a53-843419:

1) If the address is within the range of an ADR instruction it rewrites the ADRP
   into an ADR, and those doesn't need the use of a veneer.

2) If the address is not within range, it adds a branch to a veneer which will
   execute the final bit of the erratum workaround and branch back to the call
   site.

When we do this we always generate the veneers and we always align the size of
the text section to 4KB.  This is because we only know which workaround we can
use after all linking has finished and all addresses are known.  This means even
though the veneers are not used, we still generate the section and we still
change the size of the input section.

This is problematic for small memory devices as this would require the user to
take about a ~4KB hit in memory even though it's not even used.

Since there's no real way to restart the linking process from the final write
phase this patch solves the issue by allowing the user more control over which
erratum workaround gets used.

Concretely this changes the option --fix-cortex-a53-843419 to take optional
arguments --fix-cortex-a53-843419[=full|adr|adrp]

- full (default): Use both ADRP and ADR workaround. This is equivalent to not
  specifying any options and is the default behavior before this
  patch.

- adr: Only use the ADR workaround, this will not cause any increase in binary
       size but linking will fail if the referenced address is out of range of
       an ADR instruction.

- adrp: Use only the ADRP workaround, this will never rewrite your ADRP.

In the cases where the user knows how big their binaries are the `adr` option
would prevent the unneeded overhead.

bfd/ChangeLog:

PR ld/24373
* bfd-in.h (enum erratum_84319_opts): New
(bfd_elf64_aarch64_set_options, bfd_elf32_aarch64_set_options): Change
int to enum erratum_84319_opts.
* bfd-in2.h: Regenerate.
* elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Change
fix_erratum_843419 to use new enum, remove fix_erratum_843419_adr.
(_bfd_aarch64_add_stub_entry_after): Conditionally create erratum stub.
(aarch64_size_one_stub): Conditionally size erratum 843419 stubs.
(_bfd_aarch64_resize_stubs): Amend comment.
(elfNN_aarch64_size_stubs): Don't generate stubs when no workaround
requested.
(bfd_elfNN_aarch64_set_options): Use new fix_erratum_843419 enum.
(_bfd_aarch64_erratum_843419_branch_to_stub): Implement selection of
erratum workaround.
(clear_erratum_843419_entry): Update erratum conditional.

ld/ChangeLog:

PR ld/24373
* emultempl/aarch64elf.em (PARSE_AND_LIST_LONGOPTS): Add optional args
to flags.
* NEWS: Add changes to flag.
(PARSE_AND_LIST_OPTIONS): Update help descriptions.
(PARSE_AND_LIST_ARGS_CASES): Add new options to parser.
* testsuite/ld-aarch64/aarch64-elf.exp: Add new run_dump_tests.
* testsuite/ld-aarch64/erratum843419-adr.d: New test.
* testsuite/ld-aarch64/erratum843419-adrp.d: New test.
* testsuite/ld-aarch64/erratum843419-far-adr.d: New test.
* testsuite/ld-aarch64/erratum843419-far-full.d: New test.
* testsuite/ld-aarch64/erratum843419-far.s: New test.
* testsuite/ld-aarch64/erratum843419-full.d: New test.
* testsuite/ld-aarch64/erratum843419-near.s: New test.
* testsuite/ld-aarch64/erratum843419-no-args.d: New test.

5 years agoAArch64: Add SVE DWARF registers
Tamar Christina [Tue, 21 May 2019 10:03:45 +0000 (11:03 +0100)]
AArch64: Add SVE DWARF registers

The SVE DRAWF register names are missing from binutils, this may cause objdump
and readelf to ignore certain DRAWF output as the registers are unknown (most
notably CIEs).

This patch adds the registers in accordance to the "DWARF for ARM(r) 64-bit
Architecture (AARch64) with SVE support" documentation [1].

[1] https://developer.arm.com/docs/100985/latest/dwarf-for-the-arm-64-bit-architecture-aarch64-with-sve-support

binutils/ChangeLog:

* dwarf.c (dwarf_regnames_aarch64): Add SVE registers.
* testsuite/binutils-all/aarch64/sve-dwarf-registers.d: New test.
* testsuite/binutils-all/aarch64/sve-dwarf-registers.s: New test.

5 years agotestsuite: Mark the kill in gdbserver_run as optional
Alan Hayward [Tue, 21 May 2019 09:11:51 +0000 (10:11 +0100)]
testsuite: Mark the kill in gdbserver_run as optional

This matches the kill in gdb_file_cmd, and ensures that the command is not
sent to the gdb.in file.

When gdb.in is used as a batch file, any kill commands run before the target
is started will cause gdb to stop processing commands.

gdb/testsuite/ChangeLog:

* lib/gdbserver-support.exp (gdbserver_run): Mark kill as optional.

5 years agoGAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value.
John Darrington [Tue, 21 May 2019 08:11:40 +0000 (10:11 +0200)]
GAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value.

In an upcoming commit, I need to be able to set the prefix used
to introduce hexadecimal literal constants using a command line
flag.   This is not currently possible, because the switch which
determines this (LITERAL_PREFIXDOLLAR_HEX) is a macro set at
build time.

This change substitutes it for a variable to be set at start up.

gas/ChangeLog:
    * expr.c (literal_prefix_dollar_hex): New variable.
    (operand)[case '$']: Use the new variable instead of the old macro.
    Also, move this instance of "case '$'" next to the other one, and
    enable it only in the complementary proprocessor case.
    * expr.h (literal_prefix_dollar_hex): Declare it.
    * config/tc-epiphany.c (md_begin): Assign literal_prefix_dollar_hex.
    * config/tc-ip2k.c:      ditto
    * config/tc-mt.c:        ditto
    * config/tc-epiphany.h (LITERAL_PREFIXDOLLAR_HEX): Remove macro definition.
    * config/tc-ip2k.h:      ditto
    * config/tc-mt.h:        ditto

5 years agoFix PR 24571 - Relaxation does not shorten jmp or call to target at pc-relative...
Senthil Kumar Selvaraj [Thu, 16 May 2019 06:42:33 +0000 (12:12 +0530)]
Fix PR 24571 -  Relaxation does not shorten jmp or call to target at pc-relative range boundary

The range check done to transform an absolute call/jump to a pc-relative one is
off-by-one, and that causes this shortening optimization to be missed if the
branch target is right at the range boundary.

In the non-shrinkable case, the range is what is mentioned in the ISA - -4094
bytes in the backward direction, and 4096 bytes in the positive direction.

In the shrinkable case, the forward jump range increases by two bytes (deleted
because of the shortening from call/jmp to rcall/rjmp), and therefore, the
range is -4094 in the reverse, and 4098 in the positive direction.

Fix the ranges for !shrinkable and shrinkable cases, and add a test caes to
ensure jumps to max forward and backward ranges get relaxed to rjmp.

5 years agoFix PR 24564 - link fails for some rcalls/rjmps with wraparound
Senthil Kumar Selvaraj [Thu, 16 May 2019 11:46:36 +0000 (17:16 +0530)]
Fix PR 24564 - link fails for some rcalls/rjmps with wraparound

The current code to compute relative distance in the wrap around case does not
handle the edge case of the target (after adjusting for implicit PC increment)
being exactly half of the wrap around distance. This patch fixes that and adds a
testcase.

The range for a forward relative jump call is 4096 bytes ((2 * 2047) + (2 bytes
for the implicit PC increment)). If the target of the jump is at a distance of
4098 bytes, it is out of range for a forward jump - however, a backward jump can
still reach that address if pmem-wrap-around is 8192.

Assume address 0 has rjmp to address 4098. With a wrap around of 8192 and
*without* adjusting for the implicit PC increment of 2 bytes, rjmp .-4096 will
jump to address 4096 (wrap around at 8192 and decreasing addresses from then
on). Adjusting 2 bytes for the implicit PC increment, the actual target is 4098.

avr_relative_distance_considering_wrap_around though, does the wrap around only
if the passed in distance is less than half of the wrap around distance. In this
case, it is exactly equal to half (original distance 4098, adjusted distance of
4096 and wraparound of 8192), and the bypassed wrap around causes the reloc
overflow error.

Fix by wrapping around even if adjusted distance is equal to half of wrap around
distance.

5 years agoRevert "GAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value."
John Darrington [Tue, 21 May 2019 05:30:05 +0000 (07:30 +0200)]
Revert "GAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value."

This reverts commit cffc205c9eaacfa312323807cd60b9d3d1c26894.

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

5 years ago[MIPS] PR gas/14798: Limit IRIX5 specific default typing to IRIX targets
Faraz Shahbazker [Mon, 6 May 2019 16:09:02 +0000 (09:09 -0700)]
[MIPS] PR gas/14798: Limit IRIX5 specific default typing to IRIX targets

On IRIX 5, every global symbol that is not explicitly labelled as
being a function is assumed to be an object.  There is no reason
why IRIX behaviour should extend to all MIPS targets, so limit this
to only IRIX targets.

gas/
PR 14798
* config/tc-mips.c (s_mips_globl): Only treat symbols that are
not explicitly labelled as BSF_OBJECTs for IRIX targets.
* testsuite/gas/mips/pr14798.s: New test source.
* testsuite/gas/mips/pr14798-irix.d: New test.
* testsuite/gas/mips/pr14798.d: Likewise.
* testsuite/gas/mips/mips.exp: Run the new tests.

binutils/
PR 14798
* testsuite/binutils-all/readelf.ss-mips: Update reference output.
* testsuite/binutils-all/readelf.ss-tmips: Likewise.

ld/
PR 14798
* testsuite/ld-mips-elf/reloc-6a.s: Specify .text section for
global code symbols.
* testsuite/ld-mips-elf/reloc-6b.s: Likewise.

5 years agoGAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value.
John Darrington [Mon, 20 May 2019 17:53:30 +0000 (19:53 +0200)]
GAS: Replace macro LITERAL_PREFIXDOLLAR_HEX with a runtime value.

In an upcoming commit, I need to be able to set the prefix used
to introduce hexadecimal literal constants using a command line
flag.   This is not currently possible, because the switch which
determines this (LITERAL_PREFIXDOLLAR_HEX) is a macro set at
build time.

This change substitutes it for a variable to be set at start up.

gas/ChangeLog:
* expr.c (literal_prefix_dollar_hex): New variable.
(operand)[case '$']: Use the new variable instead of the old macro.
* expr.h (literal_prefix_dollar_hex): Declare it.
* config/tc-epiphany.c (md_begin): Assign literal_prefix_dollar_hex.
* config/tc-ip2k.c:      ditto
* config/tc-mt.c:        ditto
* config/tc-epiphany.h (LITERAL_PREFIXDOLLAR_HEX): Remove macro definition.
* config/tc-ip2k.h:      ditto
* config/tc-mt.h:        ditto

5 years agoCorrect the alpha sorting of the short options in the usage description of the gprof...
Nick Clifton [Mon, 20 May 2019 16:17:24 +0000 (17:17 +0100)]
Correct the alpha sorting of the short options in the usage description of the gprof program.

PR 24569
* gprof.c (usage): Restore alphabetical sorting to short options
list.  Add -r, -R and -t short options to the list.
(main): Add comment about -g and -G possibly being deprecated.
* gprof.texi: Update usage example in line with changes above.

5 years agoUpdated translations for various binutils subdirectories.
Nick Clifton [Mon, 20 May 2019 15:18:19 +0000 (16:18 +0100)]
Updated translations for various binutils subdirectories.

bfd * po/fr.po: Updated French translation.
binutils* po/ca.po: Updated Catalan translation.
gprof * po/de.po: Updated German translation.
opcodes * po/fr.po: Updated French translation.

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

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

5 years agogdb/fortran: Use floatformats_ia64_quad for fortran 16-byte floats
Andrew Burgess [Fri, 3 May 2019 14:23:55 +0000 (15:23 +0100)]
gdb/fortran: Use floatformats_ia64_quad for fortran 16-byte floats

PR gdb/18644 is caused by GDB using the wrong floating point format
for gfortran's 16-byte floating point type, including when the 16-byte
float is used as the component of a 32-byte complex type.

This commit addresses the issue in two places, first in i386-tdep.c,
there is already some code to force the use of floatformats_ia64_quad
for specific named types, this is extended to include the type names
that gfortran uses for its 16-byte floats.

Second, the builtin 16-byte float type (in f-lang.c) is changed so it
no longer uses gdbarch_long_double_format.  On i386 this type is not
16-bytes, but is smaller, this is not what gfortran is expecting.
Instead we now use gdbarch_floatformat_for_type and ask for a
16-byte (128 bit) type using the common gfortran type name.  This is
then spotted in i386-tdep.c (thanks to the first change above) and we
again get floatformats_ia64_quad returned.

This patch was tested on X86-64/GNU-Linux using '--target_board=unix'
and '--target_board=unix/-m32', and resolves all of the known failures
associated with PR gdb/18644.  I've also added the test case from the
original bug report.

gdb/ChangeLog:

PR gdb/18644:
* f-lang.c (build_fortran_types): Use floatformats_ia64_quad for
16-byte floats.
* i386-tdep.c (i386_floatformat_for_type): Use
floatformats_ia64_quad for the 16-byte floating point component
within a fortran 32-byte complex number.

gdb/testsuite/ChangeLog:

PR gdb/18644
* gdb.fortran/complex.exp: Remove setup_kfail calls.
* gdb.fortran/printing-types.exp: Add new test.
* gdb.fortran/printing-types.f90: Add 16-byte real variable for
testing.
* gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Remove
setup_kfail call.

5 years agogdb: Add constructor to struct cu_partial_die_info
Andrew Burgess [Fri, 17 May 2019 21:30:34 +0000 (22:30 +0100)]
gdb: Add constructor to struct cu_partial_die_info

Adds a constructor to 'struct cu_partial_die_info' and disables the
default constructor, preventing partially initialised instances from
being created.

Update 'find_partial_die' to return a const struct.

Users of 'find_partial_die' are updated to take account of the above
two changes.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* dwarf2read.c (struct cu_partial_die_info): Add constructor,
delete default constructor.
(find_partial_die): Update to return const struct.
(partial_die_parent_scope): Move variable declaration into scope
of its use and change its type to auto.
(guess_partial_die_structure_name): Likewise.
(partial_die_info::fixup): Likewise.

5 years agoS12Z (doc): Minor improvements to text and formatting.
John Darrington [Sat, 18 May 2019 06:25:18 +0000 (08:25 +0200)]
S12Z (doc): Minor improvements to text and formatting.

gas/
* doc/c-s12z.texi: Miscellaneous adjustments.

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

5 years agoDon't cast away const in find_and_open_source
Tom Tromey [Fri, 17 May 2019 14:42:10 +0000 (08:42 -0600)]
Don't cast away const in find_and_open_source

find_and_open_source casts away const, but hasn't needed to in a
while.  This removes the cast and a strangely hostile comment.

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

* source.c (find_and_open_source): Remove cast.

5 years agoConstify annotate_source
Tom Tromey [Fri, 17 May 2019 14:41:12 +0000 (08:41 -0600)]
Constify annotate_source

I noticed that annotate_source takes a "char *", but really should
take a "const char *".  This patch fixes this.

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

* annotate.c (annotate_source): Make "filename" const.
* annotate.h (annotate_source): Use const.

5 years agotestsuite: Remove TRANSCRIPT support
Alan Hayward [Fri, 17 May 2019 15:48:36 +0000 (16:48 +0100)]
testsuite: Remove TRANSCRIPT support

TRANSCRIPT is superseeded by the .in, .cmd and .debug files, and
can be removed.

gdb/testsuite/ChangeLog

* README (Running the Testsuite): Change example.
(Testsuite Parameters): Remove TRANSCRIPT.
* lib/gdb.exp: Remove TRANSCRIPT check.

5 years agotestsuite: Add replay logging to GDBSERVER_DEBUG
Alan Hayward [Tue, 30 Apr 2019 15:00:29 +0000 (16:00 +0100)]
testsuite: Add replay logging to GDBSERVER_DEBUG

Add "replay" to the list of GDBSERVER_DEBUG options.  This will
cause a gdbserver.replay file to be written to the test output
directory.

At the same time switch this to a comma separated list in order
to easily handle all possible options.

The replay log is created by GDB, but has been added to
GDBSERVER_DEBUG as it is only required for gdbserver tests. To
enable it, the gdb_debug_init is overridden to allow the additional
checking, before calling the original function.

gdb/testsuite/ChangeLog:

        * README (Testsuite Parameters): Add replay logging to
        GDBSERVER_DEBUG.
        (gdbserver,debug): Refer to GDBSERVER_DEBUG.
        * lib/gdbserver-support.exp (gdbserver_start): Treat gdbserverdebug
        as a comma separated list.
        (gdb_debug_init): Override procedure.

5 years agotestsuite: Create .cmd files for gdb and gdbserver
Alan Hayward [Fri, 17 May 2019 15:38:02 +0000 (16:38 +0100)]
testsuite: Create .cmd files for gdb and gdbserver

When spawning gdb or gdbserver create a .cmd file in the test output
directory containing the full command line, ensuring the current gdb
instance is appended to the files so that they can be quickly matched
to the corresponding gdb.in file.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (default_gdb_spawn): Call gdb_write_cmd_file.
(gdb_write_cmd_file): New procedure.
* lib/gdbserver-support.exp (gdbserver_start): Call
gdbserver_write_cmd_file.
(gdbserver_write_cmd_file): New proedure.

5 years agotestsuite: Record all gdb input to gdb.in
Alan Hayward [Fri, 17 May 2019 15:30:09 +0000 (16:30 +0100)]
testsuite: Record all gdb input to gdb.in

When debugging testsuite failures, it can be awkward parsing gdb.log to
obtain all the commands run in order to manually re-run the test.

This patch adds the functionality to save all gdb commands to the file gdb.in
when the testsuite is run. The file is saved in the directory for the test and
if gdb is restarted then .1, .2, .3 etc is added to the filename.

Once a test has been run, the .in file can be used to re-run the test in the
following way:

  gdb -x outputs/gdb.store/gdb.in outputs/gdb.store/store

The code works by intercepting send_gdb.  I've added a TYPE to ensure that any
commands that would destroy the playback are kept from the log (for example the
Y from an answer to a y/n question).

Adds library function standard_output_file_with_gdb_instance to open a file
postfixed with count of the gdb instance.  Ensure this count is reset when a new
.exp script is run.

I've re-run a random selection of .in files to check they do not error. Logs with
commands such as "attach <pid>" will not directly work when re-run.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_unload): Mark Y as an answer.
(delete_breakpoints): Likewise.
(gdb_run_cmd): Likewise.
(gdb_start_cmd): Likewise.
(gdb_starti_cmd): Likewise.
(gdb_internal_error_resync): Likewise.
(gdb_test_multiple): Likewise.
(gdb_reinitialize_dir): Likewise.
(default_gdb_exit): Likewise.
(gdb_file_cmd): Mark kill as optional.
(default_gdb_start): Call gdb_stdin_log_init.
(send_gdb): Call gdb_stdin_log_write.
(rerun_to_main): Mark Y as an answer.
(gdb_stdin_log_init): New function.
(gdb_stdin_log_write): Likewise.

5 years agotestsuite: Disable some tests when logging
Alan Hayward [Fri, 17 May 2019 14:35:08 +0000 (15:35 +0100)]
testsuite: Disable some tests when logging

Fix up all failures encountered when running the testsuite with
GDB_DEBUG="infrun".

Some tests rely on enabling debugging for various components.  With
debugging on, this will be lost to the debug file.

Disable separate tty for mi tests when debugging.  This currently
does not work.

disasm.c should send errors to the stderr instead of the logfile.

Note that enabling debug for other components might still cause
additional errors above what has been fixed here.

gdb/ChangeLog:

* disasm.c (set_disassembler_options): Send errors to stderr.

gdb/testsuite/ChangeLog:

* gdb.base/breakpoint-in-ro-region.exp: Disable when debugging.
* gdb.base/debug-expr.exp: Likewise.
* gdb.base/foll-fork.exp: Likewise.
* gdb.base/foll-vfork.exp: Likewise.
* gdb.base/fork-print-inferior-events.exp: Likewise.
* gdb.base/gdb-sigterm.exp: Likewise.
* gdb.base/gdbinit-history.exp: Likewise.
* gdb.base/osabi.exp: Likewise.
* gdb.base/sss-bp-on-user-bp-2.exp: Likewise.
* gdb.base/ui-redirect.exp: Likewise.
* gdb.gdb/unittest.exp: Likewise.
* gdb.mi/mi-break.exp: Disable separate-mi-tty when debugging.
* gdb.mi/mi-watch.exp: Likewise.
* gdb.mi/new-ui-mi-sync.exp: Likewise.
* gdb.mi/user-selected-context-sync.exp: Likewise.
* gdb.python/python.exp: Disable debug test when debugging.
* gdb.threads/check-libthread-db.exp: Disable when debugging.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Likewise.
* gdb.threads/stepi-random-signal.exp: Likewise.

5 years agotestsuite: Add option to capture GDB debug
Alan Hayward [Fri, 17 May 2019 13:35:23 +0000 (14:35 +0100)]
testsuite: Add option to capture GDB debug

Add both board option and environment variable which enables gdb
debug via a comma separated list and sends it to the file gdb.debug,
located in the output directory for the current test.  Document this.

Add support for the environment variable in the Makefile.

The testsuite can be run with gdb debug enabled in the following way:

make check GDB_DEBUG="infrun,target,remote"

A Test with multiple invocations of GDB will all append debug to the
same log file.

gdb/testsuite/ChangeLog:

* Makefile.in: Pass through GDB_DEBUG.
* README (Testsuite Parameters): Add GDB_DEBUG.
        (gdb,debug): Add board setting.
  * lib/gdb.exp (default_gdb_start): Start debugging.
  (gdb_debug_enabled): New procedure.
  (gdb_debug_init): Likewise.

5 years agoAdd debug redirect option
Alan Hayward [Fri, 17 May 2019 13:15:01 +0000 (14:15 +0100)]
Add debug redirect option

Currently, when logging is enabled, output will be sent to both a
logfile and standard terminal output.  The redirect option sends output
only to the logfile.  This includes all debug output.

Add the option to redirect debug output seperately to normal
output, using the cli command:

  set logging debugredirect on

By setting this and enabling logging, all output and debug will
be sent to the logfile.  The user will still see all output but
no debug output.

This causes a change in behaviour for anyone currently using
logging redirect, as now only output will be redirected.  Users
will have to issue the additional command above to also redirect
debug.

Expand ui-redirect.exp cover the changes.

gdb/ChangeLog:

* cli/cli-interp.c (struct saved_output_files): Add saved entry.
(cli_interp_base::set_logging): Check debug_redirect.
* cli/cli-interp.h (set_logging): Add debug_redirect parameter.
* cli/cli-logging.c (debug_redirect): Add static variable.
(pop_output_files): Add default param.
(handle_redirections): Print debug setting.
(show_logging_command): Likewise.
(_initialize_cli_logging): Add debugredirect command.
* interps.c (current_interp_set_logging): Add debug_redirect
parameter.
* interps.h (set_logging): Add debug_redirect parameter.
(current_interp_set_logging): Likewise.
* mi/mi-common.h: Likewise.
* mi/mi-interp.c (mi_interp::set_logging): Likewise.

gdb/testsuite/ChangeLog:

* gdb.base/ui-redirect.exp: Add debug redirect tests.

5 years agoGAS (documentation): Remove trademark acknowledgements.
John Darrington [Fri, 17 May 2019 13:05:44 +0000 (15:05 +0200)]
GAS (documentation): Remove trademark acknowledgements.

GNU policy is not to include trademark acknowlegements in
documentation [1]

[1] https://www.gnu.org/prep/standards/html_node/Trademarks.html

Committing as obvious.

gas/

* doc/c-arm.texi (ARM Options): Remove "(r)" and "(tm)"
* doc/c-bfin.texi (Blackfin Syntax): Remove "(r)"

5 years agoChange file close behavior for tee_file
Alan Hayward [Fri, 17 May 2019 13:07:04 +0000 (14:07 +0100)]
Change file close behavior for tee_file

Instead of using two bools to decide if the files should close when tee_file
is closed, make file one stay open and file two close.  This simplifies the
use cases for it.

Inline the make_logging_output into the calling functions (the logic here
looks ugly in order to simplify a later change).

Expand ui-redirect.exp to cover the changes, similar to mi-logging.exp.

gdb/ChangeLog:

* cli/cli-interp.c (cli_interp_base::set_logging): Create tee_file
directly.
* cli/cli-interp.h (make_logging_output): Remove declaration.
* cli/cli-logging.c (make_logging_output): Remove function.
* mi/mi-interp.c (mi_interp::set_logging): Create tee_file
directly.
* ui-file.c (tee_file::tee_file): Remove bools.
(tee_file::~tee_file): Remove deletes.
* ui-file.h (tee_file): Remove bools.

gdb/testsuite/ChangeLog:

* gdb.base/ui-redirect.exp: Test redirection.

5 years agoPR24567, assertion failure in ldlang.c:6868 when compiling with -flto
Alan Modra [Fri, 17 May 2019 09:39:42 +0000 (19:09 +0930)]
PR24567, assertion failure in ldlang.c:6868 when compiling with -flto

As the existing comment said: "a common ought to be overridden by a
def in a -flto object".  This patch makes the code actually do that,
rather than allowing a normal object file common to override a -flto
defined symbol.

PR 24567
* plugin.c (plugin_notice): Do not let a common symbol override
a non-common definition in IR.

5 years agoMI: Add new command -complete
Jan Vrany [Fri, 17 May 2019 09:58:23 +0000 (10:58 +0100)]
MI: Add new command -complete

There is a CLI command 'complete' intended to use with emacs. Such a command
would also be useful for MI frontends, when separate CLI and MI channels cannot
be used. For example, on Windows (because of lack of PTYs) or when GDB is used
through SSH session.

This commit adds a new '-complete' MI command.

gdb/Changelog:
2019-01-28  Jan Vrany  <jan.vrany@fit.cvut.cz>

* mi/mi-cmds.h (mi_cmd_complete): New function.
* mi/mi-main.c (mi_cmd_complete): Likewise.
* mi/mi-cmds.c: Define new MI command -complete.
* NEWS: Mention new -complete command.

gdb/doc/ChangeLog:
2019-01-28  Jan Vrany  <jan.vrany@fit.cvut.cz>

* gdb.texinfo (Miscellaneous GDB/MI Commands): Document new
MI command -complete.

gdb/testsuite/ChangeLog:
2019-01-28  Jan Vrany  <jan.vrany@fit.cvut.cz>

* gdb.mi/mi-complete.exp: New file.
* gdb.mi/mi-complete.cc: Likewise.

5 years agoMI: extract command completion logic from complete_command()
Jan Vrany [Fri, 17 May 2019 09:58:23 +0000 (10:58 +0100)]
MI: extract command completion logic from complete_command()

Extract completion logic from CLI complete_command() into a new
helper function complete().

gdb/Changelog:

* completer.h (complete): New function.
* completer.c (complete): Likewise.
* cli/cli-cmds.c: (complete_command): Update to use new complete()
function defined in completer.h.

5 years agoAdd myself to gdb/MAINTAINERS
Jan Vrany [Fri, 17 May 2019 09:48:12 +0000 (10:48 +0100)]
Add myself to gdb/MAINTAINERS

gdb/Changelog:

       * MAINTAINERS (Write After Approval): Add myself.

5 years ago[gdb] Fix heap-use-after-free in typename_concat
Tom de Vries [Fri, 17 May 2019 07:35:19 +0000 (09:35 +0200)]
[gdb] Fix heap-use-after-free in typename_concat

When running gdb using AddressSanitizer, and loading a cc1plus binary built
with profiledbootstrap and -flto, we run into a heap-use-after-free error:
...
$ LD_PRELOAD=/usr/lib64/libasan.so.3 ./gdb -batch cc1plus
==26855==ERROR: AddressSanitizer: heap-use-after-free on address \
  0x62100ad8a8b0 at pc 0x7f13803cc9e3 bp 0x7ffe55b0d090 sp 0x7ffe55b0c840
READ of size 47 at 0x62100ad8a8b0 thread T0
    #0 0x7f13803cc9e2  (/usr/lib64/libasan.so.3+0x3e9e2)
    #1 0x5e7a0d in typename_concat gdb/dwarf2read.c:22661
    #2 0x5c6437 in partial_die_full_name gdb/dwarf2read.c:8876
    #3 0x5c6555 in add_partial_symbol gdb/dwarf2read.c:8893
    #4 0x5c6ecf in add_partial_subprogram gdb/dwarf2read.c:9156
    #5 0x5c5e90 in scan_partial_symbols gdb/dwarf2read.c:8668
    #6 0x5c6c0a in add_partial_namespace gdb/dwarf2read.c:9081
    #7 0x5c5f99 in scan_partial_symbols gdb/dwarf2read.c:8702
    #8 0x5c48b6 in process_psymtab_comp_unit_reader gdb/dwarf2read.c:8056
    #9 0x5c3c1f in init_cutu_and_read_dies gdb/dwarf2read.c:7689
    #10 0x5c4c03 in process_psymtab_comp_unit gdb/dwarf2read.c:8140
    #11 0x5c58a2 in dwarf2_build_psymtabs_hard gdb/dwarf2read.c:8500
    #12 0x5c0d03 in dwarf2_build_psymtabs(objfile*) gdb/dwarf2read.c:6337
    #13 0x612359 in read_psyms gdb/elfread.c:1311
    #14 0x798a64 in require_partial_symbols(objfile*, int) gdb/psymtab.c:115
    #15 0x867d7b in read_symbols gdb/symfile.c:821
    #16 0x8683d9 in syms_from_objfile_1 gdb/symfile.c:1000
    #17 0x8684a1 in syms_from_objfile gdb/symfile.c:1017
    #18 0x868873 in symbol_file_add_with_addrs gdb/symfile.c:1124
    #19 0x868b0a in symbol_file_add_from_bfd(bfd*, char const*, \
                    enum_flags<symfile_add_flag>, std::vector<other_sections, \
    std::allocator<other_sections> >*, \
    enum_flags<objfile_flag>, objfile*) gdb/symfile.c:1204
    #20 0x868b64 in symbol_file_add(char const*, \
                    enum_flags<symfile_add_flag>, \
    std::vector<other_sections, \
    std::allocator<other_sections> >*, \
    enum_flags<objfile_flag>) gdb/symfile.c:1217
    #21 0x868c39 in symbol_file_add_main_1 gdb/symfile.c:1240
    #22 0x868bd0 in symbol_file_add_main(char const*, \
                    enum_flags<symfile_add_flag>) gdb/symfile.c:1231
    #23 0x71f1b2 in symbol_file_add_main_adapter gdb/main.c:395
    #24 0x71f10e in catch_command_errors gdb/main.c:372
    #25 0x71ff5f in captured_main_1 gdb/main.c:1043
    #26 0x72045d in captured_main gdb/main.c:1163
    #27 0x7204c8 in gdb_main(captured_main_args*) gdb/main.c:1188
    #28 0x40fd7d in main gdb/gdb.c:32
    #29 0x7f137e300f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
    #30 0x40fc89 in _start (/data/gdb_versions/devel/build/gdb/gdb+0x40fc89)

0x62100ad8a8b0 is located 944 bytes inside of 4064-byte region \
  [0x62100ad8a500,0x62100ad8b4e0)
freed by thread T0 here:
    #0 0x7f13804523a0 in __interceptor_free (/usr/lib64/libasan.so.3+0xc43a0)
    #1 0x435e44 in xfree<void> gdb/common/common-utils.h:60
    #2 0xa82c25 in call_freefun libiberty/obstack.c:103
    #3 0xa83098 in _obstack_free libiberty/obstack.c:280
    #4 0x4367da in auto_obstack::~auto_obstack() gdb/gdb_obstack.h:101
    #5 0x5ed72c in dwarf2_cu::~dwarf2_cu() gdb/dwarf2read.c:25341
    #6 0x5fb5bb in std::default_delete<dwarf2_cu>::operator()(dwarf2_cu*) const \
                   /usr/include/c++/7/bits/unique_ptr.h:78
    #7 0x5f7334 in std::unique_ptr<dwarf2_cu, \
                   std::default_delete<dwarf2_cu> >::~unique_ptr() \
   /usr/include/c++/7/bits/unique_ptr.h:268
    #8 0x5c3ce5 in init_cutu_and_read_dies gdb/dwarf2read.c:7624
    #9 0x5c4c03 in process_psymtab_comp_unit gdb/dwarf2read.c:8140
    #10 0x5c58a2 in dwarf2_build_psymtabs_hard gdb/dwarf2read.c:8500
    #11 0x5c0d03 in dwarf2_build_psymtabs(objfile*) gdb/dwarf2read.c:6337
    #12 0x612359 in read_psyms gdb/elfread.c:1311
    #13 0x798a64 in require_partial_symbols(objfile*, int) gdb/psymtab.c:115
    #14 0x867d7b in read_symbols gdb/symfile.c:821
    #15 0x8683d9 in syms_from_objfile_1 gdb/symfile.c:1000
    #16 0x8684a1 in syms_from_objfile gdb/symfile.c:1017
    #17 0x868873 in symbol_file_add_with_addrs gdb/symfile.c:1124
    #18 0x868b0a in symbol_file_add_from_bfd(bfd*, char const*, \
                    enum_flags<symfile_add_flag>, std::vector<other_sections,  \
    std::allocator<other_sections> >*, \
    enum_flags<objfile_flag>, objfile*) gdb/symfile.c:1204
    #19 0x868b64 in symbol_file_add(char const*, \
                    enum_flags<symfile_add_flag>, std::vector<other_sections, \
    std::allocator<other_sections> >*, \
    enum_flags<objfile_flag>) gdb/symfile.c:1217
    #20 0x868c39 in symbol_file_add_main_1 gdb/symfile.c:1240
    #21 0x868bd0 in symbol_file_add_main(char const*, \
                    enum_flags<symfile_add_flag>) gdb/symfile.c:1231
    #22 0x71f1b2 in symbol_file_add_main_adapter gdb/main.c:395
    #23 0x71f10e in catch_command_errors gdb/main.c:372
    #24 0x71ff5f in captured_main_1 gdb/main.c:1043
    #25 0x72045d in captured_main gdb/main.c:1163
    #26 0x7204c8 in gdb_main(captured_main_args*) gdb/main.c:1188
    #27 0x40fd7d in main gdb/gdb.c:32
    #28 0x7f137e300f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)

previously allocated by thread T0 here:
    #0 0x7f13804526b8 in __interceptor_malloc (/usr/lib64/libasan.so.3+0xc46b8)
    #1 0x5114b5 in xmalloc gdb/common/common-utils.c:44
    #2 0xa82bd5 in call_chunkfun libiberty/obstack.c:94
    #3 0xa82eda in _obstack_newchunk libiberty/obstack.c:206
    #4 0x477310 in allocate_on_obstack::operator new(unsigned long, obstack*) \
                   gdb/gdb_obstack.h:117
    #5 0x5dea8c in load_partial_dies gdb/dwarf2read.c:18571
    #6 0x5c487f in process_psymtab_comp_unit_reader gdb/dwarf2read.c:8054
    #7 0x5c3c1f in init_cutu_and_read_dies gdb/dwarf2read.c:7689
    #8 0x5c4c03 in process_psymtab_comp_unit gdb/dwarf2read.c:8140
    #9 0x5c58a2 in dwarf2_build_psymtabs_hard gdb/dwarf2read.c:8500
    #10 0x5c0d03 in dwarf2_build_psymtabs(objfile*) gdb/dwarf2read.c:6337
    #11 0x612359 in read_psyms gdb/elfread.c:1311
    #12 0x798a64 in require_partial_symbols(objfile*, int) gdb/psymtab.c:115
    #13 0x867d7b in read_symbols gdb/symfile.c:821
    #14 0x8683d9 in syms_from_objfile_1 gdb/symfile.c:1000
    #15 0x8684a1 in syms_from_objfile gdb/symfile.c:1017
    #16 0x868873 in symbol_file_add_with_addrs gdb/symfile.c:1124
    #17 0x868b0a in symbol_file_add_from_bfd(bfd*, char const*, \
                    enum_flags<symfile_add_flag>, \
    std::vector<other_sections, \
    std::allocator<other_sections> >*, \
    enum_flags<objfile_flag>, objfile*) gdb/symfile.c:1204
    #18 0x868b64 in symbol_file_add(char const*, enum_flags<symfile_add_flag>, \
                    std::vector<other_sections, \
    std::allocator<other_sections> >*, \
    enum_flags<objfile_flag>) gdb/symfile.c:1217
    #19 0x868c39 in symbol_file_add_main_1 gdb/symfile.c:1240
    #20 0x868bd0 in symbol_file_add_main(char const*, \
                    enum_flags<symfile_add_flag>) gdb/symfile.c:1231
    #21 0x71f1b2 in symbol_file_add_main_adapter gdb/main.c:395
    #22 0x71f10e in catch_command_errors gdb/main.c:372
    #23 0x71ff5f in captured_main_1 gdb/main.c:1043
    #24 0x72045d in captured_main gdb/main.c:1163
    #25 0x7204c8 in gdb_main(captured_main_args*) gdb/main.c:1188
    #26 0x40fd7d in main gdb/gdb.c:32
    #27 0x7f137e300f49 in __libc_start_main (/lib64/libc.so.6+0x20f49)
...

This error happens as follows.

The function find_partial_die has a cu argument, but returns a pdi which may
or may not be from that cu:
...
/* Find a partial DIE at OFFSET, which may or may not be in CU,
   except in the case of .debug_types DIEs which do not reference
   outside their CU (they do however referencing other types via
   DW_FORM_ref_sig8).  */

static struct partial_die_info *
find_partial_die (sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu *cu)
...

So the pdi returned by find_partial_die here in partial_die_parent_scope may
be from another cu:
...
partial_die_parent_scope (struct partial_die_info *pdi,
                          struct dwarf2_cu *cu)
{
  const char *grandparent_scope;
  struct partial_die_info *parent, *real_pdi;

  /* We need to look at our parent DIE; if we have a DW_AT_specification,
     then this means the parent of the specification DIE.  */

  real_pdi = pdi;
  while (real_pdi->has_specification)
    real_pdi = find_partial_die (real_pdi->spec_offset,
                                 real_pdi->spec_is_dwz, cu);

  parent = real_pdi->die_parent;
...
in which case both real_pdi and parent will be not from cu, but from another
one, say cu2.

Subsequently, cu's comp_unit_obstack is used to set parent->scope:
...
        parent->scope = typename_concat (&cu->comp_unit_obstack,
                                         grandparent_scope,
                                         parent->name, 0, cu);
...

So, we use cu->comp_unit_obstack to assign a value to the scope field of
a pdi belonging to cu2, and when cu is deleted, the scope field points to a
freed value.

Fix this by making find_partial_die return the cu corresponding to the
returned pdi, and handling this at the call sites.

Tested on x86_64-linux.

gdb/ChangeLog:

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

PR gdb/24094
* dwarf2read.c (struct cu_partial_die_info): New struct.
(find_partial_die): Return cu_partial_die_info.
(partial_die_parent_scope, guess_partial_die_structure_name)
(partial_die_info::fixup): Handle new return type of find_partial_die.

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

5 years agoMake stap-probe.c:stap_parse_register_operand's "regname" an std::string
Sergio Durigan Junior [Thu, 16 May 2019 20:23:24 +0000 (16:23 -0400)]
Make stap-probe.c:stap_parse_register_operand's "regname" an std::string

This patch simplifies the code of
stap-probe.c:stap_parse_register_operand by making "regname" an
std::string.  No functionality change.

I'm this code's maintainer, so I'm pushing this as it's a fairly
trivial patch.

gdb/ChangeLog:
2019-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (stap_parse_register_operand): Make "regname" an
"std::string", simplifying the algorithm.

5 years agoFix complaint string formatting on stap-probe.c
Sergio Durigan Junior [Thu, 16 May 2019 20:20:39 +0000 (16:20 -0400)]
Fix complaint string formatting on stap-probe.c

I think the string formatting for complaints was messed up by Tom's
patch to simplify the complaint mechanism.  This small and trivial
patch fixes them.

Pushed as obvious.

gdb/ChangeLog:
2019-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (handle_stap_probe): Fix complaint formatting.
(stap_static_probe_ops::get_probes): Likewise.

5 years agoSlightly improve logic of some operations on stap-probe.c
Sergio Durigan Junior [Thu, 16 May 2019 20:17:30 +0000 (16:17 -0400)]
Slightly improve logic of some operations on stap-probe.c

This patch contains three very small improvement on the logic of some
operations we do on stap-probe.c.  They don't change what the code
does.

Pushed as obvious.

gdb/ChangeLog:
2019-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (stap_parse_register_operand): Make "if (*p->arg ==
'-')" and "else if".
(stap_parse_single_operand): Join checks for
"gdbarch_stap_parse_special_token_p" and
"gdbarch_stap_parse_special_token" in the same "if" statement.
Invert check when verifying for operation on register
displacement.

5 years agoUpdate some comments on stap-probe.c
Sergio Durigan Junior [Thu, 16 May 2019 20:11:20 +0000 (16:11 -0400)]
Update some comments on stap-probe.c

Some functions's comments were not entirely correct on stap-probe.c,
so this patch updates them.

Pushed as obvious.

gdb/ChangeLog:
2019-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>

* stap-probe.c (stap_get_opcode): Update comment.
(stap_get_expected_argument_type): Likewise.
(handle_stap_probe): Likewise.

5 years agoBool-ify stap-probe.c and stap-related code on i386-tdep.c
Sergio Durigan Junior [Thu, 16 May 2019 19:58:55 +0000 (15:58 -0400)]
Bool-ify stap-probe.c and stap-related code on i386-tdep.c

This simple patch converts a bunch of "int"s to "bool" on stap-probe.c
and on the stap-related code present on i386-tdep.c.

Pushed as obvious (+ I'm the maintainer of this code).

gdb/ChangeLog:
2019-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>

* i386-tdep.c (i386_stap_parse_special_token_triplet): Change
return type to 'bool'.  Adjust comment.  Use 'bool' when
appropriate.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* stap-probe.c (stap_parse_argument_1): Likewise.
(stap_is_operator): Likewise.
(stap_is_generic_prefix): Likewise.
(stap_is_register_prefix): Likewise.
(stap_is_register_indirection_prefix): Likewise.
(stap_is_integer_prefix): Likewise.
(stap_generic_check_suffix): Likewise.
(stap_check_integer_suffix): Likewise.
(stap_check_register_suffix): Likewise.
(stap_check_register_indirection_suffix): Likewise.
(stap_parse_register_operand): Likewise.
(stap_parse_single_operand): Likewise.
(stap_parse_argument_1): Likewise.
(stap_probe::get_argument_count): Likewise.
(stap_is_operator): Likewise.