binutils-gdb.git
9 years agold: don't use ia64 register name in expression of pr16322 test
Jan Beulich [Wed, 28 Jan 2015 09:04:51 +0000 (10:04 +0100)]
ld: don't use ia64 register name in expression of pr16322 test

"f1" is a register name on ia64, and hence gets warned upon when used
as expression value:

.../binutils/2.25/ld/testsuite/ld-elf/pr16322.s: Assembler messages:
.../binutils/2.25/ld/testsuite/ld-elf/pr16322.s:6: Warning: register value used as expression

Change the name (and "p1" at once, which is a register name too, albeit
not currently causing any immediate problem).

ld/testsuite/
2015-01-28  Jan Beulich  <jbeulich@suse.com>

* ld-elf/pr16322.s (p1): Rename to px1.
(f1): Rename to fx1.

9 years agoPowerPC64 changes for xlc
Alan Modra [Tue, 27 Jan 2015 13:10:05 +0000 (23:40 +1030)]
PowerPC64 changes for xlc

The changes to reorder sections for better relro protection on powerpc64,
3e2b0f3123283c1b, and 5ad18f16, run into a problem with xlc.
xlc -qdatalocal puts global variables into .toc, which means that .toc
must be writable.  The simplest way to accomplish this is to edit the
linker script to remove .toc sections from .got on detecting xlc object
files.

bfd/
* elf64-ppc.h (struct ppc64_elf_params): Add "object_in_toc".
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Assume that global symbols
in .toc indicate xlc compiled code that might require a rw .toc.
ld/
* emulparams/elf64ppc.sh (INITIAL_READWRITE_SECTIONS): Define.
* emultempl/ppc64elf.em (params): Init new field.
(ppc_after_open): New function.
(LDEMUL_AFTER_OPEN): Define.
* ldlang.c (lang_final): Whitespace fix.
ld/testsuite/
* ld-powerpc/tocvar.d, * ld-powerpc/tocvar.s: New test.
* ld-powerpc/tocnovar.d, * ld-powerpc/tocnovar.s: New test.
* ld-powerpc/powerpc.exp: Run tocvar and tocnovar.

9 years agoFT32 initial support
Alan Modra [Wed, 28 Jan 2015 05:06:43 +0000 (15:36 +1030)]
FT32 initial support

FT32 is a new 32-bit RISC core developed by FTDI for embedded applications.

* configure.ac: Add FT32 support.
* configure: Regenerate.
bfd/
* Makefile.am: Add FT32 files.
* archures.c (enum bfd_architecture): Add bfd_arch_ft32.
(bfd_mach_ft32): Define.
(bfd_ft32_arch): Declare.
(bfd_archures_list): Add bfd_ft32_arch.
* config.bfd: Handle FT32.
* configure.ac: Likewise.
* cpu-ft32.c: New file.
* elf32-ft32.c: New file.
* reloc.c (BFD_RELOC_FT32_10, BFD_RELOC_FT32_20, BFD_RELOC_FT32_17,
BFD_RELOC_FT32_18): Define.
* targets.c (_bfd_target_vector): Add ft32_elf32_vec.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* readelf.c: Add FT32 support.
gas/
* Makefile.am: Add FT32 files.
* config/tc-ft32.c: New file.
* config/tc-ft32.h: New file.
* configure.tgt: Add FT32 support.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
gas/testsuite/
* gas/ft32/ft32.exp: New file.
* gas/ft32/insn.d: New file.
* gas/ft32/insn.s: New file.
include/
* dis-asm.h (print_insn_ft32): Declare.
include/elf/
* common.h (EM_FT32): Define.
* ft32.h: New file.
include/opcode/
* ft32.h: New file.
ld/
* Makefile.am: Add FT32 files.
* configure.tgt: Handle FT32 target.
* emulparams/elf32ft32.sh: New file.
* scripttempl/ft32.sc: New file.
* Makefile.in: Regenerate.
opcodes/
* Makefile.am: Add FT32 files.
* configure.ac: Handle FT32.
* disassemble.c (disassembler): Call print_insn_ft32.
* ft32-dis.c: New file.
* ft32-opc.c: New file.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.

9 years agoAllow symbols in MEMORY region specification
Senthil Kumar Selvaraj [Wed, 28 Jan 2015 04:31:50 +0000 (15:01 +1030)]
Allow symbols in MEMORY region specification

This patch fixes PR 4643 by allowing symbols in the LENGTH and ORIGIN
fields of MEMORY regions.  Previously, only constants and constant
expressions are allowed.

For the AVR target, this helps define memory constraints more
accurately (per device), without having to create a ton of device
specific linker scripts.

ld/
PR 4643
* ldexp.c (fold_name): Fold LENGTH only after
lang_first_phase_enum.
* ldgram.y (memory_spec): Don't evaluate ORIGIN and LENGTH
rightaway.
* ldlang.h (struct memory_region_struct): Add origin_exp and
length_exp fields.
* ldlang.c (lang_do_memory_regions): New.
(lang_memory_region_lookup): Initialize origin_exp and
length_exp fields.
(lang_process): Call lang_do_memory_regions.
ld/testsuite/
* ld-scripts/memory.t: Define new symbol tred.
* ld-scripts/memory_sym.t: New.
* ld-scripts/script.exp: Perform MEMORY with symbols test, and
conditionally check values of linker symbols.

9 years agoNDS32/opcodes: Add new system registers.
Kuan-Lin Chen [Wed, 28 Jan 2015 01:12:59 +0000 (09:12 +0800)]
NDS32/opcodes: Add new system registers.

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

9 years agoAdd gdb.Objfile.username.
Doug Evans [Tue, 27 Jan 2015 18:13:52 +0000 (10:13 -0800)]
Add gdb.Objfile.username.

gdb/ChangeLog:

* NEWS: Mention gdb.Objfile.username.
* python/py-objfile.c (objfpy_get_username): New function.
(objfile_getset): Add "username".

gdb/doc/ChangeLog:

* python.texi (Objfiles In Python): Document Objfile.username.

gdb/testsuite/ChangeLog:

* gdb.python/py-objfile.exp: Add tests for objfile.username.
Add test for objfile.filename, objfile.username after objfile
has been unloaded.

9 years agoImprove docs of objfile filename method.
Doug Evans [Tue, 27 Jan 2015 18:03:15 +0000 (10:03 -0800)]
Improve docs of objfile filename method.

gdb/doc/ChangeLog:

* python.texi (Objfiles In Python) <Objfile.filename>: Improve docs.
* guile.texi (Objfiles In Guile) <objfile-filename>: Improve docs.

9 years agoFixes for invalid memory accesses triggered by running windres on corrupt binaries.
Nick Clifton [Tue, 27 Jan 2015 17:32:23 +0000 (17:32 +0000)]
Fixes for invalid memory accesses triggered by running windres on corrupt binaries.

PR binutils/17512
* rcparse.y: Add checks to avoid integer divide by zero.
* rescoff.c (read_coff_rsrc): Add check on the size of the
resource section.
(read_coff_res_dir): Add check on the nesting level.
Check for resource names overrunning the buffer.
* resrc.c (write_rc_messagetable): Update formatting.
Add check of 'elen' being zero.

9 years agoFixes for memory access violations triggered by running addr2line on fuzzed binaries.
Nick Clifton [Tue, 27 Jan 2015 15:49:12 +0000 (15:49 +0000)]
Fixes for memory access violations triggered by running addr2line on fuzzed binaries.

PR binutils/17512
* addr2line.c (slurp_symtab): If the symcount is zero, free the
symbol table pointer.

* dwarf2.c (concat_filename): Check for an empty directory table.
(scan_unit_for_symbols): Check for reading off the end of the
unit.
(parse_comp_unit): Check for a DW_AT_comp_dir attribute with a
non-string form.
* elf64-ppc.c (opd_entry_value): Fail if there are no relocs
available.

9 years agoFix memory access violations triggered by running dlltool on corrupt binaries.
Nick Clifton [Tue, 27 Jan 2015 11:30:15 +0000 (11:30 +0000)]
Fix memory access violations triggered by running dlltool on corrupt binaries.

PR binutils/17512
* dlltool.c (identify_search_archive): If the last archive was the
same as the current archive, terminate the loop.

* pdp11.c (aout_get_external_symbols): Return false if there are
no symbols.

9 years agoNDS32/gas: Limit the format of pseudo instruction la.
Kuan-Lin Chen [Tue, 27 Jan 2015 03:19:13 +0000 (11:19 +0800)]
NDS32/gas: Limit the format of pseudo instruction la.

9 years agoNDS32/gas: Fix md_parse_name hook.
Kuan-Lin Chen [Tue, 27 Jan 2015 03:08:07 +0000 (11:08 +0800)]
NDS32/gas: Fix md_parse_name hook.

9 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Jan 2015 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix ARI warning in stack.c (return_command).
Mark Wielaard [Sat, 24 Jan 2015 14:08:32 +0000 (15:08 +0100)]
Fix ARI warning in stack.c (return_command).

gdb/ChangeLog

    * stack.c (return_command): Markup warning message with _.

9 years agocheck gdb.lookup_type return value in gdb.python/py-lookup-type.exp
Joel Brobecker [Wed, 21 Jan 2015 09:29:09 +0000 (10:29 +0100)]
check gdb.lookup_type return value in gdb.python/py-lookup-type.exp

This further improves this testcase to check the output of
our calls to gdb.lookup_type.

gdb/ChangeLog:

        * gdb.python/py-lookup-type.exp (test_lookup_type): Change
        the second test to print the name attribute of value
        returned by the call to gdb.lookup_type, and adjust
        the expected output accordingly.

9 years agoNDS32/bfd: Fix relax round setting.
Kuan-Lin Chen [Mon, 26 Jan 2015 02:48:01 +0000 (10:48 +0800)]
NDS32/bfd: Fix relax round setting.

9 years ago2015-01-25 Cary Coutant <ccoutant@google.com>
Cary Coutant [Mon, 26 Jan 2015 01:31:32 +0000 (17:31 -0800)]
2015-01-25  Cary Coutant  <ccoutant@google.com>

gold/
* output.cc (Output_segment::set_section_addresses): Fix calculation
of size of relro segment.

9 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Jan 2015 00:01:31 +0000 (00:01 +0000)]
Automatic date update in version.in

9 years agoRemove testsuite compile errors with GCC5.
Mark Wielaard [Sun, 25 Jan 2015 15:42:05 +0000 (16:42 +0100)]
Remove testsuite compile errors with GCC5.

GCC5 defaults to the GNU11 standard for C and warns by default for
implicit function declarations and implicit return types.
https://gcc.gnu.org/gcc-5/porting_to.html

Fixing these issues in the testsuite turns 9 untested and 17 unsupported
testcases into 417 new passes when compiling with GCC5.

gdb/testsuite/ChangeLog:

        * gdb.arch/i386-bp_permanent.c (standard): New declaration.
        * gdb.base/disp-step-fork.c: Include unistd.h.
        * gdb.base/siginfo-obj.c: Include stdio.h.
        * gdb.base/siginfo-thread.c: Likewise.
        * gdb.mi/non-stop.c: Include unistd.h.
        * gdb.mi/nsthrexec.c: Include stdio.h.
        * gdb.mi/pthreads.c: Include unistd.h.
        * gdb.modula2/unbounded1.c (main): Declare returns int.
        * gdb.reverse/consecutive-reverse.c: Likewise.
        * gdb.threads/create-fail.c: Include unistd.h.
        * gdb.threads/killed.c: Likewise.
        * gdb.threads/linux-dp.c: Likewise.
        * gdb.threads/non-ldr-exc-1.c: Include stdio.h and string.h.
        * gdb.threads/non-ldr-exc-2.c: Likewise.
        * gdb.threads/non-ldr-exc-3.c: Likewise.
        * gdb.threads/non-ldr-exc-4.c: Likewise.
        * gdb.threads/pthreads.c: Include unistd.h.
        (main): Declare returns int.
        * gdb.threads/tls-main.c (foo): New declaration.
        * gdb.threads/watchpoint-fork-mt.c: Define _GNU_SOURCE.

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

9 years agogdbtypes.h (TYPE_TYPE_SPECIFIC): Delete.
Doug Evans [Sat, 24 Jan 2015 19:17:08 +0000 (11:17 -0800)]
gdbtypes.h (TYPE_TYPE_SPECIFIC): Delete.

gdb/ChangeLog:

* gdbtypes.h (TYPE_TYPE_SPECIFIC): Delete.

9 years agoFix 100x slowdown regression on DWZ files
Jan Kratochvil [Sat, 24 Jan 2015 14:44:52 +0000 (15:44 +0100)]
Fix 100x slowdown regression on DWZ files

Since Fedora started to use DWZ DWARF compressor:
http://fedoraproject.org/wiki/Features/DwarfCompressor
GDB has slowed down a lot.  To make it clear - DWZ is DWARF structure
rearrangement, "compressor" does not mean any zlib style data compression.

This patch reduces LibreOffice backtrace from 5 minutes to 3 seconds (100x)
and it also reduces memory consumption 20x.
[ benchmark is at the bottom of this mail ]

Example of DWZ output:
------------------------------------------------------------------------------
  Compilation Unit @ offset 0xc4:
 <0><cf>: Abbrev Number: 17 (DW_TAG_partial_unit)
    <d0>   DW_AT_stmt_list   : 0x0
    <d4>   DW_AT_comp_dir    : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb
 <1><d8>: Abbrev Number: 9 (DW_TAG_typedef)
    <d9>   DW_AT_name        : (indirect string, offset: 0x827dc): size_t
    <dd>   DW_AT_decl_file   : 4
    <de>   DW_AT_decl_line   : 212
    <df>   DW_AT_type        : <0xae>

  Compilation Unit @ offset 0xe4:
 <0><ef>: Abbrev Number: 13 (DW_TAG_partial_unit)
    <f0>   DW_AT_stmt_list   : 0x0
    <f4>   DW_AT_comp_dir    : (indirect string, offset: 0x6f): /usr/src/debug/gdb-7.7.1/build-x86_64-redhat-linux-gnu/gdb
 <1><f8>: Abbrev Number: 45 (DW_TAG_typedef)
    <f9>   DW_AT_name        : (indirect string, offset: 0x251): __off_t
    <fd>   DW_AT_decl_file   : 3
    <fe>   DW_AT_decl_line   : 131
    <ff>   DW_AT_type        : <0x68>

  Compilation Unit @ offset 0x62d9f9:
 <0><62da04>: Abbrev Number: 20 (DW_TAG_compile_unit)
[...]
    <62da12>   DW_AT_low_pc  : 0x807e10
    <62da1a>   DW_AT_high_pc     : 134
    <62da1c>   DW_AT_stmt_list   : 0xf557e
 <1><62da20>: Abbrev Number: 7 (DW_TAG_imported_unit)
    <62da21>   DW_AT_import  : <0xcf> [Abbrev Number: 17]
------------------------------------------------------------------------------

One can see all DW_TAG_partial_unit have DW_AT_stmt_list 0x0 which causes
repeated decoding of that .debug_line unit on each DW_TAG_imported_unit.

This was OK before as each DW_TAG_compile_unit has its own .debug_line unit.
But since the introduction of DW_TAG_partial_unit by DWZ one should cache
read-in DW_AT_stmt_list .debug_line units.

Fortunately one does not need to cache whole
        struct linetable *symtab->linetable
and other data from .debug_line mapping PC<->lines
------------------------------------------------------------------------------
 Line Number Statements:
  Extended opcode 2: set Address to 0x45c880
  Advance Line by 25 to 26
  Copy
------------------------------------------------------------------------------
as the only part of .debug_line which GDB needs for DW_TAG_partial_unit is:
------------------------------------------------------------------------------
 The Directory Table:
  ../../gdb
  /usr/include/bits
[...]
 The File Name Table:
  Entry Dir     Time    Size    Name
  1     1 0 0 gdb.c
  2     2 0 0 string3.h
[...]
------------------------------------------------------------------------------
specifically referenced in GDB for DW_AT_decl_file at a single place:
------------------------------------------------------------------------------
              fe = &cu->line_header->file_names[file_index - 1];
              SYMBOL_SYMTAB (sym) = fe->symtab;
------------------------------------------------------------------------------

This is because for some reason DW_TAG_partial_unit never contains PC-related
DWARF information.  I do not know exactly why, the compression ratio is a bit
lower due to it but thanksfully currently it is that way:
dwz.c:
------------------------------------------------------------------------------
        /* These attributes reference code, prevent moving
           DIEs with them.  */
        case DW_AT_low_pc:
        case DW_AT_high_pc:
        case DW_AT_entry_pc:
        case DW_AT_ranges:
          die->die_ck_state = CK_BAD;
+
  /* State of checksum computation.  Not computed yet, computed and
     suitable for moving into partial units, currently being computed
     and finally determined unsuitable for moving into partial units.  */
  enum { CK_UNKNOWN, CK_KNOWN, CK_BEING_COMPUTED, CK_BAD } die_ck_state : 2;
------------------------------------------------------------------------------
I have also verified also real-world Fedora debuginfo files really comply with
that assumption with dwgrep
https://github.com/pmachata/dwgrep
using:
------------------------------------------------------------------------------
dwgrep -e 'entry ?DW_TAG_partial_unit child* ( ?DW_AT_low_pc , ?DW_AT_high_pc , ?DW_AT_ranges )' /usr/lib/debug/**
------------------------------------------------------------------------------

BTW I think GDB already does not support the whole DW_TAG_imported_unit and
DW_TAG_partial_unit usage possibilities as specified by the DWARF standard.
I think GDB would not work if DW_TAG_imported_unit was used in some inner
level and not at the CU level (readelf -wi level <1>) - this is how DWZ is
using DW_TAG_imported_unit.  Therefore I do not think further assumptions
about DW_TAG_imported_unit and DW_TAG_partial_unit usage by DWZ are a problem
for GDB.

One could save the whole .debug_line decoded PC<->lines mapping (and not just
the DW_AT_decl_file table) but:
 * there are some problematic corner cases so one could do it incorrectly
 * there are no real world data to really test such patch extension
 * such extension could be done perfectly incrementally on top of this patch

------------------------------------------------------------------------------

benchmark - on Fedora 20 x86_64 and FSF GDB HEAD:
echo -e 'thread apply all bt\nset confirm no\nq'|./gdb -p `pidof soffice.bin` -ex 'set pagination off' -ex 'maintenance set per-command
space' -ex 'maintenance set per-command symtab' -ex 'maintenance set per-command time'

FSF GDB HEAD ("thread apply all bt"):
Command execution time: 333.693000 (cpu), 335.587539 (wall)
                                          ---sec
Space used: 1736404992 (+1477189632 for this command)
                         ----MB
vs.
THIS PATCH ("thread apply all bt"):
Command execution time: 2.595000 (cpu), 2.607573 (wall)
                                        -sec
Space used: 340058112 (+85917696 for this command)
                        --MB

FSF GDB HEAD ("thread apply all bt full"):
Command execution time: 466.751000 (cpu), 468.345837 (wall)
                                          ---sec
Space used: 2330132480 (+2070974464 for this command)
                         ----MB
vs.
THIS PATCH ("thread apply all bt full"):
Command execution time: 18.907000 (cpu), 18.964125 (wall)
                                         --sec
Space used: 364462080 (+110325760 for this command)
                        ---MB

------------------------------------------------------------------------------

gdb/ChangeLog
2015-01-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix 100x slowdown regression on DWZ files.
* dwarf2read.c (struct dwarf2_per_objfile): Add line_header_hash.
(struct line_header): Add offset and offset_in_dwz.
(dwarf_decode_lines): Add parameter decode_mapping to the declaration.
(free_line_header_voidp): New declaration.
(line_header_hash, line_header_hash_voidp, line_header_eq_voidp): New
functions.
(dwarf2_build_include_psymtabs): Update dwarf_decode_lines caller.
(handle_DW_AT_stmt_list): Use line_header_hash.
(free_line_header_voidp): New function.
(dwarf_decode_line_header): Initialize offset and offset_in_dwz.
(dwarf_decode_lines): New parameter decode_mapping, use it.
(dwarf2_free_objfile): Free line_header_hash.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Jan 2015 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoCatch exception in value_rtti_indirect_type
Simon Marchi [Fri, 23 Jan 2015 17:59:24 +0000 (12:59 -0500)]
Catch exception in value_rtti_indirect_type

In the situation described in bug 17416 [1]:

  * "set print object" is on;
  * The variable object is a pointer to a struct, and it contains an
    invalid value (e.g. NULL, or random uninitialized value);
  * The variable object (struct) has a child which is also a pointer to a
    struct;
  * We try to use "-var-list-children".

... an exception thrown in value_ind can propagate too far and leave an
half-built variable object, leading to a wrong state. This patch adds a
TRY_CATCH to catch it and makes value_rtti_indirect_type return NULL in
that case, meaning that the type of the pointed object could not be
found.

A test for the fix is also added.

New in v2:

  * Added test.
  * Restructured "catch" code.
  * Added details about the bug in commit log.

gdb/Changelog:

* valops.c (value_rtti_indirect_type): Catch exception thrown by
value_ind.

gdb/testsuite/ChangeLog

* gdb.mi/mi-var-list-children-invalid-grandchild.c: New file.
* gdb.mi/mi-var-list-children-invalid-grandchild.exp: New file.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=17416

9 years agoFix build errors when compiling nlmconv.c on a 32-bit host.
Nick Clifton [Fri, 23 Jan 2015 16:39:53 +0000 (16:39 +0000)]
Fix build errors when compiling nlmconv.c on a 32-bit host.

* nlmconv.c (powerpc_mangle_relocs): Fix build errors introduced
by recent delta, when compiling on for a 32-bit host.

9 years agoUse GCC5/DWARF5 DW_AT_noreturn to mark functions that don't return normally.
Mark Wielaard [Tue, 9 Dec 2014 10:45:41 +0000 (11:45 +0100)]
Use GCC5/DWARF5 DW_AT_noreturn to mark functions that don't return normally.

Add a flag field is_noreturn to struct func_type. Make calling_convention
a small bit field to not increase the size of the struct. Set is_noreturn
if the new GCC5/DWARF5 DW_AT_noreturn is set on a DW_TAG_subprogram.
Use this information to warn the user before doing a finish or return from
a function that does not return normally to its caller.

(gdb) finish
warning: Function endless does not return normally.
Try to finish anyway? (y or n)

(gdb) return
warning: Function does not return normally to caller.
Make endless return now? (y or n)

gdb/ChangeLog

* dwarf2read.c (read_subroutine_type): Set TYPE_NO_RETURN from
DW_AT_noreturn.
* gdbtypes.h (struct func_type): Add is_noreturn field flag. Make
calling_convention an 8 bit bit field.
(TYPE_NO_RETURN): New macro.
* infcmd.c (finish_command): Query if function does not return
normally.
* stack.c (return_command): Likewise.

gdb/testsuite/ChangeLog

* gdb.base/noreturn-return.c: New file.
* gdb.base/noreturn-return.exp: New file.
* gdb.base/noreturn-finish.c: New file.
* gdb.base/noreturn-finish.exp: New file.

include/ChangeLog

* dwarf2.def (DW_AT_noreturn): New DWARF5 attribute.

The dwarf2.h addition and the code to emit the new attribute is already in
the gcc tree.

9 years agoLinux: make target_is_async_p return false when async is off
Pedro Alves [Fri, 23 Jan 2015 11:12:39 +0000 (11:12 +0000)]
Linux: make target_is_async_p return false when async is off

linux_nat_is_async_p currently always returns true, even when the
target is _not_ async.  That confuses
gdb_readline_wrapper/gdb_readline_wrapper_cleanup, which
force-disables target-async while the secondary prompt is active.  As
a result, when gdb_readline_wrapper returns, the target is left async,
even through it was sync to begin with.

That can result in weird bugs, like the one the test added by this
commit exposes.

Ref: https://sourceware.org/ml/gdb-patches/2015-01/msg00592.html

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

* linux-nat.c (linux_is_async_p): New macro.
(linux_nat_is_async_p):
(linux_nat_terminal_inferior): Check whether the target can async
instead of whether it is already async.
(linux_nat_terminal_ours): Don't check whether the target is
async.
(linux_async_pipe): Use linux_is_async_p.

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

* gdb.threads/continue-pending-after-query.c: New file.
* gdb.threads/continue-pending-after-query.exp: New file.

9 years agoFix filename in one of the recent gdb/ChangeLog entries (remove "gdb/").
Joel Brobecker [Fri, 23 Jan 2015 07:13:49 +0000 (08:13 +0100)]
Fix filename in one of the recent gdb/ChangeLog entries (remove "gdb/").

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Jan 2015 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoHandle R_M32C_24 specially
DJ Delorie [Thu, 22 Jan 2015 22:30:58 +0000 (17:30 -0500)]
Handle R_M32C_24 specially

2015-01-22  DJ Delorie  <dj@redhat.com>

* elf32-m32c.c (m32c_apply_reloc_24): New.
(m32c_elf_howto_table): Use it for R_M32C_24.
(m32c_elf_relocate_section): Handle R_M32C_24 specially.

9 years agoIntroduce gdb_interact in testsuite
Anders Granlund [Thu, 22 Jan 2015 19:33:04 +0000 (14:33 -0500)]
Introduce gdb_interact in testsuite

gdb_interact is a small utility that we have found quite useful to debug
test cases.

Putting gdb_interact in a test suspends it and allows to interact with
gdb to inspect whatever you want. You can then type ">>>" to resume the
test execution. Of course, this is only for gdb devs. It wouldn't make
sense to leave a gdb_interact permanently in a test case.

When starting the interaction with the user, the script prints this
banner:

+------------------------------------------+
| Script interrupted, you can now interact |
| with by gdb. Type >>> to continue.       |
+------------------------------------------+

Notes:
* When gdb is launched, the gdb_spawn_id variable (lib/gdb.exp) is
  assigned -1. Given the name, I would expect it to contain the gdb
  expect spawn id, which is needed for interact. I changed all places
  that set gdb_spawn_id to -1 to set it to the actual gdb spawn id
  instead.

* When entering the "interact" mode, the last (gdb) prompt is already
  eaten by expect, so it doesn't show up on the terminal. Subsequent
  prompts do appear though. We tried to print "(gdb)" just before the
  interact to replace it. However, it could be misleading if you are
  debugging an MI test case, it makes you think that you are typing in a
  CLI prompt, when in reality it's MI. In the end I decided that since
  the feature is for developers who know what they're doing and that one
  is normally consciously using gdb_interact, the script doesn't need
  to babysit the user.

* There are probably some quirks depending on where in the script
  gdb_interact appears (e.g. it could interfere with following
  commands and make them fail), but it works for most cases. Quirks can
  always be fixed later.

The idea and original implementation was contributed by Anders
Granlund, a colleague of mine. Thanks to him.

gdb/testsuite/ChangeLog:

* gdb.base/statistics.exp: Assign spawn id to gdb_spawn_id.
* gdb.base/valgrind-db-attach.exp: Same.
* gdb.base/valgrind-infcall.exp: Same.
* lib/mi-support.exp (default_mi_gdb_start): Same.
* lib/prompt.exp (default_prompt_gdb_start): Same.
* lib/gdb.exp (default_gdb_spawn): Same.
(gdb_interact): New.

9 years agoSort threads for thread apply all
Jan Kratochvil [Thu, 22 Jan 2015 20:04:53 +0000 (21:04 +0100)]
Sort threads for thread apply all

downstream Fedora request:
Please make it easier to find the backtrace of the crashing thread
https://bugzilla.redhat.com/show_bug.cgi?id=1024504

Currently after loading a core file GDB prints:

Core was generated by `./threadcrash1'.
Program terminated with signal SIGSEGV, Segmentation fault.
8       *(volatile int *)0=0;
(gdb) _

there is nowhere seen which of the threads had crashed.  In reality GDB always
numbers that thread as #1 and it is the current thread that time.  But after
dumping all the info into a file for later analysis it is no longer obvious.
'thread apply all bt' even puts the thread #1 to the _end_ of the output!!!

I find maybe as good enough and with no risk of UI change flamewar to just
sort the threads by their number.  Currently they are printed as they happen
in the internal GDB list which has no advantage.  Printing thread #1 as the
first one with assumed 'thread apply all bt' (after the core file is loaded)
should make the complaint resolved I guess.

On Thu, 15 Jan 2015 20:29:07 +0100, Doug Evans wrote:
No objection to sorting the list, but if thread #1 is the important one,
then a concern could be it'll have scrolled off the screen (such a
concern has been voiced in another thread in another context),
and if not lost (say it's in an emacs buffer) one would still have
to scroll back to see it.
So one *could* still want #1 to be last.
Do we want an option to choose the sort direction?

gdb/ChangeLog
2015-01-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* NEWS (Changes since GDB 7.9): Add 'thread apply all' option
'-ascending'.
* thread.c (tp_array_compar_ascending, tp_array_compar): New.
(thread_apply_all_command): Parse CMD for tp_array_compar_ascending.
Sort tp_array using tp_array_compar.
(_initialize_thread): Extend thread_apply_all_command help.

gdb/doc/ChangeLog
2015-01-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.texinfo (Threads): Describe -ascending for thread apply all.

9 years agoPrint current thread after loading a core file
Jan Kratochvil [Thu, 22 Jan 2015 20:02:24 +0000 (21:02 +0100)]
Print current thread after loading a core file

downstream Fedora request:
Please make it easier to find the backtrace of the crashing thread
https://bugzilla.redhat.com/show_bug.cgi?id=1024504

Currently after loading a core file GDB prints:

Core was generated by `./threadcrash1'.
Program terminated with signal SIGSEGV, Segmentation fault.
8       *(volatile int *)0=0;
(gdb) _

there is nowhere seen which of the threads had crashed.  In reality GDB always
numbers that thread as #1 and it is the current thread that time.  But after
dumping all the info into a file for later analysis it is no longer obvious.
'thread apply all bt' even puts the thread #1 to the _end_ of the output!!!

Should GDB always print after loading a core file what "thread" command would
print?
[Current thread is 1 (Thread 0x7fcbe28fe700 (LWP 15453))]

BTW I think it will print the thread even when loading single/non-threaded
core file when other inferior(s) exist.  But that currently crashes
[Bug threads/12074] multi-inferior internal error
https://sourceware.org/bugzilla/show_bug.cgi?id=12074
plus I think that would be a correct behavior anyway.

gdb/ChangeLog
2015-01-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* corelow.c (core_open): Call also thread_command.
* gdbthread.h (thread_command): New prototype moved from ...
* thread.c (thread_command): ... here.
(thread_command): Make it global.

9 years agoAnother part of fixing "make TAGS".
Eli Zaretskii [Thu, 22 Jan 2015 19:07:31 +0000 (21:07 +0200)]
Another part of fixing "make TAGS".

libdecnumber/
2015-01-22  Eli Zaretskii  <eliz@gnu.org>

* Makefile.in (TAGS): New target, to avoid failures in "make TAGS".

9 years agomingw32: fix windows-termcap/curses check
Pedro Alves [Thu, 22 Jan 2015 18:30:01 +0000 (18:30 +0000)]
mingw32: fix windows-termcap/curses check

When GDB is configured with "--without-tui --with-curses" or "--with-tui",
$prefer_curses is set to yes.  But, that still doesn't mean that curses
will be used.  configure will still search for the curses library, and
continue building without it.  That's done here:

 curses_found=no
 if test x"$prefer_curses" = xyes; then
 ...
   AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])

   if test "$ac_cv_search_waddstr" != no; then
     curses_found=yes
   fi
 fi

So if waddstr is not found, meaning curses is not really
available, even though it'd be preferred, $prefer_curses is
'yes', but $curses_found is 'no'.

So the right fix to tell whether we're linking with curses is
$curses_found=yes.

gdb/ChangeLog:
2015-01-22  Pedro Alves  <palves@redhat.com>

* configure.ac [*mingw32*]: Check $curses_found instead of
$prefer_curses.
* configure: Regenerate.
* windows-termcap.c: Remove HAVE_CURSES_H, HAVE_NCURSES_H and
HAVE_NCURSES_NCURSES_H checks.

9 years agoFix MinGW TUI build
Eli Zaretskii [Thu, 22 Jan 2015 18:23:12 +0000 (20:23 +0200)]
Fix MinGW TUI build

gdb/
2015-01-22  Eli Zaretskii  <eliz@gnu.org>

* gdb/tui/tui.c (tui_enable) [__MINGW32__]: If the call to 'newterm'
fails with the 1st arg NULL, try again with "unknown".  Don't test
the "cup" capability: it isn't supported by the Windows port of
ncurses, but the Windows console driver is still capable of
supporting TUI.

9 years agocompile: Fix function pointers
Jan Kratochvil [Thu, 22 Jan 2015 18:18:16 +0000 (19:18 +0100)]
compile: Fix function pointers

TBH while I always comment reasons for each of the compilation options in
reality I tried them all and chose that combination that needs the most simple
compile/compile-object-load.c (ld.so emulation) implementation.

gdb/ChangeLog
2015-01-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* compile/compile.c (_initialize_compile): Use -fPIE for compile_args.

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

* gdb.compile/compile.exp (pointer to jit function): New test.

9 years agoPartial fix for "make TAGS".
Eli Zaretskii [Thu, 22 Jan 2015 18:05:59 +0000 (20:05 +0200)]
Partial fix for "make TAGS".

gdb/
2015-01-22  Eli Zaretskii  <eliz@gnu.org>

* Makefile.in (HFILES_NO_SRCDIR): Remove ada-varobj.h.
(ALLDEPFILES): Remove irix5-nat.c.  These two are part of the
reason that "make TAGS" is broken.

9 years agogdb/hppa-tdep.c: Fix logical working flow issues and check additional store instructions.
Chen Gang [Thu, 22 Jan 2015 12:47:10 +0000 (20:47 +0800)]
gdb/hppa-tdep.c: Fix logical working flow issues and check additional store instructions.

Original working flow has several issues:

 - typo issue: "(inst >> 26) == 0x1f && ..." for checking 'stw(m)'.

 - "(inst >> 6) == 0xa" needs to be "((inst >> 6) & 0xf) == 0xa".

And also need check additional store instructions:

 - For absolute memory: 'stby', 'stdby'.

 - For unaligned: 'stwa', 'stda'.

The original code also can be improved:

 - Remove redundant double check "(inst >> 26) == 0x1b" for 'stwm'.

 - Use 2 'switch' statements instead of all 'if' statements.

* hppa-tdep.c (inst_saves_gr): Fix logical working flow issues
and check additional store instructions.

9 years agoFixes memory access violations triggered by running dlltool on fuzzed binaries.
Nick Clifton [Thu, 22 Jan 2015 12:06:04 +0000 (12:06 +0000)]
Fixes memory access violations triggered by running dlltool on fuzzed binaries.

PR binutils/17512
* coffcode.h (handle_COMDAT): When searching for the section
symbol, make sure that there is space left in the symbol table.
* vms-alpha.c (_bfd_vms_slurp_ehdr): Add range checks.

9 years ago[GOLD] Correct powerpc64 ifunc plt entry test
Alan Modra [Thu, 22 Jan 2015 02:09:50 +0000 (12:39 +1030)]
[GOLD] Correct powerpc64 ifunc plt entry test

Found when attempting to build an ELFv2 Linux kernel.  We don't
generally need a plt entry for ELFv2 got relocs, only on ifunc, just
like ppc32.

* powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
condition for need of ifunc plt entry.
(Target_powerpc::Scan::global <got relocs>): Likewise.

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

9 years agoFix memory access violations triggered by running strip on fuzzed binaries.
Nick Clifton [Wed, 21 Jan 2015 17:37:23 +0000 (17:37 +0000)]
Fix memory access violations triggered by running strip on fuzzed binaries.

PR binutils/17512
* coffcode.h (coff_set_arch_mach_hook): Check return value from
bfd_malloc.
(coff_slurp_line_table): Return FALSE if the line number
information was corrupt.
(coff_slurp_symbol_table): Return FALSE if the symbol information
was corrupt.
* mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always
initialise the fields of the dyld_info structure.
(bfd_mach_o_build_exec_seg_command): Replace assertion with an
error message and a return value.
(bfd_mach_o_layout_commands): Change the function to boolean.
Return FALSE if the function fails.
(bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands
fails.
(bfd_mach_o_read_command): Fail if an unrecognised command is
encountered.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the
read fails.
(slurp_symtab): Check the return from bfd_malloc.
(_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy
encountered an error.
(_bfd_XXi_final_link_postscript): Fail if a section could not be
copied.
* peicode.h (pe_bfd_object_p): Fail if the header could not be
swapped in.
* tekhex.c (first_phase): Fail if the section is too big.
* versados.c (struct esdid): Add content_size field.
(process_otr): Use and check the new field.
(versados_get_section_contents): Check that the section exists and
that the requested data is available.

PR binutils/17512
* addr2line.c (main): Call bfd_set_error_program_name.
* ar.c (main): Likewise.
* coffdump.c (main): Likewise.
* cxxfilt.c (main): Likewise.
* dlltool.c (main): Likewise.
* nlmconv.c (main): Likewise.
* nm.c (main): Likewise.
* objdump.c (main): Likewise.
* size.c (main): Likewise.
* srconv.c (main): Likewise.
* strings.c (main): Likewise.
* sysdump.c (main): Likewise.
* windmc.c (main): Likewise.
* windres.c (main): Likewise.
* objcopy.c (main): Likewise.
(copy_relocations_in_section): Check for relocs without associated
symbol pointers.

9 years agoAdd myself as write-after-approval GDB maintainer.
Wei-cheng Wang [Tue, 20 Jan 2015 16:07:50 +0000 (00:07 +0800)]
Add myself as write-after-approval GDB maintainer.

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add "Wei-cheng Wang".

9 years agoAdd missing comments in rs6000-tdep.c, ppc64-tdep.c and ppc-linux-tdep.c.
Wei-cheng Wang [Mon, 19 Jan 2015 15:34:07 +0000 (23:34 +0800)]
Add missing comments in rs6000-tdep.c, ppc64-tdep.c and ppc-linux-tdep.c.

gdb/ChangeLog:

* ppc-linux-tdep.c (ppc_skip_trampoline_code,
ppc_canonicalize_syscall, ppc_linux_syscall_record,
ppc_linux_record_signal, ppc_init_linux_record_tdep): Add comments.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
* rs6000-tdep.c (rs6000_epilogue_frame_cache,
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
rs6000_epilogue_frame_sniffer, ppc_record_vsr, ppc_process_record_op4,
ppc_process_record_op19, ppc_process_record_op31,
ppc_process_record_op59, ppc_process_record_op60,
ppc_process_record_op63): Likewise.

9 years agoAdd self to ARM Maintainers
Ramana Radhakrishnan [Wed, 21 Jan 2015 11:15:58 +0000 (11:15 +0000)]
Add self to ARM Maintainers

9 years agoThis patch fixes some illegal memory accesses triggered by running coffdump on fuzzed...
Nick Clifton [Wed, 21 Jan 2015 10:33:19 +0000 (10:33 +0000)]
This patch fixes some illegal memory accesses triggered by running coffdump on fuzzed binaries.

PR binutils/17512
* coffgrok.c (do_type): Check that computed ref exists.
(doit): Add range checks when computing section for scope.

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

9 years agogdb/ARI: Call safe_strerror instead of strerror in linux-ptrace.c
Joel Brobecker [Tue, 20 Jan 2015 17:38:23 +0000 (18:38 +0100)]
gdb/ARI: Call safe_strerror instead of strerror in linux-ptrace.c

gdb/ChangeLog:

        * nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string)
        (linux_ptrace_test_ret_to_nx): Use safe_strerror instead of
        strerror.

9 years agoFix date in gdb/ChangeLog.
Joel Brobecker [Tue, 20 Jan 2015 18:04:26 +0000 (19:04 +0100)]
Fix date in gdb/ChangeLog.

9 years agold: Update expected test results for 32-bit hosts.
Andrew Burgess [Tue, 20 Jan 2015 16:00:41 +0000 (16:00 +0000)]
ld: Update expected test results for 32-bit hosts.

Tests that I added in commit c05b575a8dfabab6af5d8586d1a5c0c67f819ac2
fails on 32-bit hosts due to differences in whitespace.

This patch updates the expected output patterns to be more accepting of
differences in whitespace, the tests should now pass.

ld/testsuite/ChangeLog:

* ld-scripts/provide-4-map.d: Update expected output.
* ld-scripts/provide-5-map.d: Likewise.

9 years agoFix format warning in rs6000t-dep.c
Wei-cheng Wang [Sun, 18 Jan 2015 07:20:46 +0000 (15:20 +0800)]
Fix format warning in rs6000t-dep.c

9 years agoAdd myself as write-after-approval GDB maintainer.
Chen Gang [Tue, 20 Jan 2015 14:17:09 +0000 (22:17 +0800)]
Add myself as write-after-approval GDB maintainer.

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add "Chen Gang".

9 years agoReorder more powerpc64 sections again for -z relro
Alan Modra [Tue, 20 Jan 2015 10:41:37 +0000 (21:11 +1030)]
Reorder more powerpc64 sections again for -z relro

.toc1 is the second level TOC section used by gcc's -mminimal-toc.  It
too should be read-only after relocation.  Also, the last patch
description mentioned .sbss moving but didn't actually do that, so fix
that problem.  .tocbss (whatever that is) was before .sbss previously,
so move that one too.

* emulparams/elf64ppc.sh (OTHER_SDATA_SECTIONS): Use in place of..
(OTHER_BSS_SYMBOLS): ..this.
(OTHER_PLT_RELOC_SECTIONS): Don't define.
(OTHER_GOT_RELOC_SECTIONS): Add rela.toc1 and rela.tocbss.
(OTHER_READWRITE_SECTIONS): Don't define.  Move .toc1 to..
(OTHER_RELRO_SECTIONS_2): ..here.
* scripttempl/elf.sc: Move SBSS too when DATA_SDATA.

9 years agold: Don't evaluate unneeded PROVIDE expressions.
Andrew Burgess [Wed, 7 Jan 2015 10:51:35 +0000 (10:51 +0000)]
ld: Don't evaluate unneeded PROVIDE expressions.

When creating a linker mapfile (using -Map=MAPFILE), we previously would
always try to evaluate the expression from a PROVIDE statement.

However, this is not always safe, consider:

  PROVIDE (foo = 0x10);
  PROVIDE (bar = foo);

In this example, if neither 'foo' or 'bar' is needed, then while
generating the linker mapfile evaluating the expression for 'foo' is
harmless (just the value 0x10).  However, evaluating the expression for
'bar' requires the symbol 'foo', which is undefined.  This used to cause
a fatal error.

This patch changes the behaviour, so that when the destination of the
PROVIDE is not defined (that is the PROVIDE is not going to provide
anything) the expression is not evaluated, and instead a special string
is displayed to indicate that the linker is discarding the PROVIDE
statement.

This change not only fixes the spurious undefined symbol error, but also
means that a user can now tell if a PROVIDE statement has provided
anything by inspecting the linker mapfile, something that could not be
done before.

ld/ChangeLog:

* ldlang.c (print_assignment): Only evaluate the expression for a
PROVIDE'd assignment when the destination is being defined.
Display a special message for PROVIDE'd symbols that are not being
provided.

ld/testsuite/ChangeLog:

* ld-scripts/provide-4.d: New file.
* ld-scripts/provide-4-map.d: New file.
* ld-scripts/provide-4.t: New file.
* ld-scripts/provide-5.d: New file.
* ld-scripts/provide-5.s: New file.
* ld-scripts/provide-5-map.d: New file.
* ld-scripts/provide-5.t: New file.
* ld-scripts/provide.exp: Run the provide-4.d and provide-5.d
tests.

9 years agold/testing: run_dump_test can now check linker mapfiles.
Andrew Burgess [Tue, 6 Jan 2015 23:40:48 +0000 (23:40 +0000)]
ld/testing: run_dump_test can now check linker mapfiles.

Add a new option 'map' to the ld run_dump_test mechanism.  When the
'map' option is given run_dump_test will ensure that there is a
-Map=MAPFILE present in the linker command line, adding one if needed.

The MAPFILE is then compared with the file passed to the new 'map'
option using the regexp_diff function.  This should make it slightly
easier to write tests that check the linker mapfile output.

The only test I found that already compares mapfile content is updated
to use the new mechanism.

ld/testsuite/ChangeLog:

* ld-scripts/overlay-size.d: Add 'map' option.
* ld-scripts/overlay-size.exp: Remove manual check of mapfile.
* lib/ld-lib.exp (run_dump_test): Add support for new 'map'
option, checking linker mapfile output.

9 years agoReorder more powerpc64 sections for -z relro
Alan Modra [Tue, 20 Jan 2015 06:49:15 +0000 (17:19 +1030)]
Reorder more powerpc64 sections for -z relro

This moves .got too, which requires .sdata and .sbss to move with it,
because these sections share addressing via the toc pointer and with
small-model code must be within a 16-bit signed offset.  .plt, .iplt
and .branch_lt must also be moved since they are addressed via a
32-bit offset from the toc pointer, and we might have a very large
.data section.

This change means we may have some bss style sections before the data
segment, necessitating another PT_LOAD header.  Also, since _edata is
defined at the end of the data segment it's possible with an empty
.data to have _edata at the end of .plt which looks a little unusual
since .plt is a bss style section.  That should only happen rarely in
real world binaries, but does occur in the ld testsuite.

ld/
* emulparams/elf64ppc.sh (BSS_PLT): Don't define.
(OTHER_READWRITE_SECTIONS): Move .branch_lt to..
(OTHER_RELRO_SECTIONS_2): ..here.
(DATA_GOT, SEPARATE_GOTPLT, DATA_SDATA, DATA_PLT,
PLT_BEFORE_GOT): Define.
* scripttempl/elf.sc: Handle DATA_SDATA and DATA_GOT/DATA_PLT/
PLT_BEFORE_GOT combination.
(DATA_GOT, SDATA_GOT): Don't define if either is already defined.
ld/testsuite/
* ld-powerpc/ambiguousv1.d,
* ld-powerpc/ambiguousv1b.d,
* ld-powerpc/ambiguousv2.d,
* ld-powerpc/ambiguousv2b.d,
* ld-powerpc/elfv2exe.d,
* ld-powerpc/elfv2so.d,
* ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r,
* ld-powerpc/tlstocso.r: Update.

9 years agoReorder powerpc64 sections for -z relro
Alan Modra [Tue, 20 Jan 2015 06:41:21 +0000 (17:11 +1030)]
Reorder powerpc64 sections for -z relro

More sections can be read-only after relocation.  .opd is an obvious
candidate.

* emulparams/elf64ppc.sh (OTHER_READWRITE_SECTIONS): Move .opd to..
(OTHER_RELRO_SECTIONS_2): ..here, new define.
* scripttempl/elf.sc: Add OTHER_RELRO_SECTIONS_2.

9 years agoDefine elf_backend_default_execstack as 0 for Nios II.
Chung-Lin Tang [Tue, 20 Jan 2015 04:02:15 +0000 (20:02 -0800)]
Define elf_backend_default_execstack as 0 for Nios II.

9 years agoFix pr17615 testcase
Alan Modra [Tue, 20 Jan 2015 00:41:38 +0000 (11:11 +1030)]
Fix pr17615 testcase

PR ld/17615
* ld-elf/pr17615.d: Match .sbss too.

9 years agoFix garbage collection of common symbols for powerpc64
Alan Modra [Tue, 20 Jan 2015 00:36:28 +0000 (11:06 +1030)]
Fix garbage collection of common symbols for powerpc64

I forgot powerpc64 has its own gc_mark_dynamic_ref.

PR ld/17615
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Don't drop
ELF_COMMON_DEF syms.

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

9 years agoAdd a testcase for PR ld/17615
H.J. Lu [Mon, 19 Jan 2015 17:23:29 +0000 (09:23 -0800)]
Add a testcase for PR ld/17615

PR ld/17615
* ld-elf/pr17615.d: New file.
* ld-elf/pr17615.s: Likewise.

9 years agoDon't use windows-termcap.c when linking against a curses library
Eli Zaretskii [Mon, 19 Jan 2015 15:34:29 +0000 (16:34 +0100)]
Don't use windows-termcap.c when linking against a curses library

gdb/
2015-01-17  Eli Zaretskii  <eliz@gnu.org>

        * configure.ac [*mingw32*]: Only add windows-termcap.o to
        CONFIG_OBS if not building with a curses library.
        * configure: Regenerate.

        * windows-termcap.c: Include defs.h.  Make the whole body empty if
        either one of HAVE_CURSES_H or HAVE_NCURSES_H or
        HAVE_NCURSES_NCURSES_H is defined.

9 years agostrerror.c: Do not declare sys_nerr or sys_errlist if already macros
Joel Brobecker [Mon, 19 Jan 2015 15:29:07 +0000 (16:29 +0100)]
strerror.c: Do not declare sys_nerr or sys_errlist if already macros

This fixes a MinGW warning in libiberty/strerror.c.

2015-01-19  Eli Zaretskii  <eliz@gnu.org>

        * strerror.c <sys_nerr, sys_errlist>: Declare only if they aren't
        macros.

9 years agoFix garbage collection of common symbols
Alan Modra [Sat, 17 Jan 2015 11:03:43 +0000 (21:33 +1030)]
Fix garbage collection of common symbols

Running lang_common before garbage collection means slightly less work
in garbage collection code, since common symbols should no longer
appear there.  It does have the side effect of keeping linker script
symbols (at least those defined outside of sections) global too,
hence some testsuite churn.

bfd/
PR 17165
* elf-bfd.h (ELF_COMMON_DEF): Note that this might be true for
linker script assignments too.
* elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
(bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
ld/
PR 17165
* ldlang.c (lang_process): Run lang_common before lang_gc_sections.
ld/testsuite/
* ld-gc/pr14265.d,
* ld-cris/tls-gc-68.d,
* ld-cris/tls-gc-69.d,
* ld-cris/tls-gc-70.d,
* ld-cris/tls-gc-71.d,
* ld-cris/tls-gc-75.d,
* ld-cris/tls-gc-76.d,
* ld-cris/tls-gc-79.d,
* ld-mmix/bpo-10.d,
* ld-mmix/bpo-11.d: Update.

9 years agoExtend .reloc to accept some BFD_RELOCs
Alan Modra [Mon, 19 Jan 2015 08:27:04 +0000 (18:57 +1030)]
Extend .reloc to accept some BFD_RELOCs

Tests that bfd_perform_reloc doesn't freak over a NONE reloc at end
of section.

gas/
* read.c (s_reloc): Match BFD_RELOC_NONE, BFD_RELOC{8,16,32,64}.
* write.c (get_frag_for_reloc): Allow match just past end of frag.
gas/testsuite/
* gas/all/none.s,
* gas/all/none.d: New test.
* gas/all/gas.exp: Run it.

9 years agoMore fixes related to NONE relocs
Alan Modra [Mon, 19 Jan 2015 07:45:30 +0000 (18:15 +1030)]
More fixes related to NONE relocs

* elf32-bfin.c (bfin_bfd_reloc_type_lookup): Correct loop iteration
to allow return of first howto.
* elf32-fr30.c (fr30_reloc_type_lookup): Likewise.
* elf32-m32c.c (m32c_reloc_type_lookup): Likewise.
* elf32-moxie.c (moxie_reloc_type_lookup): Likewise.
* elf32-or1k.c (or1k_reloc_type_lookup): Likewise.
* elf32-rl78.c (rl78_reloc_type_lookup): Likewise.
* elf32-rx.c (rx_reloc_type_lookup): Likewise.
* elf32-tilepro.c (tilepro_reloc_type_lookup): Likewise.
* elf32-xstormy16.c (xstormy16_reloc_type_lookup): Likewise.
* elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
* elf32-nios2.c (nios2_reloc_map): Add mapping for R_NIOS2_NONE.
* elf32-spu.c (spu_elf_bfd_to_reloc_type): Allow return of R_SPU_NONE.
(spu_elf_reloc_type_lookup): Adjust to suit.

9 years agoFallout from recent bfd_reloc_outofrange changes
Alan Modra [Mon, 19 Jan 2015 00:06:26 +0000 (10:36 +1030)]
Fallout from recent bfd_reloc_outofrange changes

Commit ec93045b and cd21f5da introduced a large number of tic4x and
tic54x regressions, due to the new checks being wrong for targets
with octets_per_byte != 1.  To fix that I introduced a new
bfd_get_section_limit_octets and performed the check on octets rather
than byte adresses, reducing the number of bfd_octets_per_byte calls.
bfd_octets_per_byte is rather expensive..

I then wondered why the same bfd_reloc_outofrange check added to
bfd_perform_relocation wasn't also added to bfd_install_relocation.
The two functions are virtually identical and ought to remain that
way.  However, adding the same check to bfd_install_relocation
resulted in ld-elf "FAIL Link eh-group.o to eh-group" on many ELF
targets, including x64_64-linux.  The reason being that eh-group.o
has NONE relocs at the end of a section, and most targets give NONE
relocs a non-zero size.  So if we are to keep the new outofrange
check it appears that NONE relocs must have a zero size.

* bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
(bfd_get_section_limit): ..here.
* reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check.
(bfd_install_relocation, _bfd_final_link_relocate): Add same check here.
* elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check.
* elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated
bfd_reloc_outofrange check.
* bfd-in2.h: Regenerate.

* cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok
on zero size relocs.
* ecoff.c (ecoff_reloc_link_order): Likewise.
* elf32-nds32.c (nds32_relocate_contents): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.

* reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs.
(_bfd_clear_contents): Likewise.
* elfxx-mips.c (mips_elf_obtain_contents): Likewise.
(mips_elf_perform_relocation): Likewise.

* aoutx.h (aout_link_reloc_link_order): Allow for NULL return
from malloc on zero size alloc.
* cofflink.c (_bfd_coff_reloc_link_order): Likewise.
* elflink.c (elf_reloc_link_order): Likewise.
* linker.c (_bfd_generic_reloc_link_order): Likewise.
* pdp11.c (aout_link_reloc_link_order): Likewise.
* xcofflink.c (xcoff_reloc_link_order): Likewise.

* aoutx.h (howto_table_ext): Ensure NONE relocs have size 3,
bitsize 0, and complain_overflow_dont.
* coff-sparc.c (coff_sparc_howto_table): Likewise.
* elf-hppa.h (elf_hppa_howto_table): Likewise.
* elf-m10200.c (elf_mn10200_howto_table): Likewise.
* elf-m10300.c (elf_mn10300_howto_table): Likewise.
* elf32-arc.c (elf_arc_howto_table): Likewise.
* elf32-arm.c (elf32_arm_howto_table_1): Likewise.
* elf32-avr.c (elf_avr_howto_table): Likewise.
* elf32-bfin.c (bfin_howto_table): Likewise.
* elf32-cr16.c (cr16_elf_howto_table): Likewise.
* elf32-cris.c (cris_elf_howto_table): Likewise.
* elf32-crx.c (crx_elf_howto_table): Likewise.
* elf32-d10v.c (elf_d10v_howto_table): Likewise.
* elf32-d30v.c (elf_d30v_howto_table): Likewise.
* elf32-dlx.c (dlx_elf_howto_table): Likewise.
* elf32-epiphany.c (epiphany_elf_howto_table): Likewise.
* elf32-fr30.c (fr30_elf_howto_table): Likewise.
* elf32-frv.c (elf32_frv_howto_table): Likewise.
* elf32-h8300.c (h8_elf_howto_table): Likewise.
* elf32-i370.c (i370_elf_howto_raw): Likewise.
* elf32-i386.c (elf_howto_table): Likewise.
* elf32-i860.c (elf32_i860_howto_table): Likewise.
* elf32-i960.c (elf32_i960_relocate): Likewise.
* elf32-ip2k.c (ip2k_elf_howto_table): Likewise.
* elf32-iq2000.c (iq2000_elf_howto_table): Likewise.
* elf32-lm32.c (lm32_elf_howto_table): Likewise.
* elf32-m32c.c (m32c_elf_howto_table): Likewise.
* elf32-m32r.c (m32r_elf_howto_table): Likewise.
* elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise.
* elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise.
* elf32-m68k.c (howto_table): Likewise.
* elf32-mcore.c (mcore_elf_howto_raw): Likewise.
* elf32-mep.c (mep_elf_howto_table): Likewise.
* elf32-metag.c (elf_metag_howto_table): Likewise.
* elf32-microblaze.c (microblaze_elf_howto_raw): Likewise.
* elf32-mips.c (elf_mips_howto_table_rel): Likewise.
* elf32-moxie.c (moxie_elf_howto_table): Likewise.
* elf32-msp430.c (elf_msp430_howto_table): Likewise.
* elf32-mt.c (mt_elf_howto_table): Likewise.
* elf32-nds32.c (nds32_elf_howto_table): Likewise.
* elf32-nios2.c (elf_nios2_howto_table_rel): Likewise.
* elf32-or1k.c (or1k_elf_howto_table): Likewise.
* elf32-pj.c (pj_elf_howto_table): Likewise.
* elf32-ppc.c (ppc_elf_howto_raw): Likewise.
* elf32-rl78.c (rl78_elf_howto_table): Likewise.
* elf32-rx.c (rx_elf_howto_table): Likewise.
* elf32-s390.c (elf_howto_table): Likewise.
* elf32-score.c (elf32_score_howto_table): Likewise.
* elf32-score7.c (elf32_score_howto_table): Likewise.
* elf32-sh-relocs.h (R_SH_NONE): Likewise.
* elf32-spu.c (elf_howto_table): Likewise.
* elf32-tic6x.c (elf32_tic6x_howto_table): Likewise.
* elf32-tilepro.c (tilepro_elf_howto_table): Likewise.
* elf32-v850.c (v850_elf_howto_table): Likewise.
* elf32-vax.c (howto_table): Likewise.
* elf32-visium.c (visium_elf_howto_table): Likewise.
* elf32-xc16x.c (xc16x_elf_howto_table): Likewise.
* elf32-xgate.c (elf_xgate_howto_table): Likewise.
* elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise.
* elf32-xtensa.c (elf_howto_table): Likewise.
* elf64-alpha.c (elf64_alpha_howto_table): Likewise.
* elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
* elf64-mmix.c (elf_mmix_howto_table): Likewise.
* elf64-ppc.c (ppc64_elf_howto_raw): Likewise.
* elf64-s390.c (elf_howto_table): Likewise.
* elf64-sh64.c (sh_elf64_howto_table): Likewise.
* elf64-x86-64.c (x86_64_elf_howto_table): Likewise.
* elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
(elfNN_aarch64_howto_none): Likewise.
* elfxx-ia64.c (ia64_howto_table): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise.
* elfxx-tilegx.c (tilegx_elf_howto_table): Likewise.
* nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.

9 years agoFix ARI warning in rs6000-tdep.c::rs6000_gdbarch_init.
Joel Brobecker [Mon, 19 Jan 2015 07:51:05 +0000 (08:51 +0100)]
Fix ARI warning in rs6000-tdep.c::rs6000_gdbarch_init.

gdb/ChangeLog:

        * rs6000-tdep.c (rs6000_gdbarch_init): Move divide operator
        from end of line to start of next line.

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

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

9 years agoSkip-trampoline for PowerPC reverse-stepping.
Wei-cheng Wang [Sat, 17 Jan 2015 06:30:59 +0000 (14:30 +0800)]
Skip-trampoline for PowerPC reverse-stepping.

9 years agoReverse debugging for PowerPC.
Wei-cheng Wang [Sat, 17 Jan 2015 06:30:33 +0000 (14:30 +0800)]
Reverse debugging for PowerPC.

9 years agoEpilogue unwinder for PowerPC.
Wei-cheng Wang [Sat, 17 Jan 2015 06:29:16 +0000 (14:29 +0800)]
Epilogue unwinder for PowerPC.

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

9 years agoReally add a prototype for tui_rehighlight_all.
Eli Zaretskii [Fri, 16 Jan 2015 17:55:40 +0000 (19:55 +0200)]
Really add a prototype for tui_rehighlight_all.

9 years agoFix nat/linux-personality.c regression on RHEL-5
Sergio Durigan Junior [Fri, 16 Jan 2015 16:42:28 +0000 (11:42 -0500)]
Fix nat/linux-personality.c regression on RHEL-5

This commit fixes the regression on RHEL-5 systems introduced by
nat/linux-personality.c's check of HAVE_DECL_ADDR_NO_RANDOMIZE.
RHEL-5 systems define HAVE_DECL_ADDR_NO_RANDOMIZE as zero, so we
cannot use #ifndef; instead this patch uses the "#if !" construction.

The regression was reported by Ulrich Weigand here:

  <https://sourceware.org/ml/gdb-patches/2015-01/msg00458.html>

gdb/ChangeLog
2015-01-16  Sergio Durigan Junior  <sergiodj@redhat.com>

* nat/linux-personality.c: Replace "#ifndef
HAVE_DECL_ADDR_NO_RANDOMIZE" by "#if
!HAVE_DECL_ADDR_NO_RANDOMIZE", fixing a regression in RHEL-5
systems.

9 years agoFix an erroneous commentary.
Eli Zaretskii [Fri, 16 Jan 2015 16:32:42 +0000 (18:32 +0200)]
Fix an erroneous commentary.

gdb/
2015-01-16  Eli Zaretskii  <eliz@gnu.org>

    * tui/tui-win.c (tui_set_tab_width_command): Fix the commentary.

9 years agoMake setting TUI border attributes take effect immediately
Eli Zaretskii [Fri, 16 Jan 2015 16:24:16 +0000 (18:24 +0200)]
Make setting TUI border attributes take effect immediately

gdb/
2015-01-16  Eli Zaretskii  <eliz@gnu.org>

     * tui/tui-win.c (tui_rehighlight_all, tui_set_var_cmd): New
     functions.
     (_initialize_tui_win) <border-kind, border-mode>:
     <active-border-mode>: Use tui_set_var_cmd as the "set" function.
     * tui/tui-win.h: Add prototype for tui_rehighlight_all.

9 years agoMake the change of tab size in TUI mode effective immediately
Eli Zaretskii [Fri, 16 Jan 2015 15:46:12 +0000 (17:46 +0200)]
Make the change of tab size in TUI mode effective immediately

gdb/ChangeLog:
2015-01-16  Eli Zaretskii  <eliz@gnu.org>

    * tui/tui-win.c (tui_set_tab_width_command): Delete and
    recreate the source and the disassembly windows, to show the
    effect of the changed tab size immediately.

9 years agoFix TUI-related documentation.
Eli Zaretskii [Fri, 16 Jan 2015 11:31:36 +0000 (13:31 +0200)]
Fix TUI-related documentation.

tui/tui-win.c (tui_scroll_left_command, tui_scroll_right_command):
Doc fix.
doc/gdb.texinfo (TUI Commands): Document the possible
values of NAME argument to 'winheight' command.  Explain the
effect of 'tabset' setting better.

9 years agoS/390: Add support for IBM z13.
Andreas Krebbel [Fri, 16 Jan 2015 11:19:21 +0000 (12:19 +0100)]
S/390: Add support for IBM z13.

- 32 128 bit vector registers (overlapping with the existing 16 64 bit
  floating point registers)
- vector double instructions
- vector integer instructions
- scalar vector instructions (allowing to have more floating point
  registers for scalar operations)
- vector string instructions

gas/ChangeLog:

* config/tc-s390.c (struct pd_reg): Remove.
(pre_defined_registers): Remove.
(REG_NAME_CNT): Remove.
(reg_name_search): Calculate the register number instead of doing
a lookup.
(register_name, tc_s390_regname_to_dw2regnum): Adopt to the new
reg_name_search signature.
(s390_parse_cpu): Support the new arch string z13.
(s390_insert_operand): Support for vector registers with the extra
field for the fifth bit of each vector register operand.
(md_gather_operand): Adjust to the new handling of optional
parameters.

* doc/as.texinfo: Document the z13 cpu string.

gas/testsuite/ChangeLog:

* gas/s390/esa-g5.d: Add a variant without the optional operand.
* gas/s390/esa-g5.s: Likewise.
* gas/s390/esa-z9-109.d: Likewise.
* gas/s390/esa-z9-109.s: Likewise.
* gas/s390/zarch-z9-109.d: Likewise.
* gas/s390/zarch-z9-109.s: Likewise.
* gas/s390/zarch-z10.d: For variants with a zero optional argument
it is not dumped by objdump anymore.
* gas/s390/zarch-zEC12.d: Likewise.

* gas/s390/zarch-z13.d: New file.
* gas/s390/zarch-z13.s: New file.
* gas/s390/s390.exp: Run the test for the z13 files.

include/opcode/ChangeLog:

* s390.h (s390_opcode_cpu_val): Add S390_OPCODE_Z13.

ld/testsuite/ChangeLog:

* ld-s390/tlsbin.dd: The nopr register operand is optional and not
printed if 0 anymore.

opcodes/ChangeLog:

* s390-dis.c (s390_extract_operand): Support vector register
operands.
(s390_print_insn_with_opcode): Support new operands types and add
new handling of optional operands.
* s390-mkopc.c (s390_opcode_mode_val, s390_opcode_cpu_val): Remove
and include opcode/s390.h instead.
(struct op_struct): New field `flags'.
(insertOpcode, insertExpandedMnemonic): New parameter `flags'.
(dumpTable): Dump flags.
(main): Parse flags from the s390-opc.txt file.  Add z13 as cpu
string.
* s390-opc.c: Add new operands types, instruction formats, and
instruction masks.
(s390_opformats): Add new formats for .insn.
* s390-opc.txt: Add new instructions.

9 years agoLeave more space in TUI mode for thread ID.
Eli Zaretskii [Fri, 16 Jan 2015 11:24:20 +0000 (13:24 +0200)]
Leave more space in TUI mode for thread ID.

gdb/tui/tui-data.h (LINE_PREFIX): Make shorter
(MAX_PID_WIDTH): Enlarge from 14 to 19, to leave enough space for
"Thread NNNNN.XXXX" thread ID notation on Windows.

9 years agoFix gcc-5 compilation
Jan Kratochvil [Fri, 16 Jan 2015 05:39:47 +0000 (06:39 +0100)]
Fix gcc-5 compilation

With gcc-5.0 pre-release one gets:

hppa-tdep.c: In function ‘inst_saves_gr’:
hppa-tdep.c:1406:30: error: comparison of constant ‘9’ with boolean expression is always false [-Werror=bool-compare]

I find the misplaced parentheses obvious.

gdb/ChangeLog
2015-01-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix gcc-5 compilation.
* hppa-tdep.c (inst_saves_gr): Fix parentheses typo.

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

9 years agoMove code to disable ASR to nat/
Sergio Durigan Junior [Thu, 15 Jan 2015 20:10:49 +0000 (15:10 -0500)]
Move code to disable ASR to nat/

This patch moves the shared code present on
gdb/linux-nat.c:linux_nat_create_inferior and
gdb/gdbserver/linux-low.c:linux_create_inferior to
nat/linux-personality.c.  This code is responsible for disabling
address space randomization based on user setting, and using
<sys/personality.h> to do that.  I decided to put the prototype of the
maybe_disable_address_space_randomization on nat/linux-osdata.h
because it seemed the best place to put it.

I regression-tested this patch on Fedora 20 x86_64, and found no
regressions.

gdb/ChangeLog
2015-01-15  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-personality.h.
(linux-personality.o): New rule.
* common/common-defs.h: Include <stdint.h>.
* config/aarch64/linux.mh (NATDEPFILES): Include
linux-personality.o.
* config/alpha/alpha-linux.mh (NATDEPFILES): Likewise.
* config/arm/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/ia64/linux.mh (NATDEPFILES): Likewise.
* config/m32r/linux.mh (NATDEPFILES): Likewise.
* config/m68k/linux.mh (NATDEPFILES): Likewise.
* config/mips/linux.mh (NATDEPFILES): Likewise.
* config/pa/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
* config/powerpc/spu-linux.mh (NATDEPFILES): Likewise.
* config/s390/linux.mh (NATDEPFILES): Likewise.
* config/sparc/linux64.mh (NATDEPFILES): Likewise.
* config/sparc/linux.mh (NATDEPFILES): Likewise.
* config/tilegx/linux.mh (NATDEPFILES): Likewise.
* config/xtensa/linux.mh (NATDEPFILES): Likewise.
* defs.h: Remove #include <stdint.h> (moved to
common/common-defs.h).
* linux-nat.c: Include nat/linux-personality.h.  Remove #include
<sys/personality.h>; do not define ADDR_NO_RANDOMIZE (moved to
nat/linux-personality.c).
(linux_nat_create_inferior): Remove code to disable address space
randomization (moved to nat/linux-personality.c).  Create cleanup
to disable address space randomization.
* nat/linux-personality.c: New file.
* nat/linux-personality.h: Likewise.

gdb/gdbserver/ChangeLog
2015-01-15  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (SFILES): Add linux-personality.c.
(linux-personality.o): New rule.
* configure.srv (srv_linux_obj): Add linux-personality.o to the
list of objects to be built.
* linux-low.c: Include nat/linux-personality.h.
(linux_create_inferior): Remove code to disable address space
randomization (moved to ../nat/linux-personality.c).  Create
cleanup to disable address space randomization.

9 years agoMove safe_strerror to common/
Sergio Durigan Junior [Thu, 15 Jan 2015 20:09:15 +0000 (15:09 -0500)]
Move safe_strerror to common/

This patch moves safe_strerror from the gdb/{posix,mingw}-hdep.c files
to the respective common/{posix,mingw}-strerror.c files.  This is a
preparation for the next patch, which shares a common code (to disable
address space randomization when creating a new inferior).

The patch has been regtested on Fedora 20 x86_64, and no regressions
were found.

gdb/ChangeLog
2015-01-15  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (ALLDEPFILES): Including common/mingw-strerror.c and
common/posix-strerror.c.
(posix-strerror.o): New rule.
(mingw-strerror.o): Likewise.
* common/common-utils.h (safe_strerror): Move prototype to here,
from utils.h.
* common/common.host: New file.
* common/mingw-strerror.c: Likewise.
* common/posix-strerror.c: Likewise.
* configure: Regenerated.
* configure.ac: Source common/common.host.  Add variable
common_host_obs to gdb_host_obs.
* contrib/ari/gdb_ari.sh: Mention gdb/common/mingw-strerror.c and
gdb/common/posix-strerror.c when warning about the use of
strerror.
* mingw-hdep.c (safe_strerror): Remove definition; move it to
common/mingw-strerror.c.
* posix-hdep.c (safe_strerror): Remove definition; move it to
common/posix-hdep.c.
* utils.h (safe_strerror): Remove prototype; move to
common/common-utils.h.

gdb/gdbserver/ChangeLog
2015-01-15  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (posix-strerror.o): New rule.
(mingw-strerror.o): Likewise.
* configure: Regenerated.
* configure.ac: Source file ../common/common.host.  Initialize new
variable srv_host_obs.  Add srv_host_obs to GDBSERVER_DEPFILES.

9 years agoDon't complain about -fPIC for undefined symbol
H.J. Lu [Thu, 15 Jan 2015 19:06:33 +0000 (11:06 -0800)]
Don't complain about -fPIC for undefined symbol

When building executable, undefined symbol is a fatal error.  We don't
complain about -fPIC if the symbol is undefined.

bfd/

PR ld/17847
* elf64-x86-64.c (elf_x86_64_relocate_section): Don't complain
about -fPIC if the symbol is undefined when building executable.

ld/testsuite/

PR ld/17847
* ld-x86-64/pie1.d: New file.
* ld-x86-64/pie1.s: Likwise.
* ld-x86-64/x86-64.exp: Run pie1.

9 years agoSkip two more attach tests when testing against stub-like targets
Don Breazeal [Thu, 15 Jan 2015 18:47:31 +0000 (10:47 -0800)]
Skip two more attach tests when testing against stub-like targets

This patch updates two attach tests to use utility procs for checking if
the attach test should run and for launching the program to be attached, as
follows:

1) Use can_spawn_for_attach instead of is_remote target
2) Use spawn_wait_for_attach instead of exec/sleep

Tested (1) with i686-mingw32 host and i686-pc-linux-gnu build/target and
both with x86_64 Ubuntu.

gdb/testsuite/ChangeLog:

* gdb.base/attach-pie-noexec.exp: Use can_spawn_for_attach
instead of checking whether the target board is remote and
use spawn_wait_for_attach instead of exec/sleep.
* gdb.base/attach-twice.exp: Likewise.

9 years agoFix memory access violations triggered by running objdump on fuzzed binaries.
Nick Clifton [Thu, 15 Jan 2015 16:22:55 +0000 (16:22 +0000)]
Fix memory access violations triggered by running objdump on fuzzed binaries.

PR binutils/17512
* elf-m10300.c (mn10300_info_to_howto): Replace assertion with an
error message.  Never return an invalid howto pointer.
* elf32-cr16.c (cr16_info_to_howto): Likewise.
* elf32-crx.c (elf_crx_info_to_howto): Likewise.
* elf32-i370.c (i370_elf_info_to_howto): Likewise.
* elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
* elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
* elf32-mips.c (mips_elf32_rtype_to_howto): Likewise.
* elf32-pj.c (pj_elf_info_to_howto): Likewise.
* elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
* elf32-spu.c (spu_elf_info_to_howto): Likewise.
* elf32-v850.c (v850_elf_info_to_howto_rela): Likewise.
* elf32-vax.c (rtype_to_howto): Likewise.
* elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
* elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
* elfn32-mips.c (sh_elf_info_to_howto): Likewise.
* elf32-sh.c (sh_elf_info_to_howto): Likewise.
(sh_elf_reloc): Check that the reloc is in range.
* reloc.c (bfd_perform_relocation): Check that the section is big
enough for the entire reloc.
(bfd_generic_get_relocated_section_contents): Report unexpected
return values from perform_reloc.

9 years agoFixes a bug in the relaxation of R_MSP430X_ABS16 to R_MSP430_10_PCREL.
Nick Clifton [Thu, 15 Jan 2015 16:20:19 +0000 (16:20 +0000)]
Fixes a bug in the relaxation of R_MSP430X_ABS16 to R_MSP430_10_PCREL.

* elf32-msp430.c (msp430_elf_relax_section): Skip unhandled
relocs.  Include PC-relative adjustment for R_MSP430X_ABS16
relaxation.

9 years agoOmit section dynsyms for any linker created section
Alan Modra [Thu, 15 Jan 2015 08:37:33 +0000 (19:07 +1030)]
Omit section dynsyms for any linker created section

This is a simplification, and fixes a testcase I had where an empty
powerpc64 .branch_lt section was chosen for the data_index_section
dynamic symbol and thus wasn't removed.

* elflink.c (_bfd_elf_link_omit_section_dynsym): Return true for
any output section matching a linker created dynobj section.

9 years agoDocument the GDB 7.8.2 release in gdb/ChangeLog
Joel Brobecker [Thu, 15 Jan 2015 11:10:36 +0000 (15:10 +0400)]
Document the GDB 7.8.2 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.8.2 released.

9 years agoFix ARM fail of gap test
Alan Modra [Thu, 15 Jan 2015 09:12:59 +0000 (19:42 +1030)]
Fix ARM fail of gap test

ld-elf/gap test was failing due to the ARM backend attempting to output
arch symbols when ld -s (strip all symbols) is in force.  This patch
stops that happening and tidies the code a little.

PR 17842
* elflink.c (elf_link_output_sym): Assert elf_onesymtab set.
(bfd_elf_final_link): Always create a symbol table when emit_relocs.
Don't assign symtab file position unless symbols will be output.
Merge blocks with condition in common.  Don't call
elf_backend_output_arch_local_syms or elf_backend_output_arch_syms
unless other symbols are output.  Move assignment of symtab_shndx
file position.  Localize variable.

9 years ago[Ada] 'first/'last/'length of array whose bound is a discriminant
Joel Brobecker [Thu, 15 Jan 2015 06:09:32 +0000 (10:09 +0400)]
[Ada] 'first/'last/'length of array whose bound is a discriminant

Consider the following code:

   type Table is array (Positive range <>) of Integer;
   type Object (N : Integer) is record
       Data : Table (1 .. N);
   end record;
   My_Object : Object := (N => 3, Data => (3, 5, 8));

Trying to print the range and length of the My_Object.Data array yields:

    (gdb) print my_object.data'first
    $1 = 1
    (gdb) print my_object.data'last
    $2 = 0
    (gdb) print my_object.data'length
    $3 = 0

The first one is correct, and that is thanks to the fact that
the lower bound is statically known.  However, for the upper
bound, and consequently the array's length, the values are incorrect.
It should be:

    (gdb) print my_object.data'last
    $2 = 3
    (gdb) print my_object.data'length
    $3 = 3

What happens here is that ada_array_bound_from_type sees that
our array has a parallel "___XA" type, and therefore tries to
use it.  In particular, it described our array's index type as:
[...]___XDLU_1__n, which means lower bound = 1, and upper bound
is value of "n". Unfortunately, ada_array_bound_from_type does
not have access to the discriminant, and is therefore unable to
compute the bound correctly.

Fortunately, at this stage, the bound has already been computed
a while ago, and therefore doesn't need to be re-computed here.
This patch fixes the issue by ignoring that ___XA type if the array
is marked as already fixed.

This also fixes the same issue with packed arrays.

gdb/ChangeLog:

        * ada-lang.c (ada_array_bound_from_type): Ignore array's parallel
        ___XA type if the array has already been fixed.

gdb/testsuite/ChangeLog:

        * gdb.ada/var_arr_attrs: New testcase.

9 years agoBuild failure in sim/rx/gdb-if.c on windows
Joel Brobecker [Thu, 15 Jan 2015 03:14:45 +0000 (07:14 +0400)]
Build failure in sim/rx/gdb-if.c on windows

This should fix a build failure reported on x86_64-mingw32 by Daniel
Calcoen due to conflicting declarations of "open".  This patch just
renames the static global in sim/rx/gdb-if.c into "rx_sim_is_open".

sim/rx/ChangeLog:

* gdb-if.c (open): Rename to...
(rx_sim_is_open): This. Replace all uses of "open" by uses of
"rx_sim_is_open" throughout.

Tested by rebuilding on x86_64-linux.

9 years agoDon't disable gprof for moxie
Anthony Green [Thu, 15 Jan 2015 00:08:12 +0000 (19:08 -0500)]
Don't disable gprof for moxie

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