external/binutils.git
8 years agoUpdate release note for 2.25.51.0.3 users/hjl/linux/release/2.25.51.0.3
H.J. Lu [Mon, 6 Jul 2015 19:13:26 +0000 (12:13 -0700)]
Update release note for 2.25.51.0.3

8 years agoMerge remote-tracking branch 'origin/users/hjl/linux/master' into users/hjl/linux...
H.J. Lu [Mon, 6 Jul 2015 17:29:14 +0000 (10:29 -0700)]
Merge remote-tracking branch 'origin/users/hjl/linux/master' into users/hjl/linux/applied

8 years agoMerge remote-tracking branch 'origin/master' into users/hjl/linux/master
H.J. Lu [Tue, 30 Jun 2015 13:15:21 +0000 (06:15 -0700)]
Merge remote-tracking branch 'origin/master' into users/hjl/linux/master

8 years agoAdd support for SADDR addressing to the RL78 port.
Nick Clifton [Tue, 30 Jun 2015 10:25:18 +0000 (11:25 +0100)]
Add support for SADDR addressing to the RL78 port.

gas * config/rl78-parse.y: Tag all saddr expressions throughout.
(SET_SA): New.
(expr_is_saddr): Allow symbolic expressions.
* config/tc-rl78.c (md_apply_fix): Handle SADDR.

bfd * elf32-rl78.c (rl78_elf_howto_table): Add RH_SADDR.
        (rl78_reloc_map): Add R_RL78_RH_SADDR.
* reloc.c: Add BFD_RELOC_RL78_SADDR.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.

8 years agoHandle media instructions in arm software single step.
Yao Qi [Tue, 30 Jun 2015 08:24:43 +0000 (09:24 +0100)]
Handle media instructions in arm software single step.

This patch fixes PR 18605 which is about incorrectly decoding media
instructions in software single step.

gdb:

2015-06-30  Yao Qi  <yao.qi@linaro.org>

PR tdep/18605
* arm-tdep.c (arm_get_next_pc_raw): Break for media
instructions.

8 years agoTurn on dwarf2 unwinding for Renesas RX architecture
Kevin Buettner [Mon, 29 Jun 2015 15:08:12 +0000 (08:08 -0700)]
Turn on dwarf2 unwinding for Renesas RX architecture

This change turns on dwarf2 unwinding in rx-tdep.c.  I found it
necessary to add rx_dwarf_reg_to_regnum in order to cause PC to be
mapped correctly.

gdb/ChangeLog:

* rx-tdep.c (RX_PSW_REGNUM): New enum constant.
(rx_dwarf_reg_to_regnum): New function.
(rx_gdbarch_init): Register rx_dwarf_reg_to_regnum.  Use dwarf2
unwinding.

8 years agoPatch for gold internal error while fixing erratum 843419.
Han Shen [Tue, 16 Jun 2015 22:00:58 +0000 (15:00 -0700)]
Patch for gold internal error while fixing erratum 843419.

The crash reason is that the insn to be moved to stub may be a
relocation spot, so instead of placing the origin insn (that is insn
before-relocation) to the stub, I have to place the relocated one.
Note the relocation involved is non-pc-relative, so it is safe to move
the relocated insn.

gold/ChangeLog:
2015-06-29  Han Shen  <shenhan@google.com>

    * AArch64.cc (Erratum_stub::Insn_utilities): New typedef.
    (Erratum_stub::update_erratum_insn): New method.
    (Stub_table::relocate_stubs): Modified to place relocated insn.
    (AArch64_relobj::fix_errata): Modified gold_assert.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR threads/18127 - threads spawned by infcall end up stuck in "running" state
Pedro Alves [Mon, 29 Jun 2015 15:07:57 +0000 (16:07 +0100)]
PR threads/18127 - threads spawned by infcall end up stuck in "running" state

Refs:
 https://sourceware.org/ml/gdb/2015-03/msg00024.html
 https://sourceware.org/ml/gdb/2015-06/msg00005.html

On GNU/Linux, if an infcall spawns a thread, that thread ends up with
stuck running state.  This happens because:

 - when linux-nat.c detects a new thread, it marks them as running,
   and does not report anything to the core.

 - we skip finish_thread_state when the thread that is running the
   infcall stops.

As result, that new thread ends up with stuck "running" state, even
though it really is stopped.

On Windows, _all_ threads end up stuck in running state, not just the
one that was spawned.  That happens because when a new thread is
detected, unlike linux-nat.c, windows-nat.c reports
TARGET_WAITKIND_SPURIOUS to infrun.  It's the fact that that event
does not cause a user-visible stop that triggers the problem.  When
the target is re-resumed, we call set_running with a wildcard ptid,
which marks all thread as running.  That set_running is not suppressed
because the (leader) thread being resumed does not have in_infcall
set.  Later, when the infcall finally finishes successfully, nothing
marks all threads back to stopped.

We can trigger the same problem on all targets by having a thread
other than the one that is running the infcall report a breakpoint hit
to infrun, and then have that breakpoint not cause a stop.  That's
what the included test does.

The fix is to stop GDB from suppressing the set_running calls while
doing an infcall, and then set the threads back to stopped when the
call finishes, iff they were originally stopped before the infcall
started.  (Note the MI *running/*stopped event suppression isn't
affected.)

Tested on x86_64 GNU/Linux.

gdb/ChangeLog:
2015-06-29  Pedro Alves  <palves@redhat.com>

PR threads/18127
* infcall.c (run_inferior_call): On infcall success, if the thread
was marked stopped before, reset it back to stopped.
* infrun.c (resume): Don't suppress the set_running calls when
doing an infcall.
(normal_stop): Only discard the finish_thread_state cleanup if the
infcall succeeded.

gdb/testsuite/ChangeLog:
2015-06-29  Pedro Alves  <palves@redhat.com>

PR threads/18127
* gdb.threads/hand-call-new-thread.c: New file.
* gdb.threads/hand-call-new-thread.c: New file.

8 years agoFix email in ChangeLog entry.
Pierre Langlois [Mon, 29 Jun 2015 09:47:51 +0000 (10:47 +0100)]
Fix email in ChangeLog entry.

8 years ago[GDBServer][AArch64] Enable support for Z0 packets
Pierre Langlois [Mon, 29 Jun 2015 09:36:55 +0000 (10:36 +0100)]
[GDBServer][AArch64] Enable support for Z0 packets

This patch lets GDBServer handle software breakpoints instead of relying
on GDB.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_supports_z_point_type): Enable for
Z_PACKET_SW_BP.

8 years ago[GDBServer][AArch64] Use the same break instruction as GDB
Pierre Langlois [Mon, 29 Jun 2015 09:34:42 +0000 (10:34 +0100)]
[GDBServer][AArch64] Use the same break instruction as GDB

GDB uses a "brk #0" instruction to perform a software breakpoint while
GDBServer uses an illegal instruction.  Both instructions should match.

When enabling support for the 'Z0' packet, we let GDBServer insert the
breakpoint instruction instead of GDB.  And in case of permanent
breakpoints for example, GDB will check if a breakpoint is inserted in the
inferior with `program_breakpoint_here_p (gdbarch, address)', and
compare the instruction read from the inferior with the breakpoint
instruction.

On AArch64, instructions are always little endian so we need to
represent it as an array of bytes, as done in aarch64-tdep.c.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c: Remove comment about endianness.
(aarch64_breakpoint): Change type to gdb_byte[].  Set to "brk #0".
(aarch64_breakpoint_at): Change type of insn to gdb_byte[].  Use
memcmp.

8 years agoUpdate my email address
Pierre Langlois [Mon, 29 Jun 2015 09:23:48 +0000 (10:23 +0100)]
Update my email address

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Update my email address.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd support for ARM v6 instructions.
Nick Clifton [Sun, 28 Jun 2015 18:14:36 +0000 (19:14 +0100)]
Add support for ARM v6 instructions.

* Makefile.in (SIM_EXTRA_CFLAGS): Add -lm.
* armdefs.h (ARMdval, ARMfval): New types.
(ARM_VFP_reg): New union.
(struct ARMul_State): Add VFP_Reg and FPSCR fields.
(VFP_fval, VFP_uword, VFP_sword, VFP_dval, VFP_dword): Accessor
macros for the new VFP_Reg field.
* armemu.c (handle_v6_insn): Add code to handle MOVW, MOVT,
QADD16, QASX, QSAX, QSUB16, QADD8, QSUB8, UADD16, USUB16, UADD8,
USUB8, SEL, REV, REV16, RBIT, BFC, BFI, SBFX and UBFX
instructions.
(handle_VFP_move): New function.
(ARMul_Emulate16): Add checks for newly supported v6
instructions.  Add support for VMRS, VMOV and MRC instructions.
(Multiply64): Allow nRdHi == nRm and/or nRdLo == nRm when
operating in v6 mode.
* armemu.h (t_resolved): Define.
* armsupp.c: Include math.h.
(handle_VFP_xfer): New function.  Handles VMOV, VSTM, VSTR, VPUSH,
VSTM, VLDM and VPOP instructions.
(ARMul_LDC): Test for co-processor 10 or 11 and pass call to the
new handle_VFP_xfer function.
(ARMul_STC): Likewise.
(handle_VFP_op): New function.  Handles VMLA, VMLS, VNMLA, VNMLS,
VNMUL, VMUL, VADD, VSUB, VDIV, VMOV, VABS, VNEG, VSQRT, VCMP,
VCMPE and VCVT instructions.
(ARMul_CDP): Test for co-processor 10 or 11 and pass call to the
new handle_VFP_op function.
* thumbemu.c (tBIT, tBITS, ntBIT, ntBITS): New macros.
(test_cond): New function.  Tests a condition and returns non-zero
if the condition has been met.
(handle_IT_block): New function.
(in_IT_block): New function.
(IT_block_allow): New function.
(ThumbExpandImm): New function.
(handle_T2_insn): New function.  Handles T2 thumb instructions.
(handle_v6_thumb_insn): Add next_instr and pc parameters.
(ARMul_ThumbDecode): Add support for IT blocks.  Add support for
v6 instructions.
* wrapper.c (sim_create_inferior): Detect a thumb address and call
SETT appropriately.

8 years agoUpdate binutils-pr18322.patch
H.J. Lu [Sun, 28 Jun 2015 13:55:04 +0000 (06:55 -0700)]
Update binutils-pr18322.patch

8 years agoUpdate binutils-pr18321.patch
H.J. Lu [Sun, 28 Jun 2015 13:54:42 +0000 (06:54 -0700)]
Update binutils-pr18321.patch

8 years agoRemove binutils-pr18451.patch
H.J. Lu [Sun, 28 Jun 2015 13:53:17 +0000 (06:53 -0700)]
Remove binutils-pr18451.patch

It has been applied to master branch.

8 years agoMerge remote-tracking branch 'origin/master' into users/hjl/linux/master
H.J. Lu [Sun, 28 Jun 2015 13:42:37 +0000 (06:42 -0700)]
Merge remote-tracking branch 'origin/master' into users/hjl/linux/master

8 years agoRemove COMPRESS_DEBUG_ZLIB
H.J. Lu [Sun, 28 Jun 2015 13:30:10 +0000 (06:30 -0700)]
Remove COMPRESS_DEBUG_ZLIB

COMPRESS_DEBUG_ZLIB isn't needed.  This patch removes COMPRESS_DEBUG_ZLIB
and replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.

bfd/

* bfd-in.h (compressed_debug_section_type): Remove
COMPRESS_DEBUG_ZLIB.
* bfd-in2.h : Regenerated.
gas/

* as.c (parse_args): Replace COMPRESS_DEBUG_ZLIB with
COMPRESS_DEBUG_GNU_ZLIB.
* config/tc-i386.c (flag_compress_debug): Likewise.

ld/

* emultempl/elf32.em  (gld${EMULATION_NAME}_handle_option):
Replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoUpdate ia64 gas tests
H.J. Lu [Sat, 27 Jun 2015 23:43:43 +0000 (16:43 -0700)]
Update ia64 gas tests

* gas/ia64/psn.d: Updated.
* gas/ia64/xdata-ilp32.d: Likewise.

8 years agoUpdate xtensa linker tests
H.J. Lu [Sat, 27 Jun 2015 23:24:50 +0000 (16:24 -0700)]
Update xtensa linker tests

* ld-xtensa/tlsbin.rd: Updated.
* ld-xtensa/tlspic.rd: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR 16253 revisited
Keith Seitz [Fri, 26 Jun 2015 17:27:45 +0000 (10:27 -0700)]
PR 16253 revisited

Last year a patch was submitted/approved/commited to eliminate
symbol_matches_domain which was causing this problem.  It was later reverted
because it introduced a (severe) performance regression.

Recap:

(gdb) list
1 enum e {A,B,C} e;
2 int main (void) { return 0; }
3
(gdb) p e
Attempt to use a type name as an expression

The parser attempts to find a symbol named "e" of VAR_DOMAIN.
This gets passed down through lookup_symbol and (eventually) into
block_lookup_symbol_primary, which iterates over the block's dictionary
of symbols:

  for (sym = dict_iter_name_first (block->dict, name, &dict_iter);
       sym != NULL;
       sym = dict_iter_name_next (name, &dict_iter))
    {
      if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
                                 SYMBOL_DOMAIN (sym), domain))
        return sym;
    }

The problem here is that we have a symbol named "e" in both STRUCT_DOMAIN
and VAR_DOMAIN, and for languages like C++, Java, and Ada, where a tag name
may be used as an implicit typedef of the type, symbol_matches_domain ignores
the difference between VAR_DOMAIN and STRUCT_DOMAIN.  As it happens, the
STRUCT_DOMAIN symbol is found first, considered a match, and that symbol is
returned to the parser, eliciting the (now dreaded) error message.

Since this bug exists specifically because we have both STRUCT and VAR_DOMAIN
symbols in a given block/CU, this patch rather simply/naively changes
block_lookup_symbol_primary so that it continues to search for an exact
domain match on the symbol if symbol_matches_domain returns a symbol
which does not exactly match the requested domain.

This "fixes" the immediate problem, but admittedly might uncover other,
related bugs.  [Paranoia?] However, it causes no regressions (functional
or performance) in the test suite.  A similar change has been made
to block_lookup_symbol for other cases in which this bug might appear.

The tests from the previous submission have been resurrected and updated.
However since we can still be given a matching symbol with a different domain
than requested, we cannot say that a symbol "was not found."  The error
messages today will still be the (dreaded) "Attempt to use a type name..."

ChangeLog

PR 16253
* block.c (block_lookup_symbol): For non-function blocks,
continue to search for a symbol with an exact domain match
Otherwise, return any previously found "best domain" symbol.
(block_lookup_symbol_primary): Likewise.

testsuite/ChangeLog

PR 16253
* gdb.cp/var-tag-2.cc: New file.
* gdb.cp/var-tag-3.cc: New file.
* gdb.cp/var-tag-4.cc: New file.
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.

8 years agoAdd option to remove duplicate command history entries
Patrick Palka [Wed, 3 Jun 2015 02:49:15 +0000 (22:49 -0400)]
Add option to remove duplicate command history entries

This patch implements the new option "history remove-duplicates", which
controls the removal of duplicate history entries ("off" by default).

The motivation for this option is to be able to reduce the prevalence of
basic commands such as "up" and "down" in the history file.  These
common commands crowd out more unique commands in the history file (when
the history file has a fixed size), and they make navigation of the
history file via ^P, ^N and ^R more inconvenient.

The option takes an integer denoting the number of history entries to
look back at for a history entry that is a duplicate of the latest one.
"history remove-duplicates 1" is equivalent to bash's ignoredups option,
and "history remove-duplicates unlimited" is equivalent to bash's
erasedups option.

[ I decided to go with this integer approach instead of a tri-state enum
  because it's slightly more flexible and seemingly more intuitive than
  leave/erase/ignore.  ]

gdb/ChangeLog:

* NEWS: Mention the new option "history remove-duplicates".
* top.c (history_remove_duplicates): New static variable.
(show_history_remove_duplicates): New static function.
(gdb_add_history): Conditionally remove duplicate history
entries.
(init_main): Add "history remove-duplicates" option.

gdb/doc/ChangeLog:

* gdb.texinfo (Command History): Document the new option
"history remove-duplicates".

gdb/testsuite/ChangeLog:

* gdb.base/history-duplicates.exp: New test.

8 years agoAdd tab completion for TUI's "focus" command
Patrick Palka [Mon, 22 Jun 2015 02:54:10 +0000 (22:54 -0400)]
Add tab completion for TUI's "focus" command

The implementation is pretty straightforward, with the only caveat being
that the "src", "cmd", "next" and "prev" entries get delibrately added
to the completion list even when the TUI has not yet been initialized
(i.e. has never been enabled during the session), since invoking the
"focus" command with these arguments already works when the TUI has not
yet been initialized.

gdb/ChangeLog:

* tui/tui-win.c (focus_completer): New static function.
(_initialize_tui_win): Set the completion function of the
"focus" command to focus_completer.

gdb/testsuite/ChangeLog:

* gdb.base/completion.exp: Test the completion of the "focus"
command.

8 years agoDo not skip prologue for asm (.S) files
Jan Kratochvil [Fri, 26 Jun 2015 13:11:14 +0000 (15:11 +0200)]
Do not skip prologue for asm (.S) files

GDB tries to skip prologue for .S files according to .debug_line but it then
places the breakpoint to a location where it is never hit.

This is because #defines in .S files cause prologue skipping which is
completely inappropriate, for s390x:

glibc/sysdeps/unix/syscall-template.S
78:/* This is a "normal" system call stub: if there is an error,
79:   it returns -1 and sets errno.  */
80:
81:T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
82:     ret

00000000000f4210 T __select
 Line Number Statements:
  Extended opcode 2: set Address to 0xf41c8
  Advance Line by 80 to 81
  Copy
  Advance PC by 102 to 0xf422e
  Special opcode 6: advance Address by 0 to 0xf422e and Line by 1 to 82
  Special opcode 34: advance Address by 2 to 0xf4230 and Line by 1 to 83
  Advance PC by 38 to 0xf4256
  Extended opcode 1: End of Sequence
  Compilation Unit @ offset 0x28b3e0:
 <0><28b3eb>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <28b3ec>   DW_AT_stmt_list   : 0x7b439
    <28b3f0>   DW_AT_low_pc  : 0xf41c8
    <28b3f8>   DW_AT_high_pc     : 0xf4256
    <28b400>   DW_AT_name        : ../sysdeps/unix/syscall-template.S
    <28b423>   DW_AT_comp_dir    : /usr/src/debug////////glibc-2.17-c758a686/misc
    <28b452>   DW_AT_producer    : GNU AS 2.23.52.0.1
    <28b465>   DW_AT_language    : 32769        (MIPS assembler)

without debuginfo or with debuginfo and the fix - correct address:
(gdb) b select
Breakpoint 1 at 0xf4210

It is also where .dynsym+.symtab point to:
00000000000f4210 T __select
00000000000f4210 W select

with debuginfo, without the fix:
(gdb) b select
Breakpoint 1 at 0xf41c8: file ../sysdeps/unix/syscall-template.S, line 81.

One part is to behave for asm files similar way like for 'locations_valid':
  /* Symtab has been compiled with both optimizations and debug info so that
     GDB may stop skipping prologues as variables locations are valid already
     at function entry points.  */
  unsigned int locations_valid : 1;

The other part is to extend the 'locations_valid'-like functionality more.

Both minsym_found and find_function_start_sal need to be patched, otherwise
their addresses do not match and GDB regresses on ppc64:

gdb/ChangeLog
2015-06-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

* linespec.c (minsym_found): Reset sal.PC for COMPUNIT_LOCATIONS_VALID
and language_asm..
* symtab.c (find_function_start_sal): Likewise.

gdb/testsuite/ChangeLog
2015-06-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/amd64-prologue-skip.S: New file.
* gdb.arch/amd64-prologue-skip.exp: New file.

8 years agoCompile-in IAMCU linker scripts
H.J. Lu [Fri, 26 Jun 2015 12:39:45 +0000 (05:39 -0700)]
Compile-in IAMCU linker scripts

* emulparams/elf_iamcu.sh (COMPILE_IN): New.

8 years agoAdd support for DT_MIPS_RLD_MAP_REL.
Matthew Fortune [Thu, 11 Jun 2015 09:16:19 +0000 (10:16 +0100)]
Add support for DT_MIPS_RLD_MAP_REL.

This tag makes it possible to access the debug map when debugging position
independent executables.

bfd/

* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable
instead of !shared to indicate an application vs shared library.
(_bfd_mips_elf_size_dynamic_sections): Likewise.
(_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL.
(_bfd_mips_elf_get_target_dtag): Likewise.

binutils/

* readelf.c (get_mips_dynamic_type): Handle DT_MIPS_RLD_MAP_REL.

include/

* elf/mips.h (DT_MIPS_RLD_MAP_REL): New macro.

ld/testsuite/

* ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag.
* ld-mips-elf/pic-and-nonpic-4b.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-5b.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise.
* ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise.
* ld-mips-elf/tlsdyn-o32-1.d: Likewise.
* ld-mips-elf/tlsdyn-o32-1.got: Likewise.
* ld-mips-elf/tlsdyn-o32-2.d: Likewise.
* ld-mips-elf/tlsdyn-o32-2.got: Likewise.
* ld-mips-elf/tlsdyn-o32-3.d: Likewise.
* ld-mips-elf/tlsdyn-o32-3.got: Likewise.
* ld-mips-elf/tlsdyn-o32.d: Likewise.
* ld-mips-elf/tlsdyn-o32.got: Likewise.
* ld-mips-elf/pie-n32.d: New file.
* ld-mips-elf/pie-n64.d: Likewise.
* ld-mips-elf/pie-o32.d: Likewise.
* ld-mips-elf/pie.s: Likewise.
* ld-mips-elf/mips-elf.exp: Add new tests.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix REL handling for MSP430
DJ Delorie [Thu, 25 Jun 2015 21:20:15 +0000 (17:20 -0400)]
Fix REL handling for MSP430

* elf32-msp430.c (msp430_final_link_relocate): Fix comments.  Fix
REL loads to match RELA stores.

8 years agoDon't set sh_size for .shstrtab twice
H.J. Lu [Thu, 25 Jun 2015 19:12:43 +0000 (12:12 -0700)]
Don't set sh_size for .shstrtab twice

_bfd_elf_assign_file_positions_for_non_load will set the sh_size
field for .shstrtab section.  There is need to initialize it in
_bfd_elf_compute_section_file_positions.

* elf.c (_bfd_elf_compute_section_file_positions): Don't
initialize sh_size for .shstrtab here.

8 years agopy-prettyprint.exp: Add is_address_zero_readable check
Simon Marchi [Thu, 25 Jun 2015 17:33:14 +0000 (13:33 -0400)]
py-prettyprint.exp: Add is_address_zero_readable check

gdb/testsuite/ChangeLog:

* gdb.python/py-prettyprint.exp (run_lang_tests): Add
is_address_zero_readable check.

8 years agoRun ld-elf/strtab only on linux/gnu targets
H.J. Lu [Thu, 25 Jun 2015 17:14:13 +0000 (10:14 -0700)]
Run ld-elf/strtab only on linux/gnu targets

Since not all ELF targets support -shared, we limit ld-elf/strtab to
linux and gnu targets.

* ld-elf/strtab.d: Only run on *-*-linux* and *-*-gnu* targets.

8 years agoUpdate .strtab section sizes in mmix tests
H.J. Lu [Thu, 25 Jun 2015 17:05:10 +0000 (10:05 -0700)]
Update .strtab section sizes in mmix tests

Since commit ef10c3ace00674e8c3599c3bf95f06c87d68898b may reduce .strtab
section size, we need to adjust expected .strtab section sizes in mmix
tests.

gas/testsuite/

* gas/mmix/loc-3.d: Updated.
* gas/mmix/loc-5.d: Likewise.

ld/testsuite/

* ld-mmix/bspec1.d: Updated.
* ld-mmix/bspec2.d: Likewise.
* ld-mmix/undef-3.d: Likewise.

8 years agoUse strtab with GC and suffix merging for .strtab
H.J. Lu [Thu, 25 Jun 2015 15:16:00 +0000 (08:16 -0700)]
Use strtab with GC and suffix merging for .strtab

This patch uses ELF strtab with GC and suffix merging support to create
ELF .strtab section.  There is some small memory overhead to use ELF
strtab:

==14928== HEAP SUMMARY:
==14928==     in use at exit: 3,276,318 bytes in 679 blocks
==14928==   total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated

vs.

==14936== HEAP SUMMARY:
==14936==     in use at exit: 3,276,318 bytes in 679 blocks
==14936==   total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated

when running:

./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o

The results are

  [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1

vs

  [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1

It reduces the .strtab size by 350 bytes, about 2%

Saving on libc.so from glibc is much more since libc.so has many alias
symbols with the same suffix.  For x32 glibc,

 [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1

vs

 [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1

It reduces the .strtab size by 17547 bytes, about 16%.

bfd/

PR gas/18451
* elf-bfd.h (elf_sym_strtab): New.
(elf_link_hash_table): Add strtabcount, strtabsize and
strtab.
(_bfd_elf_stringtab_init): Removed.
* elf.c (_bfd_elf_stringtab_init): Removed.
(_bfd_elf_compute_section_file_positions): Replace
bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/
_bfd_stringtab_size with
elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/
_bfd_elf_strtab_size.  Use _bfd_elf_strtab_add,
_bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get
st_name.
(swap_out_syms): Likewise.
* elflink.c (elf_final_link_info): Replace bfd_strtab_hash
with elf_strtab_hash.  Remove symbuf, symbuf_count,
symbuf_size and shndxbuf_size.
(elf_link_flush_output_syms): Removed.
(elf_link_output_sym): Renamed to ...
(elf_link_output_symstrtab): This.  Replace _bfd_stringtab_add
with _bfd_elf_strtab_add.  Don't flush symbols to the file nor
swap out symbols.
(elf_link_swap_symbols_out): New.
(elf_link_output_extsym): Replace elf_link_output_sym with
elf_link_output_symstrtab.
(elf_link_input_bfd): Likewise.
(elf_final_link_free): Replace _bfd_stringtab_free with
_bfd_elf_strtab_free.  Remove symbuf.
(bfd_elf_final_link): Replace _bfd_elf_stringtab_init with
_bfd_elf_strtab_init.  Don't set symbuf, symbuf_count,
symbuf_size nor shndxbuf_size.  Initialize strtabsize and
strtab.  Initialize symshndxbuf to -1 when number of sections
>= 64K.  Replace elf_link_output_sym/elf_link_output_sym with
elf_link_output_symstrtab/elf_link_output_symstrtab. Don't
call elf_link_flush_output_syms.  Call _bfd_elf_strtab_finalize
and elf_link_swap_symbols_out.  Replace _bfd_stringtab_size
and _bfd_stringtab_emit with _bfd_elf_strtab_size and
_bfd_elf_strtab_emit.

gas/testsuite/

PR gas/18451
* gas/elf/elf.exp: Run strtab.
* gas/elf/strtab.d: New file.
* gas/elf/strtab.s: Likewise.

ld/testsuite/

PR gas/18451
* ld-elf/strtab.d: New file.
* ld-elf/strtab.s: Likewise.

8 years agoCorrectly notice empty sysroots in solib_find_1
Gary Benson [Thu, 25 Jun 2015 08:54:12 +0000 (09:54 +0100)]
Correctly notice empty sysroots in solib_find_1

Some parts of solib_find_1 should only operate if the sysroot
is nonempty after processing, but the logic that checked this
happened before trailing slashes were stripped so empty but
non-NULL sysroots were possible.  This commit moves the logic
so it correctly notices all empty sysroots.

gdb/ChangeLog:

* solib.c (solib_find_1): Set local variable sysroot to NULL if
it is the empty string after trailing slashes have been stripped.

8 years agoRemove gdb_sysroot NULL checks
Gary Benson [Wed, 24 Jun 2015 15:06:49 +0000 (16:06 +0100)]
Remove gdb_sysroot NULL checks

Since fed040c6a50399617d8265cbddc7fd21b3f134ef gdb_sysroot is
never NULL.  This commit removes all gdb_sysroot NULL checks.

gdb/ChangeLog:

* exec.c (exec_file_locate_attach): Remove gdb_sysroot NULL check.
* infrun.c (follow_exec): Likewise.
* remote.c (remote_filesystem_is_local): Likewise.
* solib.c (solib_find_1): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Jun 2015 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoMerge remote-tracking branch 'origin/master' into users/hjl/linux/master
H.J. Lu [Wed, 24 Jun 2015 21:13:05 +0000 (14:13 -0700)]
Merge remote-tracking branch 'origin/master' into users/hjl/linux/master

8 years agoRemove the extra @section .cfi_lsda
H.J. Lu [Wed, 24 Jun 2015 22:27:44 +0000 (15:27 -0700)]
Remove the extra @section .cfi_lsda

Commit 2f0c68f23bb3132cd5ac466ca8775c0d9e4960cd added an extra @section
.cfi_lsda:

 @subsection @code{.cfi_lsda @var{encoding} [, @var{exp}]}
+@section @code{.cfi_lsda @var{encoding} [, @var{exp}]}
 @code{.cfi_lsda} defines LSDA and its encoding.

It shouldn't be there.

* doc/as.texinfo (.cfi_lsda): Remove the extra @section.

8 years agoSilence older GCC warning
H.J. Lu [Wed, 24 Jun 2015 21:12:15 +0000 (14:12 -0700)]
Silence older GCC warning

* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
GCC warning.

8 years agoSilence older GCC warning
H.J. Lu [Wed, 24 Jun 2015 21:12:15 +0000 (14:12 -0700)]
Silence older GCC warning

* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
GCC warning.

8 years agoFix lrealpath memory leak in build_id_to_debug_bfd
Keith Seitz [Thu, 4 Jun 2015 17:13:50 +0000 (10:13 -0700)]
Fix lrealpath memory leak in build_id_to_debug_bfd

Valgrind reports memory leaking from build_id_to_debug_bfd:
==7261== 88 bytes in 2 blocks are definitely lost in loss record 31,319 of 35,132
==7261==    at 0x4A06BCF: malloc (vg_replace_malloc.c:296)
==7261==    by 0x32CA88A9B9: strdup (strdup.c:42)
==7261==    by 0xFE62AB: lrealpath (lrealpath.c:88)
==7261==    by 0x7F7AD6: build_id_to_debug_bfd (build-id.c:116)
==7261==    by 0x7F7BB5: find_separate_debug_file_by_buildid (build-id.c:149)
==7261==    by 0x6D9382: elf_symfile_read (elfread.c:1348)
==7261==    by 0x777F02: read_symbols (symfile.c:875)
==7261==    by 0x778505: syms_from_objfile_1 (symfile.c:1078)
==7261==    by 0x778548: syms_from_objfile (symfile.c:1094)
==7261==    by 0x778746: symbol_file_add_with_addrs (symfile.c:1191)
==7261==    by 0x77893B: symbol_file_add_from_bfd (symfile.c:1280)
==7261==    by 0x8E51E3: solib_read_symbols (solib.c:706)
==7261==    by 0x8E58AF: solib_add (solib.c:1029)

This occurs because commit 1be5090b in bfd, addressing PR 11983, started
taking a copy of the input filename instead of directly caching it.  It
appears that this code was never updated to reflect that API change.

This simple patch creates a cleanup to free the return value for lrealpath.

gdb/ChangeLog

* build-id.c (build_id_to_debug_bfd): Add cleanup to free
return value from lrealpath.

8 years agoUpdate binutils-pr18322.patch against master
H.J. Lu [Wed, 24 Jun 2015 21:05:55 +0000 (14:05 -0700)]
Update binutils-pr18322.patch against master

8 years agoMerge remote-tracking branch 'origin/master' into users/hjl/linux/master
H.J. Lu [Wed, 24 Jun 2015 20:51:43 +0000 (13:51 -0700)]
Merge remote-tracking branch 'origin/master' into users/hjl/linux/master

8 years agoKeep .plt section and DT_PLTGOT for prelink
H.J. Lu [Wed, 24 Jun 2015 20:37:05 +0000 (13:37 -0700)]
Keep .plt section and DT_PLTGOT for prelink

Since the .plt section and DT_PLTGOT are used by prelink to undo
prelinking for dynamic relocations, we must keep them even if there is
no PLT relocation.  This patch reverted commit a3747075a.

bfd/

* elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate
space for the first .plt entry.
(elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt
section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
there are PLT relocations.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Always
allocate space for the first .plt entry.
(elf_x86_64_size_dynamic_sections): Always add DT_PLTGOT for
.plt section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
there are PLT relocations.

ld/testsuite/

* ld-i386/i386.exp: Run pltgot-2 for Linux targets.
* ld-x86-64/x86-64.exp: Likewise.
* ld-i386/pltgot-1.d: Updated.
* ld-x86-64/pltgot-1.d: Likewise.
* ld-i386/pltgot-2.d: New file.
* ld-x86-64/pltgot-2.d: Likewise.

8 years agoSync libiberty from GCC, replaying updates to configure scripts
Iain Buclaw [Wed, 24 Jun 2015 19:43:02 +0000 (21:43 +0200)]
Sync libiberty from GCC, replaying updates to configure scripts

8 years agoDon't convert R_X86_64_GOTPCREL if it will overflow
H.J. Lu [Wed, 24 Jun 2015 17:13:55 +0000 (10:13 -0700)]
Don't convert R_X86_64_GOTPCREL if it will overflow

When converting "mov foo@GOTPCREL(%rip), %reg" to "lea foo(%rip), %reg"
with R_X86_64_PC32 relocation, it may overflow if the target section
is more than 2GB away.  This patch estimates distance between mov
instruction and the target section.  We convert R_X86_64_GOTPCREL to
R_X86_64_PC32 only if their distance is less than 2GB.

PR ld/18591
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Don't convert
R_X86_64_GOTPCREL to R_X86_64_PC32 if it will cause relocation
overflow.

8 years agosim: trace: drop unused trace_one_insn
Mike Frysinger [Wed, 24 Jun 2015 15:09:07 +0000 (22:09 +0700)]
sim: trace: drop unused trace_one_insn

Everyone has migrated to the split functions (trace_prefix + trace_generic)
a while ago, so we can drop this one now.

8 years agosim: trace: rename debug_printf fully
Mike Frysinger [Wed, 24 Jun 2015 14:59:26 +0000 (21:59 +0700)]
sim: trace: rename debug_printf fully

Rather than redirect using a define, just rename the symbol fully.

8 years agosim: trace: add a basic cpu register class
Mike Frysinger [Wed, 24 Jun 2015 13:52:21 +0000 (19:37 +0545)]
sim: trace: add a basic cpu register class

The bfin/msp430 ports already had trace logic set up for reading/writing
cpu registers, albeit using different unrelated levels (core & vpu).  Add
a proper register class for these and for other ports.

8 years agosim: trace: add set of system helpers
Mike Frysinger [Tue, 23 Jun 2015 19:15:16 +0000 (01:00 +0545)]
sim: trace: add set of system helpers

Some code paths trace on a system instance and not a cpu instance (like
the events code), so add some helpers for those cases.

8 years agogdb: sim: merge the sysroot update logic together
Mike Frysinger [Wed, 24 Jun 2015 14:23:12 +0000 (21:23 +0700)]
gdb: sim: merge the sysroot update logic together

Initialize the local sysroot fully before we start using it.
This keeps it all a bit simpler.

8 years agosim: trace: document alu/fpu/vpu trace options better
Mike Frysinger [Wed, 24 Jun 2015 13:21:38 +0000 (19:06 +0545)]
sim: trace: document alu/fpu/vpu trace options better

Make the acronyms clear for people.

8 years agoAdd missing ChangeLog entries for yesterday's commmit below.
Peter Bergner [Wed, 24 Jun 2015 14:15:29 +0000 (09:15 -0500)]
Add missing ChangeLog entries for yesterday's commmit below.

gdb/testsuite/
* gdb.arch/powerpc-power.exp <rfebb>: Fixup test results.
* gdb.arch/powerpc-power.s <rfebb>: Likewise.

8 years agogdb: sim: handle target sysroot prefix
Mike Frysinger [Tue, 23 Jun 2015 15:29:39 +0000 (11:29 -0400)]
gdb: sim: handle target sysroot prefix

The default gdb sysroot now sets itself to "target:".  This works for
most remote targets, but when using the simulator, this causes problems
as the sim will attempt to search for that path.

Update the remote-sim logic to skip this leading prefix when it is found
so that the sysroot isn't passed in as an invalid value.

8 years agoCall set_gdbarch_get_siginfo_type in linux_init_abi
Yao Qi [Wed, 24 Jun 2015 13:53:03 +0000 (14:53 +0100)]
Call set_gdbarch_get_siginfo_type in linux_init_abi

linux_get_siginfo_type is installed to many linux gdbarch.  This patch
is to move this to a common area linux-tdep.c:linux_init_abi, so that
linux_get_siginfo_type is installed to every linux gdbarch.  If some
linux gdbarch needs its own version, please override it in
$ARCH_linux_init_abi.  In the testsuite, we enable siginfo related
tests for all linux targets.

gdb:

2015-06-24  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't call
set_gdbarch_get_siginfo_type.
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Likewise.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
* m68klinux-tdep.c (m68k_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* tilegx-linux-tdep.c (tilegx_linux_init_abi): Likewise.
* linux-tdep.c (linux_get_siginfo_type): Change it to static.
(linux_init_abi): Call set_gdbarch_get_siginfo_type.
* linux-tdep.h (linux_get_siginfo_type): Remove the declaration.

gdb/testsuite:

2015-06-24  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (supports_get_siginfo_type): Return 1 for all
linux targets.

8 years agoNew proc supports_get_siginfo_type
Yao Qi [Wed, 24 Jun 2015 13:53:03 +0000 (14:53 +0100)]
New proc supports_get_siginfo_type

Both siginfo-obj.exp and siginfo-thread.exp have the same code
checking the support of geting a type of siginfo for a given arch.
This patch is to move these code into a proc supports_get_siginfo_type.

gdb/testsuite:

2015-06-24  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (supports_get_siginfo_type): New proc.
* gdb.base/siginfo-obj.exp: Invoke supports_get_siginfo_type.
* gdb.base/siginfo-thread.exp: Likewise.

8 years agoRemove redundant include directives.
Gary Benson [Wed, 24 Jun 2015 10:59:03 +0000 (11:59 +0100)]
Remove redundant include directives.

stdint.h was added to common-defs.h some months ago and should
no longer be included directly by any file.

gdb_assert.h was added to common-defs.h nearly a year ago, but
three includes have crept in since then.

This commit removes all such redundant include directives.

gdb/ChangeLog:

* common/buffer.c (stdint.h): Do not include.
* common/print-utils.c (stdint.h): Likewise.
* compile/compile-c-symbols.c (gdb_assert.h): Likewise.
* compile/compile-c-types.c (gdb_assert.h): Likewise.
* ft32-tdep.c (gdb_assert.h): Likewise.
* guile/scm-utils.c (stdint.h): Likewise.
* i386-linux-tdep.c (stdint.h): Likewise.
* i386-tdep.c (stdint.h): Likewise.
* nat/linux-btrace.c (stdint.h): Likewise.
* nat/linux-btrace.h (stdint.h): Likewise.
* nat/linux-ptrace.c (stdint.h): Likewise.
* nat/mips-linux-watch.h (stdint.h): Likewise.
* ppc-linux-nat.c (stdint.h): Likewise.
* python/python-internal.h (stdint.h): Likewise.
* stub-termcap.c (stdlib.h): Likewise.
* target/target.h (stdint.h): Likewise.
* xtensa-linux-nat.c (stdint.h): Likewise.

gdb/gdbserver/ChangeLog:

* linux-i386-ipa.c (stdint.h): Do not include.
* lynx-i386-low.c (stdint.h): Likewise.
* lynx-ppc-low.c (stdint.h): Likewise.
* mem-break.c (stdint.h): Likewise.
* thread-db.c (stdint.h): Likewise.
* tracepoint.c (stdint.h): Likewise.
* win32-low.c (stdint.h): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix GDBHISTSIZE test failure on i686
Patrick Palka [Tue, 23 Jun 2015 14:01:38 +0000 (10:01 -0400)]
Fix GDBHISTSIZE test failure on i686

The test

  test_histsize_history_setting "99999999999999999999999999999999999" "unlimited"

was failing on i686 because the condition in init_history() for
determining whether to map a large GDBHISTSIZE value to infinity was

  long var = strtol (tmpenv);
  if (var > INT_MAX)
    history_size = unlimited;

but this condition is never true on i686 because INT_MAX == LONG_MAX.
So in order to properly map large out-of-range values of GDBHISTSIZE to
infinity on targets where LONG_MAX > INT_MAX as well as on i686, we have
to instead change the above condition to

  if (var > INT_MAX
      || (var == INT_MAX && errno == ERANGE))
    history_size = unlimited;

gdb/ChangeLog:

* top.c (init_history): Look at errno after calling strtol to
properly map large GDBHISTSIZE values to infinity.

8 years agosim: common: replace SIM_FILTER_PATH with lbasename
Mike Frysinger [Tue, 23 Jun 2015 18:51:06 +0000 (00:36 +0545)]
sim: common: replace SIM_FILTER_PATH with lbasename

This helper macro has largely the same behavior as libiberty's lbasename.
There is a slight nuance related to colons, but it's not clear what the
point of that is, and the code implies that it just wants the basename.

8 years agosim: use AS_HELP_STRING everywhere
Mike Frysinger [Tue, 23 Jun 2015 17:58:48 +0000 (23:43 +0545)]
sim: use AS_HELP_STRING everywhere

This helps standardize the configure --help output.

8 years agoinferior.h (struct inferior_suspend_state): Delete, unused.
Doug Evans [Tue, 23 Jun 2015 18:36:49 +0000 (11:36 -0700)]
inferior.h (struct inferior_suspend_state): Delete, unused.

gdb/ChangeLog:

* inferior.h (struct inferior_suspend_state): Delete, unused.
All references deleted.

8 years agoFix rfebb gdb test cases.
Peter Bergner [Tue, 23 Jun 2015 18:33:05 +0000 (13:33 -0500)]
Fix rfebb gdb test cases.

The following patch fixed the assembly / disassembly of the rfebb instruction:

    https://sourceware.org/ml/binutils/2015-06/msg00190.html

This patch updates the gdb testsuite to match the new disassembly behavior.

gdb/testsuite/
* gdb.arch/powerpc-power.exp <rfebb>: Fixup test results.
* gdb.arch/powerpc-power.s <rfebb>: Likewise.

8 years agosim: trace: do not enable internal debug by default
Mike Frysinger [Tue, 23 Jun 2015 17:57:29 +0000 (23:42 +0545)]
sim: trace: do not enable internal debug by default

Since --trace-debug is for people hacking on the sim sources rather than
people just using the sim, default it to off.  This matches the behavior
of other debug knobs we have.

8 years agosim: assume recentish compiler/systems
Mike Frysinger [Tue, 23 Jun 2015 17:54:52 +0000 (23:39 +0545)]
sim: assume recentish compiler/systems

Assume the build system supports stdint.h/stdarg.h as those have been
around long enough and we don't care about pre-stdc compilers anymore.

8 years agogdb: microblaze: delete useless stubs
Mike Frysinger [Sun, 21 Jun 2015 18:13:03 +0000 (14:13 -0400)]
gdb: microblaze: delete useless stubs

These don't accomplish anything the common core doesn't already, so
punt them as they purely waste code.

8 years agoConvert have_ptrace_getregset to a tri-state boolean
Yao Qi [Tue, 23 Jun 2015 13:03:11 +0000 (14:03 +0100)]
Convert have_ptrace_getregset to a tri-state boolean

have_ptrace_getregset is a tri-state variable (-1, 0, 1), and we have
some conditions like "if (have_ptrace_getregset)", which is not correct.
I'll explain why it is not correct in the following example.  This fix
to this problem to replace the test (have_ptrace_getregset) to test
(have_ptrace_getregset == 1) or (have_ptrace_getregset == -1) etc.
However Doug thinks it hinders readability
https://sourceware.org/ml/gdb-patches/2015-05/msg00692.html so I decide
to add a new enum tribool and change have_ptrace_getregset to it, in
order to make these tests more readable.

have_ptrace_getregset is initialised to -1, and is adjusted to 0 or 1 in
$ARCH_linux_read_description according to the capability of the kernel.
However, it is possible that have_ptrace_getregset is used before it is
set to 0 or 1, which means it is still -1.  This is shown below.

(gdb) run
Starting program: gdb/testsuite/gdb.base/break

Breakpoint 2, amd64_linux_fetch_inferior_registers (ops=0xceaa80, regcache=0xe72000, regnum=16) at git/gdb/amd64-linux-nat.c:128
128 {
top?p have_ptrace_getregset
$1 = TRIBOOL_UNKNOWN
top?c
Continuing.

Breakpoint 2, amd64_linux_fetch_inferior_registers (ops=0xceaa80, regcache=0xe72000, regnum=16) at git/gdb/amd64-linux-nat.c:128
128 {
top?c
Continuing.

Breakpoint 1, x86_linux_read_description (ops=0xceaa80) at git/gdb/x86-linux-nat.c:117
117 {

PTRACE_GETREGSET command is used even GDB doesn't know whether
PTRACE_GETREGSET is supported or not.  It is wrong, but works on x86.
However it doesn't work on arm-linux if the kernel doesn't support
PTRACE_GETREGSET at all.  We'll get:

(gdb) run
Starting program: gdb/testsuite/gdb.base/break
warning: Unable to fetch general register.
PC register is not available

gdb:

2015-06-23  Yao Qi  <yao.qi@linaro.org>

* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers):
Check whether have_ptrace_getregset is TRIBOOL_TRUE explicitly.
(amd64_linux_store_inferior_registers): Likewise.
* arm-linux-nat.c (fetch_fpregister): Likewise.
(fetch_fpregs, store_fpregister): Likewise.
(store_fpregister, store_fpregs): Likewise.
(fetch_register, fetch_regs): Likewise.
(store_register, store_regs): Likewise.
(fetch_vfp_regs, store_vfp_regs): Likewise.
(arm_linux_read_description): Check have_ptrace_getregset is
TRIBOOL_UNKNOWN.  Set have_ptrace_getregset to TRIBOOL_TRUE
or TRIBOOL_FALSE.
* i386-linux-nat.c (fetch_xstateregs): Check
have_ptrace_getregset is not TRIBOOL_TRUE.
(store_xstateregs): Likewise.
* linux-nat.c (have_ptrace_getregset): Change its type to
enum tribool.
* linux-nat.h (tribool): New enum.
* x86-linux-nat.c (x86_linux_read_description): Use enum tribool.
Check whether have_ptrace_getregset is TRIBOOL_TRUE.

8 years ago[AArch64] Generate DT_TEXTREL for relocation against read-only section
Jiong Wang [Tue, 23 Jun 2015 11:12:06 +0000 (12:12 +0100)]
[AArch64] Generate DT_TEXTREL for relocation against read-only section

2015-06-23  Jiong Wang  <jiong.wang@arm.com>

  bfd/
    * elfnn-aarch64.c (aarch64_readonly_dynrelocs): New function.
    (elfNN_aarch64_size_dynamic_sections): Traverse hash table to check
    relocations against read-only sections.

  ld/testsuite/
    * ld-aarch64/dt_textrel.s: New testcase.
    * ld-aarch64/dt_textrel.d: New expectation file.
    * ld-aarch64/aarch64-elf.exp: Run new testcase.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 23 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPPC sync instruction accepts invalid and incompatible operands
Peter Bergner [Mon, 22 Jun 2015 19:55:24 +0000 (14:55 -0500)]
PPC sync instruction accepts invalid and incompatible operands

ISA 2.07 added a new category called Elemental Memory Barriers that modifies
the sync instruction to accept an additional operand ESYNC.  Edmar added
support for this insruction varient here:

    https://sourceware.org/ml/binutils/2012-02/msg00221.html

Looking at this closer, I see that the insert_ls() function is misnamed
(since it's attached to the ESYNC operand, not the LS operand) but more
importantly, it is silently modifying the LS operand value behind the
users back when the LS operand is either invalid or is incompatible with
the new ESYNC operand.  The ISA 2.07 doc has an Assembler Note that clearly
states that assemblers that support the ESYNC operand should report all
invalid uses of LS and ESYNC.  This patch changes the assembler to
error out on invalid and incompatible operand usage.

opcodes/
* ppc-opc.c (insert_ls): Test for invalid LS operands.
(insert_esync): New function.
(LS, WC): Use insert_ls.
(ESYNC): Use insert_esync.

gas/testsuite/
* gas/ppc/e6500.s <sync>: Fix invalid test.
* gas/ppc/e6500.d: Likewise.

8 years agoStop "objdump -d" from disassembling past a symbolic address.
Nick Clifton [Mon, 22 Jun 2015 15:53:27 +0000 (16:53 +0100)]
Stop "objdump -d" from disassembling past a symbolic address.

include * dis-asm.h (struct disassemble_info): Add stop_vma field.

binuti  * objdump.c (disassemble_bytes): Set the stop_vma field in the
disassemble_info structure when disassembling code sections with
-d.
* doc/binutils.texi (objdump): Document the discrepancy between -d
and -D.

opcodes * dis-buf.c (buffer_read_memory): Fail is stop_vma is set and the
requested region lies beyond it.
* bfin-dis.c (print_insn_bfin): Ignore sysop instructions when
looking for 32-bit insns.
* mcore-dis.c (print_insn_mcore): Disable stop_vma when reading
data.
* sh-dis.c (print_insn_sh): Likewise.
* tic6x-dis.c (print_insn_tic6x): Disable stop_vma when reading
blocks of instructions.
* vax-dis.c (print_insn_vax): Check that the requested address
does not clash with the stop_vma.

tests * gas/arm/backslash-at.s: Add extra .byte directives so that the
foo symbol does not appear to point half way through an
instruction.
* gas/arm/backslash-at.d: Update expected disassembly.
* gas/i386/ilp32/x86-64-opcode-inval-intel.d: Likewise.
* gas/i386/ilp32/x86-64-opcode-inval.d: Likewise.
* gas/i386/x86-64-opcode-inval-intel.d: Likewise.
* gas/i386/x86-64-opcode-inval.d: Likewise.

8 years agoAdd comments on using board file remote-gdbserver-on-localhost.exp
Yao Qi [Tue, 28 Apr 2015 09:59:04 +0000 (10:59 +0100)]
Add comments on using board file remote-gdbserver-on-localhost.exp

This commit is to add comments on using this board file and the
requirements on localhost.

gdb/testsuite:

2015-06-22  Yao Qi  <yao.qi@linaro.org>

* boards/remote-gdbserver-on-localhost.exp: Add comments.

8 years agoDon't skip hw breakpoint/watchpoint tests for aarch64 target
Yao Qi [Mon, 22 Jun 2015 12:41:33 +0000 (13:41 +0100)]
Don't skip hw breakpoint/watchpoint tests for aarch64 target

This patch is to let skip_hw_breakpoint_tests and skip_hw_watchpoint_tests
return 0 for aarch64 target, since aarch64 has HW watchpoint and
breakpoint registers.

With this patch applied, about 1560 watchpoint/breakpoint related tests
become enabled on aarch64-linux native testing.

gdb/testsuite:

2015-06-22  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (skip_hw_breakpoint_tests): Return 0 for target
aarch64*-*-*.
(skip_hw_watchpoint_tests): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 22 Jun 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agosim: common: add basic model assert
Mike Frysinger [Sat, 20 Jun 2015 09:36:26 +0000 (15:21 +0545)]
sim: common: add basic model assert

If the configured in default doesn't match a known value, throw an
assertion failure rather than segfaulting deeper down.

8 years agosim: common: use standard intXX_t types for signedXX
Mike Frysinger [Sat, 20 Jun 2015 03:48:04 +0000 (09:33 +0545)]
sim: common: use standard intXX_t types for signedXX

Let's assume that the system supports the POSIX int8/16/32/64_t types
as this collapses the logic significantly.

8 years agosim: common: standardize multiple include defines
Mike Frysinger [Sat, 20 Jun 2015 03:46:10 +0000 (09:31 +0545)]
sim: common: standardize multiple include defines

We use SIM_xxx_H in most headers, so convert _SIM_xxx_H_ over to it.

8 years agoDon't use $< in Makefiles
Alan Modra [Sun, 21 Jun 2015 03:33:36 +0000 (13:03 +0930)]
Don't use $< in Makefiles

$< is a GNU make feature.

* Makefile.am: Expand $<.
* Makefile.in: Regenerate.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 21 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 20 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAllow for optional operands with non-zero default values.
Peter Bergner [Fri, 19 Jun 2015 22:17:07 +0000 (17:17 -0500)]
Allow for optional operands with non-zero default values.

ISA 2.07 (ie, POWER8) added the rfebb instruction which takes one operand
with the value of either a 0 or 1.  It also defines an extended mnemonic
with no operands (ie, "rfebb") that is supposed to be equivalent to "rfebb 1".
I implemented rfebb's lone operand with PPC_OPERAND_OPTIONAL, but the
problem is, optional operands that are ommitted always default to the
value 0, which is wrong in this case.  I have added support for allowing
non-zero default values by adding an additional flag PPC_OPERAND_OPTIONAL_VALUE
that specifies that the default operand value to be used is stored in the
SHIFT field of the operand field immediately following this one.

This fixes the rfebb issue.  I also fixed the mftb and mfcr instructions
so they use the same mechanism.  This allows us to flag invalid uses of
mfcr where we explicitly pass in a zero FXM value, like the use in a2.[sd].

include/opcode/

* ppc.h (PPC_OPERAND_OPTIONAL_VALUE): New.
(ppc_optional_operand_value): New inline function.

opcodes/
* ppc-dis.h (skip_optional_operands): Use ppc_optional_operand_value.
* ppc-opc.c (FXM4): Add non-zero optional value.
(TBR): Likewise.
(SXL): Likewise.
(insert_fxm): Handle new default operand value.
(extract_fxm): Likewise.
(insert_tbr): Likewise.
(extract_tbr): Likewise.

gas/
* config/tc-ppc.c (md_assemble): Use ppc_optional_operand_value.
Allow for optional operands without insert functions.

gas/testsuite/
* gas/ppc/power8.d: Fixup rfebb test results.
* gas/ppc/a2.s: Fix invalid mfcr test.
* gas/ppc/a2.d: Likewise.

8 years agoRemove special support in gdb for Sun's version of stabs.
Doug Evans [Fri, 19 Jun 2015 18:34:43 +0000 (11:34 -0700)]
Remove special support in gdb for Sun's version of stabs.

Discussion:
https://sourceware.org/ml/gdb-patches/2015-05/msg00169.html

gdb/ChangeLog:

* NEWS: Mention Sun's version of stabs is no longer supported.
* elfread.c (free_elfinfo): Delete.  All uses updated.
(elfstab_offset_sections): Delete.  All uses updated.
* gdb-stabs.h (stab_section_info): Delete.  All uses updated.
* psympriv.h (partial_symtab) <section_offsets>: Delete.
All uses updated.
* psymtab.c (start_psymtab_common): Delete arg section_offsets.
All callers updated.

gdb/doc/ChangeLog:

* stabs.texinfo (ELF Linker Relocation): Mention Sun stabs is no
longer supported.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 19 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoremote: consider addressable unit size when reading/writing memory
Simon Marchi [Thu, 18 Jun 2015 17:12:39 +0000 (13:12 -0400)]
remote: consider addressable unit size when reading/writing memory

Adapt code in remote.c to take into account addressable unit size when
reading/writing memory.

A few variables are renamed and suffixed with _bytes or _units. This
way, it's more obvious if there is any place where we add or compare
values of different kinds (which would be a mistake).

gdb/ChangeLog:

* common/rsp-low.c (needs_escaping): New.
(remote_escape_output): Add unit_size parameter. Refactor to
support multi-byte addressable units.  Rename parameters.
* common/rsp-low.h (remote_escape_output): Add unit_size
parameter and rename others. Update doc.
* remote.c (align_for_efficient_write): New.
(remote_write_bytes_aux): Add unit_size parameter and use it.
Rename some variables.  Update doc.
(remote_xfer_partial): Get unit size and use it.
(remote_read_bytes_1): Add unit_size parameter and use it.
Rename some variables. Update doc.
(remote_write_bytes): Same.
(remote_xfer_live_readonly_partial): Same.
(remote_read_bytes): Same.
(remote_flash_write): Update call to remote_write_bytes_aux.
(remote_write_qxfer): Update call to remote_escape_output.
(remote_search_memory): Same.
(remote_hostio_pwrite): Same.

gdb/gdbserver/ChangeLog:

* server.c (write_qxfer_response): Update call to
remote_escape_output.

8 years agoTest the interaction between GDBHISTSIZE and .gdbinit
Patrick Palka [Wed, 17 Jun 2015 19:41:07 +0000 (15:41 -0400)]
Test the interaction between GDBHISTSIZE and .gdbinit

The value inside the GDBHISTSIZE environment variable, only if valid,
should override setting the history size through one's .gdbinit file.

gdb/testsuite/ChangeLog:

* gdb.base/gdbinit-history.exp: Test the interaction between
setting GDBHISTSIZE and setting the history size via .gdbinit.

8 years agoAdd support for using the ADR alias in Thumb mode against nearby symbols.
Nick Clifton [Thu, 18 Jun 2015 09:23:16 +0000 (10:23 +0100)]
Add support for using the ADR alias in Thumb mode against nearby symbols.

PR gas/18541
gas * config/tc-arm.c (md_apply_fix): Add support for ADR in thumb
mode against a nearby symbol.

tests * gas/arm/thumb.s: Add test of ADR against a nearby symbol.
* gas/arm/thumb.d: Update expected output.
* gas/arm/thumb-eabi.d: Likewise.

8 years agoFix the computation of the addends for an ARM_TLS_LE32 reloc.
Nick Clifton [Thu, 18 Jun 2015 09:18:42 +0000 (10:18 +0100)]
Fix the computation of the addends for an ARM_TLS_LE32 reloc.

PR gas/18481
bfd * elf32-arm.c (R_ARM_TLS_LE32): Set the special function to NULL.

gas * config/tc-arm.c (tc_gen_reloc): Include BFD_RELOC_ARM_TLS_LE32
in the same case as BFD_RELOC_ARM_TLS_IS32.

tests * gas/arm/tls.s: Add tests of the tpoff pseudo with a local
symbol.
* gas/arm/tls.d: Update expected output.

8 years agosim: syscall: simplify unknown syscall trace
Mike Frysinger [Thu, 18 Jun 2015 08:06:27 +0000 (04:06 -0400)]
sim: syscall: simplify unknown syscall trace

Since we always include the raw syscall number when tracing, also
including it in the name when it's unknown is redundant.  Simplify
the code by using a constant string.

8 years agosim: callback: fix sentinel testing when walking maps
Mike Frysinger [Thu, 18 Jun 2015 08:02:26 +0000 (04:02 -0400)]
sim: callback: fix sentinel testing when walking maps

The new helpers for walking the maps tested the wrong value for exiting
the for loop.  This caused crashes when looking up entries that were not
in the map.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix problems with finishing a dummy function call on simulators.
Luis Machado [Wed, 17 Jun 2015 19:50:57 +0000 (16:50 -0300)]
Fix problems with finishing a dummy function call on simulators.

Some simulators don't handle permanent breakpoints properly and will
sometimes terminate when hitting such a breakpoint instruction or have
unwanted effects.

When a permanent breakpoint is inserted, GDB will not attempt to insert
other breakpoint locations on top of it, leading to the problem described
above.

By not marking permanent breakpoint locations as inserted, we allow the
insertion of breakpoint locations on top of the permanent ones, preventing
the simulators from running into that situation.

gdb/ChangeLog:

2015-06-17  Luis Machado  <lgustavo@codesourcery.com>

* breakpoint.c (add_location_to_breakpoint): Don't mark permanent
locations as inserted.
Update and expand comment about permanent locations.
(bp_loc_is_permanent): Don't return 0 for bp_call_dummy.
Move comment to add_location_to_breakpoint.
(update_global_location_list): Don't error out if a permanent
breakpoint is not marked inserted.
Don't error out if a non-permanent breakpoint location is inserted on
top of a permanent breakpoint.

8 years agoRemove unused function make_breakpoint_permanent.
Luis Machado [Wed, 17 Jun 2015 14:08:55 +0000 (11:08 -0300)]
Remove unused function make_breakpoint_permanent.

make_breakpoint_permanent is no longer used anywhere and can be
safely removed.

gdb/ChangeLog:

2015-06-17  Luis Machado  <lgustavo@codesourcery.com>

* breakpoint.c (make_breakpoint_permanent): Remove unused
function.
* breakpoint.h (make_breakpoint_permanent): Remove declaration.

8 years agoMake NEWS entry and manual regarding GDBHISTSIZE more consistent
Patrick Palka [Wed, 17 Jun 2015 18:44:38 +0000 (14:44 -0400)]
Make NEWS entry and manual regarding GDBHISTSIZE more consistent

... by mentioning in the manual that setting GDBHISTSIZE to the empty
string disables truncation, like the NEWS entry does.

gdb/doc/ChangeLog:

* gdb.texinfo (Command History): Mention that setting
GDBHISTSIZE to the empty string disables history truncation.

8 years agoTweak the handling of $GDBHISTSIZE edge cases [PR gdb/16999]
Patrick Palka [Tue, 12 May 2015 10:50:26 +0000 (06:50 -0400)]
Tweak the handling of $GDBHISTSIZE edge cases [PR gdb/16999]

When GDB reads a nonsensical value for the GDBHISTSIZE environment
variable, i.e. one that is non-numeric or negative, GDB then sets its
history size to 0.  This behavior is annoying and also inconsistent
with the behavior of bash.

This patch makes the behavior of invalid GDBHISTSIZE consistent with how
bash handles HISTSIZE.  When we encounter a null or out-of-range
GDBHISTSIZE (outside of [0, INT_MAX]) we now set the history size to
unlimited instead of 0.  When we encounter a non-numeric GDBHISTSIZE we
do nothing.

gdb/ChangeLog:

PR gdb/16999
* NEWS: Mention new GDBHISTSIZE behavior.
* top.c (init_history): For null or out-of-range GDBHISTSIZE,
set history size to unlimited.  Ignore non-numeric GDBHISTSIZE.

gdb/doc/ChangeLog:

PR gdb/16999
* gdb.texinfo (Command History): Mention new GDBHISTSIZE
behavior.

gdb/testsuite/ChangeLog:

PR gdb/16999
* gdb.base/gdbhistsize-history.exp: New test.

8 years agoRead $GDBHISTSIZE instead of $HISTSIZE
Patrick Palka [Wed, 17 Jun 2015 17:31:56 +0000 (13:31 -0400)]
Read $GDBHISTSIZE instead of $HISTSIZE

The HISTSIZE environment variable is generally expected to be read by
shells, not by applications.  Some distros for example globally export
HISTSIZE in /etc/profile -- with the intention that it only affects
shells -- and by doing so it renders useless GDB's own mechanism for
setting the history size via .gdbinit.  Also, annoyances may arise when
HISTSIZE is not interpreted the same way by the shell and by GDB, e.g.
PR gdb/16999.  That can always be fixed on a shell-by-shell basis but it
may be impossible to be consistent with the behavior of all shells at
once.  Finally it just makes sense to not confound shell environment
variables with application environment variables.

gdb/ChangeLog:

* NEWS: Mention that GDBHISTSIZE is read instead of HISTSIZE.
* top.c (init_history): Read from GDBHISTSIZE instead of
HISTSIZE.
(init_main): Refer to GDBHISTSIZE instead of HISTSIZE.

gdb/doc/ChangeLog:

* gdb.texinfo (Command History): Replace occurrences of HISTSIZE
with GDBHISTSIZE.

gdb/testsuite/ChangeLog:

* gdb.base/gdbinit-history.exp: Replace occurrences of HISTSIZE
with GDBHISTSIZE.
* gdb.base/readline.exp: Likewise.

8 years agosim: syscall: add common sim_syscall helpers
Mike Frysinger [Mon, 15 Jun 2015 13:37:38 +0000 (19:22 +0545)]
sim: syscall: add common sim_syscall helpers

Many ports have the same sim syscall logic, so add some helpers to handle
all the common details.  The arches still have to deal with the unpacking
and packing of the syscall arguments, but the rest of the sim<->callback
glue is now shared.