platform/upstream/binutils.git
8 years agotestsuite: Make standard_temp_file use invocation-specific directories
Simon Marchi [Tue, 16 Feb 2016 14:00:51 +0000 (09:00 -0500)]
testsuite: Make standard_temp_file use invocation-specific directories

Just like standard_output_file, standard_temp_file should use multiple
directories to make the tests parallel-safe.  However,
standard_temp_file is sometimes called in some procedures that are not
test-specific.  For example, gdb_init uses it, but is called once before
all test files are ran.  Therefore, we can't organize it in a
temp/gdb.subdir/testname layout, like standard_output_file.

Because it's just meant for temporary files that don't really need to be
inspected after the test, we can just put them in a directory based on
the runtest pid.  There is always a single exp file being executed by a
particular runtest invocation at any given time, so it should be safe.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (standard_temp_file): Return a path specific to
the runtest invocation.

8 years agotestsuite: Fix save-trace.exp writing outside standard output directory
Simon Marchi [Tue, 16 Feb 2016 14:00:50 +0000 (09:00 -0500)]
testsuite: Fix save-trace.exp writing outside standard output directory

In save-trace.exp, we want to test loading of a tracepoint definition
file with a relative path (I am not sure why in fact).  We currently use
"savetrace-relative.tr", which ends up directly in testsuite/.  If we
use [standard_output_file] on that path, it becomes absolute.  I decided
to just replace [pwd] with . (a dot) in the path given by
standard_output_file to make it relative.  However, this trick only
works because [pwd] is a prefix of the standard output directory.  So I
added a check to verify that precondition.

gdb/testsuite/ChangeLog:

* gdb.trace/save-trace.exp: Change relative path to be in the
standard output directory.

8 years agoPass -mrelax-relocations=yes to $(TEST_AS)
H.J. Lu [Tue, 16 Feb 2016 13:55:11 +0000 (05:55 -0800)]
Pass -mrelax-relocations=yes to $(TEST_AS)

x86_64_mov_to_lea5.o and x86_64_mov_to_lea6.o must be assembled with
-mrelax-relocations=yes since when assembler is configured with
--disable-x86-relax-relocations, R_X86_64_GOTPCRELX relocation won't
be generated.  This linker optimization requires R_X86_64_GOTPCRELX
relocation.

This patch also removed the duplicated x86_64_overflow_pc32.o target.

* testsuite/Makefile.am (x86_64_mov_to_lea5.o): Pass
-mrelax-relocations=yes to $(TEST_AS).
(x86_64_mov_to_lea6.o): Likewise.
(x86_64_overflow_pc32.o): Remove duplicated target.
* testsuite/Makefile.in: Regenerated.

8 years agoFix cleanup in arm_linux_software_single_step
Yao Qi [Tue, 16 Feb 2016 13:53:35 +0000 (13:53 +0000)]
Fix cleanup in arm_linux_software_single_step

I see the following error in testing aarch64 GDB debugging arm
program.

(gdb) PASS: gdb.reverse/readv-reverse.exp: set breakpoint at marker2
continue
Continuing.
=================================================================
==32273==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000000ce4c00 in thread T0
    #0 0x2ba5615645c7 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x545c7)^M
    #1 0x4be8b5 in VEC_CORE_ADDR_cleanup /home/yao/SourceCode/gnu/gdb/git/gdb/common/gdb_vecs.h:34^M
    #2 0x5e6d95 in do_my_cleanups /home/yao/SourceCode/gnu/gdb/git/gdb/common/cleanups.c:154^M
    #3 0x64c99a in fetch_inferior_event /home/yao/SourceCode/gnu/gdb/git/gdb/infrun.c:3975^M
    #4 0x678437 in inferior_event_handler /home/yao/SourceCode/gnu/gdb/git/gdb/inf-loop.c:44^M
    #5 0x5078f6 in remote_async_serial_handler /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:13223^M
    #6 0x4cecfd in run_async_handler_and_reschedule /home/yao/SourceCode/gnu/gdb/git/gdb/ser-base.c:137^M
    #7 0x676864 in gdb_wait_for_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:834^M
    #8 0x676a27 in gdb_do_one_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:323^M
    #9 0x676aed in start_event_loop /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:347^M
    #10 0x6706d2 in captured_command_loop /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:318^M
    #11 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M
    #12 0x6716dd in captured_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1157^M
    #13 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M
    #14 0x671b7a in gdb_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1165^M
    #15 0x467684 in main /home/yao/SourceCode/gnu/gdb/git/gdb/gdb.c:32^M
    #16 0x2ba563ed7ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)^M
    #17 0x4676b2 (/scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/gdb+0x4676b2)

looks we should discard cleanup if function
arm_linux_software_single_step returns early, or create cleanup when
it is needed.

gdb:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

* arm-linux-tdep.c (arm_linux_software_single_step): Assign
'old_chain' later.

8 years agoRemove PC from syscall_next_pc
Yao Qi [Tue, 16 Feb 2016 13:47:17 +0000 (13:47 +0000)]
Remove PC from syscall_next_pc

Method syscall_next_pc of struct arm_get_next_pcs_ops has an argument
PC, which is not necessary, because PC can be got from regcache in
'struct arm_get_next_pcs'.  This patch removes the PC argument of
syscall_next_pc.

gdb:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

* arch/arm-get-next-pcs.h (struct arm_get_next_pcs_ops)
<syscall_next_pc>: Remove argument PC.  Callers updated.
* arm-linux-tdep.c (arm_linux_get_next_pcs_syscall_next_pc):
Remove argument PC.  Get pc from regcache_read_pc.
* arm-tdep.c (arm_get_next_pcs_syscall_next_pc): Remove
argument PC.

gdb/gdbserver:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (get_next_pcs_syscall_next_pc): Remove argument
PC.  Get pc from regcache_read_pc.

8 years agoRemove documentation of deleted function S_IS_EXTERN.
Trevor Saunders [Tue, 16 Feb 2016 10:37:32 +0000 (10:37 +0000)]
Remove documentation of deleted function S_IS_EXTERN.

8 years agoFix formatting problems caused by previous update to as.texinfo.
Nick Clifton [Tue, 16 Feb 2016 10:35:54 +0000 (10:35 +0000)]
Fix formatting problems caused by previous update to as.texinfo.

* doc/as.texinfo (Section): Fix up texinfo snafus in previous
update.

8 years ago[PR19620][GAS][AArch64]Remove mov[z,k,n] relocation symbol name restriction.
Renlin Li [Tue, 16 Feb 2016 10:00:29 +0000 (10:00 +0000)]
[PR19620][GAS][AArch64]Remove mov[z,k,n] relocation symbol name restriction.

In AArch64 gas, register name or string starts with valid register name
is not allowed as symbol name for mov[z,k,n] instruction.
This patch removes the restriction.

gas/
PR gas/19620
* config/tc-aarch64.c (parse_half): Remove restrictions on symbol name.
* testsuite/gas/aarch64/movw_label.d: New.
* testsuite/gas/aarch64/movw_label.s: New.

8 years agoFix BFD format matching for x86_64-w64-mingw32 -m32 LTO.
Joseph Myers [Tue, 16 Feb 2016 00:27:11 +0000 (00:27 +0000)]
Fix BFD format matching for x86_64-w64-mingw32 -m32 LTO.

In <https://sourceware.org/ml/binutils/2015-12/msg00190.html> (commit
4a07dc81356ed8728e204e9aabeb256703c59aef), Kwok fixed a problem with
the template used for a dummy BFD for an IR file for LTO on MinGW,
where the input and output formats are not the same.

A problem, however, remains in the case of linking for
x86_64-w64-mingw32 -m32, where LTO linking reports an ambiguity
between the pe-i386 and pei-i386 formats.  An object (pe-i386) with
plugin data is being tested by the linker to see what formats match.
The default format initially set by the linker when
bfd_check_format_matches is called is pei-i386 (as that's the output
format from the linker script), which does not match, so the function
goes on to the loop over possible BFD vectors.  The pe-i386 vector
matches, as it should.  One other vector matches: the plugin vector.

bfd_check_format_matches tests a vector for matching by temporarily
modifying the BFD object to use that vector then using
_bfd_check_format on it.  So the BFD object is temporarily using
plugin_vec.  _bfd_check_format ends up using bfd_plugin_object_p which
uses plugin_object_p from ld which uses plugin_get_ir_dummy_bfd which
succeeds, having created a BFD based on link_info.output_bfd (because
srctemplate is the BFD temporarily using plugin_vec, even after Kwok's
patch link_info.output_bfd is all that's available to base the dummy
BFD on).  So we end up with a match from the plugin vector which uses
the pei-i386 vector even though the pei-i386 vector itself does not
match the input object.  (In the i686-mingw32 case, as opposed to this
multilib case, pe-i386 is the default BFD target, which would
short-circuit that logic.)

There are two cases of the linker handling inputs with a plugin: they
may be inputs that are also accepted by some non-plugin BFD format, as
here, or they may be a format that would not be recognized at all, as
with some tests in the ld testsuite.  In the former case, there is no
need for BFD to accept the objects using the plugin vector, as the
linker has its own logic to allow plugins to claim objects accepted by
some other BFD vector.  Thus, this patch arranges for the plugin
vector to have the lowest match priority, and for the priority from
that vector to be used in the relevant case (the attempted match to
the plugin vector results in TEMP pointing to the pei-i386 vector).

Tested for GCC and Binutils testsuites for x86_64-pc-linux-gnu, as
well as verifying that it fixes the observed LTO issue for
x86_64-w64-mingw32.

* plugin.c (plugin_vec): Set match priority to 255.
* format.c (bfd_check_format_matches) [BFD_SUPPORTS_PLUGINS]: When
matching against the plugin vector, take priority from there not
from TEMP.

8 years agoFix typos in gas/ChangeLog
H.J. Lu [Tue, 16 Feb 2016 00:11:23 +0000 (16:11 -0800)]
Fix typos in gas/ChangeLog

8 years agoAdd parentheses to prevent truncated addresses
H.J. Lu [Mon, 15 Feb 2016 23:58:42 +0000 (15:58 -0800)]
Add parentheses to prevent truncated addresses

* i386-dis.c (print_insn): Parenthesize expression to prevent
truncated addresses.
(OP_J): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Feb 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd missing gdb.arch/i386-prologue.c prototypes
Jan Kratochvil [Mon, 15 Feb 2016 18:01:03 +0000 (19:01 +0100)]
Add missing gdb.arch/i386-prologue.c prototypes

The testfile has not ran because:
gdb.arch/i386-prologue.c:34:3: warning: implicit declaration of function 'standard' [-Wimplicit-function-declaration]
   standard ();
   ^
gdb.arch/i386-prologue.c:35:3: warning: implicit declaration of function 'stack_align_ecx' [-Wimplicit-function-declaration]
   stack_align_ecx ();
   ^
gdb.arch/i386-prologue.c:36:3: warning: implicit declaration of function 'stack_align_edx' [-Wimplicit-function-declaration]
   stack_align_edx ();
   ^
gdb.arch/i386-prologue.c:37:3: warning: implicit declaration of function 'stack_align_eax' [-Wimplicit-function-declaration]
   stack_align_eax ();
   ^

gdb/testsuite/ChangeLog
2016-02-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/i386-prologue.c: Add missing prototypes.

8 years agoFix more testcases with standard_output_file.
Jan Kratochvil [Mon, 15 Feb 2016 17:54:03 +0000 (18:54 +0100)]
Fix more testcases with standard_output_file.

Since
commit 2151ccc56c74b55a8f0debf0724a495368f92591
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Feb 8 14:02:36 2016 -0500
    Always organize test artifacts in a directory hierarchy
these testfiles could not build.

gdb/testsuite/ChangeLog
2016-02-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/i386-gnu-cfi.exp: Use standard_output_file.
* gdb.arch/i386-prologue.exp: Likewise.
* gdb.arch/i386-size.exp: Likewise.

8 years agoFix changelog entry for previous delta.
Nick Clifton [Mon, 15 Feb 2016 16:54:49 +0000 (16:54 +0000)]
Fix changelog entry for previous delta.

8 years agotestsuite: Fix some tests that write outside of the standard output directory
Simon Marchi [Mon, 15 Feb 2016 16:46:10 +0000 (11:46 -0500)]
testsuite: Fix some tests that write outside of the standard output directory

gdb/testsuite/ChangeLog:

* gdb.base/wrong_frame_bt_full.exp: Use standard_output_file to
define object file path.
* gdb.btrace/gcore.exp: Use standard_output_file to define core
file path.
* lib/opencl.exp (gdb_compile_opencl_hostapp): Use
standard_output_file to define binfile.

8 years agoCorrect opcode generated for RX indirect MOVs without an offset.
Vinay Kumar G [Mon, 15 Feb 2016 16:34:34 +0000 (16:34 +0000)]
Correct opcode generated for RX indirect MOVs without an offset.

PR gas/19665
* config/rx-parse.y (MOV):  Opcode generation for index
register addressing mode.
* testsuite/gas/rx/rx.exp: Updated for new testcase.
* testsuite/gas/rx/pr19665.s: New file.
* testsuite/gas/rx/pr19665.s: New file.
* testsuite/gas/rx/mov.d: Update expected output.

8 years agoEnhance GAS's .section directive so that it can take numeric values for the flags...
Nick Clifton [Mon, 15 Feb 2016 11:11:46 +0000 (11:11 +0000)]
Enhance GAS's .section directive so that it can take numeric values for the flags and type fields.  (ELF only)

gas * doc/as.texinfo (.section): Document that numeric values can now
be used for the flags and type fields of the ELF target's .section
directive.  Add notes about the restrictions on setting flags and
types.
* config/obj-elf.c (obj_elf_change_section): Allow known sections
to be given processor specific section types.  Allow processor and
application specific flags of a section to be set after
definition.
(obj_elf_parse_section_letters): Handle parsing numeric values.
(obj_elf_section_type): Handle parsing numeric values.
(obj_elf_section): Allow numeric type values.
* config/obj-elf.h (obj_elf_change_section): Update prototype.
* testsuite/gas/elf/section10.d: New test.
* testsuite/gas/elf/section10.s: Source file for new test.
* testsuite/gas/elf/elf.exp: Run the new test.
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Remove dependency upon
the description of the flags produced by readelf.
* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.
* NEWS: Mention the new feature.

bfd * elf-bfd.h (struct bfd_elf_special_section): Use unsigned values
for length and type fields.  Use a signed value for the
suffix_length field.

binutils* readelf.c (get_section_type_name): Add hex prefix to offsets
printed for LOPROC and LOOS values.  Ensure that a result is
always returned for the V850 target, even when an unrecognised
processor specific value is encountered.
(process_section_headers): Display key values in the order in
which they appear to the user.  Add the "C (compressed)" value to
the list.

ld * testsuite/ld-i386/pr12718.d: Remove dependency upon the
description of the flags produced by readelf.
* testsuite/ld-i386/pr12921.d: Likewise.
* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin.rd: Likewise.
* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbindesc.rd: Likewise.
* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsdesc.rd: Likewise.
* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsgdesc.rd: Likewise.
* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
* testsuite/ld-i386/tlsnopic.rd: Likewise.
* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic.rd: Likewise.
* testsuite/ld-s390/tlsbin.rd: Likewise.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.
* testsuite/ld-s390/tlspic.rd: Likewise.
* testsuite/ld-s390/tlspic_64.rd: Likewise.
* testsuite/ld-sh/tlsbin-2.d: Likewise.
* testsuite/ld-sh/tlspic-2.d: Likewise.
* testsuite/ld-tic6x/common.d: Likewise.
* testsuite/ld-tic6x/shlib-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/pr12718.d: Likewise.
* testsuite/ld-x86-64/pr12921.d: Likewise.
* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
* testsuite/ld-x86-64/split-by-file.rd: Likewise.
* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.
* testsuite/ld-xtensa/tlsbin.rd: Likewise.
* testsuite/ld-xtensa/tlspic.rd: Likewise.

8 years agogold: Add s390 -fsplit-stack support.
Marcin Kościelnicki [Sun, 13 Dec 2015 01:53:09 +0000 (02:53 +0100)]
gold: Add s390 -fsplit-stack support.

gold/ChangeLog:

* s390.cc (Target_s390::match_view_u): New helper method.
(Target_s390::do_is_call_to_non_split): New method.
(Target_s390::ss_code_st_r14): New const.
(Target_s390::ss_code_l_r14): New const.
(Target_s390::ss_code_bras_8): New const.
(Target_s390::ss_code_l_basr): New const.
(Target_s390::ss_code_a_basr): New const.
(Target_s390::ss_code_ear): New const.
(Target_s390::ss_code_c): New const.
(Target_s390::ss_code_larl): New const.
(Target_s390::ss_code_brasl): New const.
(Target_s390::ss_code_jg): New const.
(Target_s390::ss_code_jgl): New const.
(Target_s390::ss_match_mcount): New helper method.
(Target_s390::ss_match_l): New helper method.
(Target_s390::ss_match_ahi): New helper method.
(Target_s390::ss_match_alfi): New helper method.
(Target_s390::ss_match_cr): New helper method.
(Target_s390::do_calls_non_split): New method.
* testsuite/Makefile.am: Added new tests.
* testsuite/split_s390.sh: New test.
* testsuite/split_s390_1_a1.s: New test.
* testsuite/split_s390_1_a2.s: New test.
* testsuite/split_s390_1_n1.s: New test.
* testsuite/split_s390_1_n2.s: New test.
* testsuite/split_s390_1_z1.s: New test.
* testsuite/split_s390_1_z2.s: New test.
* testsuite/split_s390_1_z3.s: New test.
* testsuite/split_s390_1_z4.s: New test.
* testsuite/split_s390_2_ns.s: New test.
* testsuite/split_s390_2_s.s: New test.
* testsuite/split_s390x_1_a1.s: New test.
* testsuite/split_s390x_1_a2.s: New test.
* testsuite/split_s390x_1_n1.s: New test.
* testsuite/split_s390x_1_n2.s: New test.
* testsuite/split_s390x_1_z1.s: New test.
* testsuite/split_s390x_1_z2.s: New test.
* testsuite/split_s390x_1_z3.s: New test.
* testsuite/split_s390x_1_z4.s: New test.
* testsuite/split_s390x_2_ns.s: New test.
* testsuite/split_s390x_2_s.s: New test.

8 years agoDon't print 0x for core_addr_to_string_nz
Yao Qi [Mon, 15 Feb 2016 10:05:56 +0000 (10:05 +0000)]
Don't print 0x for core_addr_to_string_nz

core_addr_to_string_nz returns string which has "0x" prefix, so don't
need to print "0x" again.  This patch is to remove the "0x".

gdb:

2016-02-15  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (aarch64_analyze_prologue): Remove "0x".

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Feb 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agotestsuite: Fix false Fortran regressions with recent gcc
Jan Kratochvil [Sun, 14 Feb 2016 08:21:18 +0000 (09:21 +0100)]
testsuite: Fix false Fortran regressions with recent gcc

gcc-4.9.2-6.fc21.x86_64 -> gcc-5.3.1-2.fc23.x86_64

-PASS: gdb.fortran/vla-ptype.exp: ptype pvla not initialized
+FAIL: gdb.fortran/vla-ptype.exp: ptype pvla not initialized
-PASS: gdb.fortran/vla-history.exp: print vla1 allocated
+FAIL: gdb.fortran/vla-history.exp: print vla1 allocated
-PASS: gdb.fortran/vla-history.exp: print $2
+FAIL: gdb.fortran/vla-history.exp: print $2
-PASS: gdb.fortran/vla-value.exp: print undefined pvla
+FAIL: gdb.fortran/vla-value.exp: print undefined pvla
-PASS: gdb.fortran/vla-value.exp: print non-associated &pvla
+FAIL: gdb.fortran/vla-value.exp: print non-associated &pvla
-PASS: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8)
+FAIL: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8)

These issues get fixed (or removed if no longer applicable) by attached patch.

It is based on Googled:
http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
When a pointer is declared its status is undefined, and cannot be
safely queried with the associated intrinsic.
-> nullify(VARNAME)
+
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268786
ALLOCATE is not supposed to initialize the array.
-> Remove checks like an initial print is: \\( *0, *0, *0...\\)

These regressions remain:
-PASS: gdb.fortran/library-module.exp: print var_i in lib
+FAIL: gdb.fortran/library-module.exp: print var_i in lib
-PASS: gdb.fortran/library-module.exp: print var_i in main
+FAIL: gdb.fortran/library-module.exp: print var_i in main
I believe it is more a GDB bug (in a code contributed by me), filed:
gdb.fortran/library-module.exp false regression on GCC upgrade
https://sourceware.org/bugzilla/show_bug.cgi?id=19635

gdb/testsuite/ChangeLog
2016-02-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix compatibility with recent gfortran-5.3.1.
* gdb.fortran/vla-history.exp (print vla1 allocated)
(print vla2 allocated, print $2, print $3): Remove
(print $4): Rename to ...
(print $2): ... here.
(print $9): Rename to ...
(print $5): ... here.
(print $10): Rename to ...
(print $6): ... here.
* gdb.fortran/vla.f90: Add pvla initialization.

8 years agotestsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp
Jan Kratochvil [Sun, 14 Feb 2016 08:10:59 +0000 (09:10 +0100)]
testsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp

> +static int max_value_size = 65536; /* 64k bytes */

FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array)
FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was mofified in debugger (passed fixed array)
FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was filled
FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was mofified in debugger

print array2
value requires 296352 bytes, which is more than max-value-size
(gdb) FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array)

gdb/testsuite/ChangeLog
2016-02-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.fortran/vla-value-sub-finish.exp (set max-value-size 1024*1024):
New test.
* gdb.fortran/vla-value-sub.exp: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Feb 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Feb 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix a typo in objcopy manual
H.J. Lu [Fri, 12 Feb 2016 21:38:57 +0000 (13:38 -0800)]
Fix a typo in objcopy manual

For objcopy, --compress-debug-sections=none is the same as
--decompress-debug-sections, not --nocompress-debug-sections.

* doc/binutils.texi: Fix a typo.

8 years agogdb.trace/tfile-avx.c: Change ymm15 to xmm15 for old gcc.
Marcin Kościelnicki [Fri, 12 Feb 2016 19:32:28 +0000 (20:32 +0100)]
gdb.trace/tfile-avx.c: Change ymm15 to xmm15 for old gcc.

gcc older than 4.9 doesn't understand ymm15 as a register name.  Use
xmm15 instead.

gdb/testsuite/ChangeLog:

* gdb.trace/tfile-avx.c (main): Change ymm15 to xmm15.

8 years agoi386-biarch-core.exp: Use standard_output_file
Simon Marchi [Fri, 12 Feb 2016 18:56:21 +0000 (13:56 -0500)]
i386-biarch-core.exp: Use standard_output_file

Fix the core file path to use the standard output directory.

gdb/testsuite/ChangeLog:

* i386-biarch-core.exp: Define corefile using
standard_output_file.

8 years ago[gdbserver, aarch64] Use linux_{set,get}_pc_{64,32}bit
Yao Qi [Fri, 12 Feb 2016 16:08:25 +0000 (16:08 +0000)]
[gdbserver, aarch64] Use linux_{set,get}_pc_{64,32}bit

We can use shared functions linux_{set,get}_pc_{64,32}bit in
linux-aarch64-low.c to write and read pc.

gdb/gdbserver:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_get_pc): Call linux_get_pc_64bit
or linux_get_pc_32bit.
(aarch64_set_pc): Call linux_set_pc_64bit or linux_set_pc_32bit.

8 years ago[ARM] Software single step cross kernel helpers
Yao Qi [Wed, 10 Feb 2016 14:21:38 +0000 (14:21 +0000)]
[ARM] Software single step cross kernel helpers

GDB step cross kernel helpers only works if the kernel helpers are tail
called, which is the case how it is used in glibc.  See __aeabi_read_tp
in sysdeps/unix/sysv/linux/arm/aeabi_read_tp.S.  In __aeabi_read_tp,
branch/jump to the kernel helper is the last instruction, and the next
instruction address is in LR, which is in caller function.  GDB can
handle this correctly.  For example, glibc function __GI___ctype_init
calls __aeabi_read_tp

   0xb6e19b30 <__GI___ctype_init+4>: ldr r3, [pc, #80] ;
   0xb6e19b34 <__GI___ctype_init+8>: bl 0xb6e0a6e0 <__aeabi_read_tp>
   0xb6e19b38 <__GI___ctype_init+12>: ldr r3, [pc, r3]

and __aeabi_read_tp calls kernel helper,

(gdb) disassemble __aeabi_read_tp
   0xb6fef5d0 <+0>: mvn r0, #61440 ; 0xf000
   0xb6fef5d4 <+4>: sub pc, r0, #31

once GDB or GDBserver single step instruction on 0xb6fef5d4, LR is
0xb6e19b38, which is right address of next instruction to set breakpoint
on.

However, if the kernel helpers are not tail-called, the LR is still the
address in the caller function of kernel helper's caller, which isn't
the right address of next instruction to set breakpoint on.  For example,
we use kernel helper in main,

(gdb) disassemble main
....
   0x00008624 <+32>:    mov     r3, #4064       ; 0xfe0^M
   0x00008628 <+36>:    movt    r3, #65535      ; 0xffff^M
   0x0000862c <+40>:    blx     r3
   0x00008630 <+44>:    ldr     r3, [r11, #-8]

kernel helper is called on 0x0000862c and the expected next instruction
address is 0x00008630, but the LR now is the return address of main.
The problem here is LR may not have the right address because when we
single step the instruction, it isn't executed yet, so the LR isn't
updated.  This patch fix this problem by decoding instruction, if the
instruction updates LR (BL and BLX), the next instruction address is
PC + INSN_SIZE, otherwise, get the address of next instruction from LR.

gdb:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* arch/arm-linux.c (arm_linux_get_next_pcs_fixup): Calculate
nextpc according to instruction.

gdb/testsuite:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* gdb.arch/arm-single-step-kernel-helper.c: New.
* gdb.arch/arm-single-step-kernel-helper.exp: New.

8 years ago[ARM] Fixup PC in software single step
Yao Qi [Mon, 8 Feb 2016 16:05:31 +0000 (16:05 +0000)]
[ARM] Fixup PC in software single step

When I exercise GDBserver software single step, I see the following
error, which has been already handled by GDB properly.

In GDBserver log, we can see, GDBserver tries to single step instruction
on 0xb6e0a6e4, and destination address is 0xffff0fe0,

 stop pc is 0xb6e0a6e4
 Writing f001f0e7 to 0xffff0fe0 in process 7132
 Failed to insert breakpoint at 0xffff0fe0 (Input/output error).
 Failed to insert breakpoint at 0xffff0fe0 (-1).

(gdb) disassemble __aeabi_read_tp,+8
Dump of assembler code from 0xb6e0a6e0 to 0xb6e0a6e8:
   0xb6e0a6e0 <__aeabi_read_tp+0>: mvn r0, #61440 ; 0xf000
   0xb6e0a6e4 <__aeabi_read_tp+4>: sub pc, r0, #31

however, it fails inserting breakpoint there.  This problem has already
fixed by GDB, see comments in arm-linux-tdep.c:arm_linux_software_single_step

      /* The Linux kernel offers some user-mode helpers in a high page.  We can
 not read this page (as of 2.6.23), and even if we could then we
 couldn't set breakpoints in it, and even if we could then the atomic
 operations would fail when interrupted.  They are all called as
 functions and return to the address in LR, so step to there
 instead.  */

so we need to do the same thing in GDB side as well.  This patch adds
a new field fixup in arm_get_next_pcs_ops, so that we can fix up PC
for arm-linux target.  In this way, both GDB and GDBserver can single
step instructions going to kernel helpers.

gdb:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* arch/arm-get-next-pcs.c (arm_get_next_pcs): Call
self->ops->fixup if it isn't NULL.
* arch/arm-get-next-pcs.h: Include gdb_vecs.h.
(struct arm_get_next_pcs_ops) <fixup>: New field.
* arch/arm-linux.c: Include common-regcache.h and
arch/arm-get-next-pcs.h.
(arm_linux_get_next_pcs_fixup): New function.
* arch/arm-linux.h (arm_linux_get_next_pcs_fixup): Declare.
* arm-linux-tdep.c (arm_linux_get_next_pcs_ops): Initialize
it with arm_linux_get_next_pcs_fixup.
(arm_linux_software_single_step): Move code to
arm_linux_get_next_pcs_fixup.
* arm-tdep.c (arm_get_next_pcs_ops): Initialize it.

gdb/gdbserver:

2016-02-12  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (get_next_pcs_ops): Initialize it with
arm_linux_get_next_pcs_fixup.

8 years agogdb.trace: Deduplicate write_inferior_data_ptr.
Marcin Kościelnicki [Thu, 28 Jan 2016 15:39:26 +0000 (16:39 +0100)]
gdb.trace: Deduplicate write_inferior_data_ptr.

This function is now basically identical to write_inferior_data_pointer,
remove it and change all references.

gdb/gdbserver/ChangeLog:

* tracepoint.c (x_tracepoint_action_download): Change
write_inferior_data_ptr to write_inferior_data_pointer.
(cmd_qtstart): Likewise.
(write_inferior_data_ptr): Remove.
(download_agent_expr): Change write_inferior_data_ptr to
write_inferior_data_pointer.
(download_tracepoint_1): Likewise.
(download_tracepoint): Likewise.
(download_trace_state_variables): Likewise.

8 years agogdb: Fix build failure in xml-tdesc.c without expat.
Marcin Kościelnicki [Thu, 11 Feb 2016 22:52:44 +0000 (23:52 +0100)]
gdb: Fix build failure in xml-tdesc.c without expat.

Introduced by 18d3cec54e1b4fce278dba436484846f8048d7d6.

gdb/ChangeLog:

* xml-tdesc.c (target_fetch_description_xml) [!HAVE_LIBEXPAT]: Warn
and return NULL.

8 years agobtrace, frame: fix crash in get_frame_type
Markus Metzger [Tue, 26 Jan 2016 13:58:44 +0000 (14:58 +0100)]
btrace, frame: fix crash in get_frame_type

In skip_artificial_frames we repeatedly call get_prev_frame_always until we get
a non-inline and non-tailcall frame assuming that there must be such a frame
eventually.

For record targets, however, we may have a frame chain that consists only of
artificial frames.  This leads to a crash in get_frame_type when dereferencing a
NULL frame pointer.

Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a
case and modify each caller to cope with a NULL return.

In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that
the returned value is not NULL.  Their caller was supposed to check
frame_unwind_caller_id before calling those functions.

In other cases, we thrown an error.

In infcmd further move the skip_tailcall_frames call to the forward-stepping
case since we don't need a frame for reverse execution and we don't want to fail
because of that.  Reverse-finish does make sense for a tailcall frame.

gdb/
* frame.h (skip_tailcall_frames): Update comment.
* frame.c (skip_artificial_frames, skip_tailcall_frames): Return NULL
if only artificial frames are found.  Update comment.
(frame_unwind_caller_id): Handle NULL return.
(frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that
skip_artificial_frames does not return NULL.
(frame_pop): Add an error if only tailcall frames are found.
* infcmd.c (finish_command): Move skip_tailcall_frames call into forward-
execution case.  Add an error if only tailcall frames are found.

testsuite/
* gdb.btrace/tailcall-only.exp: New.
* gdb.btrace/tailcall-only.c: New.
* gdb.btrace/x86_64-tailcall-only.S: New.
* gdb.btrace/i686-tailcall-only.S: New.

8 years agostack: check frame_unwind_caller_id
Markus Metzger [Thu, 11 Feb 2016 10:07:09 +0000 (11:07 +0100)]
stack: check frame_unwind_caller_id

Callers of frame_unwind_caller_* functions are supposed to check
frame_unwind_caller_id.

Add such a check to frame_info and treat an invalid caller ID as if the caller
PC were not available.

gdb/
* stack.c (frame_info): Check frame_unwind_caller_id.

8 years agoframe: add skip_tailcall_frames
Markus Metzger [Fri, 5 Feb 2016 08:32:53 +0000 (09:32 +0100)]
frame: add skip_tailcall_frames

Add a new function skip_tailcall_frames to skip TAILCALL_FRAME frames.

gdb/
* frame.h (skip_tailcall_frames): New.
* frame.c (skip_tailcall_frames): New.
(frame_pop): Call skip_tailcall_frames.
* infcmd.c (finish_command): Call skip_tailcall_frames.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Feb 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix a typo in ld/ChangeLog
H.J. Lu [Thu, 11 Feb 2016 23:37:00 +0000 (15:37 -0800)]
Fix a typo in ld/ChangeLog

8 years agoAdd ChangeLog for PR ld/19615 fix
H.J. Lu [Thu, 11 Feb 2016 23:24:33 +0000 (15:24 -0800)]
Add ChangeLog for PR ld/19615 fix

8 years agoEnable -Bsymbolic and -Bsymbolic-functions to PIE
H.J. Lu [Thu, 11 Feb 2016 18:28:33 +0000 (10:28 -0800)]
Enable -Bsymbolic and -Bsymbolic-functions to PIE

Before binutils 2.26, -Bsymbolic and -Bsymbolic-functions were also
applied to PIE so that "ld -pie -Bsymbolic -E" can be used to export
symbols in PIE with local binding.  This patch re-enables -Bsymbolic
and -Bsymbolic-functions for PIE.

PR ld/19615
* ld.texinfo: Document -Bsymbolic and -Bsymbolic-functions for
PIE.
* lexsup.c (parse_args): Enable -Bsymbolic and
-Bsymbolic-functions for PIE.
* testsuite/ld-i386/i386.exp: Run pr19175.
* testsuite/ld-i386/pr19615.d: New file.
* testsuite/ld-i386/pr19615.s: Likewise.
* testsuite/ld-x86-64/pr19615.d: Likewise.
* testsuite/ld-x86-64/pr19615.s: Likewise.

8 years agogdbserver: Remove tracepoint_action ops.
Wei-cheng Wang [Sat, 27 Jun 2015 16:21:38 +0000 (00:21 +0800)]
gdbserver: Remove tracepoint_action ops.

This patch removes 'ops' in tracepoint, and uses helper functions to
call action handler instead.

The object layout of tracepoint_action may differ in gdbserver and
inferior depend on the alignment rule of target ABI, so gdbserver cannot
simply copy the object from its memory to inferior memory.

For example,

  struct collect_memory_action
  {
    struct tracepoint_action base;
    {
      #ifndef IN_PROCESS_AGENT
      const struct tracepoint_action_ops *ops;
      #if
  -   char type;
  | }
  | ULONGEST addr;
  | ULONGEST len;
  - int32_t basereg;
  };

and on PowerPC,

     Wihtout ops           with ops
      0   1   2   3         0   1   2   3
   0 |type| PADDING...    0 |ops-------------|
   4 .................    4 |type|PADDING....|
   8 |addr------------    8 |addr-------------
   c ----------------|    c -----------------|
  10 |len-------------   10 |len--------------
  14 ----------------|   14 -----------------|
  18 |basereg--------|   18 |basereg---------|

so we cannot directly copy the object.

In this patch, 'ops' is removed in order to make the objects identical.

gdb/gdbserver/ChangeLog:

2016-02-11  Wei-cheng Wang  <cole945@gmail.com>
    Marcin Kościelnicki  <koriakin@0x04.net>

* tracepoint.c (struct tracepoint_action_ops): Remove.
(struct tracepoint_action): Remove ops.
(m_tracepoint_action_download, r_tracepoint_action_download)
(x_tracepoint_action_download, l_tracepoint_action_download): Adjust
size and offset accordingly.
(m_tracepoint_action_ops, r_tracepoint_action_ops)
(x_tracepoint_action_ops, l_tracepoint_action_ops): Remove.
(tracepoint_action_send, tracepoint_action_download): New functions.
Helpers for trace action handlers.
(add_tracepoint_action): Remove setup actions ops.
(download_tracepoint_1, tracepoint_send_agent): Call helper functions.

8 years agoAdd missing quotes to gdb/testsuite/README
Pedro Alves [Thu, 11 Feb 2016 19:55:46 +0000 (19:55 +0000)]
Add missing quotes to gdb/testsuite/README

gdb/testsuite/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

* README (Parallel testing): Add missing double quotes.

8 years agoSupport 'make check-parallel' in gdb's build dir
Pedro Alves [Thu, 11 Feb 2016 19:36:39 +0000 (19:36 +0000)]
Support 'make check-parallel' in gdb's build dir

Currently, you can cd to the gdb/testsuite/ dir and use
make check-parallel, instead of using FORCE_PARALLEL:

 $ make -j8 check-parallel RUNTESTFLAGS="--target_board=native-gdbserver"
 $ make -j8 check RUNTESTFLAGS="--target_board=native-gdbserver" FORCE_PARALLEL=1

But you can't do that in the build/gdb/ dir:

 $ make check-parallel RUNTESTFLAGS="--target_board=native-gdbserver"
 make: *** No rule to make target `check-parallel'.  Stop.

I find check-parallel a bit more convenient, and more typo-proof, so
this patch makes it work from the gdb build dir too.

While documenting this in testsuite/README, I found that the parallel
testing mode would better be pulled out to its own section and
extended.

gdb/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

* Makefile.in (check-parallel): New rule.

gdb/testsuite/ChangeLog:
2016-02-11  Pedro Alves  <palves@redhat.com>

* README (Parallel testing): New section.
(GDB_PARALLEL): Rewrite.
(FORCE_PARALLEL): Document.

8 years agoarm-tdep.c: Remove unused variables
Simon Marchi [Thu, 11 Feb 2016 19:09:25 +0000 (14:09 -0500)]
arm-tdep.c: Remove unused variables

Just a little bit of cleanup.

gdb/ChangeLog:

* arm-tdep.c (arm_skip_prologue): Remove unused variables.
(arm_analyze_prologue): Likewise.
(arm_scan_prologue): Likewise.
(arm_m_exception_prev_register): Likewise.
(arm_copy_block_xfer): Likewise.
(thumb2_copy_block_xfer): Likewise.
(arm_decode_miscellaneous): Likewise.
(arm_decode_ld_st_word_ubyte): Likewise.
(arm_decode_svc_copro): Likewise.
(thumb2_decode_svc_copro): Likewise.
(thumb_copy_16bit_ldr_literal): Likewise.
(thumb_copy_pop_pc_16bit): Likewise.
(decode_thumb_32bit_ld_mem_hints): Likewise.
(arm_show_force_mode): Likewise.
(_initialize_arm_tdep): Likewise.
(arm_record_strx): Likewise.
(arm_record_extension_space): Likewise.
(arm_record_data_proc_misc_ld_str): Likewise.
(arm_record_exreg_ld_st_insn): Likewise.
(arm_record_vfp_data_proc_insn): Likewise.
(arm_record_coproc_data_proc): Likewise.
(thumb_record_misc): Likewise.
(thumb_record_ldm_stm_swi): Likewise.
(thumb2_record_ld_st_dual_ex_tbb): Likewise.
(thumb2_record_ld_mem_hints): Likewise.
(thumb2_record_lmul_lmla_div): Likewise.
(thumb2_record_asimd_struct_ld_st): Likewise.
(arm_process_record): Likewise.

8 years agoarm-tdep.c: Remove unused arm_displaced_step_copy_insn
Simon Marchi [Thu, 11 Feb 2016 19:08:53 +0000 (14:08 -0500)]
arm-tdep.c: Remove unused arm_displaced_step_copy_insn

This function is never used, since it is superseded by
arm_linux_displaced_step_copy_insn.

gdb/ChangeLog:

* arm-tdep.c (arm_displaced_step_copy_insn): Remove.
(ARM displaced stepping support): Remove reference to
arm_displaced_step_copy_insn in comment.
* arm-tdep.h (arm_displaced_step_copy_insn): Remove.
* arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Remove
reference to arm_displaced_step_copy_insn in comment.

8 years agoarm-tdep.c: Change type of insn parameters
Simon Marchi [Thu, 11 Feb 2016 18:21:32 +0000 (13:21 -0500)]
arm-tdep.c: Change type of insn parameters

Almost obvious... change the type of some insn parameters, so that it
matches the rest of the code.

gdb/ChangeLog:

* arm-tdep.c (thumb_copy_unmodified_16bit): Change type of insn.
(thumb_copy_b): Likewise.
(arm_decode_b_bl_ldmstm): Likewise.
(thumb_copy_16bit_ldr_literal): Likewise.
(thumb_copy_pop_pc_16bit): Likewise.

8 years agoRemove info message for every erratum 843419 found and fixed.
Han Shen [Thu, 11 Feb 2016 17:47:49 +0000 (09:47 -0800)]
Remove info message for every erratum 843419 found and fixed.

2016-02-11 Rahul Chaudhry  <rahulchaudhry@google.com>

* aarch64.cc (Target_aarch64::scan_erratum_843419_span):
Remove info message for every erratum 843419 found and fixed.

8 years agoAllow the .cfi_sections directive to be reissued provided that CFI generation has...
Nick Clifton [Thu, 11 Feb 2016 15:30:55 +0000 (15:30 +0000)]
Allow the .cfi_sections directive to be reissued provided that CFI generation has not yet started.

PR gas/19614
* dw2gencfi.c (cfi_sections_set): Delay setting this variable
until it is actually used.
(cfi_set_sections): Set cfi_sections_set to true.
(dot_cfi_startproc): Likewise.
(dot_cfi_endproc): Likewise.
(dot_cfi_fde_data): Likewise.
(cfi_finish): Likewise.
(dot_cfi_sections): Do not set cfi_sections_set.
* doc/as.texinfo (.cfi_sections): Note that targets can provide
their own cfi section name.  Also note that the directive can be
reissued provided that CFI generation has not started.
* testsuite/gas/mips/compact-eh-err2.s: Add .cfi_startproc and
.cfi_endproc directives so that the redefinition of .cfi_sections
will trigger the generation of the error message.
* testsuite/gas/mips/compact-eh-err2.l: Update expected line
number of error message.

8 years agogdb.trace: Add a testcase for tdesc in tfile.
Marcin Kościelnicki [Sat, 6 Feb 2016 17:19:49 +0000 (18:19 +0100)]
gdb.trace: Add a testcase for tdesc in tfile.

This tests whether $ymm15 can be correctly collected and printed from
tfile.  It covers:

- storing tdesc in tfile (without that, $ymm15 doesn't exist)
- ax_pseudo_register_collect for x86 (without that, $ymm15 cannot be
  collected)
- register order in tfile_fetch_registers (without that, $ymm15h is
  fetched from wrong position)
- off-by-one in tfile_fetch_registers (without that, $ymm15h is
  incorrectly considered to be out of bounds)
- using proper tdesc in encoding tracepoint actions (without that,
  internal error happens due to $ymm15h being considered unavailable)

gdb/testsuite/ChangeLog:

* gdb.trace/tfile-avx.c: New test.
* gdb.trace/tfile-avx.exp: New test.

8 years agoUse the target architecture when encoding tracepoint actions
Antoine Tremblay [Thu, 11 Feb 2016 13:14:12 +0000 (08:14 -0500)]
Use the target architecture when encoding tracepoint actions

This patch uses the target architecture rather then the objfile
architecture when encoding tracepoint actions.

The target architecture may contain additional registers. E.g. ARM VFP
registers. This information is needed to allow their collection. Since we
can never know whether the registers numbers in the target match the
binary's we have to use tdesc here.

One note about combined debuggers / multi-inferior from Pedro Alves:

In the combined debugger case taking Cell as the practical example that
gdb supports currently:

In that case, the main target_gdbarch() will be powerpc, but you may have set a
tracepoint on _spu_ code, which has a different gdbarch.  so for that case,
target_gdbarch would be wrong.  I think that in that case, we'd need to
find __the_ target/tdesc gdbarch that is (bfd) compatible with the
objfile's gdbarch.

I think cell/spu gdbserver doesn't support tracepoints, so we can ignore
this for now.

The multi-inferior/process case is somewhat related, but its simpler.
each inferior has its own gdbarch.

That is, target_gdbarch depends on the current inferior selected.
In fact, that just returns inferior->gdbarch nowaways.

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

gdb/ChangeLog:

* tracepoint.c (encode_actions_1): Use target_gdbarch () rather
than loc->gdbarch.

8 years agoMask off the least significant bit in GOT offset
H.J. Lu [Thu, 11 Feb 2016 03:33:52 +0000 (19:33 -0800)]
Mask off the least significant bit in GOT offset

The least significant bit in GOT offset is to record whether we have
initialized the GOT entry in R_386_GOT32 processing.  We need to mask
it off for R_386_GOT32X.

PR ld/19601
* elf32-i386.c (elf_i386_relocate_section): Mask off the least
significant bit in GOT offset for R_386_GOT32X.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Feb 2016 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogdb.trace: Read XML target description from tfile.
Marcin Kościelnicki [Sat, 6 Feb 2016 00:49:14 +0000 (01:49 +0100)]
gdb.trace: Read XML target description from tfile.

gdb/ChangeLog:

* tracefile-tfile.c (trace_tdesc): New static variable.
(tfile_open): Clear trace_tdesc, call target_find_description.
(tfile_interp_line): Recognize tdesc lines.
(tfile_close): Clear trace_tdesc.
(tfile_xfer_partial_features): New function.
(tfile_xfer_partial): Call tfile_xfer_partial_features.
(tfile_append_tdesc_line): New function.

8 years agogdb.trace: Save XML target description in tfile.
Marcin Kościelnicki [Fri, 5 Feb 2016 20:32:52 +0000 (21:32 +0100)]
gdb.trace: Save XML target description in tfile.

gdb/ChangeLog:

* ctf.c (ctf_write_tdesc): New function.
(ctf_write_ops): Wire in ctf_write_tdesc.
* tracefile-tfile.c (tfile_write_tdesc): New function.
(tfile_write_ops): Wire in tfile_write_tdesc.
* tracefile.c (trace_save): Call write_tdesc method.
* tracefile.h (struct trace_file_write_ops): Add write_tdesc method.
* xml-tdesc.c (target_fetch_description_xml): New function.
* xml-tdesc.h: Add target_fetch_description_xml prototype.

8 years agoClear *VAL in regcache_raw_read_unsigned
Yao Qi [Wed, 10 Feb 2016 16:40:52 +0000 (16:40 +0000)]
Clear *VAL in regcache_raw_read_unsigned

We have function regcache_raw_read_unsigned defined in both GDB and
GDBserver, so that it is used in common like this,

  ULONGEST value;
  status = regcache_raw_read_unsigned (regcache, regnum, &value);

'value' is correctly set in GDB side, but may not be correctly set
in GDBserver, because &value is passed in regcache_raw_read_unsigned
but collect_register may only set part of the whole variable.  In my
test, I see the top half of 'value' is garbage.  This patch fixes this
problem by clearing *VAL before calling collect_register.

gdb/gdbserver:

2016-02-10  Yao Qi  <yao.qi@linaro.org>

* regcache.c (regcache_raw_read_unsigned): Clear *VAL.

8 years agoarm-tdep.c: Fix typo
Simon Marchi [Wed, 10 Feb 2016 15:10:18 +0000 (10:10 -0500)]
arm-tdep.c: Fix typo

unpriveleged -> unprivileged

gdb/ChangeLog:

* arm-tdep.c (arm_copy_extra_ld_st): Fix "unpriveleged" typo.
(arm_decode_dp_misc): Likewise.

8 years agogdb/x86: Implement ax_pseudo_register_collect hook.
Marcin Kościelnicki [Sat, 6 Feb 2016 17:17:07 +0000 (18:17 +0100)]
gdb/x86: Implement ax_pseudo_register_collect hook.

Makes "collect $ymm15" action work.

gdb/ChangeLog:

* amd64-tdep.c (amd64_ax_pseudo_register_collect): New function.
(amd64_init_abi): Fill ax_pseudo_register_collect hook.
* gdb/i386-tdep.c (i386_pseudo_register_read_into_value): Remove
misleading comment.
(i386_pseudo_register_write): Ditto.
(i386_ax_pseudo_register_collect): New function.
(i386_gdbarch_init): Fill ax_pseudo_register_collect hook.
* i386-tdep.h: Add i386_ax_pseudo_register_collect prototype.

8 years agogdb.trace: Use g packet order in tfile_fetch_registers.
Marcin Kościelnicki [Sat, 6 Feb 2016 15:26:07 +0000 (16:26 +0100)]
gdb.trace: Use g packet order in tfile_fetch_registers.

tfile_fetch_registers currently wrongly fetches registers using
gdb order instead of g packet order.  On x86_64 with AVX, this causes
problems with ymm*h and orig_rax registers: gdb has ymm*h first, while
g packet has orig_rax first.

gdb/ChangeLog:

* tracefile-tfile.c (tfile_fetch_registers): Use g packet order
instead of gdb order.

gdb/doc/ChangeLog:

* gdb.texinfo (Trace File Format): Remove misleading information
about register block ordering.

8 years agogdb.trace: Fix off-by-one in tfile_fetch_registers.
Marcin Kościelnicki [Sat, 6 Feb 2016 15:30:01 +0000 (16:30 +0100)]
gdb.trace: Fix off-by-one in tfile_fetch_registers.

This resulted in the last register being considered unavailable.
On plain x86_64 (without AVX), this happened to be orig_rax.

gdb/ChangeLog:

* tracefile-tfile.c (tfile_fetch_registers): Fix off-by-one in bounds
check.

8 years agoAdd support for ARC instruction relaxation in the assembler.
Claudiu Zissulescu [Wed, 10 Feb 2016 12:09:01 +0000 (12:09 +0000)]
Add support for ARC instruction relaxation in the assembler.

gas/
2016-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
    Janek van Oirschot <jvanoirs@synopsys.com>

        * config/tc-arc.h (TC_FRAG_TYPE, TC_PCREL_ADJUST, MAX_INSN_ARGS)
        (MAX_INSN_FLGS, MAX_FLAG_NAME_LENGHT, TC_GENERIC_RELAX_TABLE):
        Define.
        (arc_flags, arc_relax_type): New structure.
        * config/tc-arc.c (FRAG_MAX_GROWTH, RELAX_TABLE_ENTRY)
(RELAX_TABLE_ENTRY_MAX): New define.
        (relaxation_state, md_relax_table, arc_relaxable_insns)
(arc_num_relaxable_ins): New variable.
(rlx_operand_type, arc_rlx_types): New enums.
(arc_relaxable_ins): New structure.
        (OPTION_RELAX): New option.
        (arc_insn): New relax member.
        (arc_flags): Remove.
        (relax_insn_p): New function.
        (apply_fixups): Likewise.
        (relaxable_operand): Likewise.
        (may_relax_expr): Likewise.
        (relaxable_flag): Likewise.
        (arc_pcrel_adjust): Likewise.
        (md_estimate_size_before_relax): Implement.
        (md_convert_frag): Likewise.
        (md_parse_option): Handle new mrelax option.
        (md_show_usage): Likewise.
        (assemble_insn): Set relax member.
        (emit_insn0): New function.
        (emit_insn1): Likewise.
        (emit_insn): Handle relaxation case.
* NEWS: Mention the new relaxation option.
* doc/c-arc.texi (ARC Options): Document new mrelax option.

gas/testsuite
2016-01-26  Claudiu Zissulescu  <claziss@synopsys.com>

        * gas/arc/relax-avoid1.d: New file.
        * gas/arc/relax-avoid1.s: Likewise.
        * gas/arc/relax-avoid2.d: Likewise.
        * gas/arc/relax-avoid2.s: Likewise.
        * gas/arc/relax-avoid3.d: Likewise.
        * gas/arc/relax-avoid3.s: Likewise.
* gas/arc/relax-b.d: Likewise.
        * gas/arc/relax-b.s: Likewise.

include/opcode/
2016-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
    Janek van Oirschot  <jvanoirs@synopsys.com>

        * arc.h (arc_opcode arc_relax_opcodes, arc_num_relax_opcodes):
        Declare.

opcodes/
2016-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
    Janek van Oirschot  <jvanoirs@synopsys.com>

        * arc-opc.c (arc_relax_opcodes, arc_num_relax_opcodes): New
        variable.

8 years agoCorrect assertion in NIOS2 linker to allow signed 16-buit immediate values.
Nick Clifton [Wed, 10 Feb 2016 11:25:59 +0000 (11:25 +0000)]
Correct assertion in NIOS2 linker to allow signed 16-buit immediate values.

PR 19405
* elf32-nios2.c (nios2_elf32_install_imm16): Allow for signed
immediate values.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Limit the
number of messages about FDE encoding preventing .eh_frame_hdr
generation.

8 years agoSync top level files with gcc.
Nick Clifton [Wed, 10 Feb 2016 10:54:29 +0000 (10:54 +0000)]
Sync top level files with gcc.

Import these patches from the GCC mainline:

2016-01-12  Andris Pavenis  <andris.pavenis@iki.fi>

* configure.ac: Enable LTO for DJGPP
* configure: Regenerate

2016-01-24  Mikhail Maltsev  <maltsevm@gmail.com>

PR bootstrap/69329
* Makefile.tpl (BASE_FLAGS_TO_PASS): Add LSAN_OPTIONS.
* Makefile.in: Regenerate.

2016-01-25  Aditya Kumar  <aditya.k7@samsung.com>
            Sebastian Pop  <s.pop@samsung.com>

* Makefile.in: Regenerate.
* Makefile.tpl: Export ISLVER.
* configure: Regenerate.
* config/isl.m4: Detect isl-0.15.

2016-01-29  Sebastian Pop  <s.pop@samsung.com>

* config/isl.m4: Add comments about isl-0.16.
* configure: Regenerate.

8 years agoUpdate NEWS post GDB 7.11 branch creation.
Joel Brobecker [Wed, 10 Feb 2016 03:28:01 +0000 (07:28 +0400)]
Update NEWS post GDB 7.11 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.

8 years agoBump version to 7.11.50.DATE-git.
Joel Brobecker [Wed, 10 Feb 2016 03:20:26 +0000 (07:20 +0400)]
Bump version to 7.11.50.DATE-git.

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

gdb/ChangeLog:

GDB 7.11 branch created (9ef9e6a6a0dd8f948708cb67c9afcfd0be40cb0a):
* version.in: Bump version to 7.11.50.DATE-git.

8 years agobreakpoints/19546: Fix crash after updating breakpoints
Keith Seitz [Mon, 8 Feb 2016 20:57:22 +0000 (12:57 -0800)]
breakpoints/19546: Fix crash after updating breakpoints

One of the last checks update_breakpoints_after_exec does while looping
over the list of breakpoints is check that the breakpoint has a valid
location spec. It uses event_location_empty_p to check if the location spec
is "empty", and if it is, the breakpoint is deleted.

momentary_breakpoint types rely on setting the breakpoint structure's
location spec to NULL, thereby causing an update to delete the breakpoint.
However, event_location_empty_p assumed that locations were never NULL.
As a result, GDB would crash dereferencing a NULL pointer whenever
update_breakpoints_after_exec would encounter a momentary_breakpoint.

This patch creates a new wrapper/helper function which tests that the given
breakpoint's location spec is non-NULL and if it is not "empty"
or "unspecified."

gdb/ChangeLog

PR breakpoints/19546
* breakpoint.c (breakpoint_event_location_empty_p): New function.
(update_breakpoints_after_exec, bkpt_re_set): Use this new function
instead of event_location_empty_p.

gdb/testsuite/ChangeLog

PR breakpoints/19546
* gdb.base/infcall-exec.c: New file.
* gdb.base/infcall-exec2.c: New file.
* gdb.base/infcall-exec.exp: New file.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Feb 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoEnable/update legacy linespecs in MI.
Keith Seitz [Tue, 9 Feb 2016 18:02:54 +0000 (10:02 -0800)]
Enable/update legacy linespecs in MI.

MI is currently using string_to_event_location to enable the use of legacy
linespecs, but using this function (until this patchset) had the (as yet
unnoticed) side effect of allowing both MI and CLI representation for
explicit locations.

This patch simply changes MI to use the same legacy linespec functions
that the python and guile interpreters use.  This eliminates the CLI syntax
for explicit locations (in MI).

gdb/ChangeLog

* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Use
string_to_event_location_basic instead of string_to_event_location.

8 years agoUse string_to_event_location_basic in guile.
Keith Seitz [Tue, 9 Feb 2016 18:02:53 +0000 (10:02 -0800)]
Use string_to_event_location_basic in guile.

This patch, analogous to the previous python patch, implements proper
legacy linespec support in guile code using the newly introduced
string_to_event_location_basic.

gdb/ChangeLog

* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Skip
leading whitespace and use string_to_event_location_basic instead
of new_linespec_location.

gdb/testsuite/ChangeLog

* gdb.guile/scm-breakpoint.exp (test_bkpt_address): New procedure.
(toplevel): Call test_bkpt_address.

8 years agopython/19506 -- gdb.Breakpoint address location regression
Keith Seitz [Tue, 9 Feb 2016 18:02:53 +0000 (10:02 -0800)]
python/19506 -- gdb.Breakpoint address location regression

Now that "legacy" linespecs benefit from consolidated support in
string_to_event_location_basic, python's Breakpoint command should use this
function to turn strings into event locations.

As a result, this patch fixes python/19506. Before:

(gdb) python gdb.Breakpoint("*main")
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: Function "*main" not defined.
Error while executing Python code.

After:

(gdb) python gdb.Breakpoint("*main")
Breakpoint 1 at 0x4005fb: file ../../../src/gdb/testsuite/gdb.python/py-breakpoint.c, line 32.

gdb/ChangeLog

PR python/19506
* python/py-breakpoint.c (bppy_init): Use
string_to_event_location_basic instead of new_linespec_location.

gdb/testsuite/ChangeLog

PR python/19506
* gdb.python/py-breakpoint.exp (test_bkpt_address): New procedure.
(toplevel): Call test_bkpt_address.

8 years agoRefactor string_to_event_location for legacy linespec support.
Keith Seitz [Tue, 9 Feb 2016 18:02:53 +0000 (10:02 -0800)]
Refactor string_to_event_location for legacy linespec support.

This patch refactors string_to_event_location, breaking it into two
separate functions:

1) string_to_event_location_basic
A "basic" string parser that implements support for "legacy" linespecs
(linespec, address, and probe locations).  This function is intended to
be used by any UI wishing/needing to support this legacy behavior.

2) string_to_event_location
This is now intended as a CLI-only function which adds explicit location
parsing in a CLI-appropriate manner (in the form of traditional option/value
pairs).

Together these patches serve to simplify string-to-event location parsing
for all existing non-CLI interfaces (MI, guile, and python).

gdb/ChangeLog

* location.c (string_to_explicit_location): Note that "-p" is
reserved for probe locations and return NULL for any input
that starts with that.
(string_to_event_location): Move "legacy" linespec code to ...
(string_to_event_location_basic): ... here.
* location.h (string_to_event_location): Update comment.
(string_to_event_location_basic): New function.

8 years agoFix compile time warnings building the binutils with a gcc6 compiler.
Nick Clifton [Tue, 9 Feb 2016 16:34:24 +0000 (16:34 +0000)]
Fix compile time warnings building the binutils with a gcc6 compiler.

include * opcode/metag.h (metag_scondtab): Mark as possibly unused.
* opcode/nds32.h (nds32_r45map): Likewise.
(nds32_r54map): Likewise.
* opcode/visium.h (gen_reg_table): Likewise.
(fp_reg_table, cc_table, opcode_table): Likewise.

bfd * oasys.c (oasys_archive_p): Fix indentation.
* elf32-nds32.c (nds32_elf_relax_section): Use an unsigned
constant for left shifting.

8 years agoModernize configure.ac's
Simon Marchi [Tue, 9 Feb 2016 14:01:58 +0000 (09:01 -0500)]
Modernize configure.ac's

Using AC_OUTPUT with arguments has been deprecated for some time in
autoconf, even in version 2.64, which we are using.  This change should
not affect functionality.

I also removed the "exit 0"'s, they shouldn't be necessary.

gdb/ChangeLog:

* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
to AC_OUTPUT.  Remove "exit 0" at the end.
* configure: Regenerate.

gdb/testsuite/ChangeLog:

* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
to AC_OUTPUT.
* configure: Regenerate.

gdb/gdbserver/ChangeLog:

* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
to AC_OUTPUT.
* configure: Regenerate.

8 years agoFix PR19548: Breakpoint re-set inserts breakpoints when it shouldn't
Pedro Alves [Tue, 9 Feb 2016 12:12:17 +0000 (12:12 +0000)]
Fix PR19548: Breakpoint re-set inserts breakpoints when it shouldn't

PR19548 shows that we still have problems related to 13fd3ff34329:

 [PR17431: following execs with "breakpoint always-inserted on"]
 https://sourceware.org/ml/gdb-patches/2014-09/msg00733.html

The problem this time is that we currently update the global location
list and try to insert breakpoint locations after re-setting _each_
breakpoint in turn.

Say:

 - We have _more_ than one breakpoint set.  Let's assume 2.

 - There's a breakpoint with a pre-exec address that ends up being an
   unmapped address after the exec.

 - That breakpoint is NOT the first in the breakpoint list.

Then when handling an exec, and we re-set the first breakpoint in the
breakpoint list, we mistakently try to install the old pre-exec /
un-re-set locations of the other breakpoint, which fails:

 (gdb) continue
 Continuing.
 process 28295 is executing new program: (...)/execl-update-breakpoints2
 Error in re-setting breakpoint 1: Warning:
 Cannot insert breakpoint 2.
 Cannot access memory at address 0x1000764

 Breakpoint 1, main (argc=1, argv=0x7fffffffd368) at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/execl-update-breakpoints.c:34
 34        len = strlen (argv[0]);
 (gdb)

Fix this by deferring the global location list update till after all
breakpoints are re-set.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/ChangeLog:
2016-02-09  Pedro Alves  <palves@redhat.com>

PR breakpoints/19548
* breakpoint.c (create_overlay_event_breakpoint): Don't update
global location list here.
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint)
(create_exception_master_breakpoint, create_jit_event_breakpoint)
(update_breakpoint_locations):
(breakpoint_re_set): Update global location list after all
breakpoints are re-set.

gdb/testsuite/ChangeLog:
2016-02-09  Pedro Alves  <palves@redhat.com>

PR breakpoints/19548
* gdb.base/execl-update-breakpoints.c (some_function): New
function.
(main): Call it.
* gdb.base/execl-update-breakpoints.exp: Add a second breakpoint.
Tighten expected GDB output.

8 years agoFix siginfo C++ build error
Simon Marchi [Tue, 9 Feb 2016 11:18:15 +0000 (11:18 +0000)]
Fix siginfo C++ build error

Change the signature of gdbserver's siginfo_fixup functions so that it's
in line with gdb's.  This gets rid of the following build error in C++:

  /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-x86-low.c: In function ‘int x86_siginfo_fixup(siginfo_t*, void*, int)’:
  /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-x86-low.c:694:21: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
               FIXUP_32);
                       ^
  In file included from /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-x86-low.c:31:0:
  /home/emaisin/src/binutils-gdb/gdb/gdbserver/../nat/amd64-linux-siginfo.h:52:5: error:   initializing argument 2 of ‘int amd64_linux_siginfo_fixup_common(siginfo_t*, gdb_byte*, int, amd64_siginfo_fixup_mode)’ [-fpermissive]
   int amd64_linux_siginfo_fixup_common (siginfo_t *native, gdb_byte *inf,
       ^
  /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-x86-low.c:698:20: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
             FIXUP_X32);
                      ^
  In file included from /home/emaisin/src/binutils-gdb/gdb/gdbserver/linux-x86-low.c:31:0:
  /home/emaisin/src/binutils-gdb/gdb/gdbserver/../nat/amd64-linux-siginfo.h:52:5: error:   initializing argument 2 of ‘int amd64_linux_siginfo_fixup_common(siginfo_t*, gdb_byte*, int, amd64_siginfo_fixup_mode)’ [-fpermissive]
   int amd64_linux_siginfo_fixup_common (siginfo_t *native, gdb_byte *inf,
       ^

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_linux_siginfo_fixup): Change
void * to gdb_byte *.
* linux-low.c (siginfo_fixup): Likewise.
(linux_xfer_siginfo): Likewise.
* linux-low.h (struct linux_target_ops) <siginfo_fixup>:
Likewise.
* linux-x86-low.c (x86_siginfo_fixup): Likewise.

8 years agoAdd a more helpful warning message to explain why some AArch64 relocations can overflow.
Nick Clifton [Tue, 9 Feb 2016 09:56:21 +0000 (09:56 +0000)]
Add a more helpful warning message to explain why some AArch64 relocations can overflow.

bfd * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Add a more
helpful warning message to explain why certain AArch64 relocs
might overflow.

ld * testsuite/ld-aarch64/reloc-overflow-bad.d: New test.
* testsuite/ld-aarch64/reloc-overflow-1.s: New source file.
* testsuite/ld-aarch64/reloc-overflow-2.s: New source file.
* testsuite/ld-aarch64/aarch64-elf.exp: Run the new test.

8 years agoRevert "Fix build breakage"
Walfred Tedeschi [Tue, 9 Feb 2016 10:36:54 +0000 (11:36 +0100)]
Revert "Fix build breakage"

This reverts commit 222cab58b7ed37df6e01dacb0932f400a2588137.

8 years agoRevert "Add a more helpful warning message to explain why some AArch64 relocations...
Walfred Tedeschi [Tue, 9 Feb 2016 10:36:15 +0000 (11:36 +0100)]
Revert "Add a more helpful warning message to explain why some AArch64 relocations can overflow."

This reverts commit 2ea53e003163338a403d5afbb2046cafb8f3abe9.

8 years agoFix build breakage
Walfred Tedeschi [Tue, 9 Feb 2016 10:26:13 +0000 (11:26 +0100)]
Fix build breakage

Add a cast to reinterpret a void* as a gdb_byte*.

2016-02-09  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/gdbserver/ChangeLog:

        * linux-x86-low.c (x86_siginfo_fixup): Add cast to gdb_byte*.

8 years agoAdd a more helpful warning message to explain why some AArch64 relocations can overflow.
Nick Clifton [Tue, 9 Feb 2016 09:56:21 +0000 (09:56 +0000)]
Add a more helpful warning message to explain why some AArch64 relocations can overflow.

bfd * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Add a more
helpful warning message to explain why certain AArch64 relocs
might overflow.

ld * testsuite/ld-aarch64/reloc-overflow-bad.d: New test.
* testsuite/ld-aarch64/reloc-overflow-1.s: New source file.
* testsuite/ld-aarch64/reloc-overflow-2.s: New source file.
* testsuite/ld-aarch64/aarch64-elf.exp: Run the new test.

8 years agoFix macro redefinition error on Solaris
Alan Modra [Tue, 9 Feb 2016 02:22:02 +0000 (12:52 +1030)]
Fix macro redefinition error on Solaris

PR 16583
* elf/common.h (AT_SUN_HWCAP): Undef before defining.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Feb 2016 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAlways organize test artifacts in a directory hierarchy
Simon Marchi [Mon, 8 Feb 2016 19:02:36 +0000 (14:02 -0500)]
Always organize test artifacts in a directory hierarchy

When running tests in parallel, each test puts its generated files in a
different directory, under "outputs".  I think it would be nice if it
was always the case, as it would isolate the test cases a bit more.  An
artifact created by a test wouldn't get overwritten by another test.

Also, it makes it easier to clean up.  A lot of executables are left all
over the place because their names do not appear in gdb.*/Makefile.  If
everything is in "outputs", then we just have to delete that directory
(which we already do).

At the same time it makes the gdb.foo directories and their Makefiles
useless in the build directory, since they are pretty much only used for
cleaning.

What do you think?

gdb/testsuite/ChangeLog:

* Makefile.in (ALL_SUBDIRS): Remove.
(clean mostlyclean): Do not recurse in ALL_SUBDIRS.
(distclean maintainer-clean realclean): Likewise.
* configure.ac (AC_OUTPUT): Remove gdb.*/Makefile.
* configure: Regenerate.
* gdb.ada/Makefile.in: Delete.
* gdb.arch/Makefile.in: Likewise.
* gdb.asm/Makefile.in: Likewise.
* gdb.base/Makefile.in: Likewise.
* gdb.btrace/Makefile.in: Likewise.
* gdb.cell/Makefile.in: Likewise.
* gdb.compile/Makefile.in: Likewise.
* gdb.cp/Makefile.in: Likewise.
* gdb.disasm/Makefile.in: Likewise.
* gdb.dlang/Makefile.in: Likewise.
* gdb.dwarf2/Makefile.in: Likewise.
* gdb.fortran/Makefile.in: Likewise.
* gdb.gdb/Makefile.in: Likewise.
* gdb.go/Makefile.in: Likewise.
* gdb.guile/Makefile.in: Likewise.
* gdb.java/Makefile.in: Likewise.
* gdb.linespec/Makefile.in: Likewise.
* gdb.mi/Makefile.in: Likewise.
* gdb.modula2/Makefile.in: Likewise.
* gdb.multi/Makefile.in: Likewise.
* gdb.objc/Makefile.in: Likewise.
* gdb.opencl/Makefile.in: Likewise.
* gdb.opt/Makefile.in: Likewise.
* gdb.pascal/Makefile.in: Likewise.
* gdb.perf/Makefile.in: Likewise.
* gdb.python/Makefile.in: Likewise.
* gdb.reverse/Makefile.in: Likewise.
* gdb.server/Makefile.in: Likewise.
* gdb.stabs/Makefile.in: Likewise.
* gdb.threads/Makefile.in: Likewise.
* gdb.trace/Makefile.in: Likewise.
* gdb.xml/Makefile.in: Likewise.
* lib/gdb.exp (make_gdb_parallel_path): Add check for
GDB_PARALLEL.
(standard_output_file): Remove check for GDB_PARALLEL, always
return path in outputs/$subdir/$testname.

8 years agoFix in-tree, parallel running of Ada tests
Simon Marchi [Mon, 8 Feb 2016 19:00:49 +0000 (14:00 -0500)]
Fix in-tree, parallel running of Ada tests

While testing the following patch,

  [PATCH] Always organize test artifacts in a directory hierarchy
  https://sourceware.org/ml/gdb-patches/2016-01/msg00133.html

I noticed that it broke Ada testing.  This lead me to think that
parallel testing when building in-tree didn't work previously in Ada.
It is confirmed by this test:

$ make check TESTS="gdb.ada/fun_addr.exp" -j 2
...
Running ./gdb.ada/fun_addr.exp ...
FAIL: gdb.ada/fun_addr.exp: compilation foo.adb
...

This patch fixes in-tree parallel testing for Ada, and consequently
serial and parallel testing when the aforementioned patch is applied.

The problem originates from the fact that Ada support code cd's to the
builddir before compiling.  In itself it's not a problem, it allows to
place intermediate auto-generated files in that directory.  The Ada
compilation refers to the source file, which is in another directory,
only by its base name (e.g. foo.adb).  In serial mode, that worked
because builddir was the same as the source directory (e.g.
gdb.ada/fun_addr/).  In an out-of-tree build, it works because the
source directory is added as an include directory (note: this is not the
same $srcdir as autoconf's):

  set srcdir [file dirname $source]
  additional_flags=-I$srcdir

which becomes:

  additional_flags=-I/home/emaisin/build/binutils-gdb/gdb/testsuite/gdb.ada/fun_addr

However, when building in-tree, srcdir is relative: ./gdb.ada/fun_addr.
When using parallel or always-in-outputs-directory mode, we are cd'ed in
the outputs directory.  So -I$srcdir is relative to the current
directory, which is wrong.

To fix it, I made the TCL variable srcdir (set in site.exp, from which
everything else is derived) always absolute.  It is done by assigning
autoconf's abs_srcdir instead of autoconf's srcdir.  This way -I$srcdir
will always be good, regardless of where we cd'ed to.  A small apparent
change is that when running tests, DejaGnu will say:

  Running /tmp/binutils-gdb/gdb/testsuite/gdb.ada/fun_addr.exp ...

instead of

  Running ./gdb.ada/fun_addr.exp ...

I hope it's not too much of an annoyance.  I think that it should make
the testsuite a tiny bit more robust against other bugs of the same
class.

Regtested in & out of tree, only with native target.

gdb/testsuite/ChangeLog:

* Makefile.in (abs_srcdir): Assign @abs_srcdir@.
(site.exp): Assign abs_srcdir to tcl's srcdir.

8 years agoremote.c: Cleanup unused variables
Simon Marchi [Mon, 8 Feb 2016 17:57:08 +0000 (12:57 -0500)]
remote.c: Cleanup unused variables

I built remote.c with -Wunused, to check a function I was working on,
turns out there is a bunch of unused variables.

gdb/ChangeLog:

* remote.c (remote_register_number_and_offset): Remove unused
variable(s).
(remote_thread_always_alive): Likewise.
(remote_update_thread_list): Likewise.
(process_initial_stop_replies): Likewise.
(remote_start_remote): Likewise.
(remote_check_symbols): Likewise.
(discard_pending_stop_replies): Likewise.
(process_stop_reply): Likewise.
(putpkt_binary): Likewise.
(getpkt): Likewise.
(remote_add_target_side_condition): Likewise.
(remote_insert_breakpoint): Likewise.
(remote_supports_stopped_by_sw_breakpoint): Likewise.
(remote_supports_stopped_by_hw_breakpoint): Likewise.
(remote_xfer_partial): Likewise.
(remote_read_btrace): Likewise.
(remote_async_serial_handler): Likewise.
(remote_thread_events): Likewise.
(_initialize_remote): Likewise.

8 years agoFIx formatting that triggers a new compile time warning message.
Nick Clifton [Mon, 8 Feb 2016 14:51:10 +0000 (14:51 +0000)]
FIx formatting that triggers a new compile time warning message.

* config/tc-ia64.c (dot_prologue): Fix formatting.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Feb 2016 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd additional information to relocation overflow errors.
Cary Coutant [Sun, 7 Feb 2016 18:17:01 +0000 (10:17 -0800)]
Add additional information to relocation overflow errors.

gold/
PR gold/18695
* x86_64.cc (Target_x86_64::Relocate::relocate): Add additional
information to relocation overflow errors.

8 years agoFix incorrect x32 overflow checking for refs to weak undef symbols.
Cary Coutant [Sun, 7 Feb 2016 06:42:16 +0000 (22:42 -0800)]
Fix incorrect x32 overflow checking for refs to weak undef symbols.

On x32, a pc-relative reference to an undef weak symbol (value 0)
with a negative addend (typically -4) generates a spurious overflow
error because Symbol_value::value() returns a 32-bit negative number
as an unsigned number, which gets zero-extended before subtracting
the PC value. This patch fixes the problem by special-casing the
negative addend, and adding it to the value after widening it to
64 bits. Symbol_value::value() does not need the addend if it's
negative, since it is only important when processing section
symbols for merge sections, where a positive addend provides the
input section offset of the merged constant.

gold/
* x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32
overflow checking when symbol value + addend < 0.

8 years agovarobj: Cleanup dead code
Simon Marchi [Sun, 7 Feb 2016 14:45:02 +0000 (09:45 -0500)]
varobj: Cleanup dead code

This patch removes some dead code.

I noticed that varobj_delete was always called with dellist == NULL, so
I started removing that parameter.  That allows removing a good chunk of
the code in varobj_delete, making it almost trivial.  We can also remove
the resultp parameters in that whole trail.  In turn, this shows that
struct cpstack, cppush and cppop were only used fo that mechanism, so
they can be removed as well.

I also moved the function comment to the header file to comply with
today's guideline, even though the rest of the file does not respect it
(yet).

gdb/ChangeLog:

* varobj.h (varobj_delete): Remove dellist parameter, update and
move documentation here.
* varobj.c (struct cpstack, cppush, cppop): Remove.
(delete_variable): Remove resultp (first) parameter.
(delete_variable_1): Likewise.
(varobj_delete): Remove dellist parameter and unused code.
(update_dynamic_varobj_children): Adjust varobj_delete call.
(update_type_if_necessary): Likewise.
(varobj_set_visualizer): Likewise.
(varobj_update): Likewise.
(value_of_root): Likewise.
(varobj_invalidate_iter): Likewise.
* mi/mi-cmd-var.c (mi_cmd_var_delete): Likewise.

8 years agoFix compile errors about shift counts too large.
Cary Coutant [Sun, 7 Feb 2016 02:18:51 +0000 (18:18 -0800)]
Fix compile errors about shift counts too large.

In order to get around the optimizer and newer compiler warnings
about shift counts, the overflow checking code had resorted to
some messy shifting, and with the never-before-seen instantiations
of the template functions, we were still running afoul of the
compiler checks.

This patch replaces those messy shift sequences with a simple
class template that provides the min and max limits for any
bit size up to 64, with a specialization for 64 that prevents
the compiler from complaining.

gold/
PR gold/19577
* reloc.h (Limits): New class.
(Bits::has_overflow32): Use min/max values from Limits.
(Bits::has_unsigned_overflow32): Likewise.
(Bits::has_signed_unsigned_overflow32): Likewise.
(Bits::has_overflow): Likewise.
(Bits::has_unsigned_overflow): Likewise.
(Bits::has_signed_unsigned_overflow64): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Feb 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix overflow checking for 32-bit pc-relative relocations on x32.
Cary Coutant [Sat, 6 Feb 2016 22:47:05 +0000 (14:47 -0800)]
Fix overflow checking for 32-bit pc-relative relocations on x32.

The problem here is that x32 is really using 64-bit addressing,
while pretending to be 32-bit. Even though the object file format
is 32-bit, we need to do the overflow checking with 64-bit
arithmetic (because that's what the hardware will be using).
This patch overrides the pcrela32_check functions in reloc.h
with target-specific versions that do 64-bit checking.

I've also updated the test case to use -Tdata instead of adding
a huge .space directive, to reduce the size of the .o files.

gold/
PR gold/19567
* reloc.h (Relocate_functions::Overflow_check): Add comments.
* x86_64.cc (X86_64_relocate_functions): New class.
(Target_x86_64::Relocate::relocate): Use the new class.
* testsuite/Makefile.am (x86_64_overflow_pc32): Add -Tdata option.
(x32_overflow_pc32): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/x32_overflow_pc32.sh: New script.
* testsuite/x86_64_overflow_pc32.s: Remove .space directive.

8 years agoFix incorrect casts.
Cary Coutant [Sat, 6 Feb 2016 18:28:36 +0000 (10:28 -0800)]
Fix incorrect casts.

gold/
PR gold/19577
* reloc.h (Bits::has_unsigned_overflow32): Fix static_cast.
(Bits::has_unsigned_overflow): Remove unnecessary static_cast.

8 years agoAdd PR number to ChangeLog entry.
Cary Coutant [Sat, 6 Feb 2016 17:55:40 +0000 (09:55 -0800)]
Add PR number to ChangeLog entry.

8 years agoFix build failure in gold due to signed vs. unsigned comparisons.
Cary Coutant [Sat, 6 Feb 2016 17:53:58 +0000 (09:53 -0800)]
Fix build failure in gold due to signed vs. unsigned comparisons.

* reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
comparison.
(Bits::has_unsigned_overflow): Likewise.

8 years agosim: mips: fix prog_bfd usage
Mike Frysinger [Sat, 6 Feb 2016 01:16:41 +0000 (20:16 -0500)]
sim: mips: fix prog_bfd usage

We do not want to reference the "base" member directly.  We have the
STATE_PROG_BFD macro instead to look up the prog_bfd member.

8 years agogold: Add view and view_size parameters to is_call_to_non_split.
Marcin Kościelnicki [Sat, 6 Feb 2016 00:52:00 +0000 (01:52 +0100)]
gold: Add view and view_size parameters to is_call_to_non_split.

This is needed by s390 split-stack support, to distinguish call
and load-address relocations.

gold/ChangeLog:

* i386.cc (Target_i386::is_call_to_non_split): Add view and view_size
parameters.
* reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Pass view
and view_size to is_call_to_non_split.
* target.cc (Target::is_call_to_non_split): Add view and view_size
parameters.
* target.h (class Target): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Feb 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years ago2016-02-05 Sriraman Tallam <tmsriram@google.com>
Sriraman Tallam [Fri, 5 Feb 2016 23:07:45 +0000 (15:07 -0800)]
2016-02-05  Sriraman Tallam  <tmsriram@google.com>

* icf.cc (get_rel_addend): New function.
(get_section_contents):  Move merge section addend computation to a
new function.  Ignore negative values for SHT_REL and SHT_RELA addends.
Fix bug to not read past the length of the section.

Fix bug related to addend computation for MERGE sections.

8 years agoAdd some relocation overflow checks for x86_64.
Cary Coutant [Fri, 5 Feb 2016 17:19:47 +0000 (09:19 -0800)]
Add some relocation overflow checks for x86_64.

2016-02-05  Cary Coutant  <ccoutant@gmail.com>
    Andrew Senkevich  <andrew.senkevich@intel.com>

gold/
PR gold/18695
* x86_64.cc (Target_x86_64::Relocate::relocate): Add overflow
checking for R_X86_64_32, R_X86_64_32S, R_X86_64_PC32, and
R_X86_64_PLT32.
* testsuite/Makefile.am (x86_64_overflow_pc32): New test.
* testsuite/x86_64_overflow_pc32.sh: New test script.
* testsuite/x86_64_overflow_pc32.s: New source file.