platform/upstream/binutils.git
9 years agoS390: Restructure s390_push_dummy_call
Andreas Arnez [Mon, 27 Apr 2015 09:38:46 +0000 (11:38 +0200)]
S390: Restructure s390_push_dummy_call

Simplify the structure of s390_push_dummy_call and its various helper
functions.  This reduces the code and makes it easier to extend.  The
new code should be functionally equivalent to the old one, except that
copies created by the caller are now always aligned on an 8-byte
boundary.

gdb/ChangeLog:

* s390-linux-tdep.c
(is_float_singleton): Remove function.  Move the "singleton" part
of the logic...
(s390_effective_inner_type): ...here.  New function.
(is_float_like): Remove function.  Inline its logic...
(s390_function_arg_float): ...here.
(is_pointer_like, is_integer_like, is_struct_like): Remove
functions.  Inline their logic...
(s390_function_arg_integer): ...here.
(s390_function_arg_pass_by_reference): Remove function.
(extend_simple_arg): Remove function.
(alignment_of): Remove function.
(struct s390_arg_state): New structure.
(s390_handle_arg): New function.
(s390_push_dummy_call): Move parameter placement logic to the new
function s390_handle_arg.  Call it for calculating the stack area
sizes first, and again for actually writing the parameters.

9 years agoS390: For zero, let is_power_of_two() return false
Andreas Arnez [Mon, 27 Apr 2015 09:38:46 +0000 (11:38 +0200)]
S390: For zero, let is_power_of_two() return false

This fixes a minor issue with the helper function is_power_of_two(),
which returned non-zero ("true") if the argument was zero.  This led
to a wrong decision when passing a zero-sized struct in an inferior
function call.

gdb/ChangeLog:

* s390-linux-tdep.c (is_power_of_two): Add comment.  Return
  false if the argument is zero.

9 years ago[Ada] Cache all static structures and reset cache during resolution
Pierre-Marie de Rodat [Mon, 27 Apr 2015 09:06:07 +0000 (11:06 +0200)]
[Ada] Cache all static structures and reset cache during resolution

Currently, ada-lang.c:template_to_static_fixed_type (working on
structure types only) caches its result into the unused TYPE_TARGET_TYPE
field. This introduces inconsistencies when the input type is
specialized, for instance during type resolution: the cached static
fixed type is copied along with the original type, but it's no longer
adapted to the copy once the copy is modified:
template_to_static_fixed_type has to compute another static fixed type
for it.

This change first introduces a cache reset during type resolution for
structure types so that this inconsistency does not happen anymore. It
also makes template_to_static_fixed_type smarter with respect to types
that do not need static fixed copies so that less computations is done
in general.

This inconsistency was spotted thanks to code reading, not because of
any sort of failure and we did not manage to exhibit a failure yet, so
no testcase for this.

gdb/ChangeLog:

* ada-lang.c (template_to_static_fixed_type): Return input type
when it is already fixed. Cache the input type itself when not
creating a static fixed copy. Make it explicit that we never
molestate the input type.
* gdbtypes.c (resolve_dynamic_struct): Reset the
TYPE_TARGET_TYPE field for resolved copies.

9 years ago[Ada] Preserve typedef layer when getting struct element
Joel Brobecker [Mon, 27 Apr 2015 09:04:47 +0000 (11:04 +0200)]
[Ada] Preserve typedef layer when getting struct element

Consider the following declarations:

   type Int_Access is access Integer;
   type Record_Type is record
      IA : Int_Access;
   end record;

   R : Record_Type;

Printing the type name of "R.IA" yields:

    (gdb) whatis r.ia
    type = access integer

It should be:

    (gdb) whatis r.ia
    type = bar.int_access

Looking at the debugging info, field "r.ia" is defined as
a typedef which has the name of the field type:

        .uleb128 0x3    # (DIE (0x4e) DW_TAG_typedef)
        .long   .LASF4  # DW_AT_name: "bar__int_access"
        .long   0x8b    # DW_AT_type

... with the typedef's target type being an anonymous pointer
type:

        .uleb128 0x7    # (DIE (0x8b) DW_TAG_pointer_type)
        .byte   0x8     # DW_AT_byte_size
        .long   0x91    # DW_AT_type

What happens here is that a couple of function in ada-lang.c
always start by stripping all typedef layers when handling
struct fields, with the effect of making us lose the type name
in this case.

We did not understand this at the time the code was written,
but typedefs should be stripped only when we know we do not
need them. So this patch, adjust the code to avoid the stripping
while handling the fields, and adds it back in the lone place
which handles the result of processing and didn't know how to
handle typedefs struct fields yet.

gdb/ChangeLog:

        * ada-lang.c (ada_is_tagged_type): Add call to ada_check_typedef.
        (ada_lookup_struct_elt_type): Remove calls to ada_check_typedef.
        (template_to_static_fixed_type): Call ada_check_typedef only
        when necessary.

gdb/testsuite/ChangeLog:

        * gdb.ada/rec_comp: New testcase.

9 years agoS/390: z13 use GNU attribute to indicate vector ABI
Andreas Krebbel [Mon, 27 Apr 2015 08:32:23 +0000 (10:32 +0200)]
S/390: z13 use GNU attribute to indicate vector ABI

bfd/
* elf-s390-common.c (elf_s390_merge_obj_attributes): New function.
* elf32-s390.c (elf32_s390_merge_private_bfd_data): Call
elf_s390_merge_obj_attributes.
* elf64-s390.c (elf64_s390_merge_private_bfd_data): New function.

binutils/
* readelf.c (display_s390_gnu_attribute): New function.
(process_s390_specific): New function.
(process_arch_specific): Call process_s390_specific.

gas/
* doc/as.texinfo: Document Tag_GNU_S390_ABI_Vector.

include/elf/
* s390.h: Define Tag_GNU_S390_ABI_Vector.

9 years agoS/390: Fixes for z13 instructions.
Andreas Krebbel [Mon, 27 Apr 2015 08:29:16 +0000 (10:29 +0200)]
S/390: Fixes for z13 instructions.

opcodes/
* s390-opc.c: New instruction type VV0UU2.
* s390-opc.txt: Fix instruction types for VFCE, VLDE, VFSQ, WFK,
and WFC.

gas/testsuite/
* gas/s390/zarch-z13.d: Fix tests for VFCE, VLDE, VFSQ, WFK, and
WFC.
   * gas/s390/zarch-z13.s: Likewise.

9 years agoS/390: Fix gotreloc_31-1 testcase.
Andreas Krebbel [Mon, 27 Apr 2015 08:24:24 +0000 (10:24 +0200)]
S/390: Fix gotreloc_31-1 testcase.

Since we changed the default arch for objdump to zarch the following
testcase needs to check for the real instruction mnemonics instead of
just bytes.

This fixes the following testsuite fail on s390x:

FAIL: GOT: symbol address load from got to larl

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoClear variable "coredump_var_addr" before using it on gdb.base/coredump-filter.exp
Sergio Durigan Junior [Sun, 26 Apr 2015 19:34:29 +0000 (15:34 -0400)]
Clear variable "coredump_var_addr" before using it on gdb.base/coredump-filter.exp

This commit is a continuation of the fix committed on:

  commit 8cd8f2f8ac49276437b7da37f275706ea1c1c925
  Author: Sergio Durigan Junior <sergiodj@redhat.com>
  Date:   Mon Apr 13 02:40:08 2015 -0400

      Rename variable "addr" to "coredump_var_addr" in gdb.base/coredump-filter.exp

Pedro pointed out that this fix was not complete, because the
testsuite could be run several times in a row (for example), which
means that it is not enough to just make the variable name unique: it
also needs to be cleared out if it is global.

This commit does that.  It is actually just a commit made to make
things totally correct; this specific test does not fail if you run it
several times in a row.

gdb/testsuite/ChangeLog:
2015-04-26  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.base/coredump-filter.exp: Clear variable "coredump_var_addr"
before using it.

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

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoNon-alloc sections don't belong in PT_LOAD segments
Alan Modra [Fri, 24 Apr 2015 09:49:37 +0000 (19:19 +0930)]
Non-alloc sections don't belong in PT_LOAD segments

Taking them out showed a bug in the powerpc64 backend with .branch_lt
being removed from output_bfd but not from previously set up segment
section maps.  Removing the bfd sections meant their sh_flags (and
practically everything else) remaining zero, ie. not SHF_ALLOC,
triggering complaints about "`.branch_lt' can't be allocated in
segment".

include/elf/
* internal.h (ELF_SECTION_IN_SEGMENT_1): Ensure PT_LOAD and
similar segments only contain alloc sections.
ld/
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation):
Call gld${EMULATION_NAME}_map_segments regardless of need_laying_out.
ld/testsuite/
* ld-powerpc/tocnovar.d: Revert last change.

9 years ago[AArch64] PR18270, fix handling of GOT entry for local symbol
Jiong Wang [Fri, 24 Apr 2015 22:25:28 +0000 (23:25 +0100)]
[AArch64] PR18270, fix handling of GOT entry for local symbol

2015-04-24  Jiong. Wang  <jiong.wang@arm.com>

bfd/
  PR ld/18270
  * elfnn-aarch64.c (elfNN_aarch64_size_dynamic): Count local symbol for
  GOT_NORMAL for both sgot/srelgot section.
  (elfNN_aarch64_final_link_relocate): Relocate against GOT entry address
  and generate necessary runtime relocation for GOT entry.

9 years agoCopy is_linker_input to archive member
H.J. Lu [Fri, 24 Apr 2015 22:02:56 +0000 (15:02 -0700)]
Copy is_linker_input to archive member

We must copy is_linker_input to archive member.

PR binutils/18209
* archive.c (_bfd_get_elt_at_filepos): Also copy is_linker_input.

9 years agogdb: Add internationalization support to a few strings.
Andrew Burgess [Thu, 23 Apr 2015 21:18:55 +0000 (22:18 +0100)]
gdb: Add internationalization support to a few strings.

Spotted a few strings that were missing internationalization support.

gdb/ChangeLog:

* cli/cli-dump.c (srec_dump_command): Add internationalization
mark ups.
(ihex_dump_command): Likewise.
(tekhex_dump_command): Likewise.
(binary_dump_command): Likewise.
(binary_append_command): Likewise.

9 years agogdb: Add support for dumping to verilog hex format.
Andrew Burgess [Wed, 22 Apr 2015 21:52:36 +0000 (22:52 +0100)]
gdb: Add support for dumping to verilog hex format.

Extend the gdb 'dump' command to allow creating output in verilog hex
format.  Add some tests to cover new functionality.  As bfd does not
currently support reading in verilog hex formats the tests only cover
the 'dump' command, not the 'restore' command.

gdb/ChangeLog:

* cli/cli-dump.c (verilog_cmdlist): New variable.
(dump_verilog_memory): New function.
(dump_verilog_value): New function.
(verilog_dump_command): New function.
(_initialize_cli_dump): Add new commands to support verilog dump
format.
* NEWS: Add entry for "dump verilog".

gdb/doc/ChangeLog:

* gdb.texinfo (Dump/Restore Files): Add detail about verilog dump
format.

gdb/testsuite/ChangeLog:

* gdb.base/dump.exp: Add *.verilog files to all_files list.  Add
new tests for verilog output.

9 years ago[AArch64] Improve PC-relative relocation check for shared library
Jiong Wang [Fri, 24 Apr 2015 21:35:04 +0000 (22:35 +0100)]
[AArch64] Improve PC-relative relocation check for shared library

2015-04-24  Jiong. Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Reject
  PC-relative relocation for external symbol.

ld/testsuite/
  * ld-aarch64/pcrel.s: New testcase.
  * ld-aarch64/pcrel_pic_defiend_local.d: New expect file.
  * ld-aarch64/pcrel_pic_undefined.d: Ditto.
  * ld-aarch64/aarch64-elf.exp: Run them.

9 years agoFix typo
DJ Delorie [Fri, 24 Apr 2015 21:17:02 +0000 (17:17 -0400)]
Fix typo

9 years agoChange msp430 emulation to msp430elf
DJ Delorie [Fri, 24 Apr 2015 21:05:13 +0000 (17:05 -0400)]
Change msp430 emulation to msp430elf

* Makefile.am (msp430): Rename primary emulation to msp430elf.
(emsp430.c): Rename to emsp430elf.c, update dependencies
(emsp430X.c): Update dependencies.
* Makefile.in: Likewise.
* configure.tgt (msp430-*-*): Rename primary emulation to msp430elf.
* emulparame/msp430.sh: Rename to msp430elf.sh.
* emulparams/msp430X.sh: Update.

9 years agogas thunderx support
Jim Wilson [Fri, 24 Apr 2015 20:38:25 +0000 (13:38 -0700)]
gas thunderx support

gas/
* config/tc-aarch64.c (aarch64_cpus): Add CRC and CRYPTO features
for thunderx.

9 years ago* python.texi (Xmethods In Python): Fix name of method to call the xmethod.
Doug Evans [Fri, 24 Apr 2015 18:16:12 +0000 (11:16 -0700)]
* python.texi (Xmethods In Python): Fix name of method to call the xmethod.

gdb/doc/ChangeLog:

* python.texi (Xmethods In Python): Fix name of method to call the
xmethod.

9 years agoFix compile time warning messages about variables being used before they are initialised.
Nick Clifton [Fri, 24 Apr 2015 16:13:22 +0000 (17:13 +0100)]
Fix compile time warning messages about variables being used before they are initialised.

PR 18313
bin * ieee.c (ieee_read_cxx_class): Initialise the varargs variable.
* readelf.c (uncompress_section_contents): Zero initialise the
zstream structure.

bfd * compress.c (decompress_contents): Zero initialse the z_stream
structure.

9 years ago[ARM]: Don't tail-pad over-aligned functions to the alignment boundary.
Richard Earnshaw [Fri, 24 Apr 2015 14:51:49 +0000 (15:51 +0100)]
[ARM]: Don't tail-pad over-aligned functions to the alignment boundary.

2015-04/24  Richard Earnshaw  <rearnsha@arm.com>

gas/
* config/tc-arm.h (arm_min): New function.
(SUB_SEGMENT_ALIGN): Define.

gas/testsuite/
* gas/arm/align64.d: Delete trailing padding NOPs.

ld/testsuite/
* ld-arm/armthumb-lib.d: Regenerate expected output.
* ld-arm/armthumb-lib.d: Likewise.
* ld-arm/armthumb-lib.sym: Likewise.
* ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise.
* ld-arm/cortex-a8-fix-b-rel-thumb.d: Likewise.
* ld-arm/cortex-a8-fix-b.d: Likewise.
* ld-arm/cortex-a8-fix-bcc-rel-thumb.d: Likewise.
* ld-arm/cortex-a8-fix-bcc.d: Likewise.
* ld-arm/cortex-a8-fix-bl-rel-arm.d: Likewise.
* ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise.
* ld-arm/cortex-a8-fix-bl-rel-thumb.d: Likewise.
* ld-arm/cortex-a8-fix-bl.d: Likewise.
* ld-arm/cortex-a8-fix-blx-bcond.d: Likewise.
* ld-arm/cortex-a8-fix-blx-rel-arm.d: Likewise.
* ld-arm/cortex-a8-fix-blx-rel-thumb.d: Likewise.
* ld-arm/cortex-a8-fix-blx.d: Likewise.
* ld-arm/cortex-a8-fix-hdr.d: Likewise.
* ld-arm/farcall-mixed-app-v5.d: Likewise.
* ld-arm/farcall-mixed-app.d: Likewise.
* ld-arm/farcall-mixed-lib-v4t.d: Likewise.
* ld-arm/farcall-mixed-lib.d: Likewise.
* ld-arm/mixed-app-v5.d: Likewise.
* ld-arm/mixed-app.d: Likewise.
* ld-arm/mixed-lib.d: Likewise.

9 years agoFix typos in sim sources exposed by static analysis.
Nick Clifton [Fri, 24 Apr 2015 14:43:21 +0000 (15:43 +0100)]
Fix typos in sim sources exposed by static analysis.

bfin PR 18273
* bfin-sim.c (decode_dsp32alu_0): Remove spurious check for
s == 1.

erc32 PR 18273
* exec.c (add32): Fix typo in check for overflow.

igen PR 18273
* misc.c (a2i): Fix typos checking for uppercase letters.

9 years agoFix typo in check for valid register number in RX sim.
Nick Clifton [Fri, 24 Apr 2015 14:31:36 +0000 (15:31 +0100)]
Fix typo in check for valid register number in RX sim.

PR sim/18273
* reg.c (put_reg): Fix check for valid register number.

9 years agoExtend test for local labels to include fake symbols and local labels with a numeric...
Nick Clifton [Fri, 24 Apr 2015 14:17:13 +0000 (15:17 +0100)]
Extend test for local labels to include fake symbols and local labels with a numeric suffix.

* elf.c (_bfd_elf_is_local_label_name): Extend test for assembler
local labels to include local labels with a numeric suffix and
fake symbols.

9 years agoFix printing for GNAT stuff for types that do not have descr. types
Pierre-Marie de Rodat [Fri, 24 Apr 2015 14:13:19 +0000 (16:13 +0200)]
Fix printing for GNAT stuff for types that do not have descr. types

gdb/ChangeLog:
2015-04-24  Pierre-Marie de Rodat  <derodat@adacore.com>

* gdbtypes.c (print_gnat_stuff): Do not recurse on the
descriptive type when there is none.

9 years agoDefine SEC_MEP_VLIW in bfd/section.c
H.J. Lu [Fri, 24 Apr 2015 12:40:23 +0000 (05:40 -0700)]
Define SEC_MEP_VLIW in bfd/section.c

Bits in section flags should only be defined in bfd/section.c.  This
patch moves SEC_MEP_VLIW to bfd/section.c.

bfd/

PR binutils/18316
* section.c (SEC_MEP_VLIW): New.
* bfd-in2.h: Regenerated.

include/elf/

PR binutils/18316
* mep.h (SEC_MEP_VLIW): Removed.

9 years agoA new board file remote-gdbserver-on-localhost.exp
Yao Qi [Fri, 24 Apr 2015 10:00:14 +0000 (11:00 +0100)]
A new board file remote-gdbserver-on-localhost.exp

This patch is to add a new board file that does real remote gdbserver
testing on localhost.  This board file can be used to reproduce PR 18208.

gdb/testsuite

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

* boards/remote-gdbserver-on-localhost.exp: New file.

9 years agoSkip the compressed1d test for targets which do not use the elf32.em linker emulation...
Nick Clifton [Fri, 24 Apr 2015 09:15:41 +0000 (10:15 +0100)]
Skip the compressed1d test for targets which do not use the elf32.em linker emulation file.

* ld-elf/compressed1d.d: Add notarget for ELF based targets that
do not use elf.em.

9 years agoCorrect ld-elf/compressed1e.d to use notarget and for cris-elf, not cris-*.
Hans-Peter Nilsson [Fri, 24 Apr 2015 04:10:19 +0000 (06:10 +0200)]
Correct ld-elf/compressed1e.d to use notarget and for cris-elf, not cris-*.

Don't XPASS cris-linux which *does* support -shared.
And xfail is for bugs, notarget is for not-applicable.

9 years agoXfail cris and frv for ld-elf/compressed1e.d
H.J. Lu [Fri, 24 Apr 2015 01:58:46 +0000 (18:58 -0700)]
Xfail cris and frv for ld-elf/compressed1e.d

cris and frv don't support -shared.

* ld-elf/compressed1e.d: Only run for Linux/gnu.  Xfail cris and
frv.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 24 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDelay setting up compressed debug section names
H.J. Lu [Thu, 23 Apr 2015 23:37:44 +0000 (16:37 -0700)]
Delay setting up compressed debug section names

When we set up st_name for output section name in elf_fake_sections, we
don't know if the compressed DWARF debug section will be smaller. We may
end up with compressed DWARF debug sections which are bigger than the
uncompressed ones.  This patch delays setting up st_name for output DWARF
debug section to _bfd_elf_assign_file_positions_for_non_load which will
compress the output debug section.  We also postpone placement of shstrtab
section after DWARF debug sections have been compressed.  The net effect
is .shstrtab section is now placed after .symtab and .strtab sections.

bfd/

PR ld/18277
* compress.c (bfd_compress_section_contents): Remove the
write_compress argument.
(bfd_init_section_compress_status): Updated.
(bfd_compress_section): Likewise.
* elf.c (_bfd_elf_set_reloc_sh_name): New.
(_bfd_elf_init_reloc_shdr): Add delay_st_name_p.  Set sh_name
to (unsigned int) -1 if delay_st_name_p is TRUE.  Use
_bfd_elf_set_reloc_sh_name.
(elf_fake_sections): Don't rename DWARF debug section for
linker output if it will be compressed.  Instead, set
delay_st_name_p to TRUE and pass it to _bfd_elf_init_reloc_shdr.
(assign_section_numbers): Call _bfd_elf_strtab_addref only if
sh_name != (unsigned int) -1.  Don't finalize nor assign
shstrtab section here.  Delay setting output section names to
_bfd_elf_write_object_contents.
(_bfd_elf_compute_section_file_positions): Update comments on
sh_offset for shstrtab section.
(assign_file_positions_for_non_load_sections): Set sh_offset to
-1 for shstrtab section.
(assign_file_positions_except_relocs): Likewise.
(_bfd_elf_assign_file_positions_for_non_load): Set up sh_name
when compressing DWARF debug sections.  Place shstrtab section
after DWARF debug sections have been compressed.
(_bfd_elf_write_object_contents): Setting sh_name for output
sections.

ld/testsuite/

PR ld/18277
* ld-elf/compressed1d.d: New.
* ld-elf/compressed1e.d: Likewise.

9 years agoImprove warning messages for la/dla
Matthew Fortune [Thu, 23 Apr 2015 19:09:13 +0000 (20:09 +0100)]
Improve warning messages for la/dla

gas/

* config/tc-mips.c (macro): State the recommended way of creating
32-bit or 64-bit addresses.

gas/testsuite/

* gas/mips/dla-warn.l: New file.
* gas/mips/dla-warn.s: New file.
* gas/mips/la-warn.l: New file.
* gas/mips/la-warn.s: New file.
* gas/mips/mips.exp: Run new tests.

9 years agoAdd option --weak-unresolved-symbols to treat unresolved symbols as weak ref.
Sriraman Tallam [Thu, 23 Apr 2015 20:56:40 +0000 (13:56 -0700)]
Add option --weak-unresolved-symbols to treat unresolved symbols as weak ref.

This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.

9 years agoAdd option --weak-unresolved-symbols to treat unresolved as weak references.
Sriraman Tallam [Thu, 23 Apr 2015 20:48:24 +0000 (13:48 -0700)]
Add option --weak-unresolved-symbols to treat unresolved as weak references.

This patch adds option --weak-unresolved-symbols to treat unresolved symbols as
weak references.  This is helpful when we want the link to succeed with unresolved
symbols and the dynamic loader to not complain at run-time.  Option
--warn-unresolved-symbols lets the link succeed but could fail at run-time with
unresolved symbol warnings especially when the unresolved symbols have GOT entries
and dynamic relocations against them, like when -fPIE is used.

2015-04-23  Sriraman Tallam  <tmsriram@google.com>
* options.h (--weak-unresolved-symbols): New option.
* symtab.cc (Symbol_table::sized_write_globals): Change symbol
binding to weak with new option.
* symtab.h (is_weak_undefined): Check for new option.
(is_strong_undefined): Check for new option.
* testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/weak_unresolved_symbols_test.cc: New file.

9 years agoFix r6-branch-constraints test when run with n64 as default ABI
Matthew Fortune [Thu, 23 Apr 2015 19:10:50 +0000 (20:10 +0100)]
Fix r6-branch-constraints test when run with n64 as default ABI

gas/testsuite/

* gas/mips/mips.exp: Require o32 for r6-branch-constraints.

9 years agoDon't change compressed input debug section names
H.J. Lu [Thu, 23 Apr 2015 14:58:05 +0000 (07:58 -0700)]
Don't change compressed input debug section names

Change compressed input debug section name for objdump is very confusing.
But we need to change it for linker so that linker will consider the
input section as a debug section.  This patch delays section rename to
elf_fake_sections for objcopy and avoids it for objdump.

bfd/

PR binutils/18209
* bfd.c (bfd): Add is_linker_input.
* elf.c (convert_debug_to_zdebug): New.
(convert_zdebug_to_debug): Likewise.
(_bfd_elf_make_section_from_shdr): Don't convert .debug_* to
.zdebug_* here.  Use convert_zdebug_to_debug.  Set SEC_ELF_RENAME.
(_bfd_elf_init_reloc_shdr): Pass a pointer to section name
instead of a pointer to section.
(elf_fake_sections): Rename the section name if SEC_ELF_RENAME
is set.
* section.c (SEC_ELF_RENAME): New.
* bfd-in2.h: Regenerated.

binutils/

PR binutils/18209
* objcopy.c (setup_section): Copy compress status.

binutils/testsuite/

PR binutils/18209
* binutils-all/compress.exp: Replace dw2-3.W with dw2-3gabi.W
on zlib-gabi output.
* binutils-all/dw2-1.W: Convert section names to .zdebug_*.
* binutils-all/dw2-3.W: Likewise.
* binutils-all/objdump.W: Likewise.
* binutils-all/dw2-3gabi.W: New file.

ld/

PR binutils/18209
* ldfile.c (ldfile_try_open_bfd): Set is_linker_input to 1.

9 years agoFix gdb.base/interrupt.exp racy fail against gdbserver
Pedro Alves [Thu, 23 Apr 2015 14:48:27 +0000 (15:48 +0100)]
Fix gdb.base/interrupt.exp racy fail against gdbserver

Currently, against gdbserver, interrupt.exp occasionaly fails like
this:

 ERROR: Process no longer exists
 UNRESOLVED: gdb.base/interrupt.exp: send end of file

The problem is that we see gdbserver exiting before we match gdb's
output:

 expect: does "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n" (spawn_id exp8) match regular expression "end of file"? Gate "end of file"? gate=no
 expect: read eof
 expect: set expect_out(spawn_id) "exp8"
 expect: set expect_out(buffer) "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n"

Fix this by removing $inferior_spawn_id from the set of spawn ids
expect is watching as soon as we see the "end of file" string out of
the inferior spawn id, using an indirect spawn id list.

Tested on x86-64 Fedora 20, native and gdbserver (both target remote
and extended-remote).

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

* gdb.base/interrupt.exp: Use an indirect spawn id list holding
$inferior_spawn_id instead of $inferior_spawn_id directly.  On
"end of file", remove $inferior_spawn_id from the indirect list.

9 years agogdb.base/interrupt.exp: Rename saw_eof to saw_end_of_file
Pedro Alves [Thu, 23 Apr 2015 14:48:27 +0000 (15:48 +0100)]
gdb.base/interrupt.exp: Rename saw_eof to saw_end_of_file

To avoid confusion between "end of file" string matching and eof
matching, as in process exit.

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

* gdb.base/interrupt.exp: Rename saw_eof to saw_end_of_file.

9 years agogdb_test_multiple match eof of any spawn_id
Pedro Alves [Thu, 23 Apr 2015 14:48:26 +0000 (15:48 +0100)]
gdb_test_multiple match eof of any spawn_id

Since silent handling of eof is usually the wrong thing to do, this
patch makes gdb_test_multiple handle it for all $any_spawn_id.

Currently, against gdbserver, interrupt.exp occasionaly fails like
this:

 FAIL: gdb.base/interrupt.exp: send end of file

gdb.log with expect debug output enabled shows:

 expect: does "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n" (spawn_id exp8) match regular expression "end of file"? Gate "end of file"? gate=no
 expect: read eof
 expect: set expect_out(spawn_id) "exp8"
 expect: set expect_out(buffer) "\r\n\r\nChild exited with status 0\r\nGDBserver exiting\r\n"
 FAIL: gdb.base/interrupt.exp: send end of file

Note "expect: read eof" for spawn_id=exp8.  exp8 is
inferior_spawn_id/gdbserver_spawn_id.  That means
expect/gdb_test_multiple saw gdbserver exit before we got the expected
gdb output.  Since there's no explicit pattern for "eof", expect (and
thus gdb_test_multiple) just returns.

After this commit, we get instead:

 ERROR: Process no longer exists
 UNRESOLVED: gdb.base/interrupt.exp: send end of file

Note that before we still got an FAIL because $saw_inferior_exit is 0
when we get to:

gdb_assert { $saw_eof && $saw_inferior_exit } $msg

Fixing the fail (now unresolved) will be the subject of a separate
patch.

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

* lib/gdb.exp (gdb_test_multiple): Match eof/full_buffer/timeout
on $any_spawn_id instead of only on $gdb_spawn_id.

9 years agox86: disambiguate disassembly of certain AVX512 insns
Jan Beulich [Thu, 23 Apr 2015 14:42:40 +0000 (16:42 +0200)]
x86: disambiguate disassembly of certain AVX512 insns

Certain conversion operations as well as vfpclassp{d,s} are ambiguous
when the input operand is in memory and no broadcast is being used.
While in Intel mode this gets resolved by printing suitable operand
size modifiers, AT&T mode need mnemonic suffixes to be added.

gas/testsuite/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

* gas/i386/avx512dq.d: Add 'z' suffix to vfpclassp{d,s} non-
register, non-broadcast cases.
* gas/i386/x86-64-avx512dq.d: Likewise.
* gas/i386/avx512dq_vl.d: Add 'x' and 'y' suffixes to
vcvt{,u}qq2ps and vfpclassp{d,s} non-register, non-broadcast
cases.
* gas/i386/x86-64-avx512dq_vl.d: Likewise.
* gas/i386/avx512f_vl.d: Add 'x' and 'y' suffixes to
vcvt{,t}pd2{,u}dq and vcvtpd2ps non-register, non-broadcast
cases.
* gas/i386/x86-64-avx512f_vl.d: Likewise.

opcodes/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

* i386-dis.c (putop): Extend "XY" handling to AVX512. Handle "XZ".
* i386-dis-evex.h.c (vcvtpd2ps, vcvtqq2ps, vcvttpd2udq,
vcvtpd2udq, vcvtuqq2ps, vcvttpd2dq, vcvtpd2dq): Add %XY.
(vfpclasspd, vfpclassps): Add %XZ.

9 years agox86: don't require operand size specification for AVX512 broadcasts
Jan Beulich [Thu, 23 Apr 2015 14:41:21 +0000 (16:41 +0200)]
x86: don't require operand size specification for AVX512 broadcasts

Certain conversion operations as well as vfpclassp{d,s} are ambiguous
when the input operand is in memory. That ambiguity, however, doesn't
apply when using broadcasts (the destination operand size can be
induced from the broadcast specifier).

gas/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

* config/tc-i386.c (match_mem_size): Also allow no size
specification when broadcasting.

gas/testsuite/
2015-04-23  Jan Beulich  <jbeulich@suse.com>

* gas/i386/avx512dq.s: Drop 'z' suffix from vfpclassp{d,s} in
some AT&T and all Intel cases.
* gas/i386/x86-64-avx512dq.s: Likewise.
* gas/i386/avx512dq_vl.s: Drop 'x' and 'y' suffixes from
vcvt{,u}qq2ps and vfpclassp{d,s} in some AT&T and all Intel
cases.
* gas/i386/x86-64-avx512dq_vl.s: Likewise.
* gas/i386/avx512f_vl.s: Drop 'x' and 'y' suffixes from
vcvt{,t}pd2{,u}dq and vcvtpd2ps in some AT&T and all Intel
cases.
* gas/i386/x86-64-avx512f_vl.s: Likewise.

9 years agoExplicitly call rl_resize_terminal() in TUI's SIGWINCH handler
Patrick Palka [Wed, 22 Apr 2015 23:25:55 +0000 (19:25 -0400)]
Explicitly call rl_resize_terminal() in TUI's SIGWINCH handler

In readline 6.3, the semantics of SIGWINCH handling has changed.
When a SIGWINCH signal is raised, readline's rl_sigwinch_handler() now
does not immediately call rl_resize_terminal().  Instead it sets a flag
that is checked by RL_CHECK_SIGNALS() at a point where readline has
control, and calls rl_resize_terminal() if said flag is set.

This change is item (c) in https://cnswww.cns.cwru.edu/php/chet/readline/CHANGES

  c.  Fixed a bug that caused readline to try and run code to modify its idea
      of the screen size in a signal handler context upon receiving a SIGWINCH.

This change in behavior is important to us because TUI's
tui_sigwinch_handler() relies on the assumption that by the time it's
called, readline will have updated its knowledge of the terminal
dimensions via rl_resize_terminal().  Since this assumption no longer
holds true, TUI's SIGWINCH handling does not work correctly with
readline 6.3.

To fix this issue this patch makes TUI explicitly call
rl_resize_terminal() in tui_async_resize_screen() at the point where
current terminal dimensions are needed.  (We could call it in
tui_sigwinch_handler too, but since readline avoids doing it, we are
probably safer off avoiding to call it in signal handler context as
well.)  After this change, SIGWINCH handling continues to work properly
with both readline 6.2 and 6.3.

Since we no longer need it, we could now explicitly disable readline's
SIGWINCH handler by setting rl_catch_sigwinch to zero early on in the
program startup but I can't seem to find a good spot to place this
assignment (the first call to rl_initialize() occurs in
tui_initialize_readline() so the assignment should occur before then),
and the handler is harmless anyway.

gdb/ChangeLog:

* tui/tui-win.c (tui_async_resize_screen): Call
rl_resize_terminal().

9 years agoAccept odd result in ld-powerpc/tocnovar testcase
Alan Modra [Wed, 22 Apr 2015 02:01:18 +0000 (11:31 +0930)]
Accept odd result in ld-powerpc/tocnovar testcase

I didn't commit this with the relro and powerpc .TOC. changes,
thinking that something should be done about the odd result of
.shstrtab appearing in PT_GNU_RELRO.  On looking at it further,
I think that changing readelf would be wrong, so let's just
accept the results.  Real binaries will always have other sections
past .got, so PT_GNU_RELRO won't finish past the end of loaded
sections.

* ld-powerpc/tocnovar.d: Adjust.

9 years agoAlign .TOC. for PowerPC64
Alan Modra [Tue, 21 Apr 2015 09:48:24 +0000 (19:18 +0930)]
Align .TOC. for PowerPC64

This change, with prerequisite 0e5fabeb, provides a toc base aligned
to 256 bytes rather than 8 bytes.  This is necessary for a minor gcc
optimisation, allowing use of d-form instructions to correctly access
toc-relative items larger than 8 bytes.

bfd/
* elf64-ppc.c (TOC_BASE_ALIGN): Define.
(ppc64_elf_next_toc_section): Align multi-got toc base.
(ppc64_elf_set_toc): Likewise initial toc base and .TOC. symbol.
ld/
* emulparams/elf64ppc.sh (GOT): Align.
ld/testsuite/
* ld-powerpc/ambiguousv1b.d: Update for aligned .got.
* ld-powerpc/defsym.d: Likewise.
* ld-powerpc/elfv2-2exe.d: Likewise.
* ld-powerpc/elfv2exe.d: Likewise.
* ld-powerpc/elfv2so.d: Likewise.
* ld-powerpc/relbrlt.d: Likewise.
* ld-powerpc/tls.g: Likewise.
* ld-powerpc/tlsexe.d: Likewise.
* ld-powerpc/tlsexe.g: Likewise.
* ld-powerpc/tlsexe.r: Likewise.
* ld-powerpc/tlsexetoc.d: Likewise.
* ld-powerpc/tlsexetoc.g: Likewise.
* ld-powerpc/tlsexetoc.r: Likewise.
* ld-powerpc/tlsso.d: Likewise.
* ld-powerpc/tlsso.g: Likewise.
* ld-powerpc/tlsso.r: Likewise.
* ld-powerpc/tlstoc.g: Likewise.
* ld-powerpc/tlstocso.d: Likewise.
* ld-powerpc/tlstocso.g: Likewise.
* ld-powerpc/tlstocso.r: Likewise.
* ld-powerpc/tocopt.d: Likewise.
* ld-powerpc/tocopt2.d: Likewise.
* ld-powerpc/tocopt3.d: Likewise.
* ld-powerpc/tocopt4.d: Likewise.
* ld-powerpc/tocopt5.d: Likewise.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 23 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agolibiberty/setenv.c: Do not declare environ if defined as a macro.
Joel Brobecker [Wed, 22 Apr 2015 19:35:54 +0000 (12:35 -0700)]
libiberty/setenv.c: Do not declare environ if defined as a macro.

Otherwise, it causes a build warning on some platforms such as MinGW.

libiberty/ChangeLog (Eli Zaretskii  <eliz@gnu.org>):

        * setenv.c <environ>: Declare only if not a macro.

9 years agowindows-nat: Don't change current_event.dwThreadId in handle_output_debug_string()
Jon Turney [Wed, 15 Apr 2015 20:41:25 +0000 (21:41 +0100)]
windows-nat: Don't change current_event.dwThreadId in handle_output_debug_string()

Using the 'catch-signal' test from the testsuite, on x86_64 Cygwin:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    main () at ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    Failed to resume program execution (ContinueDebugEvent failed, error 87)
    (gdb)

This error occurs because when handle_output_debug_string processes a Cygwin
signal message, it re-writes current_event.dwThreadId to reflect the thread that
the signal will be delivered to, which can be different to the thread reporting
the signal.

Altering current_event.dwThreadId() will cause ContinueDebugEvent() to be
applied to the wrong thread and fail.

So, rather than re-writing the thread id in current_event, use the thread
id by returning it.

With this patch applied this test now yields the expected result:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:42
    42        raise (SIGHUP);               /* third HUP */
    (gdb)

gdb/ChangeLog:

2015-04-22  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (handle_output_debug_string): Don't change
current_event.dwThreadId.
(get_windows_debug_event): Use thread_id, rather than relying on
current_event.dwThreadId being changed.

9 years agowindows-nat: Report an error if ContinueDebugEvent() fails
Jon Turney [Wed, 15 Apr 2015 20:37:11 +0000 (21:37 +0100)]
windows-nat: Report an error if ContinueDebugEvent() fails

Using the 'catch-signal' test from the testsuite, on x86_64 Cygwin:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    [hangs]

This is due to a defect in the way Cygwin signals are handled: When
handle_output_debug_string processes a Cygwin signal message, it re-writes
current_event.dwThreadId to reflect the thread that the signal will be delivered
to.

Subsequently, the call to ContinueDebugEvent will fail, because we're trying to
resume the wrong thread.  GDB is then stuck waiting forever for another event
that will never come.

This patch doesn't fix the problem, it just adds appropriate error handling.

Using error() seems appropriate here, if ContinueDebugEvent() fails, the
inferior is in an unknown state and we will probably not be debugging it
anymore.

With this patch applied, resuming the execution of the program now yields:

    $ ./gdb testsuite/outputs/gdb.base/catch-signal/catch-signal.exe
    [...]
    (gdb) catch signal
    Catchpoint 1 (standard signals)
    (gdb) r
    [...]
    Catchpoint 1 (signal SIGHUP), main () at
    ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    (gdb) c
    Continuing.
    main () at ../../../gdb/testsuite/gdb.base/catch-signal.c:40
    40        raise (SIGHUP);               /* second HUP */
    Failed to resume program execution (ContinueDebugEvent failed, error 87)
    (gdb)

gdb/ChangeLog:

2015-04-22  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (windows_continue): Report an error if
ContinueDebugEvent() fails.

9 years agowindows-nat: Fix misspelling in debug output
Jon Turney [Tue, 14 Apr 2015 20:05:21 +0000 (21:05 +0100)]
windows-nat: Fix misspelling in debug output

gdb/ChangeLog:

2015-04-16  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (windows_resume): Fix misspelling in debug output.

9 years agowindows-nat: Cleanups in get_windows_debug_event
Jon Turney [Tue, 14 Apr 2015 18:28:44 +0000 (19:28 +0100)]
windows-nat: Cleanups in get_windows_debug_event

gdb/ChangeLog:

2015-04-16  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (get_windows_debug_event): Replace retval with
thread_id throughout.  Update stale comment.

9 years agowindows-nat: Don't use ternary conditional operator in get_windows_debug_event
Jon Turney [Tue, 14 Apr 2015 18:42:07 +0000 (19:42 +0100)]
windows-nat: Don't use ternary conditional operator in get_windows_debug_event

gdb/ChangeLog:

2015-04-16  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (get_windows_debug_event): Don't use ternary
conditional operator.

9 years agoRewrite relro adjusting code
Alan Modra [Wed, 22 Apr 2015 13:16:19 +0000 (22:46 +0930)]
Rewrite relro adjusting code

The linker tries to put the end of the last section in the relro
segment exactly on a page boundary, because the relro segment itself
must end on a page boundary.  If for any reason this can't be done,
padding is inserted.  Since the end of the relro segment is typically
between .got and .got.plt, padding effectively increases the size of
the GOT.  This isn't nice for targets and code models with limited GOT
addressing.

The problem with the current code is that it doesn't cope very well
with aligned sections in the relro segment.  When making .got aligned
to a 256 byte boundary for PowerPC64, I found that often the initial
alignment attempt failed and the fallback attempt to be less than
adequate.  This is a particular problem for PowerPC64 since the
distance between .got and .plt affects the size of plt call stubs,
leading to "stubs don't match calculated size" errors.

So this rewrite takes a direct approach to calculating a new relro
base.  Starting from the last section in the segment, we calculate
where it must start to position its end on the boundary, or as near as
possible considering alignment requirements.  The new start then
becomes the goal for the previous section to end, and so on for all
sections.  This of course ignores the possibility that user scripts
will place . = ALIGN(xxx); in the relro segment, or provide section
address expressions.  In those cases we might fail, but the old code
probably did too, and a fallback is provided.

ld/
* ldexp.h (struct ldexp_control): Delete dataseg.min_base.  Add
data_seg.relro_offset.
* ldexp.c (fold_binary <DATA_SEGMENT_ALIGN>): Don't set min_base.
(fold_binary <DATA_SEGMENT_RELRO_END>): Do set relro_offset.
* ldlang.c (lang_size_sections): Rewrite code adjusting relro
segment base to line up last section on page boundary.
ld/testsuite/
* ld-x86-64/pr18176.d: Update.

9 years agoi386: Allow copy relocs for building PIE
H.J. Lu [Wed, 22 Apr 2015 12:24:54 +0000 (05:24 -0700)]
i386: Allow copy relocs for building PIE

This patch allows copy relocs for R_386_GOTOFF relocations in PIE.  For

extern int glob_a;
int foo ()
{
  return glob_a;
}

compiler now can optimize it from

call __x86.get_pc_thunk.ax
addl $_GLOBAL_OFFSET_TABLE_, %eax
movl glob_a@GOT(%eax), %eax
movl (%eax), %eax
ret

to

call __x86.get_pc_thunk.ax
addl $_GLOBAL_OFFSET_TABLE_, %eax
movl glob_a@GOTOFF(%eax), %eax
ret

bfd/

PR ld/18289
* elf32-i386.c (elf_i386_link_hash_entry): Add gotoff_ref.
(elf_i386_link_hash_newfunc): Initialize gotoff_ref to 0.
(elf_i386_create_dynamic_sections): Always allow copy relocs for
building executables.
(elf_i386_copy_indirect_symbol): Also copy gotoff_ref.
(elf_i386_check_relocs): Set gotoff_ref for R_386_GOTOFF.
(elf_i386_adjust_dynamic_symbol): Also allocate copy relocs for
PIE and R_386_GOTOFF.
(elf_i386_relocate_section): Allow R_386_GOTOFF in executable.

ld/testsuite/

PR ld/18289
* ld-i386/copyreloc-lib.c: New file.
* ld-i386/copyreloc-main.S: Likewise.
* ld-i386/copyreloc-main.out: Likewise.
* ld-i386/copyreloc-main1.rd: Likewise.
* ld-i386/copyreloc-main2.rd: Likewise.
* ld-i386/dummy.c: Likewise.
* ld-i386/pr17689.out: Likewise.
* ld-i386/pr17689.rd: Likewise.
* ld-i386/pr17689a.c: Likewise.
* ld-i386/pr17689b.S: Likewise.
* ld-i386/pr17827.rd: Likewise.
* ld-i386/pr17827ver.rd: Likewise.
* ld-i386/i386.exp: Run copyreloc tests.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 22 Apr 2015 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix pascal behavior for class fields with testcase
Pierre Muller [Tue, 21 Apr 2015 20:10:08 +0000 (22:10 +0200)]
Fix pascal behavior for class fields with testcase

  Problem reported as PR pascal/17815

Part 1/3: Remember the case pattern that allowed finding a field of this.
File gdb/p-exp.y modified

  This is the fix in the pascal parser (p-exp.y),
to avoid the error that GDB does find normal variables
case insensitively, but not fields of this,
inside a class or object method.

Part 2/3: Add "class" option for pascal compiler
File gdb/testsuite/lib/pascal.exp

This part of the patch series is unchanged.
It adds class option to pascal compiler
which adds the required command line option to
accept pascal class types.

Part 3/3:
New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas

  Here is an updated version of this test, using Pedro's suggestions.
Test to check that PR 17815 is fixed.

9 years agoIntroduce new shared function fileio_to_host_openflags
Gary Benson [Tue, 21 Apr 2015 11:07:54 +0000 (12:07 +0100)]
Introduce new shared function fileio_to_host_openflags

This commit introduces a new shared function to replace identical
functions in GDB and gdbserver.

9 years agosim: mcore: clean up printf warnings
Mike Frysinger [Tue, 21 Apr 2015 07:05:57 +0000 (03:05 -0400)]
sim: mcore: clean up printf warnings

These printf statements are showing "word" objects which are typedefed
from long, so make sure to use l with %x when printing them to avoid
warnings from gcc.

9 years agosim: mcore: convert to common memory/verbose functions
Mike Frysinger [Tue, 21 Apr 2015 06:55:29 +0000 (02:55 -0400)]
sim: mcore: convert to common memory/verbose functions

Re-use the existing memory core that handles reads/writes.

The verbose command is converted to the common --verbose flag
since only a few call sites use it now.

9 years agosim: mcore: drop watchpoint/dumpmem/clearstats support
Mike Frysinger [Tue, 21 Apr 2015 06:50:38 +0000 (02:50 -0400)]
sim: mcore: drop watchpoint/dumpmem/clearstats support

In preparation for converting to the common memory framework, the custom
commands get in our way.  But when we realize that gdb support has been
dropped for mcore, it makes things a bit easier: the main runner does not
let you run arbitrary commands once simulation starts.

So lets disable watchpoint support until it can be converted to the common
watchpoint logic.  There's already an ifdef to let us do that.

We straight up drop support for the dumpmem command (no other sim supports
this, and if it's a feature people want, we can add a common func) and the
clearstats command (not a big deal -- just restart your simulation).

We leave in place the verbose check points as a follow up commit will cut
that over to common logic.

9 years agosim: mcore: switch to common syscall handling
Mike Frysinger [Tue, 21 Apr 2015 06:30:21 +0000 (02:30 -0400)]
sim: mcore: switch to common syscall handling

Now that libgloss has a header tracking the syscalls for this arch, we
can update the database to include it for the symbolic constants/maps.
Then we can switch the mcore syscall callbacks over to the common ones.

9 years agosim: gennltvals.sh: handle split out newlib source tree
Mike Frysinger [Tue, 21 Apr 2015 06:24:34 +0000 (02:24 -0400)]
sim: gennltvals.sh: handle split out newlib source tree

Since newlib no longer shares the same repo as binutils/gdb, we have to go
searching further afield to locate the sources.  We still look at the top
level for newlib, but if that is not found, we also try up one dir outside
of this source tree.  It sucks, but better than the status quo (no workie).

9 years agoExtend rl78 prologue analyzer to recognize more complicated prologues
Kevin Buettner [Tue, 21 Apr 2015 06:37:44 +0000 (23:37 -0700)]
Extend rl78 prologue analyzer to recognize more complicated prologues

This patch extends the rl78 prologue analyzer so that it can recognize
this kind of prologue:

   0x119f <main>:       movw    ax, sp
   0x11a1 <main+2>:     subw    ax, #0x1fa6
   0x11a4 <main+5>:     movw    sp, ax

The test case for gdb.base/miscexprs.exp is now compiled to generate
that sequence instead of a much longer and more inefficient sequence.

gdb/ChangeLog:

* rl78-tdep.c (RL78_SP_ADDR): Define.
(opc_reg_to_gdb_regnum): New static function.
(rl78_analyze_prologue): Recognize instructions forming slightly
more interesting prologues.

9 years agoEnsure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE...
Ian Coolidge [Tue, 21 Apr 2015 01:04:07 +0000 (18:04 -0700)]
Ensure that dynamically loaded libraries won't use separate copies of GNU_UNIQUE symbols.

gold/
* symtab.cc (Symbol::should_add_dynsym_entry): Return true for
GNU_UNIQUE.

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

9 years agoAlways set up sh_name in assign_section_numbers
H.J. Lu [Mon, 20 Apr 2015 19:37:14 +0000 (12:37 -0700)]
Always set up sh_name in assign_section_numbers

commit 9ad5cbcfb23cb74d34bd04f88f4e47c0f5de5155 added the initial support
for more than 64k ELF sections with holes for reserved section indices in
section header table and set entries of reserved section indices in
section header table to index 0:

   for (secn = 1; secn < section_number; ++secn)
-    i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
-                                                    i_shdrp[secn]->sh_name);
-
+    if (i_shdrp[secn] == NULL)
+      i_shdrp[secn] = i_shdrp[0];
+    else
+      i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
+ i_shdrp[secn]->sh_name);

commit 4fbb74a6055f7d48f09c44064073d3b1e99c6642 removed holes in section
header table.  Check for i_shdrp[secn] == NULL is no longer needed now.
This patch removes it.

* elf.c (assign_section_numbers): Always set up sh_name.

9 years agoDon't hardcode offset of .shstrtab section
H.J. Lu [Mon, 20 Apr 2015 16:55:34 +0000 (09:55 -0700)]
Don't hardcode offset of .shstrtab section

There is no requirement on placement of section name section, .shstrtab.
This patch removes hardcoded offsets of .shstrtab sections.

binutils/testsuite/

* binutils-all/i386/compressed-1b.d: Don't hardcode offset of
.shstrtab section.
* binutils-all/i386/compressed-1c.d: Likewise.
* binutils-all/readelf.s-64: Likewise.
* binutils-all/x86-64/compressed-1b.d: Likewise.
* binutils-all/x86-64/compressed-1c.d: Likewise.

gas/testsuite/

* gas/i386/ilp32/x86-64-unwind.d: Don't hardcode offset of
.shstrtab section.
* gas/i386/x86-64-unwind.d: Likewise.
* gas/ia64/alias-ilp32.d: Likewise.
* gas/ia64/alias.d: Likewise.
* gas/ia64/group-1.d: Likewise.
* gas/ia64/group-2.d: Likewise.
* gas/ia64/secname-ilp32.d: Likewise.
* gas/ia64/secname.d: Likewise.
* gas/ia64/unwind-ilp32.d: Likewise.
* gas/ia64/unwind.d: Likewise.
* gas/mmix/bspec-1.d: Likewise.
* gas/mmix/byte-1.d: Likewise.
* gas/mmix/loc-1.d: Likewise.
* gas/mmix/loc-2.d: Likewise.
* gas/mmix/loc-3.d: Likewise.
* gas/mmix/loc-4.d: Likewise.
* gas/mmix/loc-5.d: Likewise.
* gas/tic6x/scomm-directive-4.d: Likewise.

ld/testsuite/

* ld-mmix/bspec1.d: Don't hardcode offset of .shstrtab section.
* ld-mmix/bspec2.d: Likewise.
* ld-mmix/local1.d: Likewise.
* ld-mmix/local3.d: Likewise.
* ld-mmix/local5.d: Likewise.
* ld-mmix/local7.d: Likewise.
* ld-mmix/undef-3.d: Likewise.
* ld-sh/sh64/crangerel1.rd: Likewise.
* ld-sh/sh64/crangerel2.rd: Likewise.
* ld-tic6x/common.d: Likewise.
* ld-tic6x/shlib-1.rd: Likewise.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1.rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.
* ld-tic6x/static-app-1.rd: Likewise.
* ld-tic6x/static-app-1b.rd: Likewise.
* ld-tic6x/static-app-1r.rd: Likewise.
* ld-tic6x/static-app-1rb.rd: Likewise.
* ld-x86-64/ilp32-4.d: Likewise.
* ld-x86-64/split-by-file-nacl.rd: Likewise.
* ld-x86-64/split-by-file.rd: Likewise.

9 years agoIterate ELF sections by pointer
H.J. Lu [Mon, 20 Apr 2015 15:50:01 +0000 (08:50 -0700)]
Iterate ELF sections by pointer

Iterate ELF sections by pointer without section counter.  It removes
"i++".

* elf.c (assign_file_positions_for_non_load_sections): Iterate
sections by pointer.
(_bfd_elf_assign_file_positions_for_non_load): Likewise.

9 years agoSilence texinfo 5.1 warnings
H.J. Lu [Mon, 20 Apr 2015 15:05:13 +0000 (08:05 -0700)]
Silence texinfo 5.1 warnings

This patch silences texinfo 5.1 warnings by using @subsection and
sorting entries in Machine Dependencies menu.

* doc/as.texinfo (Bundle directives): Shorten menu entry and
use @subsection.
(CFI directives): Use @subsection.
(SH-Dependent, SH64-Dependent): Moved after SCORE-Dependent.
* doc/c-i386.texi (i386-Mnemonics): Use @subsection.

9 years agoRevert "Do not consider reference types as dynamic"
Pierre-Marie de Rodat [Mon, 20 Apr 2015 14:06:50 +0000 (16:06 +0200)]
Revert "Do not consider reference types as dynamic"

This reverts commit 961f41602529c9cd4f88af6c02fb61fb55100e27.

Note that the revert is partial: it keeps the new testcases
gdb.ada/funcall_ref.exp.

9 years agoRevert "gdbtypes.c: remove the usuned "top_level" parameter"
Pierre-Marie de Rodat [Mon, 20 Apr 2015 14:04:28 +0000 (16:04 +0200)]
Revert "gdbtypes.c: remove the usuned "top_level" parameter"

This reverts commit 25755e2b85e2bd5b313ea87f32000bf9a47dbbf8.

9 years agoFix three test failures with extended remote targets
Gary Benson [Mon, 20 Apr 2015 10:35:29 +0000 (11:35 +0100)]
Fix three test failures with extended remote targets

This commit fixes three gdb.base/attach.exp failures when using
extended remote targets.  The failures occurred because GDB now
locates and loads files when attaching on remote targets if the
remote target supports qXfer:exec-file:read; the filenames were
shown but with "target:" prefixes which the test has been updated
to handle.

gdb/testsuite/ChangeLog:

* gdb.base/attach.exp: Fix three extended remote failures.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 20 Apr 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRemove duplicated xmalloc in update_dprintf_command_list
Gabriel Krisman Bertazi [Sun, 19 Apr 2015 22:34:08 +0000 (19:34 -0300)]
Remove duplicated xmalloc in update_dprintf_command_list

Code in update_dprintf_command_list performed a duplicated memory
allocation which caused an obvious memory leak.  This removes the
duplication.

gdb/
2015-04-19  Gabriel Krisman Bertazi  <gabriel@krisman.be>

* breakpoint.c (update_dprintf_command_list): Remove duplicated
xmalloc.

9 years ago[GDB] Hurd: Robustify the reply_mig_hack.awk script.
Thomas Schwinge [Sun, 19 Apr 2015 22:31:54 +0000 (00:31 +0200)]
[GDB] Hurd: Robustify the reply_mig_hack.awk script.

..., so that it also works with the GNU MIG 1.5 just released.

gdb/
* reply_mig_hack.awk: Robustify parsing.

9 years ago[GDB] Hurd: Simplify the reply_mig_hack.awk script.
Thomas Schwinge [Sun, 19 Apr 2015 22:22:32 +0000 (00:22 +0200)]
[GDB] Hurd: Simplify the reply_mig_hack.awk script.

gdb/
* reply_mig_hack.awk: Don't bother to declare an intermediate
function pointer variable.

... allowing us to simplify the parsing a little bit.  And, instead of
"warning: initialization from incompatible pointer type", we now get "warning:
function called through a non-compatible type".  Oh well.

9 years agosim/erc32: Switched emulated memory to host endian order.
Jiri Gaisler [Fri, 3 Apr 2015 20:35:48 +0000 (22:35 +0200)]
sim/erc32: Switched emulated memory to host endian order.

Change data ordering in emulated memory from target order (big endian)
to host order. Improves performance and simplifies most memory
operations. Requires some byte twisting during stores on little
endian hosts (intel). Also removed support for little-endian binaries.

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

9 years agosim: clean up duplicate sim-engine hooks
Mike Frysinger [Sat, 18 Apr 2015 08:38:33 +0000 (04:38 -0400)]
sim: clean up duplicate sim-engine hooks

Now that we've unified sim-cpu, we can delete the duplicate sim-engine
hooks -- these targets defined these only because they didn't fully
implement the sim-cpu callbacks.

9 years agosim: trim old USING_SIM_BASE_H define
Mike Frysinger [Sat, 18 Apr 2015 08:22:25 +0000 (04:22 -0400)]
sim: trim old USING_SIM_BASE_H define

This doesn't appear to have been used since 1998, but wasn't cleaned
up since.  So much for being "quick" ;).

9 years agosim: unify SIM_CPU definition
Mike Frysinger [Sat, 18 Apr 2015 08:19:56 +0000 (04:19 -0400)]
sim: unify SIM_CPU definition

Since every target typedefs this the same way, move it to the common code.

We have to leave Blackfin behind here for now because of inter-dependencies
on types and headers: sim-base.h includes sim-model.h which needs types in
machs.h which needs types in bfim-sim.h which needs SIM_CPU.

9 years agosim: unify sim_cia definition
Mike Frysinger [Sat, 18 Apr 2015 08:08:56 +0000 (04:08 -0400)]
sim: unify sim_cia definition

Almost every target defines sim_cia the same way -- either using the
address_word type directly, or a type of equivalent size.  The only
odd one out is sh64 (who has 32bit address_word and 64bit cia), and
even that case doesn't seem to make sense.  We'll put off clean up
though of sh64 and at least set up a sensible default for everyone.

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

9 years agosolib-svr4.c (svr4_exec_displacement): Rename outer "displacement".
Doug Evans [Fri, 17 Apr 2015 17:57:45 +0000 (10:57 -0700)]
solib-svr4.c (svr4_exec_displacement): Rename outer "displacement".

gdb/ChangeLog:

* solib-svr4.c (svr4_exec_displacement): Rename outer "displacement"
to "exec_displacement" to avoid confusion with inner use of the name.

9 years agoUse LIFO instead of FIFO to implement gc's transitive closure.
Rafael Ávila de Espíndola [Fri, 17 Apr 2015 15:51:36 +0000 (11:51 -0400)]
Use LIFO instead of FIFO to implement gc's transitive closure.

FIFO is harder to implement and has less locality than LIFO. It is
also not necessary to implement a transitive closure, a LIFO works
just as well.

9 years agoMerge include/partition.h from GCC.
Richard Earnshaw [Fri, 17 Apr 2015 15:10:43 +0000 (16:10 +0100)]
Merge include/partition.h from GCC.

2015-03-19  Richard Biener  <rguenther@suse.de>

* partition.h (struct partition_elem): Re-order elements to
avoid padding.

9 years agogdbserver/xtensa: fix typo in XCHAL_HAVE_LOOPS
Max Filippov [Thu, 16 Apr 2015 23:52:50 +0000 (02:52 +0300)]
gdbserver/xtensa: fix typo in XCHAL_HAVE_LOOPS

This fixes lbeg/lend/lcount registers handling through gdbserver.

2015-04-17  Max Filippov  <jcmvbkbc@gmail.com>
gdb/gdbserver/
* linux-xtensa-low.c (xtensa_fill_gregset)
(xtensa_store_gregset): Check XCHAL_HAVE_LOOPS instead of
XCHAL_HAVE_LOOP.

9 years agogdbserver/xtensa: drop xtensa_usrregs_info
Max Filippov [Fri, 17 Apr 2015 00:07:41 +0000 (03:07 +0300)]
gdbserver/xtensa: drop xtensa_usrregs_info

xtensa_usrregs_info refers to undefined variables xtensa_num_regs and
xtensa_regmap. Drop xtensa_usrregs_info and replace pointer to usrregs
in regs_info with NULL since all registers are read/set through regsets.

2015-04-17  Max Filippov  <jcmvbkbc@gmail.com>
gdb/gdbserver/
* linux-xtensa-low.c (xtensa_usrregs_info): Remove.
(regs_info): Replace usrregs pointer with NULL.

9 years agoreturn zero in arm_linux_can_use_hw_breakpoint if HW point isn't supported
Yao Qi [Fri, 17 Apr 2015 12:52:44 +0000 (13:52 +0100)]
return zero in arm_linux_can_use_hw_breakpoint if HW point isn't supported

This patch is to cherry-pick part of Pedro's patch here
https://sourceware.org/ml/gdb-patches/2015-04/msg00527.html in which
zero is returned if the HW point isn't supported.

In arm-linux native gdb testing on a board doesn't support HW breakpoint,
without this patch, the output in gdb.base/breakpoint-in-ro-region.exp is like:

(gdb) hbreak *0x83bc^M
Hardware breakpoints used exceeds limit.^M
(gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: probe hbreak support (support)

with this patch, the output becomes:

(gdb) hbreak *0x83bc^M
No hardware breakpoint support in the target.^M
(gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: probe hbreak support (no support)

As a result, the following fails are fixed.

-FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: step in ro region (cannot insert hw break)
-FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: thread advanced
-FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: step in ro region (cannot insert hw break)
-FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: thread advanced

gdb:

2015-04-17  Pedro Alves  <palves@redhat.com>

* arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Return zero
if HW point of TYPE isn't supported.

9 years agoUpdate comments to target_can_use_hardware_watchpoint
Yao Qi [Fri, 17 Apr 2015 12:45:53 +0000 (13:45 +0100)]
Update comments to target_can_use_hardware_watchpoint

The return value of target_can_use_hardware_watchpoint isn't well
documented, so this patch is to update the comments to reflect the
fact.  This patch also removes a trailing ";" which is picked up
from Pedro's patch https://sourceware.org/ml/gdb-patches/2015-04/msg00527.html

gdb:

2015-04-17  Yao Qi  <yao.qi@linaro.org>
    Pedro Alves  <palves@redhat.com>

* target.h (target_can_use_hardware_watchpoint): Update comments.
Remove trailing ";".

9 years agoFix avr compiler warning
Senthil Kumar Selvaraj [Fri, 17 Apr 2015 11:25:54 +0000 (20:55 +0930)]
Fix avr compiler warning

declaration of "link" shadows a global declaration

* config/tc-avr.c (create_record_for_frag): Rename link to
prop_rec_link.

9 years agoAccess executable from remote system when first inferior appears
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Access executable from remote system when first inferior appears

This commit modifies remote_add_inferior to take an extra argument
try_open_exec.  If this is nonzero, remote_add_inferior will attempt
to open this inferior's executable as the main executable if no main
executable is open already.  Callers are updated appropriately.

With this commit, remote debugging can now be initiated using only a
"target remote" or "target extended-remote" command; no "set sysroot"
or "file" commands are required, e.g.

  bash$ gdb -q
  (gdb) target remote | gdbserver - /bin/sh
  Remote debugging using | gdbserver - /bin/sh
  Process /bin/sh created; pid = 32166
  stdin/stdout redirected
  Remote debugging using stdio
  Reading symbols from target:/bin/bash...

One testcase required updating as a result of this commit.  The test
checked that GDB's "info files" command does not crash if no main
executable is open, and relied on GDB's inability to access the main
executable over the remote protocol.  The test was updated to inhibit
this new behavior.

gdb/ChangeLog:

* remote.c (remote_add_inferior): New argument try_open_exec.
If nonzero, attempt to open the inferior's executable file as
the main executable if no main executable is open already.
All callers updated.
* NEWS: Mention that GDB now supports automatic location and
retrieval of executable + files from remote targets.

gdb/doc/ChangeLog:

* gdb.texinfo (Connecting to a Remote Target): Mention that
GDB can access program files from remote targets that support
qXfer:exec-file:read and Host I/O packets.

gdb/testsuite/ChangeLog:

* gdb.server/server-exec-info.exp: Inhibit GDB from accessing
the main executable over the remote protocol.

9 years agoImplement qXfer:exec-file:read in gdbserver
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Implement qXfer:exec-file:read in gdbserver

This commit implements the "qXfer:exec-file:read" packet in gdbserver.

gdb/gdbserver/ChangeLog:

* target.h (struct target_ops) <pid_to_exec_file>: New field.
* linux-low.c (linux_target_ops): Initialize pid_to_exec_file.
* server.c (handle_qxfer_exec_file): New function.
(qxfer_packets): Add exec-file entry.
(handle_query): Report qXfer:exec-file:read as supported packet.

9 years agoImplement remote_pid_to_exec_file using qXfer:exec-file:read
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Implement remote_pid_to_exec_file using qXfer:exec-file:read

This commit adds a new packet "qXfer:exec-file:read" to the remote
protocol that can be used to obtain the pathname of the file that
was executed to create a process on the remote system.  Support for
this packet is added to GDB and remote_ops.to_pid_to_exec_file is
implemented using it.

gdb/ChangeLog:

* target.h (TARGET_OBJECT_EXEC_FILE): New enum value.
* remote.c (PACKET_qXfer_exec_file): Likewise.
(remote_protocol_features): Register the
"qXfer:exec-file:read" feature.
(remote_xfer_partial): Handle TARGET_OBJECT_EXEC_FILE.
(remote_pid_to_exec_file): New function.
(init_remote_ops): Initialize to_pid_to_exec_file.
(_initialize_remote): Register new "set/show remote
pid-to-exec-file-packet" command.
* NEWS: Announce new qXfer:exec-file:read packet.

gdb/doc/ChangeLog:

* gdb.texinfo (Remote Configuration): Document the "set/show
remote pid-to-exec-file-packet" command.
(General Query Packets): Document the qXfer:exec-file:read
qSupported features.  Document the qXfer:exec-file:read packet.

9 years agoIntroduce linux_proc_pid_to_exec_file
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Introduce linux_proc_pid_to_exec_file

This commit introduces a new function linux_proc_pid_to_exec_file
that shared Linux code can use to discover the filename of the
executable that was run to create a process on the system.

gdb/ChangeLog:

* nat/linux-procfs.h (linux_proc_pid_to_exec_file):
New declaration.
* nat/linux-procfs.c (linux_proc_pid_to_exec_file):
New function, factored out from...
* linux-nat.c (linux_child_pid_to_exec_file): ...here.

9 years agoUse gdb_sysroot for main executable on attach
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Use gdb_sysroot for main executable on attach

This commit updates exec_file_locate_attach to use exec_file_find
to compute the full pathname of the main executable in some cases.
The net effect of this is that the main executable's path will be
prefixed with gdb_sysroot in the same way that shared library paths
currently are.

gdb/ChangeLog:

* exec.c (solist.h): New include.
(exec_file_locate_attach): Prefix absolute executable
paths with gdb_sysroot if set.
* NEWS: Mention that executable paths may be prepended
with sysroot.

gdb/doc/ChangeLog:

* gdb.texinfo (set sysroot): Document that "set sysroot" also
applies to executable paths if supplied to GDB as absolute.

9 years agoIntroduce exec_file_find
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Introduce exec_file_find

This commit adds a new function, exec_file_find, which computes the
full pathname of the main executable in much the same way solib_find
does for pathnames of shared libraries.  The bulk of the existing
solib_find was moved into a new static function solib_find_1, with
exec_file_find and solib_find being small wrappers for solib_find_1.

gdb/ChangeLog:

* solist.h (exec_file_find): New declaration.
* solib.c (solib_find_1): New function, factored out from...
(solib_find): ...here.
(exec_file_find): New function.

9 years agoIntroduce exec_file_locate_attach
Gary Benson [Fri, 17 Apr 2015 08:47:30 +0000 (09:47 +0100)]
Introduce exec_file_locate_attach

This commit adds a new function, exec_file_locate_attach, which works
like exec_file_attach except that, instead of a filename argument, it
takes an integer process ID and attempts to determine the executable
filename from that.

gdb/ChangeLog:

* gdbcore.h (exec_file_locate_attach): New declaration.
* exec.c (exec_file_locate_attach): New function, factored
out from...
* infcmd.c (attach_command_post_wait): ...here.