binutils-gdb.git
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.

8 years agoOverhaul relocation framework to support overflow checking.
Cary Coutant [Fri, 5 Feb 2016 16:27:13 +0000 (08:27 -0800)]
Overhaul relocation framework to support overflow checking.

gold/
PR gold/18695
* reloc.h (Relocate_functions::Address): New typedef.
(Relocate_functions::Addendtype): New typedef.
(Relocate_functions::Overflow_check): New enum type.
(Relocate_functions::Reloc_status): New enum type.
(Relocate_functions::check_overflow): New function template.
(Relocate_functions::rel): Add check parameter; check for overflow.
(Relocate_functions::rel_unaligned): Likewise.
(Relocate_functions::rela): Likewise.
(Relocate_functions::pcrel): Likewise.
(Relocate_functions::pcrel_unaligned): Likewise.
(Relocate_functions::pcrela): Likewise.
(Relocate_functions::rel8): Adjust parameter types.
(Relocate_functions::rela8): Likewise.
(Relocate_functions::pcrel8): Likewise.
(Relocate_functions::pcrela8): Likewise.
(Relocate_functions::rel16): Likewise.
(Relocate_functions::rela168): Likewise.
(Relocate_functions::pcrel16): Likewise.
(Relocate_functions::pcrela16): Likewise.
(Relocate_functions::rel32): Likewise.
(Relocate_functions::rel32_unaligned): Likewise.
(Relocate_functions::rela32): Likewise.
(Relocate_functions::pcrel32): Likewise.
(Relocate_functions::pcrel32_unaligned): Likewise.
(Relocate_functions::pcrela32): Likewise.
(Relocate_functions::rel8_check): New function.
(Relocate_functions::rela8_check): New function.
(Relocate_functions::pcrel8_check): New function.
(Relocate_functions::pcrela8_check): New function.
(Relocate_functions::rel16_check): New function.
(Relocate_functions::rela168_check): New function.
(Relocate_functions::pcrel16_check): New function.
(Relocate_functions::pcrela16_check): New function.
(Relocate_functions::rel32_check): New function.
(Relocate_functions::rel32_unaligned_check): New function.
(Relocate_functions::rela32_check): New function.
(Relocate_functions::pcrel32_check): New function.
(Relocate_functions::pcrel32_unaligned_check): New function.
(Relocate_functions::pcrela32_check): New function.
(Bits::has_unsigned_overflow32): New function.
(Bits::has_unsigned_overflow): New function.
* testsuite/Makefile.am (overflow_unittest): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/overflow_unittest.cc: New source file.

8 years agoFix formatting of pe-mips.c file.
Simon Marchi [Fri, 5 Feb 2016 10:15:26 +0000 (10:15 +0000)]
Fix formatting of pe-mips.c file.

* pe-mips.c (coff_mips_reloc): Fix formatting.

8 years agoChange the default architecture value for ARC bfds so that they have the lowest possi...
Cupertino Miranda [Fri, 5 Feb 2016 09:58:01 +0000 (09:58 +0000)]
Change the default architecture value for ARC bfds so that they have the lowest possible value, and hence can be merged with other ARC binaries wihtout changing their architecture value.

bfd * cpu-arc.c: Change default archure from bfd_mach_arc_arcv2
to bfd_mach_arc_arc600.

binutils * testsuite/binutils-all/objdump.exp: Update expected default
architecture value for ARC binaries.

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

8 years agoPrevent possible undefined behaviour computing the size of the scache by usingunsigne...
Nick Clifton [Thu, 4 Feb 2016 16:27:06 +0000 (16:27 +0000)]
Prevent possible undefined behaviour computing the size of the scache by usingunsigned integers instead of signed integers.

* cgen-scache.c (scache_option_handler): Prevent possible
undefined behaviour computing the size of the scache by using
unsigned integers instead of signed integers.

8 years ago[testsuite] Remove BASEDIR
Yao Qi [Thu, 4 Feb 2016 15:46:37 +0000 (15:46 +0000)]
[testsuite] Remove BASEDIR

BASEDIR was added by https://sourceware.org/ml/gdb-patches/2013-10/msg00587.html
in order to handle the different directory layout in serial testing
and parallel testing.  BASEDIR is "gdb.base" in serial testing and is
"outputs/gdb.base/TESTNAME" in parallel testing.  However, it doesn't
work if the GDBserver is in remote target, like this,

$ make check RUNTESTFLAGS='--target_board=remote-gdbserver-on-localhost foll-vfork.exp foll-exec.exp'
FAIL: gdb.base/foll-exec.exp: continue to first exec catchpoint (the program exited)
FAIL: gdb.base/foll-vfork.exp: exec: vfork and exec child follow, to main bp: continue to bp (the program exited)
FAIL: gdb.base/foll-vfork.exp: exec: vfork child follow, finish after tcatch vfork: finish (the program exited)
FAIL: gdb.base/foll-vfork.exp: exec: vfork relations in info inferiors: continue to bp (the program exited)

these tests fail because the executable can't be found.  With target
board native-gdbserver, the program is spawned this way,

 spawn ../gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/foll-vfork

so BASEDIR is correct.  However, with target board
remote-gdbserver-on-localhost, the program is spawned

  spawn /usr/bin/ssh -l yao localhost /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../gdbserver/gdbserver --once :2346 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/foll-vfork

so BASEDIR (either "gdb.base" or "outputs/gdb.base/TESTNAME") makes no
sense.

I had a fix that pass absolute directory to BASEDIR, but it assumes
that directory structure is the same on build and target, and it
doesn't work in remote host case.  The current fix in this patch is
to get the directory from argv[0].  In any case, the program to be
exec'ed is at the same directory with the main program.

Note that these tests do "next N" to let program stop at the desired
line, but it is fragile, because GDB for different targets may skip
function prologue slightly differently, so I replace some of them by
"tbreak on LINE NUMBER and continue".

gdb/testsuite:

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

* gdb.base/foll-exec-mode.c: Include limits.h.
(main): Add parameters argc and argv.  Get directory from
argv[0].
* gdb.base/foll-exec-mode.exp: Don't pass -DBASEDIR in
compilation.
* gdb.base/foll-exec.c: Include limits.h.
(main): Add parameters argc and argv.
Get directory from argv[0].
* gdb.base/foll-exec.exp: Don't pass -DBASEDIR in compilation.
Adjust tests on the number of lines as source code changed.
* gdb.base/foll-vfork-exit.c: Include limits.h.
(main): Add one line of statement before vfork.
* gdb.base/foll-vfork.c: Include limits.h and string.h.
(main): Add parameters argc and argv.  Get directory from
argv[0].
* gdb.base/foll-vfork.exp: Don't pass -DBASEDIR in compilation.
(setup_gdb): Set tbreak to skip some source lines.
* gdb.multi/bkpt-multi-exec.c: Include limits.h.
(main): Add parameters argc and argv.  Get directory from
argv[0].
* gdb.multi/bkpt-multi-exec.exp: Don't pass -DBASEDIR in
compilation.
* gdb.multi/multi-arch-exec.c: Include limits.h and string.h.
(main): Add parameters argc and argv.  Get directory from
argv[0].
* gdb.multi/multi-arch-exec.exp: Don't pass -DBASEDIR in
compilation.

8 years agowaiting_for_stop_reply around remote_fileio_request
Yao Qi [Thu, 4 Feb 2016 15:09:09 +0000 (15:09 +0000)]
waiting_for_stop_reply around remote_fileio_request

Hi,
I see this error when GDB connects with qemu,

(gdb) n
....
Sending packet: $vCont;c#a8...Ack
Packet received: Ffstat,00000001,f6fff038
Cannot execute this command while the target is running.
Use the "interrupt" command to stop the target
and then try again.

looks we don't set rs->waiting_for_stop_reply to zero
before handle fileio request,

 #10 0x00000000005edb64 in target_write (len=64, offset=4143968312, buf=0x7fffffffd570 "\375\377\377\377", annex=0x0, object=TARGET_OBJECT_MEMORY,
    ops=<optimised out>) at /home/yao/SourceCode/gnu/gdb/git/gdb/target.c:1922
 #11 target_write_memory (memaddr=memaddr@entry=4143968312, myaddr=myaddr@entry=0x7fffffffd6a0 "", len=len@entry=64)
    at /home/yao/SourceCode/gnu/gdb/git/gdb/target.c:1500
 #12 0x00000000004b2b41 in remote_fileio_func_fstat (buf=0x127b258 "") at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:1037
 #13 0x00000000004b1878 in do_remote_fileio_request (uiout=<optimised out>, buf_arg=buf_arg@entry=0x127b240)
    at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:1204
 #14 0x00000000005b8c7c in catch_exceptions_with_msg (func_uiout=<optimised out>, func=func@entry=0x4b1800 <do_remote_fileio_request>,
    func_args=func_args@entry=0x127b240, gdberrmsg=gdberrmsg@entry=0x0, mask=mask@entry=RETURN_MASK_ALL)
    at /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:187
 #15 0x00000000005b8dea in catch_exceptions (uiout=<optimised out>, func=func@entry=0x4b1800 <do_remote_fileio_request>, func_args=func_args@entry=0x127b240,
    mask=mask@entry=RETURN_MASK_ALL) at /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:167
 #16 0x00000000004b2fff in remote_fileio_request (buf=0x127b240 "Xf6fff038,0:", ctrlc_pending_p=0) at /home/yao/SourceCode/gnu/gdb/git/gdb/remote-fileio.c:1255
 #17 0x0000000000496f12 in remote_wait_as (ptid=..., status=0x7fffffffdb20, options=1) at /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:6997

however, we did set rs->waiting_for_stop_reply to zero before Luis's
patch https://sourceware.org/ml/gdb-patches/2015-10/msg00336.html

In fact, Luis's patch v1
https://sourceware.org/ml/gdb-patches/2015-08/msg00809.html is about
setting rs->waiting_for_stop_reply back to one after
remote_fileio_request, which is correct.  However during the review, the
patch is changed and ends up with "not setting rs->waiting_for_stop_reply
to zero".

I manually test GDB, but I don't have a way to run regression tests.

gdb:

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

* remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to
0 before handling 'F' and set it back afterwards.

8 years agoRemove support for creating ARM NOREAD sections.
Nick Clifton [Thu, 4 Feb 2016 11:57:57 +0000 (11:57 +0000)]
Remove support for creating ARM NOREAD sections.

gas * config/obj-elf.c (obj_elf_change_section): Remove support for
ARM NOREAD sections.
* config/tc-arm.c (arm_elf_section_letter): Delete.
* config/tc-arm.h (md_elf_section_letter): Delete.
* doc/c-arm.texi (ARM Section Attribute): Delete section.
* testsuite/gas/arm/section-execute-only.d: Delete.
* testsuite/gas/arm/section-execute-only.s: Delete.

ld * testsuite/ld-arm/arm-elf.exp: Remove ARM NOREAD section tests.
* testsuite/ld-arm/thumb1-input-section-flag-match.d: Delete.
* testsuite/ld-arm/thumb1-input-section-flag-match.s: Delete.
* testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.d: Delete.
* testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.s: Delete.
* testsuite/ld-arm/thumb1-noread-present-one-section.d: Delete.
* testsuite/ld-arm/thumb1-noread-present-one-section.s: Delete.
* testsuite/ld-arm/thumb1-noread-present-two-section.d: Delete.
* testsuite/ld-arm/thumb1-noread-present-two-section.s: Delete.

8 years agoFix the encoding of the MSP430's RRUX instruction.
Nick Clifton [Thu, 4 Feb 2016 09:55:10 +0000 (09:55 +0000)]
Fix the encoding of the MSP430's RRUX instruction.

PR target/19561
opcdoe * msp430-dis.c (print_insn_msp430): Add a special case for
decoding an RRC instruction with the ZC bit set in the extension
word.

include * opcode/msp430.h (IGNORE_CARRY_BIT): New define.
(RRUX): Synthesise using case 2 rather than 7.

gas * config/tc-msp430.c (msp430_operands): Remove case 7.  Use case 2
to handle encoding of RRUX instruction.
* testsuite/gas/msp430/msp430x.s: Add more tests of the extended
shift instructions.
* testsuite/gas/msp430/msp430x.d: Update expected disassembly.

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

8 years agoMAINTAINERS: Add Thiemo Seufer back, as a past maintainer
Maciej W. Rozycki [Wed, 3 Feb 2016 18:24:04 +0000 (18:24 +0000)]
MAINTAINERS: Add Thiemo Seufer back, as a past maintainer

Complement commit 26e0f8dbd817 ("* MAINTAINERS: Remove Thiemo Seufer.").

* MAINTAINERS (Past sim maintainers): Add Thiemo Seufer.

8 years agoxtensa: fix signedness of gas relocations
Max Filippov [Tue, 2 Feb 2016 14:11:38 +0000 (17:11 +0300)]
xtensa: fix signedness of gas relocations

Change 1058c7532d0b "Use signed data type for R_XTENSA_DIFF* relocation
offsets." changed signedness of BFD_RELOC_XTENSA_DIFF* relocations
substituted for BFD_RELOC_*. This made it impossible to encode arbitrary
8-, 16- and 32-bit values, which broke e.g. debug info encoding by .loc
directive. Revert this part and add test.

gas/
2016-02-03  Max Filippov  <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (md_apply_fix): Mark BFD_RELOC_XTENSA_DIFF*
substitutions for BFD_RELOC_* as unsigned.
* gas/testsuite/gas/xtensa/all.exp: Add loc to list of xtensa
tests.
* gas/testsuite/gas/xtensa/loc.d: New file: loc test result
patterns.
* gas/testsuite/gas/xtensa/loc.s: New file: loc test.

8 years agoAdd -mrelax-relocations= to x86 assembler
H.J. Lu [Wed, 3 Feb 2016 16:25:15 +0000 (08:25 -0800)]
Add -mrelax-relocations= to x86 assembler

The x86 relax relocations introduced in binutils 2.26 aren't supported
by linker on Solaris older than Solaris 12.  To use x86 assembler with
older Solaris linker, this patch adds

1. A command line option -mrelax-relocations= to x86 assembler to
control whether to generate relax relocations.
2. A configure option --enable-x86-relax-relocations to decide whether
x86 assembler should generate relax relocations by default.  It is
defaulted to yes, except for x86 Solaris targets older than Solaris 12.

gas/

PR gas/19520
* NEWS: Mention new command line option -mrelax-relocations and
new configure option --enable-x86-relax-relocations for x86
target.
* config.in: Regenerated.
* configure.ac: Add --enable-x86-relax-relocations.
(ac_default_x86_relax_relocations): New.  Default to 1 except
for x86 Solaris targets older than Solaris 12.
(DEFAULT_GENERATE_X86_RELAX_RELOCATIONS): Define.
* configure: Likewise.
* config/tc-i386.c (generate_relax_relocations): New.
(OPTION_MRELAX_RELOCATIONS): Likewise.
(output_disp): Don't generate relax relocations if
generate_relax_relocations is 0.
(md_longopts): Add -mrelax-relocations.
(md_show_usage): Likewise.
(md_parse_option): Handle OPTION_MRELAX_RELOCATIONS.
* doc/c-i386.texi: Document -mrelax-relocations=.
* testsuite/gas/i386/got-no-relax.d: New file.
* testsuite/gas/i386/x86-64-gotpcrel-no-relax.d: Likewise.
* testsuite/gas/i386/got.d: Pass -mrelax-relocations=yes to as.
* testsuite/gas/i386/localpic.d: Likewise.
* testsuite/gas/i386/mixed-mode-reloc32.d: Likewise.
* testsuite/gas/i386/reloc32.d: Likewise.
* testsuite/gas/i386/x86-64-gotpcrel.d: Likewise.
* testsuite/gas/i386/x86-64-localpic.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-gotpcrel.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-localpic.d: Likewise.
* testsuite/gas/i386/i386.exp: Run got-no-relax and
x86-64-gotpcrel-no-relax.

ld/

PR gas/19520
* testsuite/ld-i386/branch1.d: Pass -mrelax-relocations=yes to as.
* testsuite/ld-i386/call1.d: Likewise.
* testsuite/ld-i386/call2.d: Likewise.
* testsuite/ld-i386/call3a.d: Likewise.
* testsuite/ld-i386/call3b.d: Likewise.
* testsuite/ld-i386/call3c.d: Likewise.
* testsuite/ld-i386/call3d.d: Likewise.
* testsuite/ld-i386/call3e.d: Likewise.
* testsuite/ld-i386/call3f.d: Likewise.
* testsuite/ld-i386/call3g.d: Likewise.
* testsuite/ld-i386/call3h.d: Likewise.
* testsuite/ld-i386/jmp1.d: Likewise.
* testsuite/ld-i386/jmp2.d: Likewise.
* testsuite/ld-i386/lea1c.d: Likewise.
* testsuite/ld-i386/load1.d: Likewise.
* testsuite/ld-i386/load2.d: Likewise.
* testsuite/ld-i386/load3.d: Likewise.
* testsuite/ld-i386/load4a.d: Likewise.
* testsuite/ld-i386/load5a.d: Likewise.
* testsuite/ld-i386/mov2b.d: Likewise.
* testsuite/ld-i386/mov3.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-x86-64/call1a.d: Likewise.
* testsuite/ld-x86-64/call1b.d: Likewise.
* testsuite/ld-x86-64/call1c.d: Likewise.
* testsuite/ld-x86-64/call1d.d: Likewise.
* testsuite/ld-x86-64/call1e.d: Likewise.
* testsuite/ld-x86-64/call1f.d: Likewise.
* testsuite/ld-x86-64/call1h.d: Likewise.
* testsuite/ld-x86-64/call1i.d: Likewise.
* testsuite/ld-x86-64/load1a.d: Likewise.
* testsuite/ld-x86-64/load1b.d: Likewise.
* testsuite/ld-i386/got1a.S: Load GOT into %ecx and use it.
* testsuite/ld-i386/got1.dd: Updated.
* testsuite/ld-i386/got1d.S (1): Removed.
* testsuite/ld-i386/i386.exp: Add -Wa,-mrelax-relocations=yes.
* testsuite/ld-x86-64/x86-64.exp: Likewise.

8 years agomsp430: Set DWARF2_ADDR_SIZE to 4.
Kevin Buettner [Wed, 27 Jan 2016 19:44:38 +0000 (12:44 -0700)]
msp430: Set DWARF2_ADDR_SIZE to 4.

This change makes gas's notion of the msp430 dwarf2 address size match
that of gcc and gdb.  This is needed so that the format of addresses
generated for DW_LNE_set_address in .debug_line will match the address
size for the compilation unit.

In gcc/config/msp430/msp430.h, it's set to 4:

  #define DWARF2_ADDR_SIZE 4

Likewise in gdb/msp430-tdep.c:

  set_gdbarch_dwarf2_addr_size (gdbarch, 4);

(As far as I can tell, however, GDB doesn't use this value when decoding
.debug_line.  Instead, GDB uses the Pointer Size from the compilation
unit.)

readelf is able to seamlessly handle mismatches between these various
sizes by using the size of the DW_LNE_set_address instruction to
determine the address size.  Another way to fix this problem is to
make GDB behave in a similar manner.  In my opinion, GDB should detect
and inform the user about these mismatches; it's not clear to me if
it's correct for GDB to go ahead and read the address anyway when a
size mismatch is detected.

Without this change, addresses in .debug_line are encoded in two bytes
for some multilibs.  When GDB reads the address for
DW_LNE_set_address, it uses the pointer size provided by the CU.  When
these values don't match, GDB reads the wrong number of bytes.  In the
cases that I've looked at, GDB is reading 4 bytes from a 2 byte
container, which results in a garbage address.  GDB discards lines
which have a bogus address; the end result is that GDB records no line
number information for CUs which have a mismatch between the address
size (from the CU) and the format of the address used by
DW_LNE_set_address.

gas/ChangeLog:

* config/tc-msp430.h (DWARF2_ADDR_SIZE): Set to 4.

8 years agoMention -mfence-as-lock-add=yes for x86 assembler
H.J. Lu [Wed, 3 Feb 2016 14:42:39 +0000 (06:42 -0800)]
Mention -mfence-as-lock-add=yes for x86 assembler

* NEWS: Mention new command line option -mfence-as-lock-add=yes
for x86 target.

8 years agoRemove duplicated marker for 2.26 in gas/NEWS
H.J. Lu [Wed, 3 Feb 2016 14:37:21 +0000 (06:37 -0800)]
Remove duplicated marker for 2.26 in gas/NEWS

* NEWS: Remove duplicated marker for 2.26.

8 years agoFix "PowerPC64 ELFv2 entry code" for big-endian
Alan Modra [Wed, 3 Feb 2016 13:55:56 +0000 (00:25 +1030)]
Fix "PowerPC64 ELFv2 entry code" for big-endian

bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): Adjust last patch
for big-endian.
gold/
* powerpc.cc (relocate): Adjust last patch for big-endian.

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

8 years agoui-out.c: Remove unused enum
Simon Marchi [Tue, 2 Feb 2016 21:39:06 +0000 (16:39 -0500)]
ui-out.c: Remove unused enum

This is unused since 54eb231c4bca046e8b8cd73461f695e02c5620d5, where
static arrays of ui_out_levels were replaced with vectors.

gdb/ChangeLog:

* ui-out.c (MAX_UI_OUT_LEVELS): Remove.

8 years agoFix typos in bfd/ChangeLog and bfd/elf64-x86-64.c
H.J. Lu [Tue, 2 Feb 2016 21:08:58 +0000 (13:08 -0800)]
Fix typos in bfd/ChangeLog and bfd/elf64-x86-64.c

8 years agoStore estimated istrances in compressed_size
H.J. Lu [Tue, 2 Feb 2016 16:14:43 +0000 (08:14 -0800)]
Store estimated istrances in compressed_size

elf_x86_64_convert_load is very time consuming since it is called on
each input section and has a loop over input text sections to estimate
the branch distrance.  We can store the estimated distrances in the
compressed_size field of the output section, which is only used to
decompress the compressed input section.

Before the patch, linking clang 3.9 takes 52 seconds.  After the patch,
it only takes 2.5 seconds.

PR ld/19542
* elf64-x86-64.c (elf_x86_64_convert_load): Store the estimated
distrances in the compressed_size field of the output section.

8 years ago[GAS][ARM]Skip none elf target for testsuite/gas/arm/thumb2_it_search.s
Renlin Li [Tue, 2 Feb 2016 15:52:42 +0000 (15:52 +0000)]
[GAS][ARM]Skip none elf target for testsuite/gas/arm/thumb2_it_search.s

gas/

* testsuite/gas/arm/thumb2_it_search.d: Skip non-elf targets.

8 years agoAdd a testcase for PR ld/18591
H.J. Lu [Tue, 2 Feb 2016 14:36:52 +0000 (06:36 -0800)]
Add a testcase for PR ld/18591

PR ld/18591
* testsuite/ld-x86-64/pr18591.d: New file.
* testsuite/ld-x86-64/pr18591.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr18591.

8 years agoPowerPC64 ELFv2 entry code
Alan Modra [Tue, 2 Feb 2016 12:46:14 +0000 (23:16 +1030)]
PowerPC64 ELFv2 entry code

This tightens the condition under which ld optimizes PIC entry code
to non-PIC.

bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): Further restrict
ELFv2 entry optimization.
gold/
* powerpc.cc (relocate): Further restrict ELFv2 entry optimization.

8 years agoClear HAS_RELOC if there are no relocations
H.J. Lu [Tue, 2 Feb 2016 11:30:21 +0000 (03:30 -0800)]
Clear HAS_RELOC if there are no relocations

The HAS_RELOC bit should be cleared when relocations are removed from
relocatable files.

bfd/

PR binutils/19547
* elf.c (assign_section_numbers): Clear HAS_RELOC if there are
no relocations in relocatable files.

binutils/

PR binutils/19547
* testsuite/binutils-all/objcopy.exp
(objcopy_test_without_global_symbol): New proc.
Run objcopy_test_without_global_symbol.
* testsuite/binutils-all/pr19547.c: New file.

8 years agoopcodes/cgen: Rework calculation of shift when inserting fields
Andrew Burgess [Sun, 31 Jan 2016 00:41:12 +0000 (00:41 +0000)]
opcodes/cgen: Rework calculation of shift when inserting fields

The calculation of the shift amount, used to insert fields into the
instruction buffer, is not correct when the following conditions are all
true:
  - CGEN_INT_INSN_P is defined, and true.
  - CGEN_INSN_LSB0_P is true
  - Total instruction length is greater than the length of a single
    instruction word (the instruction is made of multiple words)
  - The word offset is non-zero (the field is outside the first word)

When the above conditions are all true, the calculated shift fails to
take account of the total instruction length.

After this commit the calculation of the shift amount is split into two
parts, first we calculate the shift required to get to BIT0 of the word
in which the field lives, then we calculate the shift required to place
the field within the instruction word.

The change in this commit only effects the CGEN_INT_INSN_P defined true
case, but changes the code for both CGEN_INSN_LSB0_P true, and false.

In the case of CGEN_INSN_LSB0_P being false, the code used to say:

shift = total_length - (word_offset + start + length);

Now it says:

shift_to_word = total_length - (word_offset + word_length);
shift_within_word = word_length - start - length;
shift = shift_to_word + shift_within_word;

From which we can see that in all cases the computed shift value should
be unchanged.

In the case of CGEN_INSN_LSB0_P being true, the code used to say:

shift = (word_offset + start + 1) - length;

Now it says:

shift_to_word = total_length - (word_offset + word_length);
shift_within_word = start + 1 - length;
shift = shift_to_word + shift_within_word;

In the case where 'total_length == word_length' AND 'word_offset ==
0' (which indicates an instruction of a single word), we see that the
computed shift value will be unchanged.  However, when the total_length
and word_length are different, and the word_offset is non-zero then the
computed shift value will be different (and correct).

opcodes/ChangeLog:

* cgen-ibld.in (insert_normal): Rework calculation of shift.
* epiphany-ibld.c: Regenerate.
* fr30-ibld.c: Regenerate.
* frv-ibld.c: Regenerate.
* ip2k-ibld.c: Regenerate.
* iq2000-ibld.c: Regenerate.
* lm32-ibld.c: Regenerate.
* m32c-ibld.c: Regenerate.
* m32r-ibld.c: Regenerate.
* mep-ibld.c: Regenerate.
* mt-ibld.c: Regenerate.
* or1k-ibld.c: Regenerate.
* xc16x-ibld.c: Regenerate.
* xstormy16-ibld.c: Regenerate.

8 years agogas/ip2k: Add all instructions assembler test
Andrew Burgess [Mon, 1 Feb 2016 16:31:35 +0000 (16:31 +0000)]
gas/ip2k: Add all instructions assembler test

Basic all instructions assembler test, auto-generated by CGEN, then
fixed by hand for some cases where CGEN had generated invalid
instruction operands.

gas/ChangeLog:

* testsuite/gas/ip2k/allinsn.d: New file.
* testsuite/gas/ip2k/allinsn.s: New file.
* testsuite/gas/ip2k/ip2k-allinsn.exp: New file.

8 years agoepiphany/gas: Update expected test results for 0 offset loads
Andrew Burgess [Mon, 1 Feb 2016 20:21:19 +0000 (20:21 +0000)]
epiphany/gas: Update expected test results for 0 offset loads

In commit 02a79b89fdeadccb67048291e6c2a1e5ce6ad623 some of the load
instructions with a zero offset (where the offset is not mentioned) were
marked as NO-DIS, meaning that the disassembler must display the offset,
even though it is zero.

This change seems a little strange to me as it was only applied to some
loads, not all, and the same change was not applied to the stores.

However, I'm reluctant to revert a specific change to the assembler,
when the output is obviously correct.  With this commit then I simply
bring the expected assembler test results into line with what is
actually produced.

gas/ChangeLog:

* testsuite/gas/epiphany/addr-syntax.d: Add explicit 0 offset to
some load instructions.
* testsuite/gas/epiphany/allinsn.d: Likewise.
* testsuite/gas/epiphany/regression.d: Likewise.

8 years agoepiphany/gas: Remove .l suffix from expected test results
Andrew Burgess [Mon, 1 Feb 2016 20:01:52 +0000 (20:01 +0000)]
epiphany/gas: Remove .l suffix from expected test results

In commit 02a79b89fdeadccb67048291e6c2a1e5ce6ad623 all instruction
aliases that have a '.l' suffix were marked as NO-DIS, so the
disassembler will not display them, in preference to the instruction
without the suffix.  However, the gas testsuite was not updated at the
time, this commit fixes that oversight.

gas/ChangeLog:

* testsuite/gas/epiphany/addr-syntax.d: Remove unneeded '.l'
suffixes from instruction mnemonics in expected output.
* testsuite/gas/epiphany/allinsn.d: Likewise.
* testsuite/gas/epiphany/regression.d: Likewise.
* testsuite/gas/epiphany/sample.d: Likewise.

8 years agogas/epiphany: Update expected register names in tests
Andrew Burgess [Mon, 1 Feb 2016 19:20:25 +0000 (19:20 +0000)]
gas/epiphany: Update expected register names in tests

In commit 02a79b89fdeadccb67048291e6c2a1e5ce6ad623 the register aliases
sb, sl, and ip were made less preferred than r9, r10, and r12, however,
the expected test results were not updated.  This commit fixes this
oversight and updates the test results.

gas/ChangeLog:

* testsuite/gas/epiphany/addr-syntax.d: Update expected register
names.
* testsuite/gas/epiphany/allinsn.d: Likewise.
* testsuite/gas/epiphany/sample.d: Likewise.

8 years agoepiphany/disassembler: Improve alignment of output.
Andrew Burgess [Mon, 1 Feb 2016 18:21:37 +0000 (18:21 +0000)]
epiphany/disassembler: Improve alignment of output.

Always set the bytes_per_line field (of struct disassemble_info) to the
same constant value, this is inline with the advice contained within
include/dis-asm.h.

Setting this field to a constant value will cause the disassembler
output to be better aligned.

cpu/ChangeLog:

* epiphany.opc (epiphany_print_insn): Set info->bytes_per_line to
a constant to better align disassembler output.

opcodes/ChangeLog:

* epiphany-dis.c: Regenerated from latest cpu files.

gas/ChangeLog:

* testsuite/gas/epiphany/sample.d: Update expected output.

8 years agoAdaptation of siginfo fixup for the new bnd fields
Walfred Tedeschi [Tue, 2 Feb 2016 11:02:16 +0000 (12:02 +0100)]
Adaptation of siginfo fixup for the new bnd fields

New bnds fields will be always present for x86 architecture.
Fixup for compatibility layer 32bits has to be fixed.

It was added the nat_siginfo to serving as intermediate step
between kernel provided siginfo and the fix up routine.

When executing compat_siginfo_from_siginfo or
compat_x32_siginfo_from_siginfo first the buffer read from the kernel are
converted into the nat_signfo for homogenization, then the fields of
nat_siginfo are use to set the compat and compat_x32 siginfo fields.

In other to make this conversion independent of the system where gdb
is compiled the most complete version of the siginfo, named as native
siginfo, is used internally as an intermediate step.

Conversion using nat_siginfo is exemplified below:

compat_siginfo_from_siginfo or compat_x32_siginfo_from_siginfo:

buffer (from the kernel) -> nat_siginfo -> 32 / X32 siginfo
                      (memcpy)       (field by field)

siginfo_from_compat_x32_siginfo or siginfo_from_compat_siginfo:

32 / X32 siginfo -> nat_siginfo -> buffer (to the kernel)
          (field by field)    (memcpy)

Caveat: No support for MPX on x32.

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

gdb/ChangeLog:

* amd64-linux-siginfo.c (nat_siginfo_t, nat_sigval_t, nat_timeval):
New types.
(compat_siginfo): New bound fields added.
(compat_x32_siginfo): New field added.
(cpt_si_addr_lsb): New define.
(compat_siginfo_from_siginfo): Use nat_siginfo.
(siginfo_from_compat_siginfo): Use nat_siginfo.
(compat_x32_siginfo_from_siginfo): Likewise.
(siginfo_from_compat_x32_siginfo): Likewise.

8 years agoAdd bound related fields to the siginfo structure
Walfred Tedeschi [Tue, 2 Feb 2016 10:58:36 +0000 (11:58 +0100)]
Add bound related fields to the siginfo structure

Both Linux and glibc have introduced bound related fields in the
segmentation fault fields of the siginfo_t type. Add the new fields
to our x86's siginfo_t type too.

Kernel patch:
http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=ee1b58d36aa1b5a79eaba11f5c3633c88231da83

Glibc patch:
http://repo.or.cz/w/glibc.git/commit/d4358b51c26a634eb885955aea06cad26af6f696

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

gdb/ChangeLog:

* linux-tdep.c (linux_get_siginfo_type): Add the _addr_bnd
structure to the siginfo if extra_fields contains
LINUX_SIGINFO_FIELD_ADDR_BND.

8 years agoUse linux_get_siginfo_type_with_fields for x86
Walfred Tedeschi [Tue, 2 Feb 2016 10:50:17 +0000 (11:50 +0100)]
Use linux_get_siginfo_type_with_fields for x86

Use linux_get_siginfo_type_with_fields for adding bound fields on
segmentation fault for i386/amd64 siginfo.

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

gdb/ChangeLog:

* linux-tdep.h (linux_get_siginfo_type_with_fields): Make extern.
* linux-tdep.c (linux_get_siginfo_type_with_fields): Make extern.
* i386-linux-tdep.h (x86_linux_get_siginfo_type): New
function.
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Add
x86_linux_get_siginfo_type for the amd64 abi.
* i386-linux-tdep.c (x86_linux_get_siginfo_type): New
function.
(i386_linux_init_abi): Add new function at the i386 ABI
initialization.

8 years agoPreparation for new siginfo on Linux
Walfred Tedeschi [Tue, 2 Feb 2016 10:46:28 +0000 (11:46 +0100)]
Preparation for new siginfo on Linux

First add new structure and function to allow architecture customization
for the siginfo structure.

2016-01-15  Walfred Tedeschi  <walfred.tedeschi@intel.com>

gdb/ChangeLog:

* linux-tdep.h (linux_siginfo_extra_field_values): New enum values.
(linux_siginfo_extra_fields): New enum type.
* linux-tdep.c (linux_get_siginfo_type_with_fields): New function.
(linux_get_siginfo_type): Use new function.

8 years agoMerge gdb and gdbserver implementations for siginfo
Walfred Tedeschi [Tue, 2 Feb 2016 10:42:56 +0000 (11:42 +0100)]
Merge gdb and gdbserver implementations for siginfo

Extract the compatible siginfo handling from amd64-linux-nat.c and
gdbserver/linux-x86-low to a new file nat/amd64-linux-siginfo.c.

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

gdb/ChangeLog:

* nat/amd64-linux-siginfo.c: New file.
* nat/amd64-linux-siginfo.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/amd64-linux-siginfo.h.
(amd64-linux-siginfo.o): New rule.
* config/i386/linux64.mh (NATDEPFILES): Add amd64-linux-siginfo.o.
* amd64-linux-nat.c (nat/amd64-linux-siginfo.h): New include.
(compat_siginfo_from_siginfo, siginfo_from_compat_siginfo)
(compat_x32_siginfo_from_siginfo, siginfo_from_compat_x32_siginfo)
(compat_timeval, compat_sigval, compat_x32_clock, cpt_si_pid)
(cpt_si_uid, cpt_si_timerid, cpt_si_overrun, cpt_si_status)
(cpt_si_utime, cpt_si_stime, cpt_si_ptr, cpt_si_addr, cpt_si_band)
(cpt_si_fd, si_timerid, si_overrun): Move to nat/amd64-linux-siginfo.c.

gdb/gdbserver/ChangeLog:

* configure.srv (x86_64-*-linux*): Add amd64-linux-siginfo.o
to srv_tgtobj.
(i[34567]86-*-linux*): Add amd64-linux-siginfo.o
to srv_tgtobj.
* linux-x86-low.c [__x86_64__]: Include
"nat/amd64-linux-siginfo.h".
(compat_siginfo_from_siginfo, siginfo_from_compat_siginfo)
(compat_x32_siginfo_from_siginfo, siginfo_from_compat_x32_siginfo)
(compat_timeval, compat_sigval, compat_x32_clock, cpt_si_pid)
(cpt_si_uid, cpt_si_timerid, cpt_si_overrun, cpt_si_status)
(cpt_si_utime, cpt_si_stime, cpt_si_ptr, cpt_si_addr, cpt_si_band)
(cpt_si_fd, si_timerid, si_overrun): Move from
nat/amd64-linux-siginfo.c.
* Makefile.in (amd64-linux-siginfo.o:): New rule.

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

8 years agoDon't add DT_NEEDED for unmatched symbol
H.J. Lu [Mon, 1 Feb 2016 23:49:52 +0000 (15:49 -0800)]
Don't add DT_NEEDED for unmatched symbol

Don't add DT_NEEDED if a symbol from a library loaded via DT_NEEDED
doesn't match the symbol referenced by regular object.

bfd/

PR ld/19553
* elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED
if a symbol from a library loaded via DT_NEEDED doesn't match
the symbol referenced by regular object.

ld/testsuite/

PR ld/19553
* testsuite/ld-elf/indirect.exp: Run tests for PR ld/19553.
* testsuite/ld-elf/pr19553.map: New file.
* testsuite/ld-elf/pr19553.map: Likewise.
* testsuite/ld-elf/pr19553a.c: Likewise.
* testsuite/ld-elf/pr19553b.c: Likewise.
* testsuite/ld-elf/pr19553b.out: Likewise.
* testsuite/ld-elf/pr19553c.c: Likewise.
* testsuite/ld-elf/pr19553c.out: Likewise.
* testsuite/ld-elf/pr19553d.c: Likewise.
* testsuite/ld-elf/pr19553d.out: Likewise.

8 years agogdb.texinfo (Value Sizes): Fix typo.
Doug Evans [Mon, 1 Feb 2016 23:48:56 +0000 (15:48 -0800)]
gdb.texinfo (Value Sizes): Fix typo.

8 years agogdb.texinfo (Skipping Over Functions and Files): Fix typo.
Doug Evans [Mon, 1 Feb 2016 23:39:23 +0000 (15:39 -0800)]
gdb.texinfo (Skipping Over Functions and Files): Fix typo.