Commit Graph

86490 Commits

Author SHA1 Message Date
Wei-cheng Wang 7cae9051ed 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.
2016-02-11 23:21:48 +01:00
Pedro Alves acc23c113a 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.
2016-02-11 19:55:46 +00:00
Pedro Alves e352bf0a3c 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.
2016-02-11 19:36:39 +00:00
Simon Marchi bec2ab5a15 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.
2016-02-11 14:09:25 -05:00
Simon Marchi 2ba163c8d1 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.
2016-02-11 14:08:53 -05:00
Simon Marchi 615234c107 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.
2016-02-11 13:21:32 -05:00
Han Shen e3dbf58233 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.
2016-02-11 09:47:49 -08:00
Nick Clifton bd5608dcc6 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.
2016-02-11 15:30:55 +00:00
Marcin Kościelnicki 9f5fed7852 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.
2016-02-11 15:16:31 +01:00
Antoine Tremblay 82e9becd8a 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.
2016-02-11 08:14:35 -05:00
H.J. Lu 32875eb1f3 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.
2016-02-10 19:33:52 -08:00
GDB Administrator cd7c1b9a7e Automatic date update in version.in 2016-02-11 00:00:14 +00:00
Marcin Kościelnicki 5ac87a997f 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.
2016-02-10 23:31:13 +01:00
Marcin Kościelnicki 18d3cec54e 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.
2016-02-10 23:31:11 +01:00
Yao Qi 9f6a71b4bf 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.
2016-02-10 16:40:52 +00:00
Simon Marchi 550dc4e266 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.
2016-02-10 10:10:18 -05:00
Marcin Kościelnicki 62e5fd57bc 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.
2016-02-10 15:30:31 +01:00
Marcin Kościelnicki e909d859f5 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.
2016-02-10 15:30:13 +01:00
Marcin Kościelnicki 473b99e572 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.
2016-02-10 14:50:22 +01:00
Claudiu Zissulescu 4670103e86 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.
2016-02-10 12:09:01 +00:00
Nick Clifton 83da6e748c 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.
2016-02-10 11:25:59 +00:00
Nick Clifton 52cf9762c5 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.
2016-02-10 10:54:29 +00:00
Joel Brobecker 1233c0bae6 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.
2016-02-10 07:28:01 +04:00
Joel Brobecker d1dc094269 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 (9ef9e6a6a0):
	* version.in: Bump version to 7.11.50.DATE-git.
2016-02-10 07:20:26 +04:00
Keith Seitz 9ef9e6a6a0 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.
2016-02-09 16:04:45 -08:00
GDB Administrator 224c1b2068 Automatic date update in version.in 2016-02-10 00:00:21 +00:00
Keith Seitz 39a67dc4f7 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.
2016-02-09 14:31:04 -08:00
Keith Seitz a96e36da2f 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.
2016-02-09 14:29:21 -08:00
Keith Seitz 9f61929fd8 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.
2016-02-09 14:27:50 -08:00
Keith Seitz eeb1af437c 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.
2016-02-09 10:02:53 -08:00
Nick Clifton 609332f15c 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.
2016-02-09 16:34:24 +00:00
Simon Marchi 1e94266c4d 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.
2016-02-09 09:01:58 -05:00
Pedro Alves 2a7f3dffce 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.
2016-02-09 12:12:17 +00:00
Simon Marchi 8adce0342f 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.
2016-02-09 11:18:15 +00:00
Nick Clifton 027e9c750c 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.
2016-02-09 10:47:54 +00:00
Walfred Tedeschi c23bbc1cda Revert "Fix build breakage"
This reverts commit 222cab58b7.
2016-02-09 11:36:54 +01:00
Walfred Tedeschi 0635c87593 Revert "Add a more helpful warning message to explain why some AArch64 relocations can overflow."
This reverts commit 2ea53e0031.
2016-02-09 11:36:15 +01:00
Walfred Tedeschi 222cab58b7 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*.
2016-02-09 11:26:13 +01:00
Nick Clifton 2ea53e0031 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.
2016-02-09 09:56:21 +00:00
Alan Modra 24f5f69a8a Fix macro redefinition error on Solaris
PR 16583
	* elf/common.h (AT_SUN_HWCAP): Undef before defining.
2016-02-09 13:11:16 +10:30
GDB Administrator 4c5dc7fcf6 Automatic date update in version.in 2016-02-09 00:00:10 +00:00
Simon Marchi 2151ccc56c 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.
2016-02-08 14:02:36 -05:00
Simon Marchi 437277d47a 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.
2016-02-08 14:00:49 -05:00
Simon Marchi 5488790363 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.
2016-02-08 12:57:08 -05:00
Nick Clifton 9264d32548 FIx formatting that triggers a new compile time warning message.
* config/tc-ia64.c (dot_prologue): Fix formatting.
2016-02-08 14:51:10 +00:00
GDB Administrator 1d4f3cb666 Automatic date update in version.in 2016-02-08 00:00:07 +00:00
Cary Coutant 17ecd01611 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.
2016-02-07 10:17:01 -08:00
Cary Coutant 7c8b700c92 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.
2016-02-07 07:49:34 -08:00
Simon Marchi 30914ca8c0 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.
2016-02-07 09:45:02 -05:00
Cary Coutant b7a4e9d8e6 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.
2016-02-06 18:19:13 -08:00