external/binutils.git
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.

8 years agosim: syscall: unify memory helpers
Mike Frysinger [Mon, 15 Jun 2015 15:24:21 +0000 (21:09 +0545)]
sim: syscall: unify memory helpers

Almost every port implements these two callbacks in the same way, so
unify them in the common layer.

8 years agosim: callback: add human readable strings for debugging to maps
Mike Frysinger [Mon, 15 Jun 2015 13:32:16 +0000 (19:17 +0545)]
sim: callback: add human readable strings for debugging to maps

When tracing, we often want to display the human readable name for the
various syscall/errno values.  Rather than make each target duplicate
the lookup, extend the existing maps to include the string directly,
and add helper functions to look up the constants.

While most targets are autogenerated (from libgloss), the bfin/cris
targets have custom maps for the Linux ABI which need to be updated
by hand.

8 years agoFix tcl error
Yao Qi [Wed, 17 Jun 2015 16:03:03 +0000 (17:03 +0100)]
Fix tcl error

This patch fixes the following tcl error

Running ../../../binutils-gdb/gdb/testsuite/gdb.base/break-interp.exp ...
ERROR: (DejaGnu) proc "else" does not exist.
The error code is NONE
The info on the error is:
invalid command name "else"
    while executing
"::tcl_unknown else"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 ::tcl_unknown $args"

gdb/testsuite:

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

* lib/gdb.exp (get_build_id): Move braces and "else" to the same
line.

8 years ago[AArch64] Select correct linker emulation for ILP32 according to endianes
Jiong Wang [Wed, 17 Jun 2015 15:36:04 +0000 (16:36 +0100)]
[AArch64] Select correct linker emulation for ILP32 according to endianes

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

ld/testsuite/
  * ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul): New function.
  * ld-aarch64/emit-relocs-28.d: Use aarch64_choose_ilp32_emul to choose
  emulation mode.

8 years agoFix compile warnings building previous delta in a 32-bit environment.
Nick Clifton [Wed, 17 Jun 2015 15:10:36 +0000 (16:10 +0100)]
Fix compile warnings building previous delta in a 32-bit environment.

* config/tc-arm.c (is_double_a_single): Make conditional upon the
availablity of a 64-bit type.  Use this type for the argument and
mantissa.
(double_to_single): Likewise.
* config/tc-arm.c (move_or_literal_pool): Use a 64-bit type for
the constant value, if available.  Generate a 64-bit value from a
bignum if supported.  Only perform the second optimization for
PR 18500 if the 64-bit type is available.

8 years agoDon't truncate the history file when history size is unlimited
Patrick Palka [Thu, 4 Jun 2015 14:12:27 +0000 (10:12 -0400)]
Don't truncate the history file when history size is unlimited

We still do not handle "set history size unlimited" correctly.  In
particular, after writing to the history file, we truncate the history
even if it is unlimited.

This patch makes sure that we do not call history_truncate_file() if the
history is not stifled (i.e. if it's unlimited).  This bug causes the
history file to be truncated to zero on exit when one has "set history
size unlimited" in their gdbinit file.  Although this code exists in GDB
7.8, the bug is masked by a pre-existing bug that's been only fixed in
GDB 7.9 (PR gdb/17820).

gdb/ChangeLog:

* top.c (gdb_safe_append_history): Do not call
history_truncate_file if the history is not stifled.

gdb/testsuite/ChangeLog:

* gdb.base/gdbinit-history.exp: Add test case to check that
an unlimited history file does not get truncated on exit.

8 years agoAdd support for converting LDR Rx,=<imm> to MOV or MVN in Thumb2 mode.
Alessandro Marzocchi [Wed, 17 Jun 2015 12:50:52 +0000 (13:50 +0100)]
Add support for converting LDR Rx,=<imm> to MOV or MVN in Thumb2 mode.

PR gas/18499
gas * config/tc-arm.c (move_or_literal_pool): Add support for LDR Rx,=
to MOV.w or MVN.w for Thumb2.

tests * gas/arm/thumb2_ldr_immediate_armv6.s: New test case.
* gas/arm/thumb2_ldr_immediate_armv6.d: Expected disassembly.
* gas/arm/thumb2_ldr_immediate_armv6t2.s: New test case.
* gas/arm/thumb2_ldr_immediate_armv6t2.d: Expected disassembly.

8 years agoAdd support for converting VLDR <reg>,=<constant> to a VMOV instruction when appropriate.
Alessandro Marzocchi [Wed, 17 Jun 2015 11:56:17 +0000 (12:56 +0100)]
Add support for converting VLDR <reg>,=<constant> to a VMOV instruction when appropriate.

PR gas/18500
gas * config/tc-arm.c (is_double_a_single): New function.
(double_to_single): New function.
(move_or_literal_pool): Add support for converting VLDR to VMOV.

tests * gas/arm/vfpv2-ldr_immediate.s: New test case.
* gas/arm/vfpv2-ldr_immediate.d: Expected disassembly.
* gas/arm/vfpv3-ldr_immediate.s: New test case.
* gas/arm/vfpv3-ldr_immediate.d: Expected disassembly.
* gas/arm/vfpv3xd-ldr_immediate.s: New test case.
* gas/arm/vfpv3xd-ldr_immediate.d: Expected disassembly.

8 years agoS390: Add syscall info for syscalls from 344 up to 354
Andreas Arnez [Wed, 17 Jun 2015 09:17:08 +0000 (11:17 +0200)]
S390: Add syscall info for syscalls from 344 up to 354

Represent new Linux syscalls for s390 and s390x in GDB's syscall info.
Add the syscalls from 344 (finit_module) up to 354 (execveat).

gdb/ChangeLog:

* syscalls/s390-linux.xml: Add syscalls 344 through 354.
* syscalls/s390x-linux.xml: Likewise.

8 years agoAdd vector ABI tests to gnu_vector.exp
Andreas Arnez [Wed, 17 Jun 2015 09:17:07 +0000 (11:17 +0200)]
Add vector ABI tests to gnu_vector.exp

So far the gnu_vector test was limited to "static" aspects of GDB's
vector support, like evaluating vector-valued expressions.  This patch
enriches the test and adds checks for GDB's vector ABI support as well.
The new checks particularly verify inferior function calls with vector
arguments and GDB's handling of vector return values.

The test now attempts to compile for the target's "native" architecture,
such that a hardware vector ABI is used if available.

Since GDB has no vector ABI support for x86 and x86_64 targets, most of
the new checks are KFAILed there.

gdb/testsuite/ChangeLog:

* gdb.base/gnu_vector.c: Include stdarg.h and stdio.h.
(VECTOR): New macro.  Use it...
(int4, uint4, char4, float4, int2, longlong2, float2, double2):
...for these typedefs.
(int8, char1, int1, double1): New typedefs.
(struct just_int2, struct two_int2): New structures.
(add_some_intvecs, add_many_charvecs, add_various_floatvecs)
(add_structvecs, add_singlevecs): New functions.
(main): Call add_some_intvecs twice.
* gdb.base/gnu_vector.exp: Drop GCC version check; just attempt
the compile and exit upon failure.  Try compiling for the "native"
architecture.  Test inferior function calls with vector arguments
and vector return value handling with "finish" and "return".

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

8 years agogas: section name substitution sequence
Nicolas Pitre [Wed, 10 Jun 2015 03:06:29 +0000 (23:06 -0400)]
gas: section name substitution sequence

This patch adds the ability to automatically construct a section name
based on the prior section.

When gas is invoked with --sectname-subst, the occurrence of %S in a
section name will be substituted by the name of the current section. For
example:

.macro exception_code
.pushsection %S.exception
[exception code here]
.popsection
.endm

.text
[code]
exception_code
[...]

.section .init
[init code]
exception_code
[...]

The first and second exception_code invocations create the
.text.exception and the .init.exception sections respectively.  This is
useful e.g. to discriminate between anciliary sections that are tied to
.init code and can be discarded at run time when initialization is over
vs anciliary sections tied to .text sections that need to stay resident.

* as.c (show_usage): Document --sectname-subst.
(parse_args): Add --sectname-subst.
* as.h (flag_sectname_subst): New.
* config/obj-elf.c (obj_elf_section_name): Add %S substitution.
* doc/as.texinfo: Document it.

8 years agoGDB Namespaces - Define MSG_CMSG_CLOEXEC if not defined.
Michael Eager [Tue, 16 Jun 2015 14:18:03 +0000 (07:18 -0700)]
GDB Namespaces - Define MSG_CMSG_CLOEXEC if not defined.

2015-06-16  Michael Eager  <eager@eagercon.com>

* nat/linux-namespaces.c (MSG_CMSG_CLOEXEC): Define if not defined.

8 years agoCall target_terminal_ours_for_output() before refreshing TUI's frame info
Patrick Palka [Tue, 2 Jun 2015 01:30:50 +0000 (21:30 -0400)]
Call target_terminal_ours_for_output() before refreshing TUI's frame info

In some cases tui_show_frame_info() may get called while the inferior's
terminal settings are still in effect.  But when we call this function
we absolutely need to have our terminal settings in effect because the
function is responsible for redrawing TUI's windows following a change
in the selected frame or a change in the PC.  If our terminal settings
are not in effect, the screen does not get redrawn properly, causing
temporary display artifacts (which can be fixed via ^L).

This scenario happens most prominently when stepping through a program
in TUI while a watchpoint is in effect.

Here is an example backtrace for when tui_show_frame_info() gets called
while target_terminal_is_inferior() == 1:

  #1  0x00000000004988ee in tui_selected_frame_level_changed_hook (level=0)
  #2  0x0000000000617b99 in select_frame (fi=0x18c9820)
  #3  0x0000000000617c3f in get_selected_frame (message=message@entry=0x0)
  #4  0x00000000004ce534 in update_watchpoint (b=b@entry=0x2d9a760,
      reparse=reparse@entry=0)
  #5  0x00000000004d625e in insert_breakpoints ()
  #6  0x0000000000531cfe in keep_going (ecs=ecs@entry=0x7ffea7884ac0)
  #7  0x00000000005326d7 in process_event_stop_test (ecs=ecs@entry=0x7ffea7884ac0)
  #8  0x000000000053596e in handle_inferior_event_1 (ecs=0x7ffea7884ac0)

The fix is simple: call target_terminal_ours_for_output() before calling
tui_show_frame_info() in TUI's frame-changed hook, making sure to
restore the original terminal settings afterwards.

gdb/ChangeLog:

* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Call
target_terminal_ours_for_output() before calling
tui_show_frame_info(), and restore the original terminal
settings afterwards.

8 years ago[AArch64] Support id_mmfr4 system register
Matthew Wahab [Tue, 16 Jun 2015 13:15:54 +0000 (14:15 +0100)]
[AArch64] Support id_mmfr4 system register

2015-06-16  Matthew Wahab  <matthew.wahab@arm.com>
opcodes/
  * aarch64-opc.c (aarch64_sys_regs): Add "id_mmfr4_el1".

gas/testsuite
  * sysreg.d: Add id_mmfr4_el1, update expected output.
  * sysreg.s: Add id_mmfr4_el1.

8 years agoFix build when size_t is not available in bfd-in2.h
Jon Turney [Mon, 15 Jun 2015 18:20:02 +0000 (19:20 +0100)]
Fix build when size_t is not available in bfd-in2.h

bfd/ChangeLog:

2015-06-15  Jon Turney  <jon.turney@dronecode.org.uk>

* bfd.c: Change struct bfd_build_id to use bfd_size_type.
* bfd-in2.h : Regenerate.

8 years agoFixes a compile time warnng about left shifting a negative value.
Szabolcs Nagy [Tue, 16 Jun 2015 12:35:33 +0000 (13:35 +0100)]
Fixes a compile time warnng about left shifting a negative value.

* arm-dis.c (print_insn_coprocessor): Avoid negative shift.

8 years agoFix compilation of gdb/arm-linux-nat.c on Raspbian GNU/Linux 7
Martin Simmons [Tue, 16 Jun 2015 08:32:47 +0000 (09:32 +0100)]
Fix compilation of gdb/arm-linux-nat.c on Raspbian GNU/Linux 7

GDB trunk fails to compile on Raspbian GNU/Linux 7 because
PTRACE_GETREGSET and PTRACE_SETREGSET are not defined in sys/ptrace.h.

gcc -g -O2   -I. -I. -I./common -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wold-style-declaration -Wold-style-definition -Wformat-nonliteral -Werror -c -o arm-linux-nat.o -MT arm-linux-nat.o -MMD -MP -MF .deps/arm-linux-nat.Tpo arm-linux-nat.c
arm-linux-nat.c: In function 'fetch_fpregister':
arm-linux-nat.c:103:21: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
arm-linux-nat.c:103:21: note: each undeclared identifier is reported only once for each function it appears in
arm-linux-nat.c: In function 'fetch_fpregs':
arm-linux-nat.c:144:21: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
arm-linux-nat.c: In function 'store_fpregister':
arm-linux-nat.c:184:21: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
arm-linux-nat.c:211:21: error: 'PTRACE_SETREGSET' undeclared (first use in this function)
...

This patch includes the gdb header file nat/linux-ptrace.h, which provides
fallback definitions.

2015-06-16  Martin Simmons  <martin@lispworks.com>  (tiny patch)

* arm-linux-nat.c: Include nat/linux-ptrace.h.

8 years agoppc476 linker workaround shared lib fixes again
Alan Modra [Tue, 16 Jun 2015 07:17:51 +0000 (16:47 +0930)]
ppc476 linker workaround shared lib fixes again

Huh, I can't even write a binary search properly.

bfd/
* elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of
dynamic relocs.
ld/testsuite/
* ld-powerpc/ppc476-shared.s: Repeat dynamic reloc generating insns.
* ld-powerpc/ppc476-shared.d: Update.
* ld-powerpc/ppc476-shared2.d: Update.

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

8 years agoMI: consider addressable unit size when reading/writing memory
Simon Marchi [Mon, 15 Jun 2015 19:50:31 +0000 (15:50 -0400)]
MI: consider addressable unit size when reading/writing memory

As a user of the target memory read/write interface, the MI code must
adjust its memory allocations to take into account the addressable memory
unitsize of the target.

gdb/ChangeLog:

mi/mi-main.c (mi_cmd_data_read_memory_bytes): Consider byte
size.
(mi_cmd_data_write_memory_bytes): Same.

8 years agoClarify doc about memory read/write and non-8-bits addressable memory unit sizes
Simon Marchi [Mon, 15 Jun 2015 19:31:00 +0000 (15:31 -0400)]
Clarify doc about memory read/write and non-8-bits addressable memory unit sizes

New in v3:

 * Change RSP documentation as well. The m, M and X packets now use
 lengths in addressable memory units.

New in v2:

 * Change wording: use byte for 8-bits chunks and addressable memory unit
   for the unit of data associated to a single address.
 * Introduce definition of addressable memory unit in the Memory
   section.

This patch modifies the manual to clarify the MI, RSP and Python APIs in
regard to reading/writing memory on architectures with addressable
memory unit that are not 8 bits.

Care is taken to use the word "addressable memory unit" or "memory unit"
when referring to one piece of the smallest addressable size on the
current architecture and the word "byte" when referring to an 8-bits
data piece.

For MI, -data-{read,write}-memory are not modified, since they are
deprecated.

gdb/doc/ChangeLog:

* gdb.texinfo (GDB/MI Data Manipulation): Clarify usage of
bytes and memory units for -data-{read,write}-memory-bytes.
(Packets): Same for m, M and X packets.
* python.texi (Inferiors In Python): Same for read_memory and
write_memory.

8 years agoCleanup write_memory doc
Simon Marchi [Mon, 15 Jun 2015 17:34:47 +0000 (13:34 -0400)]
Cleanup write_memory doc

This doc about write_memory seems outdated.

gdb/ChangeLog:

* corefile.c (write_memory): Update doc.
* gdbcore.h (write_memory): Same.

8 years agoCode cleanup: Rename enum -> enum filterflags
Jan Kratochvil [Mon, 15 Jun 2015 15:10:44 +0000 (17:10 +0200)]
Code cleanup: Rename enum -> enum filterflags

Bit mask ints are better to make enums as GDB already has support to
automatically decode them:

before this patch:
(gdb) p filterflags
$1 = 51
(gdb) p/x filterflags
$2 = 0x33

after this patch:
(gdb) p filterflags
$1 = (COREFILTER_ANON_PRIVATE | COREFILTER_ANON_SHARED | COREFILTER_ELF_HEADERS | COREFILTER_HUGETLB_PRIVATE)

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

* linux-tdep.c (enum filterflags): Make it from anonymous enum.
(dump_mapping_p): Use it for parameter filterflags.
(linux_find_memory_regions_full): Use it for variable filterflags.

8 years agoMerge multiple hex conversions
Jan Kratochvil [Mon, 15 Jun 2015 15:08:49 +0000 (17:08 +0200)]
Merge multiple hex conversions

gdb/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Merge multiple hex conversions.
* monitor.c: Include rsp-low.h.
(fromhex): Remove definition.

gdb/gdbserver/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Merge multiple hex conversions.
* gdbreplay.c (tohex): Rename to 'fromhex'.
(logchar): Use fromhex.

8 years agoMove utility functions to common/
Jan Kratochvil [Mon, 15 Jun 2015 15:04:56 +0000 (17:04 +0200)]
Move utility functions to common/

gdb/ChangeLog
2015-06-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Move utility functions to common/.
* cli/cli-utils.c (skip_spaces, skip_spaces_const, skip_to_space_const):
Move defs to common/common-utils.c.
* cli/cli-utils.h (skip_spaces, skip_spaces_const, skip_to_space)
(skip_to_space_const): Move decls to common/common-utils.h.
* common/common-defs.h: Move include of common-types.h before
common-utils.h.
* common/common-utils.c: Include host-defs.h and ctype.h.
(HIGH_BYTE_POSN, is_digit_in_base, digit_to_int, strtoulst): Move
from utils.c.
(skip_spaces, skip_spaces_const, skip_to_space_const): Move from
cli/cli-utils.c.
* common/common-utils.h (strtoulst): Move decl from utils.h.
(skip_spaces, skip_spaces_const, skip_to_space, skip_to_space_const):
Move from cli/cli-utils.h.
* common/host-defs.h: Include limits.h.
(TARGET_CHAR_BIT, HOST_CHAR_BIT): Moved from defs.h.
(skip_spaces, skip_spaces_const): Move decls from cli/cli-utils.h.
* defs.h (TARGET_CHAR_BIT, HOST_CHAR_BIT): Move to
common/common-utils.h.
* utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int)
(strtoulst): Move to common/common-utils.c.
* utils.h (strtoulst): Moved decl to common/common-utils.h.

8 years agoCopy aarch64-linux.xml to build tree.
Yao Qi [Mon, 15 Jun 2015 11:41:09 +0000 (12:41 +0100)]
Copy aarch64-linux.xml to build tree.

This patch fixes a bug that aarch64-linux.xml isn't copied to the
build tree, so that some tests catch-syscall.exp fail.

gdb:

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

* data-directory/Makefile.in (SYSCALLS_FILES): Add aarch64-linux.xml.

8 years agoFix ChangeLog entry.
Ulrich Weigand [Mon, 15 Jun 2015 11:49:43 +0000 (13:49 +0200)]
Fix ChangeLog entry.

8 years agoAllow gdb to find debug symbols file by build-id for PE file format also
Jon Turney [Tue, 7 Apr 2015 19:49:08 +0000 (20:49 +0100)]
Allow gdb to find debug symbols file by build-id for PE file format also

This promotes BFD's struct elf_build_id to the generic struct bfd_build_id,
populated when an ELF or PE BFD is read.

gdb is updated to use that, and to use the build-id to find symbols for PE files
also.

There is currently no generic way to extract the build-id from an object file,
perhaps an option to objdump to do this might make sense?

On x86_64-pc-cygwin, gdb's sepdebug.exp changes:

-# of unsupported tests          1
+# of expected passes            90

I don't seem to get consistent testsuite runs on i686-linux-gnu, but there
don't appear to be any regressions.

bfd/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* elf-bfd.h : Remove struct elf_build_id.
* bfd.c : Add struct bfd_build_id.
* bfd-in2.h: Regenerate.
* elf.c (elfobj_grok_gnu_build_id): Update to use bfd_build_id.
* libpei.h: Add protoype and macros for
bfd_XXi_slurp_codeview_record.
* peXXigen.c (_bfd_XXi_slurp_codeview_record): Make public
* peicode.h (pe_bfd_read_buildid): Add.
(pe_bfd_object_p): Use pe_bfd_read_buildid().

gdb/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* build-id.c: Don't include elf-bfd.h.
(build_id_bfd_get): Use bfd_build_id.
(build_id_verify): Ditto.
* build-id.h: Ditto.
(find_separate_debug_file_by_buildid): Ditto.
* python/py-objfile.c: Don't include elf-bfd.h.
(objfpy_get_build_id) Use bfd_build_id.
(objfpy_build_id_matches, objfpy_lookup_objfile_by_build_id): Ditto.
* coffread.c: Include build-id.h.
(coff_symfile_read): Try find_separate_debug_file_by_buildid.

gdb/doc/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* gdb.texinfo (Separate Debug Files): Document that PE is also
supported.

gdb/testsuite/ChangeLog:

2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>

* gdb.base/sepdebug.exp: Add EXEEXT where needed.
* lib/gdb.exp (get_build_id): Teach how to extract build-id from a
PE file.
* lib/future.exp (gdb_find_objdump): Add gdb_find_objdump.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years agowindows-nat: Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__
Jon Turney [Wed, 3 Jun 2015 12:58:45 +0000 (13:58 +0100)]
windows-nat: Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__

Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__

__COPY_CONTEXT_SIZE was added to Cygwin's headers in 2006.

Versions of Cygwin which don't define __COPY_CONTEXT_SIZE are long obsolete.

Also see the thread starting at
https://sourceware.org/ml/gdb-patches/2015-03/msg00989.html for some discussion

Note that __COPY_CONTEXT_SIZE should just be sizeof(CONTEXT) (which is a
platform constant), but isn't due to historical mistakes in Cygwin headers.

gdb/ChangeLog:

2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (do_windows_fetch_inferior_registers)
(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
conditional with __CYGWIN__.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
8 years ago[AArch64] Gas add BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 support
Renlin Li [Mon, 15 Jun 2015 10:07:37 +0000 (11:07 +0100)]
[AArch64] Gas add BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 support

2015-06-15  Renlin Li <renlin.li@arm.com>
bfd/
    * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): New entry.
    * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
    BFD_RELOC_AARCH64_LD64_GOTOFF_LO15.
    * bfd-in2.h: Regenerate.
    * libbfd.h: Regenerate.

gas/
    * config/tc-aarch64.c (reloc_table): New relocation modifier.
    (md_apply_fix): Support BFD_RELOC_AARCH64_LD64_GOTOFF_LO15.
    (aarch64_force_relocation): Ditto

gas/testsuite/
    * gas/aarch64/reloc-insn.s: Update test
    * gas/aarch64/reloc-insn.d: Update expected result.

8 years agoFix a segmentation fault triggered when trying to handle an unresolved PE symbol...
Nick Clifton [Mon, 15 Jun 2015 08:25:26 +0000 (09:25 +0100)]
Fix a segmentation fault triggered when trying to handle an unresolved PE symbol with a very long name.

PR ld/18466
* emultempl/pe.em (pe_find_data_imports): Generate an error if a
symbol name is too long to handle.
* emultempl/pep.em (pep_find_data_imports): Likewise.

8 years agogas: Don't use frag_align but use plain padding to align .debug_aranges.
Mark Wielaard [Sat, 13 Jun 2015 21:47:41 +0000 (17:47 -0400)]
gas: Don't use frag_align but use plain padding to align .debug_aranges.

out_debug_aranges uses frag_align to make sure the addresses start
out aligned. Using frag_align will call frag_var[_init], which will
end up calling TC_FRAG_INIT. On arm and aarch64 TC_FRAG_INIT will
generate a $d mapping symbol for the .debug_aranges to show that at
that point a sequence of data items starts.

Such a symbol pointing into a non-allocated debug section will confuse
eu-strip -g. And it seems inefficient and wrong in general to have
additional mapping symbols for debug sections, which won't contain
actual code in the first place.

Just keep track of the aranges header size and use plain padding to
align the addresses which avoids generating any mapping symbols on
aarch64 and arm.

Includes a testcase for aarch64 that PASS with this patch and shows
the extra $d mapping symbol in .debug_aranges before.

gas/ChangeLog

       * dwarf2dbg.c (out_header): Document EXPR->X_add_number value,
       out_debug_aranges depends on it.
       (out_debug_aranges): Track size of header to properly pad header
       for address alignment.

gas/testsuite/ChangeLog

       * gas/aarch64/dwarf.d: New.
       * gas/aarch64/dwarf.s: New.

8 years agoDJGPP port of binutils broken due to 64 bit cygwin fix
Alan Modra [Tue, 9 Jun 2015 04:44:41 +0000 (14:14 +0930)]
DJGPP port of binutils broken due to 64 bit cygwin fix

* cofflink.c (_bfd_coff_generic_relocate_section): Revert
2014-03-26 change.  Call _bfd_clear_contents for relocs against
local and global symbols defined in discarded input sections.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Jun 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

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

9 years agogdb: Rework command completion on 'tui reg'.
Andrew Burgess [Tue, 26 May 2015 22:23:23 +0000 (23:23 +0100)]
gdb: Rework command completion on 'tui reg'.

We previously specified a few known register groups for the 'tui reg'
command.  Other register groups could be accessed, but only by using the
'tui reg next' command and cycling through all the groups.

This commit removes the hard coded sub-commands of 'tui reg' and instead
adds dynamic completion of sub-commands based on the architecturally
defined register groups, giving immediate access to all available
register groups.

There is still the 'next' and 'prev' commands for cycling through the
register groups if that's wanted.

The new code maintains the ability to only enter partial names for
register groups, which is something we got for free when using the
standard sub-command mechanism.

The register (and register group) completer has been changed to use
get_current_arch rather than using the architecture of the currently
selected frame.  When the target is running, this is equivalent,
however, when the target is not running, using get_current_arch will
provide results from the default architecture.

gdb/ChangeLog:

* completer.c: Add arch-utils.h include.
(enum reg_completer_targets): New enum.
(reg_or_group_completer_1): New function containing old
reg_or_group_completer, add and use new parameter to control what
is completed on.  Use get_current_arch rather than architecture of
currently selected frame.
(reg_or_group_completer): Call new reg_or_group_completer_1.
(reggroup_completer): Call new reg_or_group_completer_1.
* completer.h (reggroup_completer): Add declaration.
* tui/tui-regs.c: Add 'completer.h' include.
(tui_reg_next_command): Renamed to...
(tui_reg_next): ...this.  Adjust parameters and return rather than
display new group.
(tui_reg_prev_command): Renamed to...
(tui_reg_prev): ...this.  Adjust parameters and return rather than
display new group.
(tui_reg_float_command): Delete.
(tui_reg_general_command): Delete.
(tui_reg_system_command): Delete.
(tui_reg_command): Rewrite to perform switching of register group.
Add header comment.
(tuireglist): Remove.
(tui_reggroup_completer): New function.
(_initialize_tui_regs): Remove 'tui reg' sub-commands, update
creation of 'tui reg' command.
* NEWS: Add comment about 'tui reg' changes.

gdb/doc/ChangeLog:

* gdb.texinfo (TUI Commands): Bring all 'tui reg' commands into a
single table entry.

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

9 years ago[gold][aarch64] Fix erratum 835769.
Han Shen [Wed, 10 Jun 2015 21:50:26 +0000 (14:50 -0700)]
[gold][aarch64] Fix erratum 835769.

gold/ChangeLog:

* aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
defintion outside class definition.
(AArch64_insn_utilities::AARCH64_ZR): New static constant.
(AArch64_insn_utilities::aarch64_op31): New member.
(AArch64_insn_utilities::aarch64_ra): New member.
(AArch64_insn_utilities::aarch64_mac): New member.
(AArch64_insn_utilities::aarch64_mlxl): New member.
(ST_E_835769): New global enum member.
(Stub_table::relocate_stubs): Add 835769 handler.
(Stub_template_repertoire::Stub_template_repertoire): Install new
stub type.
(AArch64_relobj::scan_errata): This func is renamed from
scan_erratum_843419.
(AArch64_relobj::do_count_local_symbols): Add 835769 handler.
(AArch64_relobj::do_relocate_sections): Add 835769 handler.
(AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
(Target_aarch64::scan_erratum_835769_span): New method.
(Target_aarch64::create_erratum_stub): New method.
(Target_aarch64::is_erratum_835769_sequence): New method.
(Target_aarch64::scan_erratum_843419_sequence): Move part of the
code into create_erratum_stub.
* options.h (fix_cortex_a53_835769): New option.

9 years agotarget: consider addressable unit size when reading/writing memory
Simon Marchi [Fri, 12 Jun 2015 21:02:44 +0000 (17:02 -0400)]
target: consider addressable unit size when reading/writing memory

If we are reading/writing from a memory object, the length represents
the number of "addresses" to read/write, so the addressable unit size
needs to be taken into account when allocating memory on gdb's side.

gdb/ChangeLog:

* target.c (target_read): Consider addressable unit size when
reading from a memory object.
(read_memory_robust): Same.
(read_whatever_is_readable): Same.
(target_write_with_progress): Consider addressable unit size
when writing to a memory object.
* target.h (target_read): Update documentation.
(target_write): Add documentation.

9 years agogdbarch: add addressable_memory_unit_size method
Simon Marchi [Fri, 12 Jun 2015 20:51:51 +0000 (16:51 -0400)]
gdbarch: add addressable_memory_unit_size method

Add a new gdbarch method to get the length of an addressable memory unit
for a given architecture. The default implementation returns 1.

gdb/ChangeLog:

* arch-utils.h (default_addressable_memory_unit_size): New.
* arch-utils.c (default_addressable_memory_unit_size): New.
* gdbarch.sh (addressable_memory_unit_size): New.
* gdbarch.h: Re-generate.
* gdbarch.c: Re-generate.

9 years agoRemove unused MTMSRD_L macro and re-add accidentally deleted comment.
Peter Bergner [Fri, 12 Jun 2015 20:06:07 +0000 (15:06 -0500)]
Remove unused MTMSRD_L macro and re-add accidentally deleted comment.

In the commit that added PowerPC Pair Singles, Ben accidentally removed
a comment and re-added an unused MTMSRD_L macro Alan had recently deleted.
This was probably just an oversite when he was refreshing his patch to
trunk.

opcodes/
* ppc-opc.c: Add comment accidentally removed by old commit.
(MTMSRD_L): Delete.

9 years agoVarious cleanups in target read/write code
Simon Marchi [Fri, 12 Jun 2015 17:08:12 +0000 (13:08 -0400)]
Various cleanups in target read/write code

This contains various cleanups in the target memory read and write code.
They are not directly related to the non-8-bits changes, but they
clarify things a bit down the line.

gdb/ChangeLog:

* target.c (target_read): Rename variables and use
TARGET_XFER_E_IO.
(target_read_with_progress): Same.
(read_memory_robust): Constify parameters and rename
variables.
(read_whatever_is_readable): Constify parameters,
rename variables, adjust formatting.
* target.h (read_memory_robust): Constify parameters.

9 years agosim: bfin: expand CB_SYS_xxx comment
Mike Frysinger [Fri, 12 Jun 2015 16:12:52 +0000 (12:12 -0400)]
sim: bfin: expand CB_SYS_xxx comment

9 years agosim: update configure.in->configure.ac docs
Mike Frysinger [Fri, 12 Jun 2015 16:04:42 +0000 (12:04 -0400)]
sim: update configure.in->configure.ac docs

A few places still refer to the configure.in file; update them.

9 years agoppc64: Handle short vectors as function return types
Ulrich Weigand [Fri, 12 Jun 2015 15:43:48 +0000 (17:43 +0200)]
ppc64: Handle short vectors as function return types

Short synthetic vector types (i.e. those defined using GCC's
attribute ((vector_size)) instead of AltiVec vector types)
are returned in r3.  Fix ppc64_sysv_abi_return_value to
correctly handle this.

gdb/ChangeLog:

* ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short
synthetic (non-AltiVec) vector types.
(ppc64_sysv_abi_return_value): Likewise.

9 years agosim: drop -DTRACE from configure
Mike Frysinger [Fri, 12 Jun 2015 14:32:54 +0000 (10:32 -0400)]
sim: drop -DTRACE from configure

No code uses this anymore and the symbol conflicts with the new TRACE
helper.  Punt it from configure.

9 years agosim: msp430: use new common trace print helpers
Mike Frysinger [Fri, 12 Jun 2015 14:07:55 +0000 (19:52 +0545)]
sim: msp430: use new common trace print helpers

Replace the "if (TRACE_xxx_P) trace_generic" form with "TRACE_xxx".
The output is the same, but the code is nicer to read.

9 years agoFix MI dprintf-insert not printing on a resolved pending location.
Antoine Tremblay [Fri, 12 Jun 2015 11:58:47 +0000 (07:58 -0400)]
Fix MI dprintf-insert not printing on a resolved pending location.

This patch fixes the "Format string required" error when trying to print
a dprintf on a now resolved, pending location when set via the MI interface
even if the format string is entered correctly.

This patch also adds a test case to check that issue called
mi-dprintf-pending.exp.

gdb/ChangeLog:

PR breakpoints/16465
* breakpoint.c (create_breakpoint): Save extra_string for
pending breakpoints.

gdb/testsuite/ChangeLog:

PR breakpoints/16465
* gdb.mi/mi-dprintf-pending.c: New file.
* gdb.mi/mi-dprintf-pending.exp: New test.
* gdb.mi/mi-dprintf-pendshr.c: New file.

9 years agosim: moxie: use new common trace defines
Mike Frysinger [Fri, 12 Jun 2015 09:53:03 +0000 (15:38 +0545)]
sim: moxie: use new common trace defines

Now that there's common helpers for printing trace data, switch to that
to restore the insn tracing support for this target.

9 years agosim: trace: add common macros for logging info
Mike Frysinger [Thu, 11 Jun 2015 10:28:25 +0000 (18:28 +0800)]
sim: trace: add common macros for logging info

The Blackfin port had some TRACE_xxx macros for easily logging trace data.
Use these as a base for common ones that have a simple form and match the
existing sets of helper macros.

9 years agosim: mips: switch to common WITH_TRACE_ANY_P
Mike Frysinger [Fri, 12 Jun 2015 10:06:35 +0000 (15:51 +0545)]
sim: mips: switch to common WITH_TRACE_ANY_P

We want to add new common trace helpers including "TRACE", so change the
mips one to the new WITH_TRACE_ANY_P macro since they do the same thing.

9 years agosim: trace: add WITH_TRACE_ANY_P helper
Mike Frysinger [Fri, 12 Jun 2015 10:07:07 +0000 (15:52 +0545)]
sim: trace: add WITH_TRACE_ANY_P helper

We have STRACE_ANY_P and TRACE_ANY_P, so add WITH_TRACE_ANY_P to fill
out the API.  This lets us wrap the internal configure symbol.