binutils-gdb.git
9 years agoS/390: ifunc: Handle GOTOFF relocs on ifunc symbols.
Andreas Krebbel [Fri, 16 Oct 2015 19:07:17 +0000 (21:07 +0200)]
S/390: ifunc: Handle GOTOFF relocs on ifunc symbols.

Normally a GOTOFF reloc only uses the GOT pointer to address something
relativ to it without actually requiring a GOT or PLT slot.  Things
change if the target is an ifunc symbol though.

bfd/ChangeLog:

* elf32-s390.c (elf_s390_check_relocs): Fallthrough to the PLT
slot allocating code for GOTOFF relocs on ifunc symbols.
(elf_s390_gc_sweep_hook): Decrement plt refcount for GOTOFF relocs
on ifunc symbols.
(elf_s390_relocate_section): Redirect a GOTOFF reloc to an iplt
slot.

9 years agoS/390: ifunc: Fix PR18841.
Andreas Krebbel [Thu, 22 Oct 2015 08:11:07 +0000 (10:11 +0200)]
S/390: ifunc: Fix PR18841.

In order to get the ifunc relocs properly sorted the correct class
needs to be returned.  The code mimics what has been done for x86.

bfd/ChangeLog:

PR ld/18841
* elf32-s390.c (elf_s390_reloc_type_class): Return
reloc_class_ifunc for ifunc symbols.
* elf64-s390.c (elf_s390_reloc_type_class): Likewise.

9 years agoS/390: ifunc: Fix for undefined ifunc symbols.
Andreas Krebbel [Mon, 12 Oct 2015 15:33:28 +0000 (17:33 +0200)]
S/390: ifunc: Fix for undefined ifunc symbols.

bfd/ChangeLog:

* elf32-s390.c (elf_s390_finish_dynamic_symbol): Call
elf_s390_finish_ifunc_symbol only for actually defined symbols.
* elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.

9 years agoS/390: ifunc: Enable the ifunc tests.
Andreas Krebbel [Mon, 12 Oct 2015 15:34:11 +0000 (17:34 +0200)]
S/390: ifunc: Enable the ifunc tests.

ld/testsuite/ChangeLog:

* ld-ifunc/ifunc.exp: Run ifunc tests on s390* targets.

9 years agoS/390: Get rid of superfluous parameter to s390_elf_allocate_ifunc_dyn_relocs.
Andreas Krebbel [Mon, 19 Oct 2015 11:08:27 +0000 (13:08 +0200)]
S/390: Get rid of superfluous parameter to s390_elf_allocate_ifunc_dyn_relocs.

bfd/ChangeLog:
* elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs): Remove
`head' parameter.
* elf32-s390.c (allocate_dynrelocs): Don't use last parameter.
* elf64-s390.c (allocate_dynrelocs): Don't use last parameter.

9 years agoRun add-symbol test on mips
Alan Modra [Thu, 22 Oct 2015 02:14:24 +0000 (12:44 +1030)]
Run add-symbol test on mips

* binutils-all/add-symbol.d: Run test on mips.  Support either
order of NEW and NEWDATA symbols.

9 years agoFix tests for PR 18500, revisited
Alan Modra [Thu, 22 Oct 2015 00:28:47 +0000 (10:58 +1030)]
Fix tests for PR 18500, revisited

Correct commit a846e9c1.

PR gas/18500
* gas/arm/vfpv2-ldr_immediate.d: Use parentheses, not brackets,
to select alternatives.
* gas/arm/vfpv3-ldr_immediate.d: Likewise.
* gas/arm/vfpv3xd-ldr_immediate.d: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Oct 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix accessing a function's fields (parameters) from Python (PR 18073)
Simon Marchi [Wed, 21 Oct 2015 19:57:22 +0000 (15:57 -0400)]
Fix accessing a function's fields (parameters) from Python (PR 18073)

Since 7.4, gdb doesn't allow calling .fields() on a function type, even
though the documentation states it should return a list corresponding to
the function's parameters.  This patch restores the intended behaviour
and adds a test for it.

Reg-tested on Arch Linux x86-64.

gdb/ChangeLog:

PR python/18073
* python/py-type.c (typy_get_composite): Allow returning a
function type.

gdb/testsuite/ChangeLog:

PR python/18073
* gdb.python/py-type.c (C::a_method): New.
(C::a_const_method): New.
(C::a_static_method): New.
(a_function): New.
* gdb.python/py-type.exp (test_fields): Test getting fields
from function and method.

9 years agofort_dyn_array: add basic fortran dyn array support
Keven Boell [Wed, 21 Oct 2015 19:32:30 +0000 (15:32 -0400)]
fort_dyn_array: add basic fortran dyn array support

Fortran provide types whose values may be dynamically allocated
or associated with a variable under explicit program control.
The purpose of this commit is:

  * to read allocated/associated DWARF tags and store them in
    the dynamic property list of main_type.

  * enable GDB to print the value of a dynamic array in Fortran
    in case the type is allocated or associated (pointer to
    dynamic array).

Examples:
    (gdb) p vla_not_allocated
    $1 = <not allocated>

    (gdb) p vla_allocated
    $1 = (1, 2, 3)

    (gdb) p vla_ptr_not_associated
    $1 = <not associated>

    (gdb) p vla_ptr_associated
    $1 = (1, 2, 3)

Add basic test coverage for most dynamic array use-cases in Fortran.
The commit contains the following tests:
  * Ensure that values of Fortran dynamic arrays
    can be evaluated correctly in various ways and states.
  * Ensure that Fortran primitives can be evaluated
    correctly when used as a dynamic array.
  * Dynamic arrays passed to subroutines and handled
    in different ways inside the routine.
  * Ensure that the ptype of dynamic arrays in
    Fortran can be printed in GDB correctly.
  * Ensure that dynamic arrays in different states
    (allocated/associated) can be evaluated.
  * Dynamic arrays passed to functions and returned from
    functions.
  * History values of dynamic arrays can be accessed and
    printed again with the correct values.
  * Dynamic array evaluations using MI protocol.
  * Sizeof output of dynamic arrays in various states.

The patch was tested using the test suite on Ubuntu 12.04 64bit.

gdb/ChangeLog:

        * dwarf2read.c (set_die_type): Add read of
        DW_AT_allocated and DW_AT_associated.
        * f-typeprint.c: New include of typeprint.h
        (f_print_type): Add check for allocated/associated
        status of type.
        (f_type_print_varspec_suffix): Add check for
        allocated/associated status of type.
        * gdbtypes.c (create_array_type_with_stride):
        Add check for valid data location of type in
        case allocated or associated attributes are set.
        Length of an array should be only calculated if
        allocated or associated is resolved as true.
        (is_dynamic_type_internal): Add check for allocated/
        associated.
        (resolve_dynamic_array): Evaluate allocated/associated
        properties.
        * gdbtypes.h (enum dynamic_prop_node_kind): <DYN_PROP_ALLOCATED>
        <DYN_PROP_ASSOCIATED>: New enums.
        (TYPE_ALLOCATED_PROP, TYPE_ASSOCIATED_PROP): New macros.
        (type_not_allocated): New function.
        (type_not_associated): New function.
        * valarith.c (value_subscripted_rvalue): Add check for
        allocated/associated.
        * valprint.c: New include of typeprint.h.
        (valprint_check_validity): Add check for allocated/associated.
        (value_check_printable): Add check for allocated/
        associated.
        * typeprint.h (val_print_not_allocated): New function.
        (val_print_not_associated): New function.
        * typeprint.c (val_print_not_allocated): New function.
        (val_print_not_associated): New function.

gdb/testsuite/ChangeLog:

        * gdb.fortran/vla-alloc-assoc.exp: New file.
        * gdb.fortran/vla-datatypes.exp: New file.
        * gdb.fortran/vla-datatypes.f90: New file.
        * gdb.fortran/vla-history.exp: New file.
        * gdb.fortran/vla-ptype-sub.exp: New file.
        * gdb.fortran/vla-ptype.exp: New file.
        * gdb.fortran/vla-sizeof.exp: New file.
        * gdb.fortran/vla-sub.f90: New file.
        * gdb.fortran/vla-value-sub-arbitrary.exp: New file.
        * gdb.fortran/vla-value-sub-finish.exp: New file.
        * gdb.fortran/vla-value-sub.exp: New file.
        * gdb.fortran/vla-value.exp: New file.
        * gdb.fortran/vla-ptr-info.exp: New file.
        * gdb.mi/mi-vla-fortran.exp: New file.
        * gdb.mi/vla.f90: New file.

9 years agoAdjust timeout in gdb.base/freebpcmd.exp.
Sandra Loosemore [Wed, 21 Oct 2015 16:54:49 +0000 (09:54 -0700)]
Adjust timeout in gdb.base/freebpcmd.exp.

2015-10-21  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/freebpcmd.exp: Use with_timeout_factor instead
of hardwired timeout value.

9 years agoFix tests for PR 18500 so that they will pass for big-endian ARM toolchains.
Nick Clifton [Wed, 21 Oct 2015 16:25:28 +0000 (17:25 +0100)]
Fix tests for PR 18500 so that they will pass for big-endian ARM toolchains.

PR gas/18500
* gas/arm/vfpv3xd-ldr_immediate.d: Update test for big-endian ARM
toolchains.
* gas/arm/vfpv3-ldr_immediate.d: Likewise.
* gas/arm/vfpv2-ldr_immediate.d: Likewise.

9 years agoSupport software breakpoints for ARM linux in GDBServer.
Antoine Tremblay [Wed, 21 Oct 2015 15:13:42 +0000 (11:13 -0400)]
Support software breakpoints for ARM linux in GDBServer.

This patch enables software breakpoints via GDB's Z0 packets on ARM.

No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:

* linux-arm-low.c (arm_supports_z_point_type): Add software
breakpoint support.

9 years agoRefactor the breakpoint definitions in linux-arm-low.c.
Antoine Tremblay [Wed, 21 Oct 2015 15:13:42 +0000 (11:13 -0400)]
Refactor the breakpoint definitions in linux-arm-low.c.

Before arm_sw_breakpoint_from_kind would use an #ifdef to return the right
arm_breakpoint from the abi or eabi breakpoint type.

arm_breakpoint_at would also check for the arm_breakpoint ||
arm_eabi_breakpoint.

Thus the selected arm_breakpoint would be what arm_sw_breakpoint_from_kind
returned and arm_breakpoint was arm_abi_breakpoint.

This patch makes it more clear by naming those for what they are : 2 separate
entities: arm_abi_breakpoint and arm_eabi_breakpoint and set the current used
one as arm_breakpoint.

This allows a cleaner arm_sw_breakpoint_from_kind as it just returns
arm_breakpoint rather than having the #ifdef in that function.

Any other reference to the arm_breakpoint can now also be clear of #ifdefs...

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:

* linux-arm-low.c: Refactor breakpoint definitions.
(arm_breakpoint_at): Adjust for arm_abi_breakpoint.
(arm_sw_breakpoint_from_kind): Adjust for arm_breakpoint.

9 years agoImplement breakpoint_kind_from_pc and sw_breakpoint_from_kind for ARM in GDBServer.
Antoine Tremblay [Wed, 21 Oct 2015 15:13:41 +0000 (11:13 -0400)]
Implement breakpoint_kind_from_pc and sw_breakpoint_from_kind for ARM in GDBServer.

ARM can have multiple breakpoint types based on the instruction set
it's currently in: arm, thumb or thumb2.

GDBServer needs to know what breakpoint is to be inserted at location
when inserting a breakpoint.

This is handled by the breakpoint_kind_from_pc and sw_breakpoint_from_kind
target ops introduced in a previous patch, this patch adds the
arm_breakpoint_kind_from_pc and arm_sw_breakpoint_from_kind implementation so
that the proper breakpoint type is returned based on the pc.

Also in order to share some code with GDB a new file called arm.c have been
introduced in arch/.

While this file does not contain much yet future patches will add more
to it thus the inclusion at this stage.

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/ChangeLog:

* Makefile.in: Add arm.c/o.
* arch/arm.c: New file.
* arch/arm.h: (IS_THUMB_ADDR): Move macro from arm-tdep.c.
(MAKE_THUMB_ADDR): Likewise.
(UNMAKE_THUMB_ADDR): Likewise.
* arm-tdep.c (int thumb_insn_size): Move to arm.c.
(IS_THUMB_ADDR): Move to arm.h.
(MAKE_THUMB_ADDR): Likewise.
(UNMAKE_THUMB_ADDR): Likewise.
* configure.tgt: Add arm.o to all ARM configs.

gdb/gdbserver/ChangeLog:

* Makefile.in: Add arm.c/o.
* configure.srv: Likewise.
* linux-arm-low.c (arm_breakpoint_kinds): New enum.
(arm_breakpoint_kind_from_pc): New function.
(arm_sw_breakpoint_from_kind): Return proper kind.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize.

9 years agoSupport breakpoint kinds for software breakpoints in GDBServer.
Antoine Tremblay [Wed, 21 Oct 2015 15:13:40 +0000 (11:13 -0400)]
Support breakpoint kinds for software breakpoints in GDBServer.

There's two ways to set breakpoints in GDBServer.

 - GDBServer setting its own breakpoints, through API set_breakpoint_at.

 - GDBServer setting breakpoints according to the information in Z
   packets, through API set_gdb_breakpoint.

Before this patch the breakpoint kinds were a concept unique to GDB and Z
packets, as GDBServer never had to set different kinds of breakpoint on its
own.

This patch teaches GDBServer to handle breakpoint kinds for its own
breakpoints. It generalizes the breakpoint kind as per Z packets to
represent different kinds of breakpoints directly set by GDBServer also.

GDBServer now querys breakpoint_kind_from_pc to know what breakpoint kind to
set on its own.

As the kind is now a differentiating factor equivalent to size for the
breakpoint struct and that it's size can be queried using
sw_breakpoint_from_kind, the size field has been replaced with the kind field.
All references to size are now replaced by kind or a call to bp_size that wraps
sw_breakpoing_from_kind and returns the size of the breakpoint in memory.

To fetch the software breakpoint data bp_opcode is called and wraps the
sw_breakpoint_from_kind call.

No regressions on Ubuntu 14.04 on ARMv7 and x86.
With gdbserver-{native,extended} / { -marm -mthumb }

gdb/gdbserver/ChangeLog:

* linux-low.c (initialize_low): Ajdust for breakpoint global variables
removal.
* mem-break.c : Remove breakpoint_data/breakpoint_len global variables.
(struct raw_breakpoint) <size>: Remove.
(struct raw_breakpoint) <kind>: Add.
(bp_size): New function.
(bp_opcode): Likewise.
(find_raw_breakpoint_at): Adjust for kind.
(insert_memory_breakpoint): Adjust for kind call bp_size,bp_opcode.
(remove_memory_breakpoint): Adjust for kind call bp_size.
(set_raw_breakpoint_at): Adjust for kind.
(set_breakpoint): Likewise.
(set_breakpoint_at): Call breakpoint_kind_from_pc.
(delete_raw_breakpoint): Adjust for kind.
(delete_breakpoint): Likewise.
(find_gdb_breakpoint): Likewise.
(set_gdb_breakpoint_1): Likewise.
(set_gdb_breakpoint): Likewise.
(delete_gdb_breakpoint_1): Likewise.
(delete_gdb_breakpoint): Likewise.
(uninsert_raw_breakpoint): Likewise.
(reinsert_raw_breakpoint): Likewise.
(set_breakpoint_data): Remove.
(validate_inserted_breakpoint): Adjust for kind call bp_size,bp_opcode.
(check_mem_read): Adjust for kind call bp_size.
(check_mem_write): Adjust for kind call bp_size,bp_opcode.
(clone_one_breakpoint): Adjust for kind.
* mem-break.h (set_gdb_breakpoint): Likewise.
(delete_gdb_breakpoint): Likewise.
* server.c (process_serial_event): Likewise.

9 years agoAdd the target_ops needed for software breakpoints in GDBServer.
Antoine Tremblay [Wed, 21 Oct 2015 15:17:26 +0000 (11:17 -0400)]
Add the target_ops needed for software breakpoints in GDBServer.

This patch is in preparation for software breakpoints on ARM linux.  It
refactors breakpoint and breakpoint_len into breakpoint_kind_from_pc and
sw_breakpoint_from kind to prepare the case where we have multiple types of
breakpoints.

Kind is the type of breakpoint (hardware or software) to be inserted, usually it
is the lenght of the software breakpoint but can be something else depending on
the target.

This patch introduces the linux_target_ops breakpoint_kind_from_pc and
sw_breakpoint_from_kind.

breakpoint_kind_from_pc returns the breakpoint kind and adjusts the PC to the
real memory location in case a flag was present in the PC. E.g the instruction
mode on ARM.

sw_breakpoint_from_kind returns the software breakpoint for this kind as a
string of bytes, the length of the breakpoint is adjusted for the breakpoint's
size in memory.

For targets that have only one kind of breakpoint, the default value 0 is
returned by linux_breakpoint_kind_from_pc so that not all targets need to
implement the breakpoint_kind_from_pc operation.

No regressions, tested on Ubuntu 14.04 on ARMv7 and x86
With gdbserver-{native,extended} / { -marm -mthumb }

Also since the target_ops have been changed compilation was tested on
affected archs namely : aarch64, arm, bfin, cris, crisv32, m32r,
m68k, mips, nios2, ppc, s390, sparc, tic6x, tile, x86, steins.

Not tested : sh

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-arm-low.c (arm_breakpoint_kind_from_pc): New function.
(arm_sw_breakpoint_from_kind): New function.
* linux-bfin-low.c (bfin_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-cris-low.c (cris_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-crisv32-low.c (cris_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-low.c (linux_wait_1): Call breakpoint_kind_from_pc
and sw_breakpoint_from_kind to increment the pc.
(linux_breakpoint_kind_from_pc): New function.
(linux_sw_breakpoint_from_kind): New function.
(struct target_ops) <sw_breakpoint_from_kind>: Initialize field.
(initialize_low): Call breakpoint_kind_from_pc and
sw_breakpoint_from_kind to replace breakpoint_data/len.
* linux-low.h (struct linux_target_ops) <breakpoint_kind_from_pc>:
New field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Likewise.
* linux-m32r-low.c (m32r_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-m68k-low.c (m68k_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-mips-low.c (mips_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-nios2-low.c (nios2_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-ppc-low.c (ppc_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-s390-low.c (s390_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-sh-low.c (sh_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-sparc-low.c (sparc_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-tic6x-low.c (tic6x_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-tile-low.c (tile_sw_breakpoint_from_kind): New function.
* linux-x86-low.c (x86_sw_breakpoint_from_kind): New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.
* linux-xtensa-low.c (xtensa_sw_breakpoint_from_kind) New function.
(struct linux_target_ops) <breakpoint>: Remove.
(struct linux_target_ops) <breakpoint_len>: Remove.
(struct linux_target_ops) <breakpoint_kind_from_pc>: Initialize field.
(struct linux_target_ops) <sw_breakpoint_from_kind>: Initialize field.

9 years agoFix typo in spelling of author's name.
Ronald Hoogenboom [Wed, 21 Oct 2015 15:20:02 +0000 (16:20 +0100)]
Fix typo in spelling of author's name.

9 years agoRemove checking vCont;s in exec_cmd_expect_vCont_count
Yao Qi [Wed, 21 Oct 2015 15:16:25 +0000 (16:16 +0100)]
Remove checking vCont;s in exec_cmd_expect_vCont_count

Nowadays, in the range-stepping tests, we check not only the number of
vCont;r packets but also the number of vCont;s packets, because we think
the remote target which can do range stepping must support single step.

However, if we turn displaced stepping on, the remote target (GDBserver)
can do range stepping, and support single step, but GDB may decide to
resume instructions in the scratchpad rather than single step them one
by one for displaced stepping.  For example, when aarch64 GDB debugs
arm linux program with aarch64 GDBserver, GDBserver supports both range
stepping and single step, but GDB (with the gdbarch for arm-linux)
decides resume instructions in the scratchpad, so in the RSP traffic,
there is no vCont;s packet at all, and some range-stepping.exp tests
fail,

FAIL: gdb.base/range-stepping.exp: multi insns: next: vCont;s=1 vCont;r=1

This patch is to get rid of the checking to the number of vCont;s in
exec_cmd_expect_vCont_count.

gdb/testsuite:

2015-10-21  Yao Qi  <yao.qi@linaro.org>

* lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
Remove argument exp_vCont_s.
* gdb.base/range-stepping.exp: Callers updated.
* gdb.trace/range-stepping.exp: Likewise.

9 years ago[nto] Improve ABI sniffing.
Aleksandar Ristovski [Wed, 21 Oct 2015 14:37:33 +0000 (10:37 -0400)]
[nto] Improve ABI sniffing.

Use qnx specific notes to figure out the OS.

gdb/ChangeLog:
* gdb/nto-tdep.c (QNX_NOTE_NAME, QNX_INFO_SECT_NAME): New defines.
(nto_sniff_abi_note_section): New function.
(nto_elf_osabi_sniffer): Use new function to recognize nto specific
binary.

9 years ago[nto] Fix nto target stopped by watchpoint.
Aleksandar Ristovski [Wed, 21 Oct 2015 14:37:33 +0000 (10:37 -0400)]
[nto] Fix nto target stopped by watchpoint.

Fix 'stopped by watchpoint' detection: add inferior data, use inferior data
for storing last stopped flags needed for detection.

gdb/ChangeLog:

* nto-procfs.c (procfs_wait): Set stopped_flags nad stopped_pc.
(procfs_stopped_by_watchpoint): Use flags stored in inferior data.
* nto-tdep.c (nto_new_inferior_data_reg): New definition.
(nto_new_inferior_data, nto_inferior_data_cleanup, nto_inferior_data):
New functions.
(_initialize_nto_tdep): New forward declaration, new function.
* nto-tdep.h (struct nto_inferior_data): New struct.
(nto_inferior_data): New function declaration.

9 years agoAdd ability for objcopy to insert new symbols into a binary.
Ronald Hoogenbllon [Wed, 21 Oct 2015 14:16:35 +0000 (15:16 +0100)]
Add ability for objcopy to insert new symbols into a binary.

PR binutils/19104
binutils * objcopy.c (command_line_switch): Add OPTION_ADD_SYMBOL.
(copy_options): Add add-symbol.
(copy_usage): Likewise.
(parse_symflags): New function.
(need_sym_before): New function.
(create_new_symbol): New function.
(filter_symbols): Add code to insert new symbols.
(copy_main): Process OPTION_ADD_SYMBOL.
* doc/binutils.texi: Document new feature.
* NEWS: Add note about the new feature.

tests * binutils-all/add-symbol.d: New test.
* binutils-all/objcopy.exp: Run the new test.

9 years agoExtend description of the --enable-compressed-debug-sections configure option in...
Nick Clifton [Wed, 21 Oct 2015 13:57:28 +0000 (14:57 +0100)]
Extend description of the --enable-compressed-debug-sections configure option in gas and ld.

9 years agoReset x86 Linux targets to not compressing debug sections by default. Enable compres...
Nick Clifton [Wed, 21 Oct 2015 12:12:19 +0000 (13:12 +0100)]
Reset x86 Linux targets to not compressing debug sections by default.  Enable compression of debug sections by default in the linker, if so configured.

PR gas/19109
. * configure.ac: Note the 'none' is an acceptable argument to
--enable-compressed-debug-sections.
* configure: Regenerate.

gas * configure.ac: Restore --enable-compressed-debug-sections.
Do not enable compressed debug sections by default for x86 Linux
targets.
* configure: Regenerate.

ld * configure.ac: Add --enable-compressed-debug-sections.
* configure: Regenerate.
* config.in: Regenerate.
* ld.texinfo: Document how to determine the default action for
debug sections.
* ldmain.c (main): If DEFAULT_FLAG_COMPRESS_DEBUG is defined then
set the compress_debug field of the link_info structure to
zlib-gabi.
* lexsup.c (elf_static_list_options): Output the default setting
for the --compress-debug-sections option.
* NEWS: Mention the new configure option.

9 years agoFix --host cris-*-linux build of GDBServer.
Antoine Tremblay [Wed, 21 Oct 2015 11:44:26 +0000 (07:44 -0400)]
Fix --host cris-*-linux build of GDBServer.

Compiling GDBServer with --host cris-*-linux yields a compilation error :

linux-cris-low.c:65:21: error: ‘void’ must be the only parameter

This patch fixes the issue by removing the void parameter in cris_get_pc.

gdb/gdbserver/ChangeLog:
* linux-cris-low.c (cris_get_pc): Remove void arg.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Oct 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix internal error on DW_OP_bregx(-1)
Jan Kratochvil [Tue, 20 Oct 2015 18:40:38 +0000 (20:40 +0200)]
Fix internal error on DW_OP_bregx(-1)

https://bugzilla.redhat.com/show_bug.cgi?id=1270564#c15
https://bugzilla.redhat.com/attachment.cgi?id=1081772

clang-3.5.0-9.fc22.x86_64
 <3><22b2>: Abbrev Number: 69 (DW_TAG_variable)
    <22b3>   DW_AT_location    : 7 byte block: 92 ff ff ff ff f 0 (DW_OP_bregx: 4294967295 (r-1) 0)
    <22bb>   DW_AT_name        : (indirect string, offset: 0x2a36): texture_data
    <22c1>   DW_AT_type        : <0x1d3>

(gdb) p variable
warning: Unmapped DWARF Register #-1 encountered.
regcache.c:177: internal-error: register_size: Assertion `regnum >= 0 && regnum < (gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs
(gdbarch))' failed.
[...]
Quit this debugging session? (y or n) FAIL: gdb.dwarf2/dw2-regno-invalid.exp: p variable (GDB internal error)

-> (x86_64)
(gdb) p variable
warning: Unmapped DWARF Register #-1 encountered.
Invalid register #-1, expecting 0 <= # < 220
(gdb) PASS: gdb.dwarf2/dw2-regno-invalid.exp: p variable
-> (i386)
(gdb) p variable
Invalid register #104, expecting 0 <= # < 104
(gdb) PASS: gdb.dwarf2/dw2-regno-invalid.exp: p variable

GDB calls gdbarch_dwarf2_reg_to_regnum() first which returns -1 in the x86_64
case
  if (regnum == -1)
    warning (_("Unmapped DWARF Register #%d encountered."), reg);
but in i386 case it does:
  /* This will hopefully provoke a warning.  */
  return gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
and the default implementation is a nop, leaving whatever register number
the DWARF specified.

gdb/ChangeLog
2015-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

* findvar.c (address_from_register): Check REGNUM validity.

gdb/testsuite/ChangeLog
2015-10-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Pedro Alves  <palves@redhat.com>

* gdb.dwarf2/dw2-regno-invalid.exp: New file.
* lib/dwarf.exp (Dwarf): Add DW_OP_bregx.

9 years agoFeed right input object to x86_64_mov_to_lea1[12]
H.J. Lu [Tue, 20 Oct 2015 17:43:33 +0000 (10:43 -0700)]
Feed right input object to x86_64_mov_to_lea1[12]

x86_64_mov_to_lea1.o is a 64-bit x86-64 object and x86_64_mov_to_lea2.o
is a 32-bit x86-64 object.  x86_64_mov_to_lea11 should use
x86_64_mov_to_lea2.o and x86_64_mov_to_lea12 should use
x86_64_mov_to_lea1.o.

* testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
(x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
x86_64_mov_to_lea1.o.
* testsuite/Makefile.in: Regenerated.

9 years ago[nto] Implement procfs_pid_to_exec_file.
Aleksandar Ristovski [Tue, 20 Oct 2015 17:11:53 +0000 (13:11 -0400)]
[nto] Implement procfs_pid_to_exec_file.

gdb/ChangeLog:

* gdb/nto-procfs.c (procfs_pid_to_exec_file): New function.
(init_procfs_targets): Wire new function.

9 years ago[nto] Implement TARGET_OBJECT_AUXV.
Aleksandar Ristovski [Tue, 20 Oct 2015 16:58:47 +0000 (12:58 -0400)]
[nto] Implement TARGET_OBJECT_AUXV.

Fix 'info auxv' for nto.

gdb/ChangeLog:

* nto-procfs.c (sys/auxv.h): Include.
(procfs_xfer_partial): Implement TARGET_OBJECT_AUXV.
* nto-tdep.c (nto_read_auxv_from_initial_stack): New function.
* nto-tdep.h (nto_read_auxv_from_initial_stack): New declaration.

9 years ago[nto] Fixes for nto procfs.
Aleksandar Ristovski [Tue, 20 Oct 2015 16:58:46 +0000 (12:58 -0400)]
[nto] Fixes for nto procfs.

Fix errnoeus construction of procfs path. The issue is, after the first
info pidlist or first run, the path for local node (the most common node)
will be reset to empty which makes subsequent queries and runs impossible.

gdb/ChangeLog:

* nto-procfs.c (nto_procfs_path): Rename to...
(nodestr): ... this, and change type.
(nto_node): Use new variable and logic accordingly.
(procfs_open_1): Use new variable name. Use local buffer to construct
procfrs path.
(procfs_pidlist): Use NODESTR to construct procfs path.
(procfs_files_info): Use NODESTR to output meaningful text.
(do_attach): Construct procfs using NODESTR.
(procfs_create_inferior): Compare pointer to NULL.

9 years agoAdd --enable-compressed-debug-sections={all,gas,gold,ld}
H.J. Lu [Tue, 20 Oct 2015 15:58:10 +0000 (08:58 -0700)]
Add --enable-compressed-debug-sections={all,gas,gold,ld}

This patch removes the gas configure option:

--enable-compressed-debug-sections

and adds a toplevel configure option:

--enable-compressed-debug-sections={all,gas,gold,ld}

to enable compressed debug sections for gas, gold or ld by default.  At
the moment, this configure option is ignored by gold and ld.  For x86
Linux targets, default to compressing debug sections in gas.

PR gas/19109
* configure.ac: Add
--enable-compressed-debug-sections={all,gas,gold,ld}.
* configure: Regenerated.

gas/

PR gas/19109
* NEWS: Update --enable-compressed-debug-sections=.
* configure.ac: Remove --enable-compressed-debug-sections.
(DEFAULT_FLAG_COMPRESS_DEBUG): Check
--enable-compressed-debug-sections={all,gas} instead of
--enable-compressed-debug-sections.  For x86 Linux targets,
default to compressing debug sections.
* configure: Regenerated.

9 years agoCorrect printed value of Main in mmo.c consistency error message.
Hans-Peter Nilsson [Tue, 20 Oct 2015 04:56:33 +0000 (06:56 +0200)]
Correct printed value of Main in mmo.c consistency error message.

9 years agogdb: Improve syscall entry/return tracking on Linux
Josh Stone [Tue, 20 Oct 2015 00:59:38 +0000 (17:59 -0700)]
gdb: Improve syscall entry/return tracking on Linux

The existing logic was simply to flip syscall entry/return state when a
syscall trap was seen, and even then only with active 'catch syscall'.
That can get out of sync if 'catch syscall' is toggled at odd times.

This patch updates the entry/return state for all syscall traps,
regardless of catching state, and also updates known syscall state for
other kinds of traps.  Almost all PTRACE_EVENT stops are delivered from
the middle of a syscall, so this can act like an entry.  Every other
kind of ptrace stop is only delivered outside of syscall event pairs, so
marking them ignored ensures the next syscall trap looks like an entry.

Three new test scenarios are added to catch-syscall.exp:

- Disable 'catch syscall' from an entry to deliberately miss the return
  event, then re-enable to make sure a new entry is recognized.

- Enable 'catch syscall' for the first time from a vfork event, which is
  a PTRACE_EVENT_VFORK in the middle of the syscall.  Make sure the next
  syscall event is recognized as the return.

- Make sure entry and return are recognized for an ENOSYS syscall.  This
  is to defeat a common x86 hack that uses the pre-filled ENOSYS return
  value as a sign of being on the entry side.

gdb/ChangeLog:

2015-10-19  Josh Stone  <jistone@redhat.com>

* linux-nat.c (linux_handle_syscall_trap): Always update entry/
return state, even when not actively catching syscalls at all.
(linux_handle_extended_wait): Mark syscall_state like an entry.
(wait_lwp): Set syscall_state ignored for other traps.
(linux_nat_filter_event): Likewise.

gdb/testsuite/ChangeLog:

2015-10-19  Josh Stone  <jistone@redhat.com>

* gdb.base/catch-syscall.c: Include <sched.h>.
(unknown_syscall): New variable.
(main): Trigger a vfork and an unknown syscall.
* gdb.base/catch-syscall.exp (vfork_syscalls): New variable.
(unknown_syscall_number): Likewise.
(check_call_to_syscall): Accept an optional syscall pattern.
(check_return_from_syscall): Likewise.
(check_continue): Likewise.
(test_catch_syscall_without_args): Check for vfork and ENOSYS.
(test_catch_syscall_skipping_return): New test toggling off 'catch
syscall' to step over the syscall return, then toggling back on.
(test_catch_syscall_mid_vfork): New test turning on 'catch syscall'
during a PTRACE_EVENT_VFORK stop, in the middle of a vfork syscall.
(do_syscall_tests): Call test_catch_syscall_without_args and
test_catch_syscall_mid_vfork.
(test_catch_syscall_without_args_noxml): Check for vfork and ENOSYS.
(fill_all_syscalls_numbers): Initialize unknown_syscall_number.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Oct 2015 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMake GDB wait for events after handling target File-I/O
Luis Machado [Mon, 19 Oct 2015 13:33:19 +0000 (11:33 -0200)]
Make GDB wait for events after handling target File-I/O

_ftext () at arm-vector.S:25
25              ldr pc, [pc, #24] @ reset
(gdb) load
Loading section .text, size 0xc01c lma 0x0
Loading section .eh_frame, size 0x48 lma 0xc01c
Loading section .ARM.exidx, size 0x8 lma 0xc064
Loading section .rodata, size 0x398 lma 0xc070
Loading section .data, size 0x8e0 lma 0xc408
Start address 0x40, load size 52452
Transfer rate: 17074 KB/sec, 1748 bytes/write.
(gdb) c
Continuing.
infrun: clear_proceed_status_thread (Thread 1)
infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 1] at 0x40
Sending packet: $vCont?#49...Ack
Packet received:
Packet vCont (verbose-resume) is NOT supported
Sending packet: $Hc0#db...Ack
Packet received: OK
Sending packet: $c#63...Ack
infrun: infrun_async(1)
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [Thread 0],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: Ffstat,00000001,07fffdb0
Sending packet: $M7fffdb0,40:000000000000000000002080000000010000c336000001180000000000000000000000000000000000000200000000000000000055dfb11b55dfb11b55dfb11b#5a...Ack
Packet received: OK
Sending packet: $F0#76...Ack
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [Thread 0],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [Thread 0],
infrun:   status->kind = no-resumed
infrun: TARGET_WAITKIND_NO_RESUMED
infrun: stop_waiting
infrun: clear_step_over_info
Sending packet: $qfThreadInfo#bb...Ack
Packet received: m1
Sending packet: $qsThreadInfo#c8...Ack
Packet received: l
No unwaited-for children left.
infrun: infrun_async(0)
(gdb) c
Continuing.
Cannot execute this command while the selected thread is running.
(gdb)
Continuing.
Cannot execute this command while the selected thread is running.

This behavior shows up whenever GDB is in all-stop mode and is handling
target-initiated File-I/O requests, in the middle of, say, a continue
request.

When GDB is done handling the File-I/O request, it doesn't set
rs->waiting_for_stop_reply back to 1, meaning GDB should wait for
further target events.

This seems to be a latent bug, because in the past this didn't really
cause any issues. But it seems to have been uncovered by commit
567420d10895611e03d5ee65e6b24c16a69a6e99, which explicitly checks
for rs->waiting_for_stop_reply == 0, triggering the failures above.

The following patch fixes this by reorganizing the setting of
rs->waiting_for_stop_reply.

infrun: prepare_to_wait
Packet received: Ffstat,00000001,07fffdb0
Sending packet: $M7fffdb0,40:000000000000000000002080000000010000c336000001180000000000000000000000000000000000000200000000000000000055dfb19e55dfb19e55dfb19e#7b...Ack
Packet received: OK
Sending packet: $F0#76...Ack
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [Thread 0],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: Fisatty,00000001
Sending packet: $F1#77...Ack
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [Thread 0],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: Fwrite,00000001,0000d098,00000004
Sending packet: $md098,4#d2...Ack
Packet received: 3732300a
720
Sending packet: $F4#7a...Ack
infrun: target_wait (-1.0.0, status) =
infrun:   -1.0.0 [Thread 0],
infrun:   status->kind = ignore
infrun: TARGET_WAITKIND_IGNORE
infrun: prepare_to_wait
Packet received: Fwrite,00000001,07ffffac,00000011
Sending packet: $m7ffffac,11#8e...Ack
Packet received: 0a2a2a2a204558495420636f646520300a

*** EXIT code 0

Regression-tested on Ubuntu x86-64 and qemu-system-based debugging
for arm eabi.

gdb/ChangeLog:

2015-10-16  Luis Machado  <lgustavo@codesourcery.com>

* remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to 0
when handling 'E', 'T', 'S', 'X' and 'W' packets.
Do not set rs->waiting_for_stop_reply back to 1.

9 years agoAdd test to ensure that ternary linker script operators copy symbol flags.
Simon Dardis [Mon, 19 Oct 2015 13:32:54 +0000 (14:32 +0100)]
Add test to ensure that ternary linker script operators copy symbol flags.

* ld-elf/attributes.d: New test for symbol attribute copying.
* ld-elf/attributes.ld: Part of above.
* ld-elf/attributes.s: Likewise.

9 years agoAdd a gas configure option to select the default behaviour for the generation of...
Nick Clifton [Mon, 19 Oct 2015 10:45:54 +0000 (11:45 +0100)]
Add a gas configure option to select the default behaviour for the generation of debug sections - compressed or uncompressed.

PR gas/19109
* configure.ac: Add option --enable-compressed-debug-sections.
This sets the default behaviour for compressing debug sections.
* as.c (flag_compress_debug): Define and initialise to
COMPRESS_DEBUG_GABI_ZLIB if DEFAULT_COMPRESS_DEBUG is set.
(show_usage): Indicate whether --no-compress-debug-sections
or --compress-debug-sections is the default.
* config/tc-i386.c (flag_compress_debug): Delete definition.
* doc/as.texinfo (--nocompress-debug-sectionas): Update
description.
* NEWS: Announce the new feature.
* config.in: Regenerate.
* configure: Regenerate.

9 years agoFixup comments oops in last commit.
Andrew Stubbs [Mon, 19 Oct 2015 10:21:52 +0000 (11:21 +0100)]
Fixup comments oops in last commit.

9 years agoRobustify inherit.exp and virtbase.exp.
Andrew Stubbs [Thu, 15 Oct 2015 15:54:37 +0000 (16:54 +0100)]
Robustify inherit.exp and virtbase.exp.

2015-10-19  Andrew Stubbs  <ams@codesourcery.com>

gdb/testsuite/
* gdb.cp/inherit.exp (print g_vB, print g_vC, print g_vD,
print g_vE): Add new pass patterns.
* gdb.cp/virtbase.exp (print *this, print *(D *) e): Allow GDB to
print various symbol names for vptr fields.

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

9 years agotargets.c (bfd_flavour_name): "MMO" is spelled "mmo".
Doug Evans [Sun, 18 Oct 2015 20:13:07 +0000 (13:13 -0700)]
targets.c (bfd_flavour_name): "MMO" is spelled "mmo".

bfd/ChangeLog:

* targets.c (bfd_flavour_name): "MMO" is spelled "mmo".

9 years agoFix PR binutils/19147 -- off by one when printing NT_FILE note.
Paul Pluzhnikov [Sun, 18 Oct 2015 16:39:25 +0000 (09:39 -0700)]
Fix PR binutils/19147 -- off by one when printing NT_FILE note.

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Oct 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoCorrect powerpc64le __glink_PLTresolve .eh_frame FDE
Alan Modra [Sat, 17 Oct 2015 09:31:15 +0000 (20:01 +1030)]
Correct powerpc64le __glink_PLTresolve .eh_frame FDE

* elf64-ppc.c (ppc64_elf_size_stubs): Correct __glink_PLTresolve
eh_frame FDE for ELFv1.

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

9 years ago[nto] Fix nto build.
Aleksandar Ristovski [Fri, 16 Oct 2015 15:29:17 +0000 (11:29 -0400)]
[nto] Fix nto build.

gdb/gdbserver/ChangeLog:

* gdbserver/nto-low.c (nto_insert_point, nto_remove_point): Fix
variable name.

gdb/ChangeLog:

* nto-procfs.c (common/filestuff.h): Include.
(procfs_can_use_hw_breakpoint): Fix enum name.
(procfs_open_1): Fix compiler warning.
(procfs_pidlist): Make static.
(procfs_meminfo): Make static, fix type name, add missing argument.
(procfs_store_registers): Make static.
(procfs_thread_info): Remove unused function.
(_initialize_procfs): Forward declare.

9 years agogdbserver: Reset current_thread when the thread is removed.
Aleksandar Ristovski [Fri, 16 Oct 2015 15:12:21 +0000 (11:12 -0400)]
gdbserver: Reset current_thread when the thread is removed.

Reset current_thread and make sure 'remove_process' is used
after all associated threads have been removed first.

gdb/gdbserver/ChangeLog:
* inferiors.c (thread_pid_matches_callback): New function.
(find_thread_process): New function.
(remove_thread): Reset current_thread.
(remove_process): Assert threads have been removed first.

9 years agogdbserver: Reset current_thread when the thread is removed.
Aleksandar Ristovski [Fri, 16 Oct 2015 15:08:38 +0000 (11:08 -0400)]
gdbserver: Reset current_thread when the thread is removed.

Reset current_thread and make sure 'remove_process' is used
after all associated threads have been removed first.

gdb/gdbserver/ChangeLog:
* inferiors.c (thread_pid_matches_callback): New function.
(find_thread_process): New function.
(remove_thread): Reset current_thread.
(remove_process): Assert threads have been removed first.

9 years agoDon't ignore "-m emulation" command line option
H.J. Lu [Fri, 16 Oct 2015 15:04:58 +0000 (08:04 -0700)]
Don't ignore "-m emulation" command line option

Gold shouldn't ignore "-m emulation" command line option, which may
lead to incorrect output.

PR gold/19119
* options.h (General_options): Remove "obsolete" from -m.
* parameters.cc (set_parameters_target): Check if input target
is compatible with output emulation set by "-m emulation".

9 years agoMAINTAINERS: Fix my inconsistent email address
Yao Qi [Fri, 16 Oct 2015 11:22:45 +0000 (12:22 +0100)]
MAINTAINERS: Fix my inconsistent email address

Hi,
This patch fixes inconsistency in my email address.

2015-10-16  Yao Qi  <yao.qi@arm.com>

* MAINTAINERS: Update my email address.

9 years agoCheck if symbol is defined when converting mov to lea
H.J. Lu [Fri, 16 Oct 2015 11:17:49 +0000 (04:17 -0700)]
Check if symbol is defined when converting mov to lea

We need to check if symbol is defined when converting mov to lea since
SYMBOL_REFERENCES_LOCAL may return true on hidden undefined symbols.

* elf32-i386.c (elf_i386_convert_mov_to_lea): Check if symbol
is defined.
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.

9 years agoConvert mov to lea for loading address of local common symbol
H.J. Lu [Fri, 16 Oct 2015 10:14:40 +0000 (03:14 -0700)]
Convert mov to lea for loading address of local common symbol

There is no need to check def_regular when converting mov to lea for
loading address of local symbols since def_regular may be false for
common symbols and SYMBOL_REFERENCES_LOCAL is sufficient.

bfd/

* elf32-i386.c (elf_i386_convert_mov_to_lea): Don't check
def_regular.
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.

ld/testsuite/

* ld-i386/lea1.s: Add a test for loading address of local common
symbol.
* ld-x86-64/lea1.s: Likewise.
* ld-i386/lea1a.d: Updated.
* ld-i386/lea1b.d: Likewise.
* ld-i386/lea1c.d: Likewise.
* ld-x86-64/lea1a.d: Likewise.
* ld-x86-64/lea1b.d: Likewise.
* ld-x86-64/lea1c.d: Likewise.
* ld-x86-64/lea1d.d: Likewise.
* ld-x86-64/lea1e.d: Likewise.
* ld-x86-64/lea1f.d: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Oct 2015 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix typos in comments in _bfd_elf_merge_symbol
H.J. Lu [Thu, 15 Oct 2015 18:01:39 +0000 (11:01 -0700)]
Fix typos in comments in _bfd_elf_merge_symbol

* elflink.c (_bfd_elf_merge_symbol): Fix typos in comments

9 years agoFix a typo for "-z noextern-protected-data"
H.J. Lu [Thu, 15 Oct 2015 17:59:55 +0000 (10:59 -0700)]
Fix a typo for "-z noextern-protected-data"

* ld.texinfo: Fix a typo for "-z noextern-protected-data".

9 years agoaarch64 multi-arch part 6: HW breakpoint on unaligned address
Yao Qi [Thu, 15 Oct 2015 14:05:10 +0000 (15:05 +0100)]
aarch64 multi-arch part 6: HW breakpoint on unaligned address

Nowadays, both aarch64 GDB and linux kernel assumes that address for
setting breakpoint should be 4-byte aligned.  However that is not true
after we support multi-arch, because thumb instruction can be at 2-byte
aligned address.  Patch http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/375141.html
to linux kernel is to teach kernel to handle 2-byte aligned address for
HW breakpoint, while this patch is to teach aarch64 GDB handle 2-byte
aligned address.

First of all, we call gdbarch_breakpoint_from_pc to get the instruction
length rather than using hard-coded 4.  Secondly, in GDBserver, we set
length back to 2 if it is 3, because GDB encode 3 in it to indicate it
is a 32-bit thumb breakpoint.  Then we relax the address alignment
check from 4-byte aligned to 2-byte aligned.

This patch enables some tests (such as gdb.base/break-idempotent.exp,
gdb.base/cond-eval-mode.exp, gdb.base/watchpoint-reuse-slot.exp,) and
fixes many fails (such as gdb.base/hbreak2.exp) when the program is
compiled in thumb mode on aarch64.

Regression tested on aarch64-linux, both native and gdbserver.  This
is the last patch of multi-arch work.

gdb:

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

* aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint):
Call gdbarch_breakpoint_from_pc to instruction length.
(aarch64_linux_remove_hw_breakpoint): Likewise.
* common/common-regcache.h (regcache_register_size): Declare.
* nat/aarch64-linux-hw-point.c: Include "common-regcache.h".
(aarch64_point_is_aligned): Set alignment to 2 for breakpoint if
the process is 32bit, otherwise set alignment to 4.
(aarch64_handle_breakpoint): Update comments.
* regcache.c (regcache_register_size): New function.

gdb/gdbserver:

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

* linux-aarch64-low.c (aarch64_insert_point): Set len to 2
if it is 3.
(aarch64_remove_point): Likewise.
* regcache.c (regcache_register_size): New function.

9 years agobinutils objcopy test tidy
Alan Modra [Thu, 15 Oct 2015 11:07:13 +0000 (21:37 +1030)]
binutils objcopy test tidy

The main aim of this patch is to perform more objcopy tests when we
can build executables but not run them.  ie. non-native with cross
compiler available.

* binutils-all/objcopy.exp: Delete trailing whitespace.  Use
"string equal" rather than "string match" when making simple
string comparisons.  Revert 2008-07-08 host_triplet checks.
Perform non-run tests when we can build executable.
(strip_executable, strip_executable_with_saving_a_symbol): Move
run test later.  Take extra param on whether to perform run test.
Update callers.
(keep_debug_symbols_and_test_copy): Delete unused vars.

9 years agoobjcopy --extract-symbol testcase
Alan Modra [Thu, 15 Oct 2015 11:04:39 +0000 (21:34 +1030)]
objcopy --extract-symbol testcase

Run the test for more than just ELF.  Shows that objcopy --extract-symbol
isn't working on PE, mips, mmix and some aout targets.

* config/default.exp (size): New global.
* ld-elf/extract-symbol-1.s,
* ld-elf/extract-symbol-1.ld,
* ld-elf/extract-symbol-1sec.d,
* ld-elf/extract-symbol-1sym.d: Delete.
* ld-scripts/script.exp (extract_symbol_test): New.

9 years agoobjcopy --extract-symbol
Alan Modra [Thu, 15 Oct 2015 11:03:38 +0000 (21:33 +1030)]
objcopy --extract-symbol

Calling bfd_copy_private_bfd_data is necessary to copy ELF file header
info.

binutils/
* objcopy.c (copy_object): Don't omit bfd_copy_private_bfd_data
call when extract_symbol.
bfd/
* elf32-v850.c (v850_elf_copy_private_bfd_data): Remove assertion
that input and output .note.renesas sections are same size.
Instead, only copy input to output if they are.

9 years agoNormalize my (personal) email address in ChangeLog
Simon Marchi [Thu, 15 Oct 2015 12:56:37 +0000 (08:56 -0400)]
Normalize my (personal) email address in ChangeLog

9 years agoRemove core_regset_section
Aleksandar Ristovski [Wed, 14 Oct 2015 18:56:31 +0000 (14:56 -0400)]
Remove core_regset_section

gdb/ChangeLog:

* gdbarch.sh (core_regset_section): Remove.
* gdbarch.h: Regenerate.

9 years agoWhen evaluating a ternary operator in a linker script, copy the symbol flags.
Simon Dardis [Thu, 15 Oct 2015 12:28:27 +0000 (13:28 +0100)]
When evaluating a ternary operator in a linker script, copy the symbol flags.

* ld/ldexp.c: (try_copy_symbol_flags): New. Factored out from...
(exp_fold_tree_1): Here.  Cope with ternary operator in
assignments.  Use new helper.

9 years agoUse the file_ptr type when calling bfd_seek.
Riku Voipio [Thu, 15 Oct 2015 11:56:55 +0000 (12:56 +0100)]
Use the file_ptr type when calling bfd_seek.

PR ld/19123
* elfcore.h (elf_core_file_p): Use the file_ptr type to hold the
offset for bfd_seek.
* elfcode.h (elf_object_p): Likewise.

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

9 years agobfd: [SH] Emit DT_PLTGOT for FDPIC output unconditionally
Rich Felker [Wed, 14 Oct 2015 22:14:43 +0000 (07:14 +0900)]
bfd: [SH] Emit DT_PLTGOT for FDPIC output unconditionally

PR ld/19091
* elf32-sh.c (sh_elf_size_dynamic_sections): Always emit DT_PLTGOT for FDPIC output.

9 years agoAdd missing changelog entries
Andreas Krebbel [Wed, 14 Oct 2015 10:19:39 +0000 (12:19 +0200)]
Add missing changelog entries

9 years agoS/390: Fix instruction type of troo, trot, trto, and trtt.
Andreas Krebbel [Wed, 14 Oct 2015 08:58:41 +0000 (10:58 +0200)]
S/390: Fix instruction type of troo, trot, trto, and trtt.

opcodes/ChangeLog:

2015-10-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.c: Fix comment.
* s390-opc.txt: Change instruction type for troo, trot, trto, and
trtt to RRF_U0RER since the second parameter does not need to be a
register pair.

gas/testsuite/ChangeLog:

2015-10-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* gas/s390/esa-g5.d: Use odd GPR for the second operand.
* gas/s390/esa-g5.s: Likewise.
* gas/s390/esa-z9-109.d: Likewise.
* gas/s390/esa-z9-109.s: Likewise.

9 years agoUpdated Chinese translation for the linker (again!)
Nick Clifton [Wed, 14 Oct 2015 08:55:30 +0000 (09:55 +0100)]
Updated Chinese translation for the linker (again!)

9 years agoDefine enum out of struct
Yao Qi [Wed, 14 Oct 2015 08:23:14 +0000 (09:23 +0100)]
Define enum out of struct

This patch moves the definition of enum out of the scope of struct
aarch64_memory_operand, otherwise it breaks GDB build in c++ mode.

gdb:

2015-10-14  Yao Qi  <yao.qi@linaro.org>

* arch/aarch64-insn.h (struct aarch64_memory_operand): Move enum
out of it.
(enum aarch64_memory_operand_type): New.

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

9 years agoRecognize a few more AIX XCOFF DWARF sections.
David Edelsohn [Tue, 13 Oct 2015 22:45:38 +0000 (18:45 -0400)]
Recognize a few more AIX XCOFF DWARF sections.

gdb/ChangeLog:

        * xcoffread.c (dwarf2_xcoff_names): Add .dwmac and .dwpbtyp.

9 years agoMore char constification
Pedro Alves [Tue, 13 Oct 2015 18:40:50 +0000 (19:40 +0100)]
More char constification

Trivial constifications flagged by G++.  E.g.:

 src/gdb/c-varobj.c: In function ‘void c_describe_child(const varobj*, int, char**, value**, type**, char**)’:
 src/gdb/c-varobj.c:373:33: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
    char *join = was_ptr ? "->" : ".";
  ^

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

* ada-lang.c (ada_enum_name): Constify local.
* ada-typeprint.c (print_range_bound): Constify locals.
* c-varobj.c (c_describe_child): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
* dwarf2read.c (find_file_and_directory): Likewise.
(anonymous_struct_prefix, dwarf2_name): Likewise.
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
* go-lang.c (unpack_mangled_go_symbol): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* ser-tcp.c (net_open): Likewise.
* symfile.c (deduce_language_from_filename): Likewise.
* symtab.c (gdb_mangle_name): Likewise.
* tui/tui-io.c (tui_redisplay_readline): Likewise.

9 years agoFix execution_direction's type
Pedro Alves [Tue, 13 Oct 2015 18:40:50 +0000 (19:40 +0100)]
Fix execution_direction's type

This fixes a few build errors like these in C++ mode:

  src/gdb/reverse.c: In function ‘void exec_reverse_once(char*, char*, int)’:
  src/gdb/reverse.c:49:34: error: invalid conversion from ‘int’ to ‘exec_direction_kind’ [-fpermissive]
     enum exec_direction_kind dir = execution_direction;
    ^
  make: *** [reverse.o] Error 1

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

* infrun.c (restore_execution_direction): New function.
(fetch_inferior_event): Use it instead of
make_cleanup_restore_integer.
(execution_direction): Change type to enum
exec_direction_kind.
* infrun.h (execution_direction): Likewise.

9 years agoada-lang.c:ada_value_primitive_packed_val: const correctness
Pedro Alves [Tue, 13 Oct 2015 18:40:50 +0000 (19:40 +0100)]
ada-lang.c:ada_value_primitive_packed_val: const correctness

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

* ada-lang.c (ada_value_primitive_packed_val): Constify
locals.  Use value_contents_writeable.  Remove casts.

9 years agoada-lang.c: malloc/alloca casts for C++
Pedro Alves [Tue, 13 Oct 2015 18:40:50 +0000 (19:40 +0100)]
ada-lang.c: malloc/alloca casts for C++

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

* ada-lang.c (ada_value_primitive_packed_val): Add casts to malloc
and alloca calls.

9 years agolm32: Replace call to write_memory with write_memory_unsigned_integer
Simon Marchi [Tue, 13 Oct 2015 17:37:13 +0000 (13:37 -0400)]
lm32: Replace call to write_memory with write_memory_unsigned_integer

Fixes this error:

/home/emaisin/src/binutils-gdb/gdb/lm32-tdep.c: In function ‘CORE_ADDR lm32_push_dummy_call(gdbarch*, value*, regcache*, CORE_ADDR, int, value**, CORE_ADDR, int, CORE_ADDR)’:
/home/emaisin/src/binutils-gdb/gdb/lm32-tdep.c:292:59: error: invalid conversion from ‘void*’ to ‘const gdb_byte* {aka const unsigned char*}’ [-fpermissive]
    write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type));
                                                           ^
In file included from /home/emaisin/src/binutils-gdb/gdb/lm32-tdep.c:29:0:
/home/emaisin/src/binutils-gdb/gdb/gdbcore.h:107:13: error:   initializing argument 2 of ‘void write_memory(CORE_ADDR, const gdb_byte*, ssize_t)’ [-fpermissive]
 extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
             ^

gdb/ChangeLog:

* lm32-tdep.c (lm32_push_dummy_call): Replace call to
write_memory with write_memory_unsigned_integer.

9 years agoConstify arguments of gdb_bfd_lookup_symbol and related functions
Simon Marchi [Tue, 13 Oct 2015 16:40:01 +0000 (12:40 -0400)]
Constify arguments of gdb_bfd_lookup_symbol and related functions

Fixes this error:

/home/pedro/gdb/mygit/src/gdb/solib-frv.c: In function â€˜int enable_break2()’:
/home/pedro/gdb/mygit/src/gdb/solib-frv.c:622:72: error: invalid conversion from â€˜const void*’ to â€˜void*’ [-fpermissive]
       addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");
                                                                        ^
In file included from /home/pedro/gdb/mygit/src/gdb/solib-frv.c:23:0:
/home/pedro/gdb/mygit/src/gdb/solib.h:82:18: error:   initializing argument 3 of â€˜CORE_ADDR gdb_bfd_lookup_symbol(bfd*, int (*)(asymbol*, void*), void*)’ [-fpermissive]
 extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
                  ^

The call in question is:

      addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");

gdb/ChangeLog:

* solib-dsbt.c (cmp_name): Constify arguments.
* solib-frv.c (cmp_name): Likewise.
* solib-svr4.c (svr4_create_solib_event_breakpoints): Likewise.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Likewise.
(bfd_lookup_symbol_from_dyn_symtab): Likewise.
(gdb_bfd_lookup_symbol): Likewise.
* solib.h (gdb_bfd_lookup_symbol): Likewise.
(gdb_bfd_lookup_symbol_from_symtab): Likewise.

9 years agoAdd EM_IAMCU support to gold
H.J. Lu [Tue, 13 Oct 2015 16:02:23 +0000 (09:02 -0700)]
Add EM_IAMCU support to gold

elfcpp/

PR gold/19118
* elfcpp.h (EM): Add EM_IAMCU.

gold/

PR gold/19118
* i386.cc (Target_iamcu): New class.
(Target_selector_iamcu): Likewise.
(Target_iamcu::iamcu_info): New variable.
(target_selector_iamcu): Likewise.

9 years agoUpdated Chinese translation for the linker.
Nick Clifton [Tue, 13 Oct 2015 13:32:44 +0000 (14:32 +0100)]
Updated Chinese translation for the linker.

* po/zh_TW.po: Updated Chinese translation.

9 years agoTidy code setting PT_GNU_RELRO p_flags
Alan Modra [Tue, 13 Oct 2015 05:48:56 +0000 (16:18 +1030)]
Tidy code setting PT_GNU_RELRO p_flags

No functional changes here.

* elf.c (_bfd_elf_map_sections_to_segments): Don't set
PT_GNU_RELRO p_flags.
(assign_file_positions_for_non_load_sections): Set PT_GNU_RELRO
flags to PF_R here.

9 years agosim: ft32: test coverage for link parameters and PM write port
James Bowman [Wed, 7 Oct 2015 15:19:08 +0000 (15:19 +0000)]
sim: ft32: test coverage for link parameters and PM write port

Adds test coverage for recent features.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Oct 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agogdb: Simplify parse_frame_specification.
Andrew Burgess [Mon, 7 Sep 2015 08:15:15 +0000 (09:15 +0100)]
gdb: Simplify parse_frame_specification.

Remove an unneeded parameter from parse_frame_specification, replace
with a fixed string within parse_frame_specification.  The message was
the same in every place that parse_frame_specification was used anyway.

gdb/ChangeLog:

* stack.c (parse_frame_specification): Remove message parameter,
replace with fixed string in function body, update function
comment.
(frame_info): Remove message to parse_frame_specification.
(select_frame_command): Likewise.

9 years agogdb: Avoid unneeded calls to parse_frame_specification.
Andrew Burgess [Mon, 7 Sep 2015 08:04:07 +0000 (09:04 +0100)]
gdb: Avoid unneeded calls to parse_frame_specification.

Within the stack command there are a couple of places where fixed
strings are passed into functions that are really intended for
processing user input.  These fixed strings are then processed and the
result returned.

Given that the input strings in these cases are fixed, and are always
"0", then the result will always be the same, the current frame.  By
switching to using get_current_frame instead the code can be simplified,
and the intention of the code is clearer.

gdb/ChangeLog:

* stack.c (parse_frame_specification): Delete.
(parse_frame_specification_1): Rename to
parse_frame_specification.
(frame_info): Use parse_frame_specification.
(select_frame_command): Likewise.
(return_command): Use select_frame and print_stack_frame rather
than frame_command and select_frame_command.
(func_command): Use get_current_frame rather than
parse_frame_specification.

9 years agogdb: Fix bug with dbx style func command.
Andrew Burgess [Mon, 7 Sep 2015 07:53:24 +0000 (08:53 +0100)]
gdb: Fix bug with dbx style func command.

The func command, available when starting gdb in dbx mode, is supposed
to take a function name and locate the frame for that function in the
stack.  This has been broken for a while due to an invalid check of the
arguments within the worker function.  Fixed in this commit.

gdb/ChangeLog:

* stack.c (func_command): Return early when there is no ARG
string.

gdb/testsuite/ChangeLog:

* gdb.base/dbx.exp (test_func): Remove xfails, update expected
results.

9 years agogdb/doc: Restructure frame command documentation.
Andrew Burgess [Thu, 10 Sep 2015 16:59:58 +0000 (17:59 +0100)]
gdb/doc: Restructure frame command documentation.

The 'frame' command is documented in two places.  The 'select-frame'
command is only mentioned in one of these places.

Of the two places, having the description of 'frame' and 'select-frame'
in the section 'Selecting a Frame' seems like the most obvious choice,
which is where things like 'up' and 'down' are also documented.

This commit moves the documentation of 'frame' and 'select-frame' into
the 'Selecting a Frame' section, and removes the duplicate documentation
of the 'frame' command.

At the same time I have reordered the sections in the 'Examining the
Stack' chapter, moving the discussion of frame filters to the end of the
chapter; it feels odd that we talk about frame filters before such basic
things like navigating the stack, or examining stack frames in general.

gdb/doc/ChangeLog:

* gdb.texinfo (Frames): Remove 'frame' and 'select-frame'
description.
(Frame Filter Management): Move to later in the 'Examining the
Stack' chapter.
(Selection): Add entry for 'select-frame'.

9 years agogdb: Make use of safe-ctype.h header.
Andrew Burgess [Mon, 7 Sep 2015 22:46:49 +0000 (23:46 +0100)]
gdb: Make use of safe-ctype.h header.

In stack.c switch to using safe-ctype.h instead of ctype.h, update code
as required.

gdb/ChangeLog:

* stack.c: Include safe-ctype.h not ctype.h.
(parse_frame_specification): Use ISSPACE not isspace.
(backtrace_command): Use TOLOWER not tolower.

9 years agomep: Add cast for int to enum conversion
Simon Marchi [Mon, 12 Oct 2015 16:43:23 +0000 (12:43 -0400)]
mep: Add cast for int to enum conversion

Taken directly from Pedro's branch.

gdb/ChangeLog:

* mep-tdep.c (current_me_module): Add cast.
(mep_gdbarch_init): Likewise.

9 years agom32c: Split m32c_move_reg_t in read/write variants
Simon Marchi [Mon, 12 Oct 2015 16:39:40 +0000 (12:39 -0400)]
m32c: Split m32c_move_reg_t in read/write variants

This allows to avoid casting away the const qualification in
m32c_pseudo_register_write (which is the entry points for all other
register read/write functions).

Also, use gdb_byte* instead of void* to avoid casts when calling gdb
common memory functions.  It also allows to remove those "For adderss
arithmetic" local variables.

gdb/ChangeLog:

* m32c-tdep.c (m32c_move_reg_t): Replace with...
(m32c_write_reg_t): ...this and...
(m32c_read_reg_t): ...this.
(struct m32c_reg): Update types of read and write.
(m32c_raw_read): Change declaration type to m32c_read_reg_t and
adjust definition.
(m32c_banked_read): Likewise.
(m32c_sb_read): Likewise.
(m32c_part_read): Likewise.
(m32c_cat_read): Likewise.
(m32c_r3r2r1r0_read): Likewise.
(m32c_raw_write): Change declaration type to m32c_write_reg_t
and adjust definition.
(m32c_banked_write): Likewise.
(m32c_sb_write): Likewise.
(m32c_part_write): Likewise.
(m32c_cat_write): Likewise.
(m32c_r3r2r1r0_write): Likewise.

9 years agoaarch64: Add cast for integer to enum cast
Simon Marchi [Mon, 12 Oct 2015 16:24:38 +0000 (12:24 -0400)]
aarch64: Add cast for integer to enum cast

/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c: In function â€˜int aarch64_linux_syscall_record(regcache*, long unsigned int)’:
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:904:57: error: invalid conversion from â€˜long unsigned int’ to â€˜aarch64_syscall’ [-fpermissive]
   syscall_gdb = aarch64_canonicalize_syscall (svc_number);
                                                         ^
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:645:1: note:   initializing argument 1 of â€˜gdb_syscall aarch64_canonicalize_syscall(aarch64_syscall)’
 aarch64_canonicalize_syscall (enum aarch64_syscall syscall_number)
 ^

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_linux_syscall_record): Add cast.

9 years agoaarch64: Use gdb_sys_no_syscall enum instead of -1
Simon Marchi [Mon, 12 Oct 2015 16:24:37 +0000 (12:24 -0400)]
aarch64: Use gdb_sys_no_syscall enum instead of -1

Fixes:

/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c: In function "gdb_syscall aarch64_canonicalize_syscall(aarch64_syscall)":
/home/simark/src/binutils-gdb/gdb/aarch64-linux-tdep.c:874:13: error: invalid conversion from "int" to "gdb_syscall" [-fpermissive]
     return -1;
             ^

gdb/ChangeLog:

* aarch64-linux-tdep.c (aarch64_canonicalize_syscall): Return
gdb_sys_no_syscall instead of -1.

9 years agoSkip the unversioned definition after the default version
H.J. Lu [Mon, 12 Oct 2015 11:55:24 +0000 (04:55 -0700)]
Skip the unversioned definition after the default version

We may see an unversioned definition after the default version.  We
should skip the unversioned definition in this case.

bfd/

PR ld/19073
* elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned
definition after the default version.

ld/testsuite/

PR ld/19073
* ld-elf/pr19073.map: New file.
* ld-elf/pr19073.rd: Likewise.
* ld-elf/pr19073.s: Likewise.
* ld-elf/shared.exp (build_tests): Add tests for PR ld/19073.

9 years agoUpdate list of known MSP430 MCU names.
Nick Clifton [Mon, 12 Oct 2015 10:51:05 +0000 (11:51 +0100)]
Update list of known MSP430 MCU names.

* config/tc-msp430.c (msp430_mcu_names): Rename to
msp430_mcu_data.  Add fields for the ISA and hardware multiply
support.  Update with information from the latest devices.csv
file.
(md_parse_option): Make use of the new array.

9 years agoMention the change in NEWS
Yao Qi [Mon, 12 Oct 2015 10:28:39 +0000 (11:28 +0100)]
Mention the change in NEWS

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* NEWS: Mention the change.

9 years agoRename emit_load_store to aarch64_emit_load_store
Yao Qi [Mon, 12 Oct 2015 10:28:39 +0000 (11:28 +0100)]
Rename emit_load_store to  aarch64_emit_load_store

Likewise, this patch renames emit_load_store to
aarch64_emit_load_store.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* arch/aarch64-insn.c (emit_load_store): Rename to ...
(aarch64_emit_load_store): ... it.  All callers updated.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c: Update all callers as emit_load_store
is renamed to aarch64_emit_load_store.

9 years agoRename emit_insn to aarch64_emit_insn
Yao Qi [Mon, 12 Oct 2015 10:28:39 +0000 (11:28 +0100)]
Rename emit_insn to aarch64_emit_insn

As emit_insn becomes extern, the prefix "aarch64_" is needed.  This
patch renames emit_insn to aarch64_emit_insn.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* arch/aarch64-insn.c (emit_insn): Rename to ...
(aarch64_emit_insn): ... it.  All callers updated.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c: Update all callers of function renaming
from emit_insn to aarch64_emit_insn.

9 years agoNew test case gdb.arch/disp-step-insn-reloc.exp
Yao Qi [Mon, 12 Oct 2015 10:28:38 +0000 (11:28 +0100)]
New test case gdb.arch/disp-step-insn-reloc.exp

This patch adds a new test case which uses gdb.arch/insn-reloc.c too
to test displaced stepping.  Nowadays, tests are for x86, x86_64 and
aarch64.

gdb/testsuite:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/disp-step-insn-reloc.exp: New test case.

9 years agoSupport displaced stepping in support_displaced_stepping for aarch64*-*-linux*
Yao Qi [Mon, 12 Oct 2015 10:28:38 +0000 (11:28 +0100)]
Support displaced stepping in support_displaced_stepping for aarch64*-*-linux*

gdb/testsuite:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (support_displaced_stepping): Return 1 if target
is aarch64*-*-linux*.

9 years agoSupport displaced stepping in aarch64-linux
Yao Qi [Mon, 12 Oct 2015 10:28:38 +0000 (11:28 +0100)]
Support displaced stepping in aarch64-linux

This patch is to support displaced stepping in aarch64-linux.  A
visitor is implemented for displaced stepping, and used to record
information to fixup pc after displaced stepping if needed.  Some
emit_* functions are converted to macros, and moved to
arch/aarch64-insn.{c,h} so that they can be shared.

gdb:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-tdep.c: Include arch-utils.h.
(aarch64_linux_init_abi): Call set_gdbarch_max_insn_length,
set_gdbarch_displaced_step_copy_insn,
set_gdbarch_displaced_step_fixup,
set_gdbarch_displaced_step_free_closure,
set_gdbarch_displaced_step_location,
and set_gdbarch_displaced_step_hw_singlestep.
* aarch64-tdep.c (struct displaced_step_closure): New.
(struct aarch64_displaced_step_data): New.
(aarch64_displaced_step_b): New function.
(aarch64_displaced_step_b_cond): Likewise.
(aarch64_register): Likewise.
(aarch64_displaced_step_cb): Likewise.
(aarch64_displaced_step_tb): Likewise.
(aarch64_displaced_step_adr): Likewise.
(aarch64_displaced_step_ldr_literal): Likewise.
(aarch64_displaced_step_others): Likewise.
(aarch64_displaced_step_copy_insn): Likewise.
(aarch64_displaced_step_fixup): Likewise.
(aarch64_displaced_step_hw_singlestep): Likewise.
* aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): New macro.
(aarch64_displaced_step_copy_insn): Declare.
(aarch64_displaced_step_fixup): Declare.
(aarch64_displaced_step_hw_singlestep): Declare.
* arch/aarch64-insn.c (emit_insn): Moved from
gdbserver/linux-aarch64-low.c.
(emit_load_store): Likewise.
* arch/aarch64-insn.h (enum aarch64_opcodes): Moved from
gdbserver/linux-aarch64-low.c.
(struct aarch64_register): Likewise.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(can_encode_int32): New macro.
(emit_b, emit_bcond, emit_cb, emit_ldr, emit_ldrsw): Likewise.
(emit_tb, emit_nop): Likewise.
(emit_insn): Declare.
(emit_load_store): Declare.

gdb/gdbserver:

2015-10-12  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (enum aarch64_opcodes): Move to
arch/aarch64-insn.h.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(emit_insn): Move to arch/aarch64-insn.c.
(emit_b, emit_bcond, emit_cb, emit_tb): Remove.
(emit_load_store): Move to arch/aarch64-insn.c.
(emit_ldr, emit_ldrb, emit_ldrsw, emit_nop): Remove.
(can_encode_int32): Remove.