binutils-gdb.git
8 years agoFix a seg-fault in the linker when it encounters a corrupt binary containing a reloc...
Nick Clifton [Fri, 19 Feb 2016 15:20:30 +0000 (15:20 +0000)]
Fix a seg-fault in the linker when it encounters a corrupt binary containing a reloc with no associated symbol.

PR ld/19628
* reloc.c (bfd_generic_get_relocated_section_contents): Stop
processing if we encounter a reloc without an associated symbol.

8 years ago[ARM] Add FP16 feature extension for ARMv8.2 architecture
Jiong Wang [Fri, 19 Feb 2016 14:27:23 +0000 (14:27 +0000)]
[ARM] Add FP16 feature extension for ARMv8.2 architecture

include/
  * opcode/arm.h (ARM_EXT2_FP16_INSN): New.

gas/
  * config/tc-arm.c (arm_ext_fp16): New.
  (arm_extensions): New entry for "fp16".

8 years agoPrevent seg-fault in gas reading a binary input file.
Nick Clifton [Fri, 19 Feb 2016 13:19:57 +0000 (13:19 +0000)]
Prevent seg-fault in gas reading a binary input file.

PR 19630
* read.c (read_a_source_file): Check for assemble_one returning
with input_line_pointer set to NULL.

8 years agoChange the return type of the rebuffer_line function to void.
Trevor Saunders [Fri, 19 Feb 2016 12:13:08 +0000 (12:13 +0000)]
Change the return type of the rebuffer_line function to void.

* listing.c (rebuffer_line): Change return type to void.

8 years agoAdd const to various variables in the gas sources.
Trevor Saunders [Fri, 19 Feb 2016 12:03:08 +0000 (12:03 +0000)]
Add const to various variables in the gas sources.

* symbols.c (decode_local_label_name): Make type a const char *.
* listing.c (print_source): Make type of p const char *.
(print_line): Make type of string const char *.
(buffer_line): Return const char *.
(title): Make type const char *.
(subtitle): Likewise.
(listing_listing): Make type of p const char *.
* messages.c (as_internal_value_out_of_range): Make type of prefix
const char *.
* stabs.c (s_stab_generic): make type of stab_secname, stabstr_secname
and string const char *.
* read.c (_bfd_rel): Make type of name const char *.
* app.c (out_string): Change type to const char *.
        (struct app_save::out_string): Likewise.

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

8 years agoAdd D support to gdb_default_target_compile.
Iain Buclaw [Thu, 18 Feb 2016 21:01:44 +0000 (22:01 +0100)]
Add D support to gdb_default_target_compile.

gdb/testsuite/ChangeLog:

* lib/future.exp: Add D support.
(gdb_find_gdc): New proc.
(gdb_default_target_compile): Add D support.

8 years agoDetermine the iteration count based on wallclock instead of user+system time.
Wei-cheng Wang [Thu, 20 Aug 2015 17:32:18 +0000 (01:32 +0800)]
Determine the iteration count based on wallclock instead of user+system time.

gdb/testsuite/ChangeLog:

2016-02-18  Wei-cheng Wang  <cole945@gmail.com>

* gdb.trace/tspeed.c (myclock): Return wallclock instead of
user+system time.
(trace_speed_test): Determine the iteration count for a time
between 15..30 seconds.

8 years agogdb/s390: Fill guess_tracepoint_registers hook.
Marcin Kościelnicki [Sat, 23 Jan 2016 22:53:41 +0000 (23:53 +0100)]
gdb/s390: Fill guess_tracepoint_registers hook.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_guess_tracepoint_registers): New function.
(s390_gdbarch_init): Fill guess_tracepoint_registers hook.

8 years agoIntel MPX bound violation handling
Walfred Tedeschi [Thu, 18 Feb 2016 16:24:59 +0000 (17:24 +0100)]
Intel MPX bound violation handling

With Intel Memory Protection Extensions it was introduced the concept of
boundary violation.  A boundary violations is presented to the inferior as
a segmentation fault having SIGCODE 3.  This patch adds a
handler for a boundary violation extending the information displayed
when a bound violation is presented to the inferior.  In the stop mode
case the debugger will also display the kind of violation: "upper" or
"lower", bounds and the address accessed.
On no stop mode the information will still remain unchanged.  Additional
information about bound violations are not meaningful in that case user
does not know the line in which violation occurred as well.

When the segmentation fault handler is stop mode the out puts will be
changed as exemplified below.

The usual output of a segfault is:
Program received signal SIGSEGV, Segmentation fault
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68        value = *(p + len);

In case it is a bound violation it will be presented as:
Program received signal SIGSEGV, Segmentation fault
Upper bound violation while accessing address 0x7fffffffc3b3
Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
0x0000000000400d7c in upper (p=0x603010, a=0x603030, b=0x603050,
c=0x603070, d=0x603090, len=7) at i386-mpx-sigsegv.c:68
68        value = *(p + len);

In mi mode the output of a segfault is:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault", frame={addr="0x0000000000400d7c",
func="upper",args=[{name="p", value="0x603010"},{name="a",value="0x603030"}
,{name="b",value="0x603050"}, {name="c",value="0x603070"},
{name="d",value="0x603090"},{name="len",value="7"}],
file="i386-mpx-sigsegv.c",fullname="i386-mpx-sigsegv.c",line="68"},
thread-id="1",stopped-threads="all",core="6"

in the case of a bound violation:
*stopped,reason="signal-received",signal-name="SIGSEGV",
signal-meaning="Segmentation fault",
sigcode-meaning="Upper bound violation",
lower-bound="0x603010",upper-bound="0x603023",bound-access="0x60302f",
frame={addr="0x0000000000400d7c",func="upper",args=[{name="p",
value="0x603010"},{name="a",value="0x603030"},{name="b",value="0x603050"},
{name="c",value="0x603070"},{name="d",value="0x603090"},
{name="len",value="7"}],file="i386-mpx-sigsegv.c",
fullname="i386-mpx-sigsegv.c",line="68"},thread-id="1",
stopped-threads="all",core="6"

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

gdb/ChangeLog:

* NEWS: Add entry for bound violation.
* amd64-linux-tdep.c (amd64_linux_init_abi_common):
Add handler for segmentation fault.
* gdbarch.sh (handle_segmentation_fault): New.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): New.
(SIG_CODE_BONDARY_FAULT): New define.
(i386_linux_init_abi): Use i386_mpx_bound_violation_handler.
* i386-linux-tdep.h (i386_linux_handle_segmentation_fault) New.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* i386-tdep.c (i386_mpx_enabled): Add as external.
* infrun.c (handle_segmentation_fault): New function.
(print_signal_received_reason): Use handle_segmentation_fault.

gdb/testsuite/ChangeLog:

* gdb.arch/i386-mpx-sigsegv.c: New file.
* gdb.arch/i386-mpx-sigsegv.exp: New file.
* gdb.arch/i386-mpx-simple_segv.c: New file.
* gdb.arch/i386-mpx-simple_segv.exp: New file.

gdb/doc/ChangeLog:

* gdb.texinfo (Signals): Add bound violation display hints for
a SIGSEGV.

8 years agogdb: Add guess_tracepoint_registers hook to gdbarch.
Marcin Kościelnicki [Thu, 18 Feb 2016 08:21:38 +0000 (09:21 +0100)]
gdb: Add guess_tracepoint_registers hook to gdbarch.

When we're looking at a tracefile trace frame where registers are not
available, and the tracepoint has only one location, we supply
the location's address as the PC register.  However, this only works
if PC is not a pseudo register, and individual architectures may want
to guess more registers.  Add a gdbarch hook that will handle that.

gdb/ChangeLog:

* arch-utils.c (default_guess_tracepoint_registers): New function.
* arch-utils.h (default_guess_tracepoint_registers): New prototype.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh: Add guess_tracepoint_registers hook.
* tracefile.c (tracefile_fetch_registers): Use the new gdbarch hook.

8 years agoEnable PR ld/19617 tests only for Linux/GNU/Solaris
H.J. Lu [Thu, 18 Feb 2016 15:48:57 +0000 (07:48 -0800)]
Enable PR ld/19617 tests only for Linux/GNU/Solaris

Since PR ld/19617 tests require share library support, enable them
only for Linux/GNU/Solaris targets.

* testsuite/ld-elf/pr19617a.d: Enable only for *-*-linux*,
*-*-gnu* and *-*-solaris*.
* testsuite/ld-elf/pr19617b.d: Likewise.
* testsuite/ld-elf/pr19617c.d: Likewise.

8 years agoRemove setup_kfail server/13796 in disp-step-syscall.exp
Yao Qi [Thu, 18 Feb 2016 13:02:12 +0000 (13:02 +0000)]
Remove setup_kfail server/13796 in disp-step-syscall.exp

This patch series add fork support in target remote,

  [PATCH v2 0/3] Target remote mode fork and exec support
  https://sourceware.org/ml/gdb-patches/2015-12/msg00144.html

so GDB can be informed about the child, and adjust child correctly in
displaced stepping.  The PR server/13796 was fixed by this patch
series actually.  Test results on buildbot show this KFAIL->KPASS
change https://sourceware.org/ml/gdb-testers/2015-q4/msg10128.html

gdb/testsuite:

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

* gdb.base/disp-step-syscall.exp (disp_step_cross_syscall):
Don't call setup_kfail.

8 years agoSet breakpoint condition-evaluation in forking-threads-plus-breakpoint.exp
Yao Qi [Thu, 18 Feb 2016 12:04:32 +0000 (12:04 +0000)]
Set breakpoint condition-evaluation in forking-threads-plus-breakpoint.exp

Proc do_test in forking-threads-plus-breakpoint.exp has an argument
cond_bp_target, but the test doesn't use it to set
"breakpoint condition-evaluation", which is an oversight in the test.

This patch fixes it by setting "breakpoint condition-evaluation" per
$cond_bp_target.

gdb/testsuite:

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

* gdb.threads/forking-threads-plus-breakpoint.exp (do_test):
Set "set breakpoint condition-evaluation" per $cond_bp_target.

8 years agoAlways create dynamic sections for -E/--dynamic-list
H.J. Lu [Thu, 18 Feb 2016 11:13:19 +0000 (03:13 -0800)]
Always create dynamic sections for -E/--dynamic-list

In embedded environments, including boot loaders, the non-PIC executable
needs to export its symbols to modules loaded in the future.  We should
always create dynamic sections for -E/--dynamic-list.

bfd/

PR ld/19617
* elflink.c (elf_link_add_object_symbols): Always create dynamic
sections for -E/--dynamic-list.

ld/

PR ld/19617
* testsuite/ld-elf/pr19617.s: New file.
* testsuite/ld-elf/pr19617a.d: Likewise.
* testsuite/ld-elf/pr19617b.d: Likewise.
* testsuite/ld-elf/pr19617c.d: Likewise.

8 years agoFix computation of CXX_FOR_TARGET so that it can detect an in-tree xg++ executable.
Nick Clifton [Thu, 18 Feb 2016 10:10:36 +0000 (10:10 +0000)]
Fix computation of CXX_FOR_TARGET so that it can detect an in-tree xg++ executable.

* Makefile.am (CXX_FOR_TARGET): Check for the presence of an
in-tree xg++ executable after checking for the presence of an
in-tree g++ executable.
* Makefile.in: Regenerate.

8 years agoAvoid setting or recording negative alignments when the target stores multiple octets...
Dan Gisselquist [Thu, 18 Feb 2016 09:47:31 +0000 (09:47 +0000)]
Avoid setting or recording negative alignments when the target stores multiple octets in a single byte.

gas * read.c (finish_bundle): Avoid recording a negative alignment.
(do_align): Use unsigned values for n, len and max.  Only create
a frag if the alignment requirement is greater than the minimum
byte alignment.  Avoid recording a negative alignment.
(s_align): Use unsigned values where appropriate.
(bss_alloc): Use an unsigned value for the alignment.
(sizeof_sleb128): Add a comment noting that we encode one octet
per byte, regardless of the value of OCTETS_PER_BYTE_POWER.
(emit_leb129_expr): Abort if the emitted encoding was longer than
expected.
* read.h (output_leb128): Update prototype.
(sizeof_leb128): Update prototype.
(bss_alloc): Update prototype.
* write.c (record_alignment): Use an unsigned value for the
alignment.  Do not record alignments less than the minimum
alignment for a byte.
* write.h (record_alignment): Update prototype.

8 years agogdb/doc: Add documentation for tfile description section lines.
Marcin Kościelnicki [Wed, 10 Feb 2016 20:09:24 +0000 (21:09 +0100)]
gdb/doc: Add documentation for tfile description section lines.

gdb/doc/ChangeLog:

* gdb.texinfo (Trace File Format): Add documentation for description
section lines.

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

8 years agoUpdate IFUNC tests for x32
H.J. Lu [Wed, 17 Feb 2016 21:05:06 +0000 (13:05 -0800)]
Update IFUNC tests for x32

* testsuite/ld-ifunc/ifunc-1-local-x86.d: Updated.
* testsuite/ld-ifunc/ifunc-1-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-3a-x86.d: Likewise.

8 years agoxtensa: fix .init/.fini literals moving
Max Filippov [Mon, 15 Feb 2016 23:23:28 +0000 (02:23 +0300)]
xtensa: fix .init/.fini literals moving

Despite the documentation and the comment in xtensa_move_literals, in
the presence of --text-section-literals and --auto-litpools literals are
moved from the separate literal sections into .init and .fini, because
the check in the xtensa_move_literals is incorrect.

This moving was broken with introduction of auto litpools: some literals
now may be lost. This happens because literal frags emitted from .init
and .fini are not closed when new .literal_position marks new literal
pool. Then frag_align(2, 0, 0) changes type of the last literal frag to
rs_align. rs_align frags are skipped in the xtensa_move_literals. As a
result fixups against such literals are not moved out of .init.literal/
.fini.literal sections producing the following assembler error:

  test.S: Warning: fixes not all moved from .init.literal
  test.S: Internal error!

Fix check for .init.literal/.fini.literal in the xtensa_move_literals
and don't let it move literals from there in the presence of
--text-section-literals or --auto-litpools.

2016-02-17  Max Filippov  <jcmvbkbc@gmail.com>
gas/
* config/tc-xtensa.c (xtensa_move_literals): Fix check for
.init.literal/.fini.literal section name.
* testsuite/gas/xtensa/all.exp: Add init-fini-literals to the
list of xtensa tests.
* testsuite/gas/xtensa/init-fini-literals.d: New file:
init-fini-literals test result patterns.
* testsuite/gas/xtensa/init-fini-literals.s: New file:
init-fini-literals test.

8 years ago[x86-64] Omit dynamic sections symbols
H.J. Lu [Wed, 17 Feb 2016 19:18:53 +0000 (11:18 -0800)]
[x86-64] Omit dynamic sections symbols

Define elf_backend_omit_section_dynsym to bfd_true for x86-64, similar
to i386, x86-64 doesn't need dynamic sections symbols.

bfd/

* elf64-x86-64.c (elf_backend_omit_section_dynsym): New.  Defined
to bfd_true.

ld/

* testsuite/ld-ifunc/ifunc-1-local-x86.d: Updated.
* testsuite/ld-ifunc/ifunc-1-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-3a-x86.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/load1c-nacl.d: Likewise.
* testsuite/ld-x86-64/load1c.d: Likewise.
* testsuite/ld-x86-64/load1d-nacl.d: Likewise.
* testsuite/ld-x86-64/load1d.d: Likewise.
* testsuite/ld-x86-64/pr14207.d: Likewise.
* testsuite/ld-x86-64/pr19162.d: 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.

8 years agoAdd missing cleanup in exec_file_locate_attach
Gary Benson [Wed, 17 Feb 2016 14:38:36 +0000 (14:38 +0000)]
Add missing cleanup in exec_file_locate_attach

exec_file_locate_attach allocates memory for full_exec_path (using
either exec_file_find, source_full_path_of or xstrdup) but this
memory is never freed.  This commit adds the necessary cleanup.

gdb/ChangeLog:

* exec.c (exec_file_locate_attach): Add missing cleanup.

8 years agoSkip eh-frame-hdr test for arc-elf targets.
Nick Clifton [Wed, 17 Feb 2016 10:20:53 +0000 (10:20 +0000)]
Skip eh-frame-hdr test for arc-elf targets.

ld * testsuite/ld-elf/eh-frame-hdr.d: Skip for ARC ELF targets.

8 years agoUpdate list of known MSP430 MCUs.
Nick Clifton [Wed, 17 Feb 2016 09:55:32 +0000 (09:55 +0000)]
Update list of known MSP430 MCUs.

* config/tc-msp430.c (msp430_mcu_data): Sync with data from TI's
devices.csv file as of March 2016.

8 years agogdbserver/s390: Advertise Z0 packet support.
Marcin Kościelnicki [Tue, 19 Jan 2016 18:37:38 +0000 (19:37 +0100)]
gdbserver/s390: Advertise Z0 packet support.

This is necessary for upcoming tracepoint support - otherwise, setting
a tracepoint and a breakpoint on the same address will fail, since gdbserver
won't know about gdb's breakpoint.

Tested on s390x-ibm-linux-gnu and s390-ibm-linux-gnu, RHEL 7.2.

gdb/gdbserver/ChangeLog:

* linux-s390-low.c (s390_supports_z_point_type): New function.
(struct linux_target_ops): Wire s390_supports_z_point_type in.

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

8 years agoAdd a missing break to readelf.c
H.J. Lu [Tue, 16 Feb 2016 23:03:39 +0000 (15:03 -0800)]
Add a missing break to readelf.c

PR binutils/19647
* readelf.c (get_section_type_name): Add a missing break.

8 years agoWhitespace cleanup for skip testcase.
Doug Evans [Tue, 16 Feb 2016 20:39:16 +0000 (12:39 -0800)]
Whitespace cleanup for skip testcase.

gdb/testsuite/ChangeLog:

* gdb.base/skip.c: Add copyright.  Whitespace cleanup.
* gdb.base/skip1.c: Ditto.
* gdb.base/skip.exp: Whitespace cleanup.

8 years agoPR remote/19496, internal err forking-threads-plus-bkpt
Don Breazeal [Tue, 16 Feb 2016 16:56:06 +0000 (08:56 -0800)]
PR remote/19496, internal err forking-threads-plus-bkpt

This patch fixes an internal error that occurs in
gdb.threads/forking-threads-plus-breakpoint.exp:

/blah/binutils-gdb/gdb/target.c:2723: internal-error: Can't determine the
current address space of thread Thread 3170.3170

In default_thread_address_space, find_inferior_ptid couldn't find 3170.3170
because it had been overwritten in inferior_appeared, called as follows:

inferior_appeared
  remote_add_inferior
    remote_notice_new_inferior
      remote_update_thread_list

The cause of the problem was the following sequence of events:

* GDB knows only about the main thread

* the first fork event is reported to GDB, saved as pending_event

* qXfer:threads:read gets the threads from the remote.
  remove_new_fork_children id's the fork child from the pending event
  and removes it from the list reported to GDB.  All the rest of the
  threads, including the fork parent, are added to the GDB thread list.

* GDB stops all the threads.  All the stop events are pushed onto the
  stop reply queue behind the pending fork event.  The fork waitstatus
  is saved in the fork parent thread's pending status field
  thread_info.suspend.

* remote_wait_ns calls queued_stop_reply and process_stop_reply to
  remove the fork event from the front of the stop reply queue and save
  event information in the thread_info structure for the fork parent
  thread.  Unfortunately, none of the information saved in this way is
  the fork-specific information.

* A subsequent qXfer:threads:read packet gets the thread list including
  the fork parent and fork child.  remove_new_fork_children checks the
  thread list to see if there is a fork parent, doesn't find one, checks
  the stop reply queue for a pending fork event, doesn't find one, and
  allows the fork child thread to be reported to GDB before the fork
  event has been handled.  remote_update_thread_list calls
  remote_notice_new_thread and overwrites the current (main) thread in
  inferior_appeared.

So the fork event has been reported out of target_wait but it was left
pending on the infrun side (infrun.c:save_waitstatus).  IOW, the fork
event hasn't been processed by handle_inferior_event yet, so it hasn't
made it to tp->pending_follow yet.

The fix is to check thread_info.suspend along with the
thread_info.pending_follow in remote.c:remove_new_fork_children, to
prevent premature reporting of the fork child thread creation.

gdb/ChangeLog:

PR remote/19496
* remote.c (remove_new_fork_children): Check for pending
fork status in thread_info.suspend.

gdb/testsuite/ChangeLog:

PR remote/19496
* gdb.threads/forking-threads-plus-breakpoint.exp (do_test):
Remove kfail for PR remote/19496.

8 years ago[ARC] Enable .cfi_* pseudo-ops.
Claudiu Zissulescu [Tue, 16 Feb 2016 14:56:04 +0000 (15:56 +0100)]
[ARC] Enable .cfi_* pseudo-ops.

gas/
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (tc_arc_frame_initial_instructions): New
function.
(tc_arc_regname_to_dw2regnum): Likewise.
* config/tc-arc.h (TARGET_USE_CFIPOP): Define
(tc_cfi_frame_initial_instructions): Likewise.
(tc_regname_to_dw2regnum): Likewise.

gas/testsuite
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* gas/cfi/cfi-arc-1.d: New file.
* gas/cfi/cfi-arc-1.s: Likewise.
* gas/cfi/cfi.exp: Allow running tests for arc.

binutils/
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* readelf.c (is_32bit_pcrel_reloc): Add R_ARC_32_PCREL.

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.