external/binutils.git
8 years agofix up two issues with the removal of unused variables
Trevor Saunders [Wed, 11 May 2016 01:33:45 +0000 (21:33 -0400)]
fix up two issues with the removal of unused variables

gdb/ChangeLog:

2016-05-10  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* iq2000-tdep.c (iq2000_scan_prologue): Remove if that shouldn't guard
anything.
* linespec.c (add_sal_to_sals): Restore call to symtab_to_fullname.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 May 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoEnable Intel RDPID instruction.
Alexander Fomin [Tue, 10 May 2016 18:35:52 +0000 (21:35 +0300)]
Enable Intel RDPID instruction.

This patch enables Intel RDPID instruction described in Intel64 and
IA-32 Architectures Software Developer's Manual, April 2016.

gas/

* config/tc-i386.c (cpu_arch): Add RDPID.
* doc/c-i386.texi: Document RDPID.

gas/testsuite/

* gas/i386/i386.exp: Run RDPID tests.
* gas/i386/prefix.d: Adjust.
* gas/i386/rdpid.s: New test.
* gas/i386/rdpid.d: Ditto.
* gas/i386/rdpid-intel.d: Ditto.
* gas/i386/x86-64-rdpid.s: Ditto.
* gas/i386/x86-64-rdpid.d: Ditto.
* gas/i386/x86-64-rdpid-intel.d: Ditto.

opcodes/

* i386-dis.c (prefix_table): Add RDPID instruction.
* i386-gen.c (cpu_flag_init): Add RDPID flag.
(cpu_flags): Add RDPID bitfield.
* i386-opc.h (enum): Add RDPID element.
(i386_cpu_flags): Add RDPID field.
* i386-opc.tbl: Add RDPID instruction.
* i386-init.h: Regenerate.
* i386-tbl.h: Regenerate.

8 years agoAllow veneers to claim veneered symbols
Thomas Preud'homme [Tue, 10 May 2016 15:20:19 +0000 (16:20 +0100)]
Allow veneers to claim veneered symbols

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (enum elf32_arm_stub_type): New max_stub_type
enumerator.
(arm_stub_sym_claimed): New function.
(elf32_arm_create_stub): Use veneered symbol name and section if
veneer needs to claim its symbol, and keep logic unchanged otherwise.
(arm_stub_claim_sym): New function.
(arm_map_one_stub): Call arm_stub_claim_sym if veneer needs to claim
veneered symbol, otherwise create local symbol as before.

8 years agoUse getters/setters to access ARM branch type
Thomas Preud'homme [Tue, 10 May 2016 15:14:23 +0000 (16:14 +0100)]
Use getters/setters to access ARM branch type

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (elf32_arm_size_stubs): Use new macros
ARM_GET_SYM_BRANCH_TYPE and ARM_SET_SYM_BRANCH_TYPE to respectively get
and set branch type of a symbol.
(bfd_elf32_arm_process_before_allocation): Likewise.
(elf32_arm_relocate_section): Likewise and fix identation along the
way.
(allocate_dynrelocs_for_symbol): Likewise.
(elf32_arm_finish_dynamic_symbol): Likewise.
(elf32_arm_swap_symbol_in): Likewise.
(elf32_arm_swap_symbol_out): Likewise.

gas/
* config/tc-arm.c (arm_adjust_symtab): Use ARM_SET_SYM_BRANCH_TYPE to
set branch type of a symbol.

gdb/
* arm-tdep.c (arm_elf_make_msymbol_special): Use
ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol.

include/
* arm.h (enum arm_st_branch_type): Add new ST_BRANCH_ENUM_SIZE
enumerator.
(NUM_ENUM_ARM_ST_BRANCH_TYPE_BITS): New macro.
(ENUM_ARM_ST_BRANCH_TYPE_BITMASK): Likewise.
(ARM_SYM_BRANCH_TYPE): Replace by ...
(ARM_GET_SYM_BRANCH_TYPE): This and ...
(ARM_SET_SYM_BRANCH_TYPE): This in two versions depending on whether
BFD_ASSERT is defined or not.

ld/
* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use
ARM_GET_SYM_BRANCH_TYPE to get branch type of a symbol.

opcodes/
* arm-dis.c (get_sym_code_type): Use ARM_GET_SYM_BRANCH_TYPE to get
branch type of a symbol.
(print_insn): Likewise.

8 years agoAllow stubs without associated input section in ARM backend
Thomas Preud'homme [Tue, 10 May 2016 14:45:01 +0000 (15:45 +0100)]
Allow stubs without associated input section in ARM backend

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* bfd-in.h (elf32_arm_size_stubs): Add an output section parameter.
* bfd-in2.h: Regenerated.
* elf32-arm.c (struct elf32_arm_link_hash_table): Add an output section
parameter to add_stub_section callback.
(elf32_arm_create_or_find_stub_sec): Get output section from link_sec
and pass it down to add_stub_section.
(elf32_arm_add_stub): Set section to stub_sec if NULL before using it
for error message.
(elf32_arm_size_stubs): Add output section parameter to
add_stub_section function pointer parameter.

ld/
* emultempl/armelf.em (elf32_arm_add_stub_section): Add output_section
parameter and rename input_section parameter to after_input_section.
Append input stub section to the output section if after_input_section
is NULL.

8 years agoFactor our stub creation in ARM backend
Thomas Preud'homme [Tue, 10 May 2016 14:42:20 +0000 (15:42 +0100)]
Factor our stub creation in ARM backend

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (elf32_arm_create_stub): New function.
(elf32_arm_size_stubs): Use elf32_arm_create_stub for stub creation.

8 years agoRefactor Cortex-A8 erratum workaround in preparation
Thomas Preud'homme [Tue, 10 May 2016 14:28:10 +0000 (15:28 +0100)]
Refactor Cortex-A8 erratum workaround in preparation

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
* elf32-arm.c (enum elf32_arm_stub_type): Delete
arm_stub_a8_veneer_lwm enumerator.
(arm_stub_a8_veneer_lwm): New unsigned constant to replace
aforementioned enumerator.
(struct elf32_arm_stub_hash_entry): Delete target_addend
field and add source_value.
(struct a8_erratum_fix): Delete addend field and add target_offset.
(stub_hash_newfunc): Initialize source_value field amd remove
initialization for target_addend.
(arm_build_one_stub): Stop special casing Thumb relocations: promote
the else to being always executed, moving the
arm_stub_a8_veneer_b_cond specific code in it.  Remove
stub_entry->target_addend from points_to computation.
(cortex_a8_erratum_scan): Store in a8_erratum_fix structure the offset
to target symbol from start of section rather than the offset from the
stub address.
(elf32_arm_size_stubs): Set stub_entry's source_value and target_value
fields from struct a8_erratum_fix's offset and target_offset
respectively.
(make_branch_to_a8_stub): Rename target variable to loc.  Compute
veneered_insn_loc and loc using stub_entry's source_value.

8 years agoAdd support for ARMv8-M Mainline with DSP extension
Thomas Preud'homme [Tue, 10 May 2016 14:15:15 +0000 (15:15 +0100)]
Add support for ARMv8-M Mainline with DSP extension

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

bfd/
(elf32_arm_merge_eabi_attributes): Add merging logic for
Tag_DSP_extension.

binutils/
* readelf.c (display_arm_attribute): Add output for Tag_DSP_extension.
(arm_attr_public_tags): Define DSP_extension attribute.

gas/
* NEWS: Document ARMv8-M and ARMv8-M Security and DSP Extensions.
* config/tc-arm.c (arm_ext_dsp): New feature for Thumb DSP
instructions.
(arm_extensions): Add dsp extension for ARMv8-M Mainline.
(aeabi_set_public_attributes): Memorize the feature bits of the
architecture selected for Tag_CPU_arch.  Use it to set
Tag_DSP_extension to 1 for ARMv8-M Mainline with DSP extension.
(arm_convert_symbolic_attribute): Define Tag_DSP_extension.
* testsuite/gas/arm/arch7em-bad.d: Rename to ...
* testsuite/gas/arm/arch7em-bad-1.d: This.
* testsuite/gas/arm/arch7em-bad-2.d: New file.
* testsuite/gas/arm/arch7em-bad-3.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-2.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-3.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
* testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.

include/
* elf/arm.h (Tag_DSP_extension): Define.

ld/
* testsuite/ld-arm/arm-elf.exp (EABI attribute merging 10 (DSP)): New
test.
* testsuite/ld-arm/attr-merge-10b-dsp.s: New file.
* testsuite/ld-arm/attr-merge-10-dsp.attr: Likewise.

8 years agoAllow extension availability to depend on several architecture bits
Thomas Preud'homme [Tue, 10 May 2016 14:06:41 +0000 (15:06 +0100)]
Allow extension availability to depend on several architecture bits

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (struct arm_option_extension_value_table): Make
allowed_archs an array with 2 entries.
(ARM_EXT_OPT): Adapt to only fill the first entry of allowed_archs.
(ARM_EXT_OPT2): New macro filling the two entries of allowed_archs.
(arm_extensions): Use separate entries in allowed_archs when several
archs are allowed to use an extension and change ARCH_ANY in
ARM_ARCH_NONE in allowed_archs.
(arm_parse_extension): Check that, for each allowed_archs entry, all
bits are set in the current architecture, ignoring ARM_ANY entries.
(s_arm_arch_extension): Likewise.

include/
* arm.h (ARM_FSET_CPU_SUBSET): Define macro.

8 years agoAdd support for ARMv8-M security extensions instructions
Thomas Preud'homme [Tue, 10 May 2016 14:01:53 +0000 (15:01 +0100)]
Add support for ARMv8-M security extensions instructions

2016-05-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (arm_ext_m): Add feature bit ARM_EXT2_V8M_MAIN.
(arm_ext_v8m_main): New feature set for bit ARM_EXT2_V8M_MAIN.
(arm_ext_v8m_m_only): New feature set for instructions in ARMv8-M not
shared with a non M profile architecture.
(do_rn): New function.
(known_t32_only_insn): Check opcode against arm_ext_v8m_m_only rather
than arm_ext_v8m.
(v7m_psrs): Add ARMv8-M security extensions new special registers.
(insns): Add ARMv8-M Security Extensions instructions.
(aeabi_set_public_attributes): Use arm_ext_v8m_m_only instead of
arm_ext_v8m_m to decide the profile and the Thumb ISA.
* testsuite/gas/arm/archv8m-cmse.s: New file.
* testsuite/gas/arm/archv8m-cmse-main.s: Likewise..
* testsuite/gas/arm/archv8m-cmse-msr.s: Likewise.
* testsuite/gas/arm/any-cmse.d: Likewise.
* testsuite/gas/arm/any-cmse-main.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-base.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-main-1.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-main-2.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.

include/
* opcode/arm.h (ARM_EXT2_V8M_MAIN): new feature bit.
(ARM_AEXT2_V8M_MAIN): New architecture extension feature set.
(ARM_ARCH_V8M_MAIN): Use ARM_AEXT2_V8M_MAIN instead of ARM_AEXT2_V8M
for the high core bits.

opcodes/
* arm-dis.c (coprocessor_opcodes): Add entries for VFP ARMv8-M
Mainline Security Extensions instructions.
(thumb_opcodes): Add entries for narrow ARMv8-M Security
Extensions instructions.
(thumb32_opcodes): Add entries for wide ARMv8-M Security Extensions
instructions.
(psr_name): Add new MSP_NS and PSP_NS ARMv8-M Security Extensions
special registers.

8 years agobinutils/doc: Update documentation for nm --size-sort
Andrew Burgess [Fri, 29 Apr 2016 12:22:51 +0000 (13:22 +0100)]
binutils/doc: Update documentation for nm --size-sort

The documentation for 'nm --size-sort' is out of step with the code, the
special handling for ELF is not mentioned in the documentation, and
could cause confusion to a user.

binutils/ChangeLog:

* doc/binutils.texi (nm): Update description of --size-sort.

8 years ago2016-05-10 Christophe Lyon <christophe.lyon@linaro.org>
Christophe Lyon [Tue, 10 May 2016 07:33:08 +0000 (09:33 +0200)]
2016-05-10  Christophe Lyon  <christophe.lyon@linaro.org>

* ld/testsuite/ld-elf/flags1.d (xfail): Remove *-*-nacl*".

8 years agoPR 20059 _bfd_elf_copy_link_hash_symbol_type segfault
Pip Cet [Tue, 10 May 2016 01:31:47 +0000 (11:01 +0930)]
PR 20059 _bfd_elf_copy_link_hash_symbol_type segfault

PR ld/20059
* elfxx-target.h (bfd_elfNN_bfd_copy_link_hash_symbol_type):
Define as _bfd_generic_copy_link_hash_symbol_type when using
generic hash table.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 May 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix for PR gold/19987.
Han Shen [Fri, 6 May 2016 22:07:13 +0000 (15:07 -0700)]
Fix for PR gold/19987.

8 years agoFix seg fault objdumping a corrupt binary with an invalid sh_link field.
Nick Clifton [Mon, 9 May 2016 16:31:07 +0000 (17:31 +0100)]
Fix seg fault objdumping a corrupt binary with an invalid sh_link field.

PR binutils/20063
* elf.c (bfd_elf_get_elf_syms): Check for out of range sh_link
field before accessing sections array.

* readelf.c (get_32bit_section_headers): Warn if an out of range
sh_link or sh_info field is encountered.
(get_64bit_section_headers): Likewise.

8 years ago[ARM/STM32L4XX] PR 20030: --fix-stm32l4xx-629360 fails to create vldm/vpop veneers...
Christophe Monat [Mon, 9 May 2016 13:10:37 +0000 (15:10 +0200)]
[ARM/STM32L4XX] PR 20030: --fix-stm32l4xx-629360 fails to create vldm/vpop veneers for double-precision registers

bfd/
PR ld/20030
* elf32-arm.c (is_thumb2_vldm): Account for T1 (DP) encoding.
(stm32l4xx_need_create_replacing_stub): Rename ambiguous nb_regs
to nb_words.
(create_instruction_vldmia): Add is_dp to disambiguate SP/DP
encoding.
(create_instruction_vldmdb): Likewise.
(stm32l4xx_create_replacing_stub_vldm): is_dp detects DP encoding,
uses it to re-encode.

ld/
PR ld/20030
* testsuite/ld-arm/arm-elf.exp: Run new stm32l4xx-fix-vldm-dp
tests. Fix misnamed stm32l4xx-fix-all.
* testsuite/ld-arm/stm32l4xx-fix-vldm-dp.s: New tests for multiple
loads with DP registers.
* testsuite/ld-arm/stm32l4xx-fix-vldm-dp.d: New reference file.
* testsuite/ld-arm/stm32l4xx-fix-vldm.s: Add missing comment.
* testsuite/ld-arm/stm32l4xx-fix-all.s: Add tests for multiple
loads with DP registers.
* testsuite/ld-arm/stm32l4xx-fix-all.d: Update reference.

8 years agoRevert accidental commit.
Nick Clifton [Mon, 9 May 2016 11:07:32 +0000 (12:07 +0100)]
Revert accidental commit.

PR 19938
* elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Revert accidental
commit.

8 years agoUpdate section merge test.
Pitchumani Sivanupandi [Mon, 9 May 2016 11:04:16 +0000 (12:04 +0100)]
Update section merge test.

* testsuite/ld-elf/flags1.d (readelf): Dump section header instead
program headers.
(xfail): Remove avr-*-*.
Update regex to check the section flags.
* testsuite/ld-elf/merge.d (xfail): Remove avr-*-*.

8 years agoopcodes,gas: sparc: fix mnemonic of faligndatai
Jose E. Marchesi [Mon, 9 May 2016 11:09:53 +0000 (04:09 -0700)]
opcodes,gas: sparc: fix mnemonic of faligndatai

opcodes/ChangeLog:

2016-05-09  Jose E. Marchesi  <jose.marchesi@oracle.com>

* sparc-opc.c (sparc_opcodes): Fix mnemonic of faligndatai.

gas/ChangeLog:

2016-05-09  Jose E. Marchesi  <jose.marchesi@oracle.com>

* testsuite/gas/sparc/sparc5vis4.s: Fix mnemonic of faligndatai.
* testsuite/gas/sparc/sparc5vis4.d: Likewise.

8 years agoRegenerate configure
Alan Modra [Mon, 9 May 2016 07:54:30 +0000 (17:24 +0930)]
Regenerate configure

8 years agoFix ealphavms.c and eelf64_ia64_vms.c deps
Alan Modra [Mon, 9 May 2016 07:40:03 +0000 (17:10 +0930)]
Fix ealphavms.c and eelf64_ia64_vms.c deps

* Makefile.am (ealphavms.c, eelf64_ia64_vms): Correct .em deps.
* Makefile.in: Regenerate.

8 years agoRedundant hash table check
Alan Modra [Mon, 9 May 2016 07:38:35 +0000 (17:08 +0930)]
Redundant hash table check

* elf64-ppc.c (ppc64_elf_init_stub_bfd): Remove redundant NULL check.

8 years agoCorrect script input section pattern
Alan Modra [Mon, 9 May 2016 07:37:33 +0000 (17:07 +0930)]
Correct script input section pattern

We don't want this to match .rela.text or similar.

* testsuite/ld-scripts/pr14962-2.t: Match .text, not *.text.
* testsuite/ld-scripts/rgn-at5.t: Similarly, .sec not *.sec.
* testsuite/ld-scripts/section-match-1.t: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 May 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoremove trivialy unused variables
Trevor Saunders [Mon, 18 Apr 2016 17:16:27 +0000 (13:16 -0400)]
remove trivialy unused variables

gdb/ChangeLog:

2016-05-07  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Remove unused
variables.
* aarch64-tdep.c (aarch64_skip_prologue): Likewise.
(aarch64_scan_prologue): Likewise.
(aarch64_prologue_prev_register): Likewise.
(aarch64_dwarf2_prev_register): Likewise.
(pass_in_v): Likewise.
(aarch64_push_dummy_call): Likewise.
(aarch64_breakpoint_from_pc): Likewise.
(aarch64_return_in_memory): Likewise.
(aarch64_return_value): Likewise.
(aarch64_displaced_step_b_cond): Likewise.
(aarch64_displaced_step_cb): Likewise.
(aarch64_displaced_step_tb): Likewise.
(aarch64_gdbarch_init): Likewise.
(aarch64_process_record): Likewise.
* alpha-mdebug-tdep.c (alpha_mdebug_init_abi): Likewise.
* alpha-tdep.c (_initialize_alpha_tdep): Likewise.
* amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise.
* amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Likewise.
* amd64-tdep.c (fixup_riprel): Likewise.
* amd64-windows-tdep.c (amd64_windows_frame_decode_epilogue): Likewise.
(amd64_windows_frame_decode_insns): Likewise.
(amd64_windows_frame_cache): Likewise.
(amd64_windows_frame_prev_register): Likewise.
(amd64_windows_frame_this_id): Likewise.
(amd64_windows_init_abi): Likewise.
* arm-linux-tdep.c (arm_linux_get_syscall_number): Likewise.
(arm_linux_get_next_pcs_syscall_next_pc): Likewise.
* arm-symbian-tdep.c (arm_symbian_init_abi): Likewise.
* arm-tdep.c (arm_make_epilogue_frame_cache): Likewise.
(arm_epilogue_frame_prev_register): Likewise.
(arm_record_vdata_transfer_insn): Likewise.
(arm_record_exreg_ld_st_insn): Likewise.
* auto-load.c (execute_script_contents): Likewise.
(print_scripts): Likewise.
* avr-tdep.c (avr_frame_prev_register): Likewise.
(avr_push_dummy_call): Likewise.
* bfin-linux-tdep.c (bfin_linux_sigframe_init): Likewise.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* blockframe.c (find_pc_partial_function_gnu_ifunc): Likewise.
* break-catch-throw.c (fetch_probe_arguments): Likewise.
* breakpoint.c (breakpoint_xfer_memory): Likewise.
(breakpoint_init_inferior): Likewise.
(breakpoint_inserted_here_p): Likewise.
(software_breakpoint_inserted_here_p): Likewise.
(hardware_breakpoint_inserted_here_p): Likewise.
(bpstat_what): Likewise.
(break_range_command): Likewise.
(save_breakpoints): Likewise.
* coffread.c (coff_symfile_read): Likewise.
* cris-tdep.c (cris_push_dummy_call): Likewise.
(cris_scan_prologue): Likewise.
(cris_register_size): Likewise.
(_initialize_cris_tdep): Likewise.
* d-exp.y: Likewise.
* dbxread.c (dbx_read_symtab): Likewise.
(process_one_symbol): Likewise.
(coffstab_build_psymtabs): Likewise.
(elfstab_build_psymtabs): Likewise.
* dicos-tdep.c (dicos_init_abi): Likewise.
* disasm.c (do_mixed_source_and_assembly): Likewise.
(gdb_disassembly): Likewise.
* dtrace-probe.c (dtrace_process_dof): Likewise.
* dwarf2read.c (error_check_comp_unit_head): Likewise.
(build_type_psymtabs_1): Likewise.
(skip_one_die): Likewise.
(process_imported_unit_die): Likewise.
(dwarf2_physname): Likewise.
(read_file_scope): Likewise.
(setup_type_unit_groups): Likewise.
(create_dwo_cu_reader): Likewise.
(create_dwo_cu): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(free_dwo_file): Likewise.
(check_producer): Likewise.
(dwarf2_add_typedef): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_unsigned_leb128): Likewise.
(read_signed_leb128): Likewise.
(dwarf2_const_value): Likewise.
(follow_die_sig_1): Likewise.
(dwarf_decode_macro_bytes): Likewise.
* extension.c (restore_active_ext_lang): Likewise.
* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
* ft32-tdep.c (ft32_analyze_prologue): Likewise.
* gdbtypes.c (lookup_typename): Likewise.
(resolve_dynamic_range): Likewise.
(check_typedef): Likewise.
* h8300-tdep.c (h8300_is_argument_spill): Likewise.
(h8300_gdbarch_init): Likewise.
* hppa-tdep.c (hppa32_push_dummy_call): Likewise.
(hppa_frame_this_id): Likewise.
(_initialize_hppa_tdep): Likewise.
* hppanbsd-tdep.c (hppanbsd_sigtramp_cache_init): Likewise.
* hppaobsd-tdep.c (hppaobsd_supply_fpregset): Likewise.
* i386-dicos-tdep.c (i386_dicos_init_abi): Likewise.
* i386-tdep.c (i386_bnd_type): Likewise.
(i386_gdbarch_init): Likewise.
(i386_mpx_bd_base): Likewise.
* i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Likewise.
* i386obsd-tdep.c (i386obsd_elf_init_abi): Likewise.
* ia64-tdep.c (examine_prologue): Likewise.
(ia64_frame_cache): Likewise.
(ia64_push_dummy_call): Likewise.
* infcmd.c (finish_command_fsm_async_reply_reason): Likewise.
(default_print_one_register_info): Likewise.
* infrun.c (infrun_thread_ptid_changed): Likewise.
(thread_still_needs_step_over): Likewise.
(stop_all_threads): Likewise.
(restart_threads): Likewise.
(keep_going_stepped_thread): Likewise.
* iq2000-tdep.c (iq2000_scan_prologue): Likewise.
* language.c (language_init_primitive_type_symbols): Likewise.
* linespec.c (add_sal_to_sals): Likewise.
* linux-nat.c (status_callback): Likewise.
(kill_unfollowed_fork_children): Likewise.
(linux_nat_kill): Likewise.
* linux-tdep.c (linux_fill_prpsinfo): Likewise.
* linux-thread-db.c (thread_db_notice_clone): Likewise.
(record_thread): Likewise.
* location.c (string_to_event_location_basic): Likewise.
* m32c-tdep.c (m32c_prev_register): Likewise.
* m32r-linux-tdep.c (m32r_linux_init_abi): Likewise.
* m32r-tdep.c (decode_prologue): Likewise.
* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
* machoread.c (macho_symtab_read): Likewise.
(macho_symfile_read): Likewise.
(macho_symfile_offsets): Likewise.
* maint.c (set_per_command_cmd): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise.
(mi_cmd_stack_list_variables): Likewise.
* mi/mi-main.c (mi_cmd_exec_run): Likewise.
(output_register): Likewise.
(mi_cmd_execute): Likewise.
(mi_cmd_trace_define_variable): Likewise.
(print_variable_or_computed): Likewise.
* minsyms.c (prim_record_minimal_symbol_full): Likewise.
* mn10300-tdep.c (mn10300_frame_prev_register): Likewise.
* msp430-tdep.c (msp430_pseudo_register_write): Likewise.
* mt-tdep.c (mt_registers_info): Likewise.
* nios2-tdep.c (nios2_analyze_prologue): Likewise.
(nios2_push_dummy_call): Likewise.
(nios2_frame_unwind_cache): Likewise.
(nios2_stub_frame_cache): Likewise.
(nios2_stub_frame_sniffer): Likewise.
(nios2_gdbarch_init): Likewise.
* ppc-ravenscar-thread.c: Likewise.
* ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise.
* python/py-evts.c (add_new_registry): Likewise.
* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
(bpfinishpy_detect_out_scope_cb): Likewise.
* python/py-framefilter.c (py_print_value): Likewise.
* python/py-inferior.c (infpy_write_memory): Likewise.
* python/py-infevents.c (create_inferior_call_event_object): Likewise.
* python/py-infthread.c (thpy_get_ptid): Likewise.
* python/py-linetable.c (ltpy_get_pcs_for_line): Likewise.
(ltpy_get_all_source_lines): Likewise.
(ltpy_is_valid): Likewise.
(ltpy_iternext): Likewise.
* python/py-symtab.c (symtab_and_line_to_sal_object): Likewise.
* python/py-unwind.c (pyuw_object_attribute_to_pointer): Likewise.
(unwind_infopy_str): Likewise.
* python/py-varobj.c (py_varobj_get_iterator): Likewise.
* ravenscar-thread.c (ravenscar_inferior_created): Likewise.
* rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise.
* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise.
* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise.
* s390-linux-tdep.c (s390_supply_tdb_regset): Likewise.
(s390_frame_prev_register): Likewise.
(s390_dwarf2_frame_init_reg): Likewise.
(s390_record_vr): Likewise.
(s390_process_record): Likewise.
* score-tdep.c (score_push_dummy_call): Likewise.
(score3_analyze_prologue): Likewise.
* sh-tdep.c (sh_extract_return_value_nofpu): Likewise.
* sh64-tdep.c (sh64_analyze_prologue): Likewise.
(sh64_push_dummy_call): Likewise.
(sh64_extract_return_value): Likewise.
(sh64_do_fp_register): Likewise.
* solib-aix.c (solib_aix_get_section_offsets): Likewise.
* solib-darwin.c (darwin_read_exec_load_addr_from_dyld): Likewise.
(darwin_solib_read_all_image_info_addr): Likewise.
* solib-dsbt.c (enable_break): Likewise.
* solib-frv.c (enable_break2): Likewise.
(frv_fdpic_find_canonical_descriptor): Likewise.
* solib-svr4.c (svr4_handle_solib_event): Likewise.
* sparc-tdep.c (sparc_skip_stack_check): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_get_longjmp_target): Likewise.
* sparcobsd-tdep.c (sparc32obsd_init_abi): Likewise.
* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
* stack.c (read_frame_local): Likewise.
* symfile.c (symbol_file_add_separate): Likewise.
(remove_symbol_file_command): Likewise.
* symmisc.c (maintenance_print_one_line_table): Likewise.
* symtab.c (symbol_cache_flush): Likewise.
(basic_lookup_transparent_type): Likewise.
(sort_search_symbols_remove_dups): Likewise.
* target.c (target_memory_map): Likewise.
(target_detach): Likewise.
(target_resume): Likewise.
(acquire_fileio_fd): Likewise.
(target_store_registers): Likewise.
* thread.c (print_thread_info_1): Likewise.
* tic6x-tdep.c (tic6x_analyze_prologue): Likewise.
* tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Likewise.
* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
(tilegx_analyze_prologue): Likewise.
(tilegx_stack_frame_destroyed_p): Likewise.
(tilegx_frame_cache): Likewise.
* tracefile.c (trace_save): Likewise.
* tracepoint.c (encode_actions_and_make_cleanup): Likewise.
(start_tracing): Likewise.
(print_one_static_tracepoint_marker): Likewise.
* tui/tui.c (tui_enable): Likewise.
* valops.c (value_struct_elt_bitpos): Likewise.
(find_overload_match): Likewise.
(find_oload_champ): Likewise.
* value.c (value_contents_copy_raw): Likewise.
* windows-tdep.c (windows_get_tlb_type): Likewise.
* x86-linux-nat.c (x86_linux_enable_btrace): Likewise.
* xcoffread.c (record_minimal_symbol): Likewise.
(scan_xcoff_symtab): Likewise.
* xtensa-tdep.c (execute_code): Likewise.
(xtensa_gdbarch_init): Likewise.
(_initialize_xtensa_tdep): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 May 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 May 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoStrip global symbol defined in discarded section
H.J. Lu [Fri, 6 May 2016 16:46:34 +0000 (09:46 -0700)]
Strip global symbol defined in discarded section

When a global symbol is defined in COMDAT group, we shouldn't leave an
undefined symbol in symbol table when the symbol section is discarded
unless there is a reference to the symbol outside of COMDAT group.

bfd/

PR ld/17550
* elf-bfd.h (elf_link_hash_entry): Update comments for indx,
documenting that indx == -3 if symbol is defined in a discarded
section.
* elflink.c (elf_link_add_object_symbols): Set indx to -3 if
symbol is defined in a discarded section.
(elf_link_output_extsym): Strip a global symbol defined in a
discarded section.

ld/

PR ld/17550
* testsuite/ld-elf/pr17550-1.s: New file.
* testsuite/ld-elf/pr17550-2.s: Likewise.
* testsuite/ld-elf/pr17550-3.s: Likewise.
* testsuite/ld-elf/pr17550-4.s: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.

8 years agoDefine elf_backend_add_symbol_hook for Intel MCU
H.J. Lu [Fri, 6 May 2016 15:28:27 +0000 (08:28 -0700)]
Define elf_backend_add_symbol_hook for Intel MCU

elf_backend_add_symbol_hook is undefined for FreeBSD.  Define it for
Intel MCU to support STB_GNU_UNIQUE for Intel MCU and NaCl.

* elf32-i386.c (elf_backend_add_symbol_hook): Defined for Intel
MCU.

8 years ago * ld/testsuite/ld-srec/srec.exp: Mark test as XFAIL for AVR.
Senthil Kumar Selvaraj [Fri, 6 May 2016 15:24:01 +0000 (16:24 +0100)]
* ld/testsuite/ld-srec/srec.exp: Mark test as XFAIL for AVR.

8 years ago[ARM][gas] Fix warnings about uninitialised uses and unused const variables
Kyrylo Tkachov [Fri, 6 May 2016 12:36:07 +0000 (13:36 +0100)]
[ARM][gas] Fix warnings about uninitialised uses and unused const variables

* config/tc-arm.c (fpu_arch_vfp_v1): Mark with ATTRIBUTE_UNUSED.
(fpu_arch_vfp_v3): Likewise.
(fpu_arch_neon_v1): Likewise.
(arm_arch_full): Likewise.
(parse_neon_el_struct_list): Initialize fields of firsttype.

8 years agoTest load conversion with symbol versioning for x86
H.J. Lu [Fri, 6 May 2016 12:28:18 +0000 (05:28 -0700)]
Test load conversion with symbol versioning for x86

* testsuite/ld-i386/i386.exp: Run load7.
* testsuite/ld-i386/load7.d: New file.
* testsuite/ld-i386/load7.map: Likewise.
* testsuite/ld-i386/load7.s: Likewise.
* testsuite/ld-x86-64/load2.d: Likewise.
* testsuite/ld-x86-64/load2.map: Likewise.
* testsuite/ld-x86-64/load2.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run load2.

8 years agoAdd support for FMLA (by element) to AArch64 sim.
Nick Clifton [Fri, 6 May 2016 09:35:33 +0000 (10:35 +0100)]
Add support for FMLA (by element) to AArch64 sim.

* simulator.c (do_FMLA_by_element): New function.
(do_vec_op2): Call it.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 May 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMore setting CHECK_RELOCS_AFTER_OPEN_INPUT to yes
H.J. Lu [Thu, 5 May 2016 15:43:58 +0000 (08:43 -0700)]
More setting CHECK_RELOCS_AFTER_OPEN_INPUT to yes

* emulparams/elf_iamcu.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): New.
* emulparams/elf_k1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/elf_l1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.

8 years agoPass --no-relax to ld in ld-x86-64/pr18591.d
H.J. Lu [Sun, 1 May 2016 21:19:03 +0000 (14:19 -0700)]
Pass --no-relax to ld in ld-x86-64/pr18591.d

Pass --no-relax to ld so that GOTPCREL relocation will be kept.

* testsuite/ld-x86-64/pr18591.d: Pass --no-relax to ld.

8 years agoFix ChangeLog entry format
Simon Marchi [Thu, 5 May 2016 13:46:06 +0000 (09:46 -0400)]
Fix ChangeLog entry format

8 years agoExtract convert_load_reloc from x86 convert_load
H.J. Lu [Thu, 5 May 2016 11:13:47 +0000 (04:13 -0700)]
Extract convert_load_reloc from x86 convert_load

* elf32-i386.c (elf_i386_convert_load): Extract the GOT load
conversion to ...
(elf_i386_convert_load_reloc): This.  New function.
* elf64-x86-64.c (elf_x86_64_convert_load): Extract the GOT load
conversion to ...
(elf_x86_64_convert_load_reloc): This.  New function.

8 years agoCache the section contents in x86 check_relocs
H.J. Lu [Thu, 5 May 2016 11:11:57 +0000 (04:11 -0700)]
Cache the section contents in x86 check_relocs

Cache the section contents in x86 check_relocs for sections without
TLS relocations.

* elf32-i386.c (elf_i386_check_tls_transition): Remove abfd.
Don't check if contents == NULL.
(elf_i386_tls_transition): Add from_relocate_section.  Check
from_relocate_section instead of contents != NULL.  Update
elf_i386_check_tls_transition call.
(elf_i386_check_relocs): Cache the section contents if
keep_memory is FALSE.  Pass FALSE as from_relocate_section to
elf_i386_tls_transition.
(elf_i386_relocate_section): Pass TRUE as from_relocate_section
to elf_i386_tls_transition.
(elf_backend_caches_rawsize): New.
* elf64-x86-64.c (elf_x86_64_check_tls_transition): Don't check
if contents == NULL.
(elf_x86_64_tls_transition): Add from_relocate_section.  Check
from_relocate_section instead of contents != NULL.
(elf_x86_64_check_relocs): Cache the section contents if
keep_memory is FALSE.  Pass FALSE as from_relocate_section to
elf_x86_64_tls_transition.
(elf_x86_64_relocate_section): Pass TRUE as from_relocate_section
to elf_x86_64_tls_transition.
(elf_backend_caches_rawsize): New.

8 years agoInitialize res in get_next_pcs_read_memory_unsigned_integer
Yao Qi [Thu, 5 May 2016 08:00:56 +0000 (09:00 +0100)]
Initialize res in get_next_pcs_read_memory_unsigned_integer

This patch initialize res to zero, otherwise, it may have some garbage
bits after the *the_target->read_memory call.

gdb/gdbserver:

2016-05-05  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (get_next_pcs_read_memory_unsigned_integer):
Initialize res to zero.

8 years agoChange type of cpsr in arm_sigreturn_next_pc
Yao Qi [Thu, 5 May 2016 08:00:56 +0000 (09:00 +0100)]
Change type of cpsr in arm_sigreturn_next_pc

Variable cpsr holds the value of cpsr register, which is 32-bit.  It
is better to explicitly use uint32_t.

gdb/gdbserver:

2016-05-05  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (arm_sigreturn_next_pc): Change type of cpsr
to uint32_t.

8 years agoPass %E to einfo when bfd_section == NULL
H.J. Lu [Thu, 5 May 2016 02:41:34 +0000 (19:41 -0700)]
Pass %E to einfo when bfd_section == NULL

Report BFD error When bfd_section == NULL in init_os.

* ldlang.c (init_os): Pass %E to einfo when bfd_section == NULL.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 May 2016 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years ago[spu] Fix C++ build problems
Ulrich Weigand [Wed, 4 May 2016 23:42:09 +0000 (19:42 -0400)]
[spu] Fix C++ build problems

ChangeLog:

* spu-linux-nat.c (spu_bfd_iovec_pread): Add pointer cast for C++.
(spu_bfd_open): Likewise.

gdbserver/ChangeLog:

* spu-low.c (fetch_ppc_register): Cast PowerPC-Linux-specific value
used as first ptrace argument to PTRACE_TYPE_ARG1 for C++.
(fetch_ppc_memory_1, store_ppc_memory_1): Likewise.

8 years agoLD/testsuite: Add STB_GNU_UNIQUE cross-linker test
Maciej W. Rozycki [Wed, 4 May 2016 00:46:10 +0000 (01:46 +0100)]
LD/testsuite: Add STB_GNU_UNIQUE cross-linker test

Some targets are only really, or at least regularly, regression-tested
in a crossed configuration.  Currently we only have native compiled test
cases for the STB_GNU_UNIQUE feature in the linker test suite.  This is
nice, covering run-time semantics even, but quite often not run at all.
Consequently a regression may remain unnoticed for long.

Add a simple test case then to provide basic linker coverage with no
need for a compiler or a native toolchain.

ld/
* testsuite/ld-unique/unique.d: New test.
* testsuite/ld-unique/unique.exp: Run the new test.  Adjust
messages for compiled tests.

8 years ago[ARC] Add SYNTAX_NOP and SYNTAX_1OP for extension instructions
Claudiu Zissulescu [Tue, 3 May 2016 11:44:13 +0000 (13:44 +0200)]
[ARC] Add SYNTAX_NOP and SYNTAX_1OP for extension instructions

gas/
2016-05-03  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (syntaxclass): Add SYNTAX_NOP and SYNTAX_1OP.
(arc_extinsn): Handle new introduced syntax.
* testsuite/gas/arc/textinsn1op.d: New file.
* testsuite/gas/arc/textinsn1op.s: Likewise.
* doc/c-arc.texi: Document SYNTAX_NOP and SYNTAX_1OP.

opcodes/
2016-05-03  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-ext.c (dump_ARC_extmap): Handle SYNATX_NOP and SYNTAX_1OP.
(arcExtMap_genOpcode): Likewise.
* arc-opc.c (arg_32bit_rc): Define new variable.
(arg_32bit_u6): Likewise.
(arg_32bit_limm): Likewise.

include/
2016-05-03  Claudiu Zissulescu  <claziss@synopsys.com>

* opcode/arc.h (ARC_SYNTAX_1OP): Declare
(ARC_SYNTAX_NOP): Likewsie.
(ARC_OP1_MUST_BE_IMM): Update defined value.
(ARC_OP1_IMM_IMPLIED): Likewise.
(arg_32bit_rc, arg_32bit_u6, arg_32bit_limm): Declare.

8 years agoThrow NOT_AVAILABLE_ERROR in read_stack and read_code
Yao Qi [Wed, 4 May 2016 14:04:01 +0000 (15:04 +0100)]
Throw NOT_AVAILABLE_ERROR in read_stack and read_code

Nowadays, read_memory may throw NOT_AVAILABLE_ERROR (it is done by
patch http://sourceware.org/ml/gdb-patches/2013-08/msg00625.html)
however, read_stack and read_code still throws MEMORY_ERROR only.  This
causes PR 19947, that is prologue unwinder is unable unwind because
code memory isn't available, but MEMORY_ERROR is thrown, while unwinder
catches NOT_AVAILABLE_ERROR.

 #0  memory_error (err=err@entry=TARGET_XFER_E_IO, memaddr=memaddr@entry=140737349781158) at /home/yao/SourceCode/gnu/gdb/git/gdb/corefile.c:217
 #1  0x000000000065f5ba in read_code (memaddr=memaddr@entry=140737349781158, myaddr=myaddr@entry=0x7fffffffd7b0 "\340\023<\001", len=len@entry=1)
     at /home/yao/SourceCode/gnu/gdb/git/gdb/corefile.c:288
 #2  0x000000000065f7b5 in read_code_unsigned_integer (memaddr=memaddr@entry=140737349781158, len=len@entry=1, byte_order=byte_order@entry=BFD_ENDIAN_LITTLE)
     at /home/yao/SourceCode/gnu/gdb/git/gdb/corefile.c:363
 #3  0x00000000004717e0 in amd64_analyze_prologue (gdbarch=gdbarch@entry=0x13c13e0, pc=140737349781158, current_pc=140737349781165, cache=cache@entry=0xda0cb0)
     at /home/yao/SourceCode/gnu/gdb/git/gdb/amd64-tdep.c:2267
 #4  0x0000000000471f6d in amd64_frame_cache_1 (cache=0xda0cb0, this_frame=0xda0bf0) at /home/yao/SourceCode/gnu/gdb/git/gdb/amd64-tdep.c:2437
 #5  amd64_frame_cache (this_frame=0xda0bf0, this_cache=<optimised out>) at /home/yao/SourceCode/gnu/gdb/git/gdb/amd64-tdep.c:2508
 #6  0x000000000047214d in amd64_frame_this_id (this_frame=<optimised out>, this_cache=<optimised out>, this_id=0xda0c50)
     at /home/yao/SourceCode/gnu/gdb/git/gdb/amd64-tdep.c:2541
 #7  0x00000000006b94c4 in compute_frame_id (fi=0xda0bf0) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:481
 #8  get_prev_frame_if_no_cycle (this_frame=this_frame@entry=0xda0b20) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1809
 #9  0x00000000006bb6c9 in get_prev_frame_always_1 (this_frame=0xda0b20) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1983
 #10 get_prev_frame_always (this_frame=this_frame@entry=0xda0b20) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1999
 #11 0x00000000006bbe11 in get_prev_frame (this_frame=this_frame@entry=0xda0b20) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:2241
 #12 0x00000000006bc13c in unwind_to_current_frame (ui_out=<optimised out>, args=args@entry=0xda0b20) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1485

The fix is to let read_stack and read_code throw NOT_AVAILABLE_ERROR too,
in order to align with read_memory.

gdb:

2016-05-04  Yao Qi  <yao.qi@linaro.org>

PR gdb/19947
* corefile.c (read_memory): Rename it to ...
(read_memory_object): ... it.  Add parameter object.
(read_memory): Call read_memory_object.
(read_stack): Likewise.
(read_code): Likewise.

8 years agoFix solib-display.exp remote check
Simon Marchi [Wed, 4 May 2016 13:27:34 +0000 (09:27 -0400)]
Fix solib-display.exp remote check

This test currently uses [is_remote target] to check if the test is
supported.  This is not quite correct, as the limitation is actually
that it requires support for "running", ruling out stub-like targets.
Therefore, it should check for use_gdb_stub.

This has no visible effect right now, but it will once we make the
native-gdbserver board non-dejagnu-remote.

gdb/testsuite/ChangeLog:

* gdb.base/solib-display.exp: Check for [use_gdb_stub] instead
of [is_remote target],

8 years agoIntroduce procedure use_gdb_stub
Simon Marchi [Wed, 4 May 2016 13:27:19 +0000 (09:27 -0400)]
Introduce procedure use_gdb_stub

This patch introduces the use_gdb_stub procedure, which allows getting
the right value of the use_gdb_stub variable/property in any all
situations.

When calling it before the $use_gdb_stub global variable has been set,
it will return the value of the use_gdb_stub property from the board
file.  This happens when tests want to bail out early (even before gdb
has been started) when the current test setup is a stub.

Otherwise, it returns the value of the $use_gdb_stub global.

It's possible for these two to differ when a test file overrides the
value of the global.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (use_gdb_stub): New procedure.

8 years agoFix some AVR test failures.
Senthil Kumar Selvaraj [Wed, 4 May 2016 12:03:52 +0000 (13:03 +0100)]
Fix some AVR test failures.

binutils* testsuite/lib/binutils-common.exp (is_elf_format): Add avr-*-*.

ld * testsuite/ld-elf/pr18735.d: Allow other symbols.
* testsuite/ld-elf/sec64k.exp: Skip 64ksec for avr.
* testsuite/ld-gc/pr14265.d: Allow other symbols.
* testsuite/ld-plugin/plugin.exp: Add PR ld/17973 to
plugin_tests only if check_shared_lib_support is true.
* testsuite/ld-selective/selective.exp: Add --section-start
flag for avr.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 May 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR symtab/19914 fix handling of dwp + split debug
Doug Evans [Tue, 3 May 2016 23:30:58 +0000 (16:30 -0700)]
PR symtab/19914 fix handling of dwp + split debug

PR symtab/19914
* dwarf2read.c (open_and_init_dwp_file): Look at backlink if objfile
is separate debug file.

testsuite/
* gdb.dwarf2/dwp-sepdebug.c: New file.
* gdb.dwarf2/dwp-sepdebug.exp: New file.

8 years agoFix typos in gdb_pipe function comment
Don Breazeal [Tue, 3 May 2016 22:54:45 +0000 (15:54 -0700)]
Fix typos in gdb_pipe function comment

gdb/ChangeLog:
2016-05-03  Don Breazeal <donb@codesourcery.com>

* serial.h (gdb_pipe): Fix argument names in comment.

8 years agoPR 10549: MIPS/LD: Handle OSABI setting for STB_GNU_UNIQUE
Maciej W. Rozycki [Tue, 3 May 2016 22:47:55 +0000 (23:47 +0100)]
PR 10549: MIPS/LD: Handle OSABI setting for STB_GNU_UNIQUE

Add missing OSABI handling for MIPS/LD, complementing:

commit f64b2e8d60f277b705c96d4b4e585f5f7c847cc4
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Apr 11 08:13:22 2011 +0000

Adjust test coverage accordingly.

bfd/
PR 10549
* elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Handle
STB_GNU_UNIQUE.

ld/
PR 10549
* testsuite/ld-unique/unique.exp: Also run for `mips*-*-*'.

8 years agoUpdated Swedish translation for the binutils.
Nick Clifton [Tue, 3 May 2016 12:36:22 +0000 (13:36 +0100)]
Updated Swedish translation for the binutils.

8 years agoFix gdb/python/python.c use-after-free
Pedro Alves [Tue, 3 May 2016 11:16:56 +0000 (12:16 +0100)]
Fix gdb/python/python.c use-after-free

Valgrind shows:

 ==26964== Invalid read of size 1
 ==26964==    at 0x6E14100: __GI_strcmp (strcmp.S:180)
 ==26964==    by 0x6DB55AA: setlocale (setlocale.c:238)
 ==26964==    by 0x4E0455: _initialize_python() (python.c:1731)
 ==26964==    by 0x786731: initialize_all_files() (init.c:319)
 ==26964==    by 0x72EF0A: gdb_init(char*) (top.c:1929)
 ==26964==    by 0x60BCAC: captured_main(void*) (main.c:863)
 ==26964==    by 0x606AD5: catch_errors(int (*)(void*), void*, char*, return_mask) (exceptions.c:234)
 ==26964==    by 0x60C608: gdb_main(captured_main_args*) (main.c:1165)
 ==26964==    by 0x40CAEC: main (gdb.c:32)
 ==26964==  Address 0x81d30a0 is 0 bytes inside a block of size 181 free'd
 ==26964==    at 0x4C29CF0: free (vg_replace_malloc.c:530)
 ==26964==    by 0x6DB5B65: setname (setlocale.c:201)
 ==26964==    by 0x6DB5B65: setlocale (setlocale.c:388)
 ==26964==    by 0x4E037F: _initialize_python() (python.c:1712)
 ==26964==    by 0x786731: initialize_all_files() (init.c:319)
 ==26964==    by 0x72EF0A: gdb_init(char*) (top.c:1929)
 ==26964==    by 0x60BCAC: captured_main(void*) (main.c:863)
 ==26964==    by 0x606AD5: catch_errors(int (*)(void*), void*, char*, return_mask) (exceptions.c:234)
 ==26964==    by 0x60C608: gdb_main(captured_main_args*) (main.c:1165)
 ==26964==    by 0x40CAEC: main (gdb.c:32)

The problem is doing this:

  oldloc = setlocale (LC_ALL, NULL);
  setlocale (LC_ALL, "");
  ...
  setlocale (LC_ALL, oldloc);

I.e., the second setlocale call frees 'oldloc'.

From http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlocale.html :

 "The returned string pointer might be invalidated or the string
 content might be overwritten by a subsequent call to setlocale()."

gdb/ChangeLog:
2016-05-03  Pedro Alves <palves@redhat.com>

PR python/20037
* python/python.c (_initialize_python) [IS_PY3K]: xstrdup/xfree
oldloc.

8 years agoRemove gdb/python/python.c code that handles strlen failing with -1
Pedro Alves [Tue, 3 May 2016 11:16:55 +0000 (12:16 +0100)]
Remove gdb/python/python.c code that handles strlen failing with -1

This makes no sense -- strlen doesn't really ever fail with -1.

gdb/ChangeLog:
2016-05-03  Pedro Alves <palves@redhat.com>

* python/python.c (_initialize_python) [IS_PY3K]: Remove dead
code.

8 years ago[AArch64] Also puts value in place for R_AARCH64_RELATIVE
Jiong Wang [Tue, 3 May 2016 10:59:37 +0000 (11:59 +0100)]
[AArch64] Also puts value in place for R_AARCH64_RELATIVE

When handling absolute relocations for global symbols bind within the
shared object, AArch64 will generate one dynamic RELATIVE relocation,
but won't apply the value for this absolution relocations at static
linking stage. This is different from AArch64 gold linker and x86-64.

This is not a bug as AArch64 is RELA, there is only guarantee that
relocation addend is placed in the relocation entry.  But some
system softwares originally writen for x86-64 might assume AArch64
bfd linker gets the same behavior as x86-64, then they could take
advantage of this buy skipping those RELATIVE dynamic relocations
if the load address is the same as the static linking address.

This patch makes AArch64 BFD linker applies absolution relocations at
static linking stage for scenario described above.  Meanwhile old AArch64
android loader has a bug (PR19163) which relies on current linker behavior
as a workaround, so the same option --no-apply-dynamic-relocs added.

8 years agoFix generation of AArhc64 instruction table.
Szabolcs Nagy [Tue, 3 May 2016 10:48:56 +0000 (11:48 +0100)]
Fix generation of AArhc64 instruction table.

* aarch64-gen.c (VERIFIER): Define.
* aarch64-opc.c (VERIFIER): Define.
(verify_ldpsw): Use static linkage.
* aarch64-opc.h (verify_ldpsw): Remove.
* aarch64-tbl.h: Use VERIFIER for verifiers.

8 years agoAssume that the GAS testsuite for the AVR is being run without -mlink-relax specified.
Pitchumani Sivanupandi [Tue, 3 May 2016 09:56:30 +0000 (10:56 +0100)]
Assume that the GAS testsuite for the AVR is being run without -mlink-relax specified.

* testsuite/gas/lns/lns.exp: Add avr to list of targets using
DW_LNS_fixed_advance_pc.

8 years agoSkip ELF STT_COMMON linker tests if shared libraries are not supported.
Senthil Kumar Selvaraj [Tue, 3 May 2016 09:44:35 +0000 (10:44 +0100)]
Skip ELF STT_COMMON linker tests if shared libraries are not supported.

* testsuite/ld-elfcomm/elfcomm.exp: Check for shared lib support
before running STT_COMMON tests.

8 years agoFix PR gdb/16818, workaround Python's forcing of -export-dynamic
Pedro Alves [Tue, 3 May 2016 09:30:51 +0000 (10:30 +0100)]
Fix PR gdb/16818, workaround Python's forcing of -export-dynamic

GDB's use of --dynamic-list to only export the proc-service symbols is
broken due to Python's "python-config --ldflags" saying we should link
with -export-dynamic, causing us to export _all_ extern symbols
anyway.  On Fedora 23:

 $ python-config --ldflags
 -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
 $ python3.4-config --ldflags
  -L/usr/lib64 -lpython3.4m -lpthread -ldl  -lutil -lm  -Xlinker -export-dynamic

Having GDB export all its symbols leads to issues such as PR gdb/16818
(GDB crashes when using name for target remote hostname:port), where a
GDB symbol unintentionally preempts a symbol in one of the NSS modules
glibc loads into the process.  NSS modules should not define symbols
outside the implementation namespace or the relevant standards, but,
alas, that's a longstanding and hard to fix issue.  See libc-alpha
discussion at:

  [symbol name space issues with NSS modules]
  https://sourceware.org/ml/libc-alpha/2016-04/msg00130.html

Python should instead be either using GCC's symbol visibility feature
or -Wl,--dynamic-list as well, to only export Python API symbols, but,
it doesn't.  There are bugs open upstream for that:

  [Use -Wl,--dynamic-list=x.list, not -Xlinker -export-dynamic]
  http://bugs.python.org/issue10112

  [Use GCC visibility attrs in PyAPI_*]
  http://bugs.python.org/issue11410

But that's taking a long while to resolve.

I thought of working around this Python issue by making GDB build with
-fvisibility=hidden, as Jan suggests in Python issue 10112, as then
Python's "-Xlinker -export-dynamic" has no effect.  However, that
would need to be done in the whole source tree (bfd, libiberty, etc.),
and I think that would break GCC plugins, as I believe those have
access to all of GCCs symbols, by "design".  So we'd need a new
configure switch, or have the libraries in the tree detect which of
GCC or GDB is being built, but that doesn't work, because the answer
can be "both" with combined builds...

So this patch instead works around Python's bug, by simply sed'ing
away "-Xlinker -export-dynamic" from the result of python-config.py
--ldflags, making -Wl,--dynamic-list work again as it used to.  It's
ugly, but so is the bug...

Note that if -Wl,--dynamic-list doesn't work, we always link with
-rdynamic, so static Python should still work.

Tested on F23 with --python=python (Python 2.7) and
--python=python3.4.

gdb/ChangeLog:y
2016-05-03  Pedro Alves  <palves@redhat.com>

* configure.ac (PYTHON_LIBS): Sed away "-Xlinker -export-dynamic".
* configure: Regenerate.

8 years agoFix "-Wl,--dynamic-list" gdb/configure test
Pedro Alves [Tue, 3 May 2016 09:30:51 +0000 (10:30 +0100)]
Fix "-Wl,--dynamic-list" gdb/configure test

The -Wl,--dynamic-list test is currently broken on Fedora 23, when you
configure with --with-python=python3.4.  We see:

 configure:13741: checking for the dynamic export flag
 configure:13796: gcc -o conftest -g3 -O0  -fno-strict-aliasing -DNDEBUG -fwrapv    -Wl,--dynamic-list=/home/pedro/gdb/mygit/src/gdb/proc-service.list conftest.c -ldl -lncurses -lm -ldl  -lpthread -ldl -lutil -lm -lpython3.4m -Xlinker -export-dynamic >&5
 conftest.c:182:30: fatal error: python3.4/Python.h: No such file or directory
 compilation terminated.
 configure:13796: $? = 1

The correct -I path is in PYTHON_CPPFLAGS:

 PYTHON_CPPFLAGS='-I/usr/include/python3.4m -I/usr/include/python3.4m'

(Other Python-related tests in the file are already doing this.)

gdb/ChangeLog:
2016-05-03  Pedro Alves  <palves@redhat.com>

* configure.ac (checking for the dynamic export flag): Add
$PYTHON_CPPFLAGS to CPPFLAGS.
* configure: Regenerate.

8 years ago[gdb] Fix -Wparentheses warnings
Kyrylo Tkachov [Tue, 3 May 2016 08:40:54 +0000 (09:40 +0100)]
[gdb] Fix -Wparentheses warnings

2016-05-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

* symfile.c (find_pc_overlay): Add braces to avoid -Wparentheses
warning.
(find_pc_mapped_section): Likewise.
(list_overlays_command): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 May 2016 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix detach.exp remote check
Simon Marchi [Mon, 2 May 2016 17:10:33 +0000 (13:10 -0400)]
Fix detach.exp remote check

This test seems to work with both native-gdbserver and
native-extended-gdbserver, so I removed the remote check.

When running with native-gdbserver (a stub-like target), detach makes
gdbserver stop and gdb disconnect.  runto_main just spawns a brand new
gdbserver.  So it tests the exact same thing twice.  It doesn't hurt
though.

With native-extended-gdbserver, the test is probably a bit more useful
(and similar to native).  It tests running/detaching twice using the
same gdb/gdbserver instances, since with extended-remote, you can
detach/attach/run all you want, unlike with remote.

gdb/testsuite/ChangeLog:

* gdb.base/detach.exp: Remove is_remote check.

8 years agoFix annota-input-while-running.exp remote check
Simon Marchi [Mon, 2 May 2016 17:04:42 +0000 (13:04 -0400)]
Fix annota-input-while-running.exp remote check

The comment says that we can't use runto_main here becore it doesn't
know how to handle annotation.  Instead, the test puts a breakpoint at
main and calls run by hand.  Therefore, it can't work with stub targets,
since they can't "run".  The check should be then changed to check the
use_gdb_stub variable instead of [is_remote target].

But as an alternative, we can just use runto_main and enable annotations
after, since the "run to main" part is not really part of what we want
to test.

I also removed the "set test..." line that is unused.

gdb/testsuite/ChangeLog:

* gdb.base/annota-input-while-running.exp: Don't check for
[is_remote target].  Enable annotations after running to main.
Remove unused "set test..." line.

8 years agoFix startup on MS-Windows when 'gdb.ini' is found in $HOME
Eli Zaretskii [Mon, 2 May 2016 16:37:43 +0000 (19:37 +0300)]
Fix startup on MS-Windows when 'gdb.ini' is found in $HOME

* windows-nat.c (_initialize_check_for_gdb_ini): Fix off-by-one
error in allocation of space for "$HOME/.gdbinit" string.  This
caused GDB to abort on startup whenever a '~/gdb.ini' file was
actually found, because xsnprintf would hit an assertion
violation.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 May 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 May 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 30 Apr 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoSet interpreter in x86 create_dynamic_sections
H.J. Lu [Fri, 29 Apr 2016 15:27:13 +0000 (08:27 -0700)]
Set interpreter in x86 create_dynamic_sections

Set interpreter in x86 create_dynamic_sections to make this information
available to x86 check_relocs.

* elf32-i386.c (elf_i386_size_dynamic_sections): Move interp
setting to ...
(elf_i386_create_dynamic_sections): Here.
* elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Move
interp setting to ...
(elf_x86_64_create_dynamic_sections): Here.

8 years agoPass GOT_RELOC to UNDEFINED_WEAK_RESOLVED_TO_ZERO
H.J. Lu [Fri, 29 Apr 2016 15:17:12 +0000 (08:17 -0700)]
Pass GOT_RELOC to UNDEFINED_WEAK_RESOLVED_TO_ZERO

When UNDEFINED_WEAK_RESOLVED_TO_ZERO is checked to convert load via
GOT, has_got_reloc is always TRUE.  This patch adds GOT_RELOC, which
is TRUE in x86 convert_load, to UNDEFINED_WEAK_RESOLVED_TO_ZERO.

* elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Take GOT_RELOC
and replace (EH)->has_got_reloc with GOT_RELOC.
(elf_i386_fixup_symbol): Pass has_got_reloc to
UNDEFINED_WEAK_RESOLVED_TO_ZERO.
(elf_i386_allocate_dynrelocs): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(elf_i386_convert_load): Pass TRUE to
UNDEFINED_WEAK_RESOLVED_TO_ZERO.
* elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Take
GOT_RELOC and replace (EH)->has_got_reloc with GOT_RELOC.
(elf_x86_64_fixup_symbol): Pass has_got_reloc to
UNDEFINED_WEAK_RESOLVED_TO_ZERO.
(elf_x86_64_allocate_dynrelocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_finish_dynamic_symbol): Likewise.
(elf_x86_64_convert_load): Pass TRUE to
UNDEFINED_WEAK_RESOLVED_TO_ZERO.

8 years agoDownload source only on remote host
H.J. Lu [Fri, 29 Apr 2016 13:50:33 +0000 (06:50 -0700)]
Download source only on remote host

There is no need to download source if we aren't on remote host.
Otherwise, each ld test run on local host leaves behind a couple
test files.

* config/default.exp (NOPIE_CFLAGS): Download source only on
remote host.
(NOPIE_LDFLAGS): Likewise.
* testsuite/lib/ld-lib.exp (check_lto_available): Likewise.
(check_lto_fat_available): Likewise.
(check_lto_shared_available): Likewise.
(check_ifunc_available): Likewise.
(check_ifunc_attribute_available): Likewise.

8 years agoEnhance readelf's recognition of AVR relocation types.
Pitchumani Sivanupandi [Fri, 29 Apr 2016 13:05:12 +0000 (14:05 +0100)]
Enhance readelf's recognition of AVR relocation types.

* readelf.c (is_32bit_pcrel_reloc): Return true if reloc is 32-bit
PC relocation for AVR target.
(is_none_reloc): Return true if reloc is any of AVR diff
relocations.

8 years agoi386: Don't relocate section when check_relocs failed
H.J. Lu [Fri, 29 Apr 2016 11:31:54 +0000 (04:31 -0700)]
i386: Don't relocate section when check_relocs failed

No need to relocate section when check_relocs failed.

* elf32-i386.c (check_relocs_failed): New.
(elf_i386_check_relocs): Set check_relocs_failed on error.
(elf_i386_relocate_section): Skip if check_relocs failed.

8 years agoX86-64: Set check_relocs_failed on error
H.J. Lu [Fri, 29 Apr 2016 11:29:38 +0000 (04:29 -0700)]
X86-64: Set check_relocs_failed on error

When checking relocations, set check_relocs_failed on error.

* elf64-x86-64.c (elf_x86_64_check_relocs): Set
check_relocs_failed on error.

8 years agoEnhance support for copying and stripping Solaris and ARM binaries.
Nick Clifton [Fri, 29 Apr 2016 08:24:42 +0000 (09:24 +0100)]
Enhance support for copying and stripping Solaris and ARM binaries.

PR 19938
bfd * elf-bfd.h (struct elf_backend_data): Rename
elf_backend_set_special_section_info_and_link to
elf_backend_copy_special_section_fields.
* elfxx-target.h: Likewise.
* elf.c (section_match): Ignore the SHF_INFO_LINK flag when
comparing section flags.
(copy_special_section_fields): New function.
(_bfd_elf_copy_private_bfd_data): Copy the EI_ABIVERSION field.
Perform two scans over special sections.  The first one looks for
a direct mapping between the output section and an input section.
The second scan looks for a possible match based upon section
characteristics.
* elf32-arm.c (elf32_arm_copy_special_section_fields): New
function.  Handle setting the sh_link field of SHT_ARM_EXIDX
sections.
* elf32-i386.c (elf32_i386_set_special_info_link): Rename to
elf32_i386_copy_solaris_special_section_fields.
* elf32-sparc.c (elf32_sparc_set_special_section_info_link):
Rename to elf32_sparc_copy_solaris_special_section_fields.
* elf64-x86-64.c (elf64_x86_64_set_special_info_link): Rename to
elf64_x86_64_copy_solaris_special_section_fields.

binutils* readelf.c (get_solaris_segment_type): New function.
(get_segment_type): Call it.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 29 Apr 2016 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoDon't show deprecated commands in help
Simon Marchi [Thu, 28 Apr 2016 18:11:38 +0000 (14:11 -0400)]
Don't show deprecated commands in help

Just like completion doesn't show deprecated commands, I think that help
should not list them, so that we don't incite users to use them.

gdb/ChangeLog:

* cli/cli-decode.c (help_cmd_list): Do not list commands that
are deprecated.

8 years agoAdd test for tracepoint enable/disable
Simon Marchi [Thu, 28 Apr 2016 16:55:30 +0000 (12:55 -0400)]
Add test for tracepoint enable/disable

This patch adds a test for tracepoints enabling/disabling, which
didn't work properly for fast tracepoints on big endian systems.

gdb/testsuite/ChangeLog:

* gdb.trace/trace-enable-disable.exp: New file.
* gdb.trace/trace-enable-disable.c: New file.

8 years agoFix write endianness/size problem for fast tracepoint enabled flag
Par Olsson [Thu, 28 Apr 2016 16:54:07 +0000 (12:54 -0400)]
Fix write endianness/size problem for fast tracepoint enabled flag

I am sending this fix on behalf of Par Olsson, as a follow-up of this
one:

https://www.sourceware.org/ml/gdb-patches/2015-10/msg00196.html

This problem is exposed when enabling/disabling fast tracepoints on big
endian machines.  The flag is defined as an int8_t, but is written from
gdbserver as an integer (usually 32 bits).  When the agent code reads it
as an int8_t, it only considers the most significant byte, which is
always 0.

Also, we were writing 32 bits in an 8 bits field, so the write would
overflow, but since the following bytes are padding (the next field is
an uint64_t), it luckily didn't cause any issue on little endian
systems.

The fix was originally tested on ARM big endian systems, but I don't
have access to such a system.  However, thanks to Marcin's PowerPC fast
tracepoint patches and gcc110 (big endian Power7) on the gcc compile
farm, I was able to reproduce the problem, test the fix and write a
test (the following patch).

gdb/gdbserver/ChangeLog:

YYYY-MM-DD  Par Olsson  <par.olsson@windriver.com>

* tracepoint.c (write_inferior_int8): New function.
(cmd_qtenable_disable): Write enable flag using
write_inferior_int8.

8 years agoftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary
Simon Marchi [Thu, 28 Apr 2016 13:49:01 +0000 (09:49 -0400)]
ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary

Some fast tracepoints tests make sure that the in-process agent library
is properly loaded, by searching for the library name in "info
sharedlibrary".

Originally, it would search for the full path.  Since patch "Make ftrace
tests work with remote targets" [1], the "runtime" location of the IPA,
in the standard output directory, is not the same as the original
location, in the gdbserver build directory.  Therefore, the patch
changed the checks:

  gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"

to

  gdb_test "info sharedlibrary" ".*[file tail ${libipa}].*" "IPA loaded"

so that only the "libinproctrace.so" part would be searched for.
Antoine (in CC) pointed out that I missed some, so I have to update
them.  In the mean time, I noticed that I missed a few test failures:
adding the SONAME to the IPA makes it possible for the test executable
to erroneously pick up libinproctrace.so from /usr/lib if the test
harness failed to put the libinproctrace.so we want to test in the right
place.  To mitigate that kind of error in the future, we can use the
return value of gdb_load_shlib (the path of the "runtime" version of the
library) and use that to search in the output of info sharedlibrary.

When testing locally, gdb_load_shlib returns the full normalized path of
the destination library, which the test executable should use e.g.:

  /path/to/gdb/testsuite/outputs/gdb.trace/thetest/libinproctrace.so

My testing showed that it was the same path that gdb displayed in info
sharedlibrary.  If the test executable picks up another
libinproctrace.so, the test will fail.

When testing remotely, gdb_load_shlib/gdb_remote_download only returns
us "libinproctrace.so", so the situation doesn't really change.  If
there is a rogue libinproctrace.so in /usr/lib on the target and we fail
to download ours, it might cover up a test failure.  But that situation
is probably still better than the original one, where it wasn't possible
to test remotely using the IPA at all.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6e774b13c3b81ac2599812adf058796948ce7e95

gdb/testsuite/ChangeLog:

* gdb.arch/ftrace-insn-reloc.exp: Save gdb_load_shlib result,
use it in info sharedlibrary test.
* gdb.trace/ftrace-lock.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/range-stepping.exp: Likewise.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.

8 years agoUpdated Chinese (simplified) translations for bfd, binutils and gold.
Nick Clifton [Thu, 28 Apr 2016 13:09:49 +0000 (14:09 +0100)]
Updated Chinese (simplified) translations for bfd, binutils and gold.

8 years agoRemove need_step_over from struct lwp_info
Yao Qi [Thu, 28 Apr 2016 10:52:23 +0000 (11:52 +0100)]
Remove need_step_over from struct lwp_info

Hi,
I happen to see that field need_step_over in struct lwp_info is only
used to print a debug info.  need_step_over is set in linux_wait_1
when breakpoint_here is true, however, we check breakpoint_here too in
need_step_over_p and do the step over.  I think we don't need field
need_step_over, and check breakpoint_here directly in need_step_over_p.

This field was added in this patch
https://sourceware.org/ml/gdb-patches/2010-03/msg00605.html and the code
wasn't changed much since then.

This patch is to remove it.

gdb/gdbserver:

2016-04-28  Yao Qi  <yao.qi@linaro.org>

* linux-low.h (struct lwp_info) <need_step_over>: Remove.
* linux-low.c (linux_wait_1): Update.
(need_step_over_p): Likewise.

8 years agoAdd support to AArch64 disassembler for verifying instructions. Add verifier for...
Nick Clifton [Thu, 28 Apr 2016 08:11:03 +0000 (09:11 +0100)]
Add support to AArch64 disassembler for verifying instructions.  Add verifier for LDPSW.

PR target/19722
opcodes * aarch64-dis.c (aarch64_opcode_decode): Run verifier if present.
* aarch64-opc.c (verify_ldpsw): New function.
* aarch64-opc.h (verify_ldpsw): New prototype.
* aarch64-tbl.h: Add initialiser for verifier field.
(LDPSW): Set verifier to verify_ldpsw.

binutils* testsuite/binutils-all/aarch64/illegal.s: New test.
* testsuite/binutils-all/aarch64/illegal.d: New test driver.

include * opcode/aarch64.h (struct aarch64_opcode): Add verifier field.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 28 Apr 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoLimit ld-elf/compressed1b.d to Linux/GNU targets
H.J. Lu [Wed, 27 Apr 2016 22:51:29 +0000 (15:51 -0700)]
Limit ld-elf/compressed1b.d to Linux/GNU targets

Since not all ELF targets use the elf.em emulation to support ld option:
--compress-debug-sections=zlib-gnu, limit compressed1b.d to Linux/GNU
targets.

* testsuite/ld-elf/compressed1b.d: Only run for Linux/GNU targets.

8 years agoRename gdb_load_shlibs to gdb_load_shlib
Simon Marchi [Wed, 27 Apr 2016 22:08:59 +0000 (18:08 -0400)]
Rename gdb_load_shlibs to gdb_load_shlib

Rename gdb_load_shlibs to gdb_load_shlib to reflect that it can only
load a single shlib at the time.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_load_shlibs): Rename to...
(gdb_load_shlib): ... this.
* gdb.arch/ftrace-insn-reloc.exp: Adjust gdb_load_shlibs ->
gdb_load_shlib.
* gdb.base/catch-load.exp (one_catch_load_test): Likewise.
* gdb.base/ctxobj.exp: Likewise.
* gdb.base/dprintf-pending.exp: Likewise.
* gdb.base/dso2dso.exp: Likewise.
* gdb.base/fixsection.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gdb1555.exp: Likewise.
* gdb.base/global-var-nested-by-dso.exp: Likewise.
* gdb.base/gnu-ifunc.exp: Likewise.
* gdb.base/hbreak-in-shr-unsupported.exp: Likewise.
* gdb.base/jit-so.exp (one_jit_test): Likewise.
* gdb.base/pending.exp: Likewise.
* gdb.base/print-file-var.exp: Likewise.
* gdb.base/print-symbol-loading.exp: Likewise.
* gdb.base/shlib-call.exp: Likewise.
* gdb.base/shreloc.exp: Likewise.
* gdb.base/so-impl-ld.exp: Likewise.
* gdb.base/solib-disc.exp: Likewise.
* gdb.base/solib-nodir.exp: Likewise.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.base/solib-symbol.exp: Likewise.
* gdb.base/solib-weak.exp (do_test): Likewise.
* gdb.base/sym-file.exp: Likewise.
* gdb.base/symtab-search-order.exp: Likewise.
* gdb.base/type-opaque.exp: Likewise.
* gdb.base/unload.exp: Likewise.
* gdb.base/watchpoint-solib.exp: Likewise.
* gdb.compile/compile.exp: Likewise.
* gdb.cp/gdb2384.exp: Likewise.
* gdb.cp/infcall-dlopen.exp: Likewise.
* gdb.cp/re-set-overloaded.exp: Likewise.
* gdb.fortran/library-module.exp: Likewise.
* gdb.opt/solib-intra-step.exp: Likewise.
* gdb.python/py-finish-breakpoint.exp: Likewise.
* gdb.python/py-shared.exp: Likewise.
* gdb.reverse/solib-precsave.exp: Likewise.
* gdb.reverse/solib-reverse.exp: Likewise.
* gdb.server/solib-list.exp: Likewise.
* gdb.threads/dlopen-libpthread.exp: Likewise.
* gdb.threads/tls-shared.exp: Likewise.
* gdb.threads/tls-so_extern.exp: Likewise.
* gdb.trace/change-loc.exp: Likewise.
* gdb.trace/ftrace-lock.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise.
* gdb.trace/pending.exp: Likewise.
* gdb.trace/range-stepping.exp: Likewise.
* gdb.trace/strace.exp (strace_remove_socket): Likewise.
(strace_info_marker): Likewise.
(strace_probe_marker): Likewise.
(strace_trace_on_same_addr): Likewise.
(strace_trace_on_diff_addr): Likewise.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.

8 years agoMake gdb_load_shlibs return the destination path of the library
Simon Marchi [Wed, 27 Apr 2016 22:07:44 +0000 (18:07 -0400)]
Make gdb_load_shlibs return the destination path of the library

This patch makes gdb_load_shlibs return the destination path of the
copied library.  To make the procedure implementation and interface more
straightforward, it also changes it so that it accepts a single shared
library path at the time.  Therefore, calls that are passed multiple
libraries:

  gdb_load_shlibs $lib1 $lib2

must be changed to separate calls:

  gdb_load_shlibs $lib1
  gdb_load_shlibs $lib2

A subtle impact is the solib-search-path handling.  In the former
version, solib-search-path is set using the directory of the first
passed lib (further calls overwrite the value).  In the later version,
the directory of the library passed to the last call to gdb_load_shlibs
remnains.  I don't think that's a problem in practice, since if we had
tests that needed multiple different paths in solib-search-path, they
wouldn't work in the first place.

Changed in v2:

* Split behavioural and rename changes in two separate patches.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_load_shlibs):  Accept a single argument.  Return
result of gdb_remote_download.
* gdb.base/ctxobj.exp: Split gdb_load_shlibs call.
* gdb.base/dso2dso.exp: Likewise.
* gdb.base/global-var-nested-by-dso.exp: Likewise.
* gdb.base/print-file-var.exp: Likewise.
* gdb.base/shlib-call.exp: Likewise.
* gdb.base/shreloc.exp: Likewise.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.base/solib-weak.exp (do_test): Likewise.
* gdb.base/unload.exp: Likewise.

8 years agoWorkaround gdbserver<7.7 for setfs
Jan Kratochvil [Wed, 27 Apr 2016 19:27:40 +0000 (21:27 +0200)]
Workaround gdbserver<7.7 for setfs

With current FSF GDB HEAD and old FSF gdbserver I expected I could do:
gdb -ex 'file target:/root/redhat/threadit' -ex 'target remote :1234'
(supplying that unsupported qXfer:exec-file:read by "file")
But that does not work because:
Sending packet: $vFile:setfs:0#bf...Packet received: OK
Packet vFile:setfs (hostio-setfs) is supported
...
Sending packet: $vFile:setfs:104#24...Packet received: OK
"target:/root/redhat/threadit": could not open as an executable file: Invalid argument

GDB documentation says:
The valid responses to Host I/O packets are:
An empty response indicates that this operation is not recognized.

This "empty response" vs. "OK" was a bug in gdbserver < 7.7.  It was fixed by:
commit e7f0d979dd5cc4f8b658df892e93db69d6d660b7
Author: Yao Qi <yao@codesourcery.com>
Date:   Tue Dec 10 21:59:20 2013 +0800
    Fix a bug in matching notifications.
Message-ID: <1386684626-11415-1-git-send-email-yao@codesourcery.com>
https://sourceware.org/ml/gdb-patches/2013-12/msg00373.html
2013-12-10  Yao Qi  <yao@codesourcery.com>
* notif.c (handle_notif_ack): Return 0 if no notification
matches.

with unpatched old FSF gdbserver and patched FSF GDB HEAD:
gdb -ex 'file target:/root/redhat/threadit' -ex 'target remote :1234'
Sending packet: $vFile:setfs:0#bf...Packet received: OK
Packet vFile:setfs (hostio-setfs) is NOT supported
...
(gdb) info sharedlibrary
From                To                  Syms Read   Shared Object Library
0x00007ffff7ddbae0  0x00007ffff7df627a  Yes (*)     target:/lib64/ld-linux-x86-64.so.2
0x00007ffff7bc48a0  0x00007ffff7bcf514  Yes (*)     target:/lib64/libpthread.so.0

gdb/ChangeLog
2016-04-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

* remote.c (remote_start_remote): Detect PACKET_vFile_setfs.support.

8 years agoSkip debug sections when estimating distances
H.J. Lu [Wed, 27 Apr 2016 16:13:10 +0000 (09:13 -0700)]
Skip debug sections when estimating distances

Skip debug sections when estimating distances between output sections
since compressed_size is used to compress debug sections and debug
sections aren't excluded from distances between output sections.

bfd/

PR ld/20006
* elf64-x86-64.c (elf_x86_64_convert_load): Skip debug sections
when estimating distances between output sections.

ld/

PR ld/20006
* testsuite/ld-elfvsb/elfvsb.exp (COMPRESS_LDFLAG): New.
(visibility_run): Pass COMPRESS_LDFLAG to visibility_test on
ELF targets.

8 years agoSkip gdb.base/branch-to-self.exp if gdb,nosignals exists
Yao Qi [Wed, 27 Apr 2016 15:11:53 +0000 (16:11 +0100)]
Skip gdb.base/branch-to-self.exp if gdb,nosignals exists

I get a timeout fail in branch-to-self.exp when it is compiled by a
bare-mental target running qemu, which doesn't have signal.

The test should be skipped if gdb,nosignals exists, and that is
what this patch does.

gdb/testsuite:

2016-04-27  Yao Qi  <yao.qi@linaro.org>

* gdb.base/branch-to-self.exp: Skip it if gdb,nosignals
exists.

8 years agoc_value_print: Revert 'val' to a reference for TYPE_CODE_STRUCT
Martin Galvan [Wed, 27 Apr 2016 15:01:14 +0000 (12:01 -0300)]
c_value_print: Revert 'val' to a reference for TYPE_CODE_STRUCT

Currently c_value_print will turn struct reference values into pointers before
doing a set of RTTI checks.  This was introduced as a fix to PR c++/15401.
If there's RTTI the pointer will be adjusted and converted back to a reference.
However, if there's no RTTI the value will still be treated as a pointer during
the remainder of the function.
This patch moves the conversion down so that it's always performed when needed.

Notice this currently has not user-visible effects, so can be seen as a small
code cleanup.  However, it'll be necessary for the bug-fix for handling
synthetic C++ references.  It causes no testsuite regressions.

gdb/ChangeLog:
2016-04-26  Martin Galvan  <martin.galvan@tallertechnologies.com>

* c-valprint.c (c_value_print): Always convert val back to reference
type if we converted it to a pointer type.

8 years agoTweak doc on command tfind
Yao Qi [Wed, 27 Apr 2016 14:01:20 +0000 (15:01 +0100)]
Tweak doc on command tfind

Hi,
command "tfind" will find the first trace snapshot if no trace
snapshot is selected, but this behavior isn't documented.

This patch completes the doc of command "tfind" without argument.

gdb/doc:

2016-04-27  Yao Qi  <yao.qi@linaro.org>

* gdb.texinfo (tfind): Complete doc about tfind without
argument.

8 years agoAvoid non-C++-enabled babeltrace versions
Andreas Arnez [Wed, 27 Apr 2016 13:52:16 +0000 (15:52 +0200)]
Avoid non-C++-enabled babeltrace versions

In some babeltrace versions before 1.2.0, the header file iterator.h
declares the enum values `BT_SEEK_*' within the struct declaration of
bt_iter_pos.  The enum values are supposed to be globally-scoped, which
works for C, but not for C++.  Later babeltrace versions declare the
enum outside the struct:

  https://lists.lttng.org/pipermail/lttng-dev/2013-September/021411.html

Now that GDB is compiled with C++, the GDB build fails on a system with
an affected babeltrace version: the compiler complains about a missing
declaration of BT_SEEK_BEGIN in ctf.c.

This patch enhances the configure check to recognize such babeltrace
versions as unusable for GDB.

gdb/ChangeLog:

* configure.ac: Enhance configure check for babeltrace to reject
non-C++-enabled versions.
* configure: Regenerate.

8 years agoPass --compress-debug-sections=none to ld
H.J. Lu [Wed, 27 Apr 2016 12:25:18 +0000 (05:25 -0700)]
Pass --compress-debug-sections=none to ld

Since ld may generate compressed debug sections by default, pass
--compress-debug-sections=none to ld to avoid compressed debug
sections.

* ld-elf/compressed1b.d: Pass --compress-debug-sections=none
to ld.
* ld-elf/compressed1c.d: Likewise.

8 years agoFix a typo in the check for SNANs in the RX simulator.
Nick Clifton [Wed, 27 Apr 2016 11:37:11 +0000 (12:37 +0100)]
Fix a typo in the check for SNANs in the RX simulator.

PR target/20000
* fpu.c (check_exceptions): Fix typo checking for signalling
NANs.