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

9 years agoMerge include/libiberty.h from GCC
Jan-Benedict Glaw [Wed, 14 Jan 2015 21:10:15 +0000 (22:10 +0100)]
Merge include/libiberty.h from GCC

This pulls in some missing prototypes and also adds corresponding entries
to the ChangeLog file. Please note that for one function, strverscmp(),
the ChangeLog entry was already there, but the actual prototype wasn't.

  These ChangeLog entries are added:

2014-10-28  Yury Gribov  <y.gribov@samsung.com>

       * libiberty.h (strtol, strtoul, strtoll, strtoull): New prototypes.

2014-10-15  David Malcolm  <dmalcolm@redhat.com>

       * libiberty.h (choose_tmpdir): New prototype.

9 years ago[ARM] Reject R_ARM_REL32 when trying to defer it to runtime
Jiong Wang [Wed, 14 Jan 2015 19:11:54 +0000 (19:11 +0000)]
[ARM] Reject R_ARM_REL32 when trying to defer it to runtime

  bfd/
    * elf32-arm.c (elf32_arm_final_link_relocate): Reject R_ARM_32/_NOI when
    trying to defer them to runtime.

  ld/testsuite/
    * ld-arm/elf32-reject.s: New testcase.
    * ld-arm/elf32-reject.d: Likewise.
    * ld-arm/elf32-reject-pie.s: Likewise.
    * ld-arm/elf32-reject-pie.d: Likewise.
    * ld-arm/arm-elf.exp: Run new testcases.
    * ld-arm/ifunc-7.s: Delete f2/f4 test items.
    * ld-arm/ifunc-7.rd: Likewise.
    * ld-arm/ifunc-7.gd: Likewise.
    * ld-arm/ifunc-7.dd: Likewise.
    * ld-arm/ifunc-8.s: Likewise.
    * ld-arm/ifunc-8.rd: Likewise.
    * ld-arm/ifunc-8.gd: Likewise.
    * ld-arm/ifunc-8.dd: Likewise.

9 years agoFix a bug in resolving HI16/LO16 relocation pairs for MIPS.
Cary Coutant [Wed, 14 Jan 2015 18:30:14 +0000 (10:30 -0800)]
Fix a bug in resolving HI16/LO16 relocation pairs for MIPS.

2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>

gold/
* mips.cc (reloc_high): Add r_sym.
(Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
reloc_high constructor.
(Mips_relocate_functions::relgot16_local): Likewise.
(Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
r_type to decide whether LO16 matches HI16.
(Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
rello16 and relgot16_local.

9 years agoDetect 64-bit-ness in PowerPC Book III-E
Yao Qi [Fri, 28 Nov 2014 01:18:26 +0000 (09:18 +0800)]
Detect 64-bit-ness in PowerPC Book III-E

This patch is to teach both GDB and GDBServer to detect 64-bit inferior
correctly.  We find a problem that GDBServer is unable to detect on a
e5500 core processor.  Current GDBServer assumes that MSR is a 64-bit
register, but MSR is a 32-bit register in Book III-E.  This patch is
to fix this problem by checking the right bit in MSR, in order to handle
both Book III-S and Book III-E.  In order to detect Book III-S and
Book III-E, we check the PPC_FEATURE_BOOKE from the host's HWCAP (by
getauxval on glibc >= 2.16.  If getauxval doesn't exist, we implement
the fallback by parsing /proc/self/auxv), because it should an invariant
on the same machine cross different processes.

In order to share code, I add nat/ppc-linux.c for both GDB and
GDBserver side.

gdb:

2015-01-14  Yao Qi  <yao@codesourcery.com>

* Makefile.in (ppc-linux.o): New rule.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Add ppc-linux.o.
* configure.ac: AC_CHECK_FUNCS(getauxval).
* config.in: Re-generated.
* configure: Re-generated.
* nat/ppc-linux.h [__powerpc64__] (ppc64_64bit_inferior_p):
Declare.
* nat/ppc-linux.c: New file.
* ppc-linux-nat.c (ppc_linux_target_wordsize) [__powerpc64__]:
Call ppc64_64bit_inferior_p.

gdb/gdbserver:

2015-01-14  Yao Qi  <yao@codesourcery.com>

* Makefile.in (SFILES): Add nat/ppc-linux.c.
(ppc-linux.o): New rule.
* configure.srv (powerpc*-*-linux*): Add ppc-linux.o.
* configure.ac: AC_CHECK_FUNCS(getauxval).
* config.in: Re-generated.
* configure: Re-generated.
* linux-ppc-low.c (ppc_arch_setup) [__powerpc64__]: Call
ppc64_64bit_inferior_p

9 years agoMove some ppc macros to nat/ppc-linux.h
Yao Qi [Thu, 8 Jan 2015 09:23:55 +0000 (17:23 +0800)]
Move some ppc macros to nat/ppc-linux.h

When I use PPC_FEATURE_BOOKE in GDBserver, I find it is defined in GDB
but not in GDBserver.  After taking a further look, I find some macros
are duplicated between ppc-linux-nat.c and linux-ppc-low.c, so this
patch is to move them into nat/ppc-linux.h.

gdb/gdbserver:

2015-01-14  Yao Qi  <yao@codesourcery.com>

* linux-ppc-low.c: Include "nat/ppc-linux.h".
 (PPC_FEATURE_HAS_VSX): Move to nat/ppc-linux.h.
(PPC_FEATURE_HAS_ALTIVEC,  PPC_FEATURE_HAS_SPE): Likewise.
(PT_ORIG_R3, PT_TRAP): Likewise.
(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.

gdb:

2015-01-14  Yao Qi  <yao@codesourcery.com>

* ppc-linux-nat.c (PT_ORIG_R3, PT_TRAP): Move to
nat/ppc-linux.h.
(PPC_FEATURE_CELL, PPC_FEATURE_BOOKE): Likewise.
(PPC_FEATURE_HAS_DFP): Likewise.
(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.
Include "nat/ppc-linux.h".
* nat/ppc-linux.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/ppc-linux.h.

9 years agoPR17525 - breakpoint commands not executed when program run from -x script
Pedro Alves [Mon, 12 Jan 2015 19:30:08 +0000 (19:30 +0000)]
PR17525 - breakpoint commands not executed when program run from -x script

Executing a gdb script that runs the inferior (from the command line
with -x), and has it hit breakpoints with breakpoint commands that
themselves run the target, is currently broken on async targets
(Linux, remote).

While we're executing a command list or a script, we force the
interpreter to be sync, which results in some functions nesting an
event loop and waiting for the target to stop, instead of returning
immediately and having the top level event loop handle the stop.

The issue with this bug is simply that bpstat_do_actions misses
checking whether the interpreter is sync.  When we get here, in the
case of executing a script (or, when the interpreter is sync), the
program has already advanced to the next breakpoint, through
maybe_wait_sync_command_done.  We need to process its breakpoints
immediately, just like with a sync target.

Tested on x86_64 Fedora 20.

gdb/
2015-01-14  Pedro Alves  <palves@redhat.com>

PR gdb/17525
* breakpoint.c: Include "interps.h".
(bpstat_do_actions_1): Also check whether the interpreter is
async.

gdb/testsuite/
2015-01-14  Pedro Alves  <palves@redhat.com>
    Joel Brobecker  <brobecker@adacore.com>

PR gdb/17525
* gdb.base/bp-cmds-execution-x-script.c: New file.
* gdb.base/bp-cmds-execution-x-script.exp: New file.
* gdb.base/bp-cmds-execution-x-script.gdb: New file.

9 years agoPR cli/17828: -batch -ex r breaks terminal
Pedro Alves [Wed, 14 Jan 2015 11:51:06 +0000 (11:51 +0000)]
PR cli/17828: -batch -ex r breaks terminal

Commit d3d4baed (PR python/17372 - Python hangs when displaying
help()) had the side effect of causing 'gdb -batch' to leave the
terminal in the wrong state if the program was run.  E.g,.

 $ echo 'main(){*(int*)0=0;}' | gcc -x c -; ./gdb/gdb -batch -ex r ./a.out
 Program received signal SIGSEGV, Segmentation fault.
 0x00000000004004ff in main ()
 $

If you start typing the next command, seemingly nothing happens - GDB
left the terminal with echo disabled.

The issue is that that "r" ends up in fetch_inferior_event, which
calls reinstall_readline_callback_handler_cleanup, which causes
readline to prep the terminal (raw, echo disabled).  But "-batch"
causes GDB to exit before the top level event loop is first started,
and then nothing de-preps the terminal.

The reinstall_readline_callback_handler_cleanup function's intro
comment mentions:

 "Need to do this as we go back to the event loop, ready to process
 further input."

but the implementation forgets the case of when the interpreter is
sync, which indicates we won't return to the event loop yet, or as in
the case of -batch, we have not started it yet.

The fix is to not install the readline callback in that case.

For the test, in this case, checking that command echo still works is
sufficient.  Comparing stty output before/after running GDB is even
better.  Because stty may not be available, the test tries both ways.
In any case, since expect's spawn (what we use to start gdb) creates a
new pseudo tty, another expect spawn or tcl exec after GDB exits would
not see the wrong terminal settings.  So instead, the test spawns a
shell and runs stty and GDB in it.

Tested on x86_64 Fedora 20.

gdb/
2015-01-14  Pedro Alves  <palves@redhat.com>

PR cli/17828
* infrun.c (reinstall_readline_callback_handler_cleanup): Don't
reinstall if the interpreter is sync.

gdb/testsuite/
2015-01-14  Pedro Alves  <palves@redhat.com>

PR cli/17828
* gdb.base/batch-preserve-term-settings.c: New file.
* gdb.base/batch-preserve-term-settings.exp: New file.

9 years agoEnhance gdb.lookup_objfile so that it works with a symlinked binary.
Doug Evans [Wed, 14 Jan 2015 01:00:31 +0000 (17:00 -0800)]
Enhance gdb.lookup_objfile so that it works with a symlinked binary.

gdb/Changelog:

* objfiles.c (objfile_filename): New function.
* objfiles.h (objfile_filename): Declare it.
(objfile_name): Add function comment.
* python/py-objfile.c (objfpy_lookup_objfile_by_name): Try both the
bfd file name (which may be realpath'd), and the original name.

gdb/testsuite/ChangeLog:

* gdb.python/py-objfile.exp: Test gdb.lookup_objfile on symlinked
binary.

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

9 years ago[ARM] vcmp/vcmpe should accept #0x0 as an operand
Jiong Wang [Tue, 13 Jan 2015 15:44:47 +0000 (15:44 +0000)]
[ARM] vcmp/vcmpe should accept #0x0 as an operand

gas/
2015-01-13  Matthew Wahab  <matthew.wahab@arm.com>

     * config/tc-arm.c (parse_ifimm_zero): Accept #0x0 as a synonym for
     #0, restoring previous behaviour.

gas/testsuite/
2015-01-13  Matthew Wahab  <matthew.wahab@arm.com>

     * gas/arm/ual-vcmp.s: Add vcmp, vcmpe with #0x0 operand.
     * gas/ual/vcmp.d: Update expected output.
     * gas/ual/vcmp-zero-bad.l: Likewise

9 years agogdb/testsuite: Make clean mostlyclean should not delete *.py.
Joel Brobecker [Tue, 13 Jan 2015 14:59:32 +0000 (18:59 +0400)]
gdb/testsuite: Make clean mostlyclean should not delete *.py.

A sanity-check in my release scripts caught something: After having
created the tarballs, I verify that no checked-in file disappeared
in the process, and lo and behod, it found that the following file
got wiped:

    - gdb/testsuite/dg-extract-results.py:

And it's not part of the tarball either.

I don't understand while we delete all *.py files in gdb/testsuite,
since I don't see a rule that expected to create one. A run of the
testsuite also doesn't seem to be creating .py files there.
I traced this to the following commit, which unfortunately provided
no explanation. Perhaps we used to run some tests in the gdb/testsuite
directory and caused files to be left behind there. Perhaps we still
do today?

In the meantime, Executive Decision: In order to allow me to create
tarballs without losing files, I removed it. It's easy to put something
back if we find out why it might still be needed.

gdb/testsuite/ChangeLog:

        * Makefile.in (clean mostlyclean): Do not delete *.py.

Tested on x86_64-linux by running the src-release.sh script again,
and this time, dg-extract-results.py no longer gets wiped.

9 years agoUpdate NEWS post GDB 7.9 branch creation.
Joel Brobecker [Tue, 13 Jan 2015 12:24:45 +0000 (16:24 +0400)]
Update NEWS post GDB 7.9 branch creation.

gdb/ChangeLog:

* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.

9 years agoBump version to 7.9.50.DATE-cvs.
Joel Brobecker [Tue, 13 Jan 2015 12:16:07 +0000 (16:16 +0400)]
Bump version to 7.9.50.DATE-cvs.

Now that the GDB 7.9 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 7.9 branch created (92fc2e6978d9a7c8324c7e851dbee59e22ec7a37):
* version.in: Bump version to 7.9.50.DATE-cvs.

9 years ago[AArch64] Fix function pointer variable with -Bsymbolic-functions
Jiong Wang [Tue, 13 Jan 2015 11:36:54 +0000 (11:36 +0000)]
[AArch64] Fix function pointer variable with -Bsymbolic-functions

bfd/ChangeLog

2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>

    * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
    SYMBOLIC_BIND to check if a symbol should be bound symbolically.

ld/testsuite/ChangeLog

2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com>

    * ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test.
    * ld-aarch64/relocs-257-symbolic-func.d: New file.
    * ld-aarch64/relocs-257-symbolic-func.s: Likewise.

9 years ago[AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2
Jiong Wang [Tue, 13 Jan 2015 11:21:43 +0000 (11:21 +0000)]
[AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2

  bfd/
    * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check for
    TLSLE_MOVW_TPREL_G2.

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

9 years ago[AArch64] Enable overflow check for R_AARCH64_TLSLE_ADD_TPREL_HI12
Jiong Wang [Tue, 13 Jan 2015 11:18:10 +0000 (11:18 +0000)]
[AArch64] Enable overflow check for R_AARCH64_TLSLE_ADD_TPREL_HI12

  bfd/
    PR ld/17415
    * elfnn-aarch64.c (elfNN_aarch64_howto_table): Mark
    R_AARCH64_TLSLE_ADD_TPREL_HI12 as complain_overflow_unsigned.
    * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Correct the bit
    mask.

  ld/testsuite/
    PR ld/17415
    * ld-aarch64/pr17415.s: Source file for new test.
    * ld-aarch64/pr17415.d: Expect file for new test.
    * ld-aarch64/aarch64-elf.exp: Run the new test.

9 years ago[ARI] Remove trailing new-line in argument of call to warning.
Joel Brobecker [Tue, 13 Jan 2015 10:36:34 +0000 (14:36 +0400)]
[ARI] Remove trailing new-line in argument of call to warning.

gdb/ChangeLog:

        * nat/linux-procfs.c (linux_proc_attach_tgid_threads):
        Remove trailing new-line in argument of call to warning.

9 years ago[ARI] Remove trailing new-line in argument of call to warning.
Joel Brobecker [Tue, 13 Jan 2015 10:35:49 +0000 (14:35 +0400)]
[ARI] Remove trailing new-line in argument of call to warning.

gdb/ChangeLog:

* linux-nat.c (attach_proc_task_lwp_callback): Remove trailing
new-line in argument of call to "warning".

9 years ago[python/Ada] gdb.lookup_type fails to looking primitive type
Joel Brobecker [Mon, 12 Jan 2015 11:46:34 +0000 (15:46 +0400)]
[python/Ada] gdb.lookup_type fails to looking primitive type

The following change...

    commit 1994afbf19892c9e614a034fbf1a5233e9addce3
    Date:   Tue Dec 23 07:55:39 2014 -0800
    Subject: Look up primitive types as symbols.

... caused the following regression:

    % gdb
    (gdb) set lang ada
    (gdb) python print gdb.lookup_type('character')
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    gdb.error: No type named character.
    Error while executing Python code.

This is because the language_lookup_primitive_type_as_symbol call
was moved to the la_lookup_symbol_nonlocal hook. A couple of
implementations have been upated accordingly, but the Ada version
has not. This patch fixes this omission.

gdb/ChangeLog:

        * ada-lang.c (ada_lookup_symbol_nonlocal): If name not found
        in static block, then try searching for primitive types.

gdb/testsuite/ChangeLog:

        * gdb.python/py-lookup-type.exp: New file.

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

9 years agoAppend to input history file instead of overwriting it
Patrick Palka [Mon, 12 Jan 2015 22:51:33 +0000 (17:51 -0500)]
Append to input history file instead of overwriting it

This patch makes readline append new history lines to the GDB history
file on exit instead of overwriting the entire history file on exit.
This change allows us to run multiple simultaneous GDB sessions without
having each session overwrite the added history of each other session on
exit.

Care must be taken to ensure that the history file doesn't get corrupted
when multiple GDB processes are trying to simultaneously append to and
then truncate it.  Safety is achieved in such a situation by using an
intermediate local history file to mutually exclude multiple processes
from simultaneously performing write operations on the global history
file.

gdb/ChangeLog:

* top.h (gdb_add_history): Declare.
* top.c (command_count): New variable.
(gdb_add_history): New function.
(gdb_safe_append_history): New static function.
(quit_force): Call it.
(command_line_input): Use gdb_add_history instead of
add_history.
* event-top.c (command_line_handler): Likewise.

9 years agoProperly check abbrev size
H.J. Lu [Mon, 12 Jan 2015 21:34:24 +0000 (13:34 -0800)]
Properly check abbrev size

abbrev_base is independent of abbrev_size.  We should use abbrev_base +
abbrev_size to check abbrev section size.

* dwarf.c (process_debug_info): Properly check abbrev size.

9 years agoAnother fix for memory access errors trigegred by running readelf on a corrupt binary.
Nick Clifton [Mon, 12 Jan 2015 17:28:55 +0000 (17:28 +0000)]
Another fix for memory access errors trigegred by running readelf on a corrupt binary.

PR binutils/17531
* dwarf.c (display_debug_addr): Use xcalloc to allocate the debug_addr_info
array.  Check for an address_base that is too large.

9 years ago[darwin/gdb] Use <setjmp.h> instead of <machine/setjmp.h>
James Clarke [Mon, 12 Jan 2015 17:13:54 +0000 (21:13 +0400)]
[darwin/gdb] Use <setjmp.h> instead of <machine/setjmp.h>

The `machine/setjmp.h' header is no longer present on OS X 10.10, and is
non-standard. Instead, `darwin-nat.c' should be using the standard
`setjmp.h' header.

gdb/ChangeLog:

2015-01-12  James Clarke  <jrtc27@jrtc27.com>  (tiny patch)

PR gdb/17046
* darwin-nat.c: Replace <machine/setjmp.h> #include by
<setjmp.h> #include.

9 years agogdb.python/py-prompt.exp: restore GDBFLAGS
Pedro Alves [Mon, 12 Jan 2015 17:10:06 +0000 (17:10 +0000)]
gdb.python/py-prompt.exp: restore GDBFLAGS

The previous change to py-prompt.exp made it return without restoring
GDBFLAGS, resulting in breaking the following tests:

  $ make check RUNTESTFLAGS="--target_board=native-gdbserver --directory=gdb.python"
  ...
  Running src/gdb/testsuite/gdb.python/py-prompt.exp ...
  Running src/gdb/testsuite/gdb.python/py-section-script.exp ...
  ERROR: (timeout) GDB never initialized after 10 seconds.
  ERROR: no fileid for gdbuild
  ERROR: Couldn't send python print ('test') to GDB.
  ERROR: no fileid for gdbuild
  ERROR: Couldn't send python print (sys.version_info[0]) to GDB.
  ERROR: no fileid for gdbuild
  ERROR: Couldn't send python print (sys.version_info[1]) to GDB.
  ERROR: no fileid for gdbuild
  ERROR: no fileid for gdbuild
  ...

gdb/testsuite/
2015-01-12  Pedro Alves  <palves@redhat.com>

* gdb.python/py-prompt.exp: When the board can't spawn for attach,
restore GDBFLAGS before returning.

9 years agoMore fixes for memory access errors when running readelf on fuzzed binaries.
Nick Clifton [Mon, 12 Jan 2015 16:08:41 +0000 (16:08 +0000)]
More fixes for memory access errors when running readelf on fuzzed binaries.

PR binutils/17531
* dwarf.c (process_debug_info): Check for abbrev_base being larger
than the section size.
(process_cu_tu_index): Use xcalloc2 to allocate the CU and TU
arrays.
(xcalloc2): New function.  Like xcalloc, but checks for overflow.
* dwarf.h (xcalloc2): Prototype.

9 years agogas: allow labeling of CFI instructions
Jan Beulich [Mon, 12 Jan 2015 14:24:20 +0000 (15:24 +0100)]
gas: allow labeling of CFI instructions

When runtime patching code (like e.g. done by the Linux kernel) there
may be cases where the set of stack frame alterations differs between
unpatched and patched code. Consequently the corresponding unwind data
needs patching too. Locating the right places within an FDE, however,
is rather cumbersome without a way to insert labels in the resulting
section. Hence this patch introduces a new directive, .cfi_label. Note
that with the way CFI data gets emitted currently (at the end of the
assembly process) this can't support local FB- and dollar-labels.

gas/
2015-01-12  Jan Beulich  <jbeulich@suse.com>

* gas/dw2gencfi.c (cfi_add_label, dot_cfi_label): New.
(cfi_pseudo_table): Add "cfi_label".
(output_cfi_insn): Handle CFI_label.
(select_cie_for_fde): Als terminate CIE when encountering
CFI_label.
* dw2gencfi.h (cfi_add_label): Declare.
(struct cfi_insn_data): New member "sym_name".
(CFI_label): New.
* read.c (read_symbol_name): Drop "static".
* read.h (read_symbol_name): Declare.

gas/testsuite/
2015-01-12  Jan Beulich  <jbeulich@suse.com>

gas/cfi/cfi-label.d, gas/cfi/cfi-label.s: New.
gas/cfi/cfi.exp: Run new tests.

9 years agoFix GDB crash caused by discarding grouped debug sections
Terry Guo [Mon, 12 Jan 2015 11:00:00 +0000 (21:30 +1030)]
Fix GDB crash caused by discarding grouped debug sections

Keep a group containing just debug sections or the other special
sections we currently mark against garbage collection.

* elflink.c (_bfd_elf_gc_mark_debug_special_section_group): New
function.
(_bfd_elf_gc_mark_extra_sections): Use it.

9 years agoFix build without makeinfo from release binutils tar
Alan Modra [Mon, 12 Jan 2015 09:54:12 +0000 (20:24 +1030)]
Fix build without makeinfo from release binutils tar

PR 17817
* Makefile.am (aoutx.stamp): cp -p $srcdir/aoutx.texi to keep
timestamps so that makeinfo need not be installed.
(archive.stamp, archures.stamp, bfdt.stamp, cache.stamp,
coffcode.stamp, core.stamp, elf.stamp, elfcode.stamp, mmo.stamp,
format.stamp, libbfd.stamp, bfdio.stamp, bfdwin.stamp,
opncls.stamp, reloc.stamp, section.stamp, syms.stamp, targets.stamp,
init.stamp, hash.stamp, linker.stamp): Similarly.
(bfdver.texi): Use test rather than [ ] in commands.
* Makefile.in: Regenerate.

9 years ago[testsuite patch] Fix new FAIL: py-frame.exp: test Frame.read_register(rip)
Jan Kratochvil [Mon, 12 Jan 2015 10:02:46 +0000 (11:02 +0100)]
[testsuite patch] Fix new FAIL: py-frame.exp: test Frame.read_register(rip)

for x86_64 -m32 run one gets:

+FAIL: gdb.python/py-frame.exp: test Frame.read_register(rip)

I do not have x32 OS here but the %rip test should PASS there I think.

On Sun, 11 Jan 2015 14:58:06 +0100, Yao Qi wrote:
With your patch applied, this test is skipped on 'x86_64 -m32'.  I
prefer to increasing the test coverage, so how about extending the test
for 'x86_64 -m32'?  I mean test Frame.read_register(eip)...

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

* gdb.python/py-frame.exp (test Frame.read_register(rip)): Use
is_amd64_regs_target and is_x86_like_target.

9 years agoarm: properly range check immediate operands of VSHL and VQSHL
Jan Beulich [Mon, 12 Jan 2015 08:05:19 +0000 (09:05 +0100)]
arm: properly range check immediate operands of VSHL and VQSHL

These two, other than VQSHLU, didn't have their immediates properly range
checked so far.

(Re-sending unchanged from the original v2 due to never having got an
answer to https://sourceware.org/ml/binutils/2013-04/msg00121.html.)

gas/
2015-01-12  Jan Beulich  <jbeulich@suse.com>

* gas/config/tc-arm.c (do_neon_shl_imm): Check immediate range.
(do_neon_qshl_imm): Likewise.

gas/testsuite/
2015-01-12  Jan Beulich  <jbeulich@suse.com>

* gas/arm/neon-addressing-bad.s: Add test for invalid VSHL,
VQSHL, and VQSHLU immediates.
* gas/arm/neon-addressing-bad.l: Update accordingly.

9 years agoAssorted compiler warning fixes
Alan Modra [Sat, 10 Jan 2015 22:00:33 +0000 (08:30 +1030)]
Assorted compiler warning fixes

The C standard doesn't guarantee a function pointer can be cast to
void* and vice versa.

binutils/
* prdbg.c (print_debugging_info): Don't use void* for function
pointer param.
* budbg.h (print_debugging_info): Update prototype.
gas/
* read.c (s_altmacro, s_reloc): Make definition static.

9 years agodwarf2read.c (compute_delayed_physnames): Use TYPE_FN_FIELD_PHYSNAME.
Doug Evans [Mon, 12 Jan 2015 00:39:46 +0000 (16:39 -0800)]
dwarf2read.c (compute_delayed_physnames): Use TYPE_FN_FIELD_PHYSNAME.

gdb/ChangeLog:

* dwarf2read.c (compute_delayed_physnames): Use TYPE_FN_FIELD_PHYSNAME.

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

9 years agoRequire numeric attributes to specify the form.
Doug Evans [Sun, 11 Jan 2015 23:45:43 +0000 (15:45 -0800)]
Require numeric attributes to specify the form.

gdb/testsuite/ChangeLog:

* lib/dwarf.exp (Dwarf): Flag an error if a numeric attribute value
is given without an explicit form.
* gdb.dwarf2/arr-subrange.exp: Specify forms for all numeric
attributes.
* gdb.dwarf/corrupt.exp: Ditto.
* gdb.dwarf2/enum-type.exp: Ditto.
* gdb.trace/entry-values.exp: Ditto.
* gdb.trace/unavailable-dwarf-piece.exp: Ditto.

9 years agoTemporarily revert symbol lookup cache.
Doug Evans [Sun, 11 Jan 2015 23:16:26 +0000 (15:16 -0800)]
Temporarily revert symbol lookup cache.

clear_symtab_users calls breakpoint_re_set before
observer_notify_new_objfile(NULL), and thus symbol lookup
done during breakpoint_re_set will see a stale cache.

Presumably we just need to move the call to observer_notify_new_objfile(NULL)
to before breakpoint_re_set, but need to check for other such issues,
and 7.9 is scheduled to branch tomorrow.

Reverts commits:
b2fb95e006c29e2cbe4b30523879fe3640f906ad
400678a494713abf8f7ea2367f213109a2c4b886
d98b9ccbccf36563dad92f6093a93655b38bc51b
77087adf50cedf78cc216ac6eb3b2863839d713c

gdb/ChangeLog:

* symtab.c (eq_symbol_entry): Use SYMBOL_SEARCH_NAME and
symbol_matches_domain for symbol comparisons.

* symtab.c (symbol_cache_mark_found): Improve function comment.
Rename parameter objfile to objfile_context.
(symbol_cache_mark_not_found): Improve function comment.

Add symbol lookup cache.
* NEWS: Document new options and commands.
* symtab.c (symbol_cache_key): New static global.
(DEFAULT_SYMBOL_CACHE_SIZE, MAX_SYMBOL_CACHE_SIZE): New macros.
(SYMBOL_LOOKUP_FAILED): New macro.
(symbol_cache_slot_state): New enum.
(block_symbol_cache): New struct.
(symbol_cache): New struct.
(new_symbol_cache_size, symbol_cache_size): New static globals.
(hash_symbol_entry, eq_symbol_entry): New functions.
(symbol_cache_byte_size, resize_symbol_cache): New functions.
(make_symbol_cache, free_symbol_cache): New functions.
(get_symbol_cache, symbol_cache_cleanup): New function.
(set_symbol_cache_size, set_symbol_cache_size_handler): New functions.
(symbol_cache_lookup, symbol_cache_clear_slot): New function.
(symbol_cache_mark_found, symbol_cache_mark_not_found): New functions.
(symbol_cache_flush, symbol_cache_dump): New functions.
(maintenance_print_symbol_cache): New function.
(maintenance_flush_symbol_cache): New function.
(symbol_cache_stats): New function.
(maintenance_print_symbol_cache_statistics): New function.
(symtab_new_objfile_observer): New function.
(symtab_free_objfile_observer): New function.
(lookup_static_symbol, lookup_global_symbol): Use symbol cache.
(_initialize_symtab): Init symbol_cache_key.  New parameter
maint symbol-cache-size.  New maint commands print symbol-cache,
print symbol-cache-statistics, flush-symbol-cache.
Install new_objfile, free_objfile observers.

gdb/doc/ChangeLog:

* gdb.texinfo (Symbols): Document new commands
"maint print symbol-cache", "maint print symbol-cache-statistics",
"maint flush-symbol-cache".  Document new option
"maint set symbol-cache-size".

9 years agoPR gdb/15830
Doug Evans [Sun, 11 Jan 2015 22:06:34 +0000 (14:06 -0800)]
PR gdb/15830

gdb/ChangeLog:

PR gdb/15830
* NEWS: The "maint demangle" command is renamed as "demangle".
* demangle.c: #include cli/cli-utils.h, language.h.
(demangle_command): New function.
(_initialize_demangle): Add new command "demangle".
* maint.c (maintenance_demangle): Stub out.
(_initialize_maint_cmds): Update help text for "maint demangle",
and mark as deprecated.

gdb/doc/ChangeLog:

* gdb.texinfo (Debugging C Plus Plus): Mention "demangle".
(Symbols): Ditto.
(Maintenance Commands): Delete docs for "maint demangle".

gdb/testsuite/ChangeLog:

* gdb.base/maint.exp: Remove references to "maint demangle".
* gdb.cp/demangle.exp: Update.  "maint demangle" -> "demangle".
Add tests for explicitly specifying language to demangle.
* gdb.dlang/demangle.exp: Ditto.

9 years agoFix build on OpenBSD.
Mark Kettenis [Sun, 11 Jan 2015 21:16:11 +0000 (22:16 +0100)]
Fix build on OpenBSD.

gdb/ChangeLog:

* inf-ptrace.c (inf_ptrace_follow_fork): Adjust now that
inferior_thread is a function.

9 years agosymtab.c (eq_symbol_entry): Use SYMBOL_SEARCH_NAME and symbol_matches_domain.
Doug Evans [Sun, 11 Jan 2015 20:02:23 +0000 (12:02 -0800)]
symtab.c (eq_symbol_entry): Use SYMBOL_SEARCH_NAME and symbol_matches_domain.

gdb/ChangeLog:

* symtab.c (eq_symbol_entry): Use SYMBOL_SEARCH_NAME and
symbol_matches_domain for symbol comparisons.

9 years agotweak previous entry
Doug Evans [Sun, 11 Jan 2015 19:40:41 +0000 (11:40 -0800)]
tweak previous entry

9 years agoImprove comments for symbol_cache_mark_{not_,}found.
Doug Evans [Sun, 11 Jan 2015 19:36:36 +0000 (11:36 -0800)]
Improve comments for symbol_cache_mark_{not_,}found.

gdb/ChangeLog:

* symtab.c (symbol_cache_mark_found): Improve function comment.
Rename parameter objfile to objfile_context.
(symbol_cache_mark_not_found): Ditto.

9 years agoOnly discard space for pc-relative relocs symbols
H.J. Lu [Sun, 11 Jan 2015 16:04:27 +0000 (08:04 -0800)]
Only discard space for pc-relative relocs symbols

When building PIE, we should only discard space for pc-relative relocs
symbols which turn out to need copy relocs.

bfd/

PR ld/17827
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): For PIE,
only discard space for pc-relative relocs symbols which turn
out to need copy relocs.

ld/testsuite/

PR ld/17827
* ld-x86-64/pr17689.out: Updated.
* ld-x86-64/pr17689b.S: Likewise.

* ld-x86-64/pr17827.rd: New file.

* ld-x86-64/x86-64.exp: Run PR ld/17827 test.

9 years agoAdd symbol lookup cache.
Doug Evans [Sun, 11 Jan 2015 06:27:10 +0000 (22:27 -0800)]
Add symbol lookup cache.

gdb/ChangeLog:

Add symbol lookup cache.
* NEWS: Document new options and commands.
* symtab.c (symbol_cache_key): New static global.
(DEFAULT_SYMBOL_CACHE_SIZE, MAX_SYMBOL_CACHE_SIZE): New macros.
(SYMBOL_LOOKUP_FAILED): New macro.
(symbol_cache_slot_state): New enum.
(block_symbol_cache): New struct.
(symbol_cache): New struct.
(new_symbol_cache_size, symbol_cache_size): New static globals.
(hash_symbol_entry, eq_symbol_entry): New functions.
(symbol_cache_byte_size, resize_symbol_cache): New functions.
(make_symbol_cache, free_symbol_cache): New functions.
(get_symbol_cache, symbol_cache_cleanup): New function.
(set_symbol_cache_size, set_symbol_cache_size_handler): New functions.
(symbol_cache_lookup, symbol_cache_clear_slot): New function.
(symbol_cache_mark_found, symbol_cache_mark_not_found): New functions.
(symbol_cache_flush, symbol_cache_dump): New functions.
(maintenance_print_symbol_cache): New function.
(maintenance_flush_symbol_cache): New function.
(symbol_cache_stats): New function.
(maintenance_print_symbol_cache_statistics): New function.
(symtab_new_objfile_observer): New function.
(symtab_free_objfile_observer): New function.
(lookup_static_symbol, lookup_global_symbol): Use symbol cache.
(_initialize_symtab): Init symbol_cache_key.  New parameter
maint symbol-cache-size.  New maint commands print symbol-cache,
print symbol-cache-statistics, flush-symbol-cache.
Install new_objfile, free_objfile observers.

doc/ChangeLog:

* gdb.texinfo (Symbols): Document new commands
"maint print symbol-cache", "maint print symbol-cache-statistics",
"maint flush-symbol-cache".  Document new option
"maint set symbol-cache-size".

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

9 years agoFix use of wrong struct i387_xsave field in i387_cache_to_xsave
Joel Brobecker [Sat, 10 Jan 2015 05:50:44 +0000 (09:50 +0400)]
Fix use of wrong struct i387_xsave field in i387_cache_to_xsave

gdb/gdbserver/ChangeLog:

        * i387-fp.c (i387_cache_to_xsave): In look over
        num_avx512_zmmh_high_registers, replace use of struct i387_xsave
        zmmh_low_space field by use of zmmh_high_space.

Tested on x86_64-linux, using boards/native-gdbserver.exp.

9 years agogas/avr: Prevent incorrect overflow errors for diff fixups.
Andrew Burgess [Sun, 4 Jan 2015 00:03:16 +0000 (00:03 +0000)]
gas/avr: Prevent incorrect overflow errors for diff fixups.

When fixups are converted to a difference type within md_apply_fix, we
previously left the contents of VALP (the value that was initially
computed within write.c:fixup_segment) unchanged.  This is harmless,
except that this value is used within write.c:fixup_segment once we
return from md_apply_fix to perform an overflow check.

In some cases, the value computed in write.c:fixup_segment is so wrong
that an overflow error can be triggered.  These errors are incorrect.

This patch avoids the overflow errors by adjusting the value in
write.c:fixup_segment using the VALP pointer in md_apply_fix.

A test for this issue is included.

gas/ChangeLog:

* config/tc-avr.c (md_apply_fix): Update the contents of VALP for
diff fixups.

gas/testsuite/ChangeLog:

* gas/avr/large-debug-line-table.d: New file.
* gas/avr/large-debug-line-table.s: New file.

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

9 years agoDon't align start of segment unless alignment is larger than page size.
Cary Coutant [Fri, 9 Jan 2015 23:55:50 +0000 (15:55 -0800)]
Don't align start of segment unless alignment is larger than page size.

This fixes an issue where a page-aligned data section, combined with -z relro,
could lead to a gap between text and data segments larger than a page, and
we would fail to overlap the segments in the file.

gold/
* layout.cc (Layout::set_segment_offsets): Don't align start of segment
unless alignment is larger than page size.

9 years agoDon't munge yacc's #line directives
Patrick Palka [Sun, 30 Nov 2014 16:47:16 +0000 (11:47 -0500)]
Don't munge yacc's #line directives

The #line directives within GDB's autogenerated yacc files (e.g.
c-exp.c) are being incorrectly munged, causing these directives to refer
to nonexistent source files, e.g.

 #line 36 "/home/patrick/binutils-gdb/gdb//home/patrick/binutils-gdb/gdb/c-exp.y"

as opposed to

  #line 36 "/home/patrick/binutils-gdb/gdb/c-exp.y"

The munging happens due to a sed expression added by commit 954d8cae
whose intended purpose[1] was to work around the fact that ylwrap emitted #line
directives without any directory information, e.g.

  #line 36 "c-exp.y"

So the sed expression was meant to munge such directives to refer to
absolute paths instead.  But the behavior of ylwrap was changed some
years ago[2] to emit absolute paths within #line directives.  And when
our local copy of ylwrap was synced by commit e30465112, the sed
expression in question became unnecessary, and indeed harmful.

This patch removes the now-obsolete sed expression.  The emitted #line
directives are now correct without it.

gdb/ChangeLog:

* Makefile.in (.y.c): Don't munge yacc's #line
directives.

[1]: https://sourceware.org/ml/gdb-patches/2010-11/msg00265.html
[2]: http://git.savannah.gnu.org/cgit/automake.git/commit/lib/ylwrap?id=b6359a5f3