binutils-gdb.git
9 years agogas line buffer handling
Alan Modra [Wed, 22 Jul 2015 12:28:50 +0000 (21:58 +0930)]
gas line buffer handling

This fixes a segfault when macro definitions end on the last line of a
file, and that line isn't properly terminated with a newline.  gas
used to throw away the last line in cases like this, whereas in other
cases gas added the missing newline.  So I've also made gas
consistently provide a missing newline.

PR gas/18687
* input-scrub.c (input_scrub_next_buffer): Rearrange and simplify
loop.  Don't drop lines at end of file lacking a newline, add a
newline instead.  Ensure partial_size is zero whenever
partial_where is NULL.  Adjust buffer size for extra char.
(input_scrub_push, input_scrub_begin): Adjust buffer size here too.

9 years agoDon't compare symbol addresses directly
H.J. Lu [Wed, 22 Jul 2015 10:36:42 +0000 (03:36 -0700)]
Don't compare symbol addresses directly

GCC 5 will fold symbol address comparison, assuming each symbol has a
different address, which leads to abort.  We should use separate
functions to compare symbol address.

PR gold/18663
* testsuite/Makefile.am (script_test_1_SOURCES): Set to
script_test_1a.cc script_test_1b.cc.
(script_test_11_r.o): Replace script_test_11.o with
script_test_11a.o script_test_11b.o.
(script_test_11.o): Removed.
(script_test_11a.o): New.
(script_test_11b.o): Likewise.
* testsuite/Makefile.in: Regenerated.
* testsuite/script_test_1.h: New file.
* testsuite/script_test_1b.cc: Likewise.
* testsuite/script_test_11.h: Likewise.
* testsuite/script_test_11b.c: Likewise.
* testsuite/script_test_1.cc: Renamed to ...
* testsuite/script_test_1a.cc: This.
Include "script_test_1.h".
(main): Call check_int and check_ptr.
* testsuite/script_test_11.c: Renamed to ...
* testsuite/script_test_11a.c: This.
Include "script_test_11.h".
(main): Call ptr_equal.

9 years agoMark global with hidden attribute
H.J. Lu [Wed, 22 Jul 2015 10:35:47 +0000 (03:35 -0700)]
Mark global with hidden attribute

GCC 5 will generate a relocation for protected symbol:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248

when compiling for a shared library.  It is undefined to access protected
symbol in IFUNC selector function inside a shared library.

PR gold/18628
* testsuite/ifuncdep2.c (global): Change protected to hidden.
* testsuite/ifuncmod1.c (global): Likewise.
* testsuite/ifuncmod5.c (global): Likewise.

9 years agoFix ppc64 ELFv1 assertion failure
Alan Modra [Wed, 22 Jul 2015 09:41:22 +0000 (19:11 +0930)]
Fix ppc64 ELFv1 assertion failure

Bogus assembly can hit an assertion in opd_entry_value when the symbol
referenced by a function descriptor is undefined.  Worse, the code
after the assert copies unitialised memory to return the code section.
This uninitialised pointer can later be dereferencd, possibly causing
a linker segmentation fault.

* elf64-ppc.c (opd_entry_value): Remove assertion.  Instead,
return -1 if symbol referenced is not defined.  Tidy.

9 years agoGOLD aarch64 warning fix
Alan Modra [Tue, 21 Jul 2015 02:40:27 +0000 (12:10 +0930)]
GOLD aarch64 warning fix

aarch64.cc:2026:50: error: integer overflow in expression [-Werror=overflow]
       Insntype adr_insn = adrp_insn & ((1 << 31) - 1);

* aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 22 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoFix problem where __start_ and __stop_ section symbols do not honor version script.
Cary Coutant [Tue, 21 Jul 2015 23:10:05 +0000 (16:10 -0700)]
Fix problem where __start_ and __stop_ section symbols do not honor version script.

When creating the special __start_ and __stop_ section symbols, gold
does not check the version script to see if they should be local
instead of global.

2015-07-21  Cary Coutant  <ccoutant@gmail.com>

gold/
PR gold/18548
* symtab.cc (Symbol_table::do_define_in_output_data): Check for
forced local symbol even when oldsym != NULL.
(Symbol_table::do_define_in_output_segment): Likewise.
(Symbol_table::do_define_as_constant): Likewise.

9 years agoFix typo in PR number.
Cary Coutant [Tue, 21 Jul 2015 19:50:45 +0000 (12:50 -0700)]
Fix typo in PR number.

    Fix internal error when linking an archive library with no preceding objects.

    gold/
PR gold/18698
* archive.cc (Library_base::should_include_member): Don't use entry
point for relocatable links, or if target is not yet valid.
* parameters.cc (Parameters::entry): Check target_valid().

9 years agoFix internal error when linking an archive library with no preceding objects.
Cary Coutant [Tue, 21 Jul 2015 19:42:07 +0000 (12:42 -0700)]
Fix internal error when linking an archive library with no preceding objects.

gold/
PR gold/18696
* archive.cc (Library_base::should_include_member): Don't use entry
point for relocatable links, or if target is not yet valid.
* parameters.cc (Parameters::entry): Check target_valid().

9 years agoMove aarch64_linux_get_debug_reg_capacity to nat/aarch64-linux-hw-point.c
Yao Qi [Tue, 21 Jul 2015 15:33:41 +0000 (16:33 +0100)]
Move aarch64_linux_get_debug_reg_capacity to nat/aarch64-linux-hw-point.c

There are also some duplication on getting HW watchpoint/breakpoint
registers info between GDB and GDBserver.  This patch moves them
to nat/aarch64-linux-hw-point.c.

Note that ENABLE_NLS is not defined in GDBserver, so it should be OK
to use _( markup.

gdb:

2015-07-21  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity):
Move it to nat/aarch64-linux-hw-point.c.
(aarch64_linux_child_post_startup_inferior): Update.
* nat/aarch64-linux-hw-point.c (aarch64_linux_get_debug_reg_capacity):
New function.
* nat/aarch64-linux-hw-point.h (aarch64_linux_get_debug_reg_capacity):
Declare it.

gdb/gdbserver:

2015-07-21  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_arch_setup): Remove code and call
aarch64_linux_get_debug_reg_capacity.

9 years agobtrace: fix case label in btrace_data_append
Markus Metzger [Wed, 15 Jul 2015 06:43:09 +0000 (08:43 +0200)]
btrace: fix case label in btrace_data_append

gdb/
* common/btrace-common.c (btrace_data_append): Change case label.

9 years ago[ARM] Support correctly spelled ARMv6KZ architecture names
Matthew Wahab [Tue, 21 Jul 2015 08:43:35 +0000 (09:43 +0100)]
[ARM] Support correctly spelled ARMv6KZ architecture names

2015-07-20  Matthew Wahab  <matthew.wahab@arm.com>

gas/
    * NEWS: Mention corrected spelling of armv6kz.
    * config/tc-arm.c (arm_cpus): Replace ARM_ARCH_V6ZK with
    ARM_ARCH_V6KZ.
    (arm_archs): Likewise. Also add "armv6kz" and "armv6kzt2".
    * doc/c-arm.texi: Replace "armv6zk" with "armv6kz".

gas/testsuite

    * gas/arm/attr-march-armv6kz.d: New.
    * gas/arm/attr-march-armv6kzt2.d: New.

include/opcode

    * arm.h (ARM_AEXT_V6ZK): Rename to ARM_AEXT_V6KZ.
    (ARM_AEXT_V6ZKT2): Rename to ARM_AEXT_V6KZT2.
    (ARM_ARCH_V6ZK): Rename to ARM_ARCH_V6KZ.
    (ARM_ARCH_V6ZKT2): Rename to ARM_ARCH_V6KZT2.

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

9 years agogdb.ada/info_exc.exp: Adjust expected output in "info exception" test.
Joel Brobecker [Mon, 20 Jul 2015 22:09:44 +0000 (15:09 -0700)]
gdb.ada/info_exc.exp: Adjust expected output in "info exception" test.

Since multi_line was moved to gdb.exp in a slightly stricter form,
The gdb.ada/info_exc.exp:info exceptions test has been failing.
This is because it now expects a new-line sequence at the end of
each argument given to multi_line, including ".*". But the intent
when writing the test was to signify "could-be-nothing-at-all".
As a result, the test fails on x86_64-linux with a runtime built as
recommended, because of that
extra new-line sequence.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc.exp: Adjust "info exceptions" expected output.

9 years agoOptimize erratum 843419 fix.
Han Shen [Mon, 20 Jul 2015 20:04:06 +0000 (13:04 -0700)]
Optimize erratum 843419 fix.

gold/ChangeLog:
* aarch64.cc (AArch64_insn_utilities::is_adr): New method.
(AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
(AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
(E843419_stub): New sub-class of Erratum_stub.
(AArch64_relobj::try_fix_erratum_843419_optimized): New method.
(AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
(AArch64_relobj::create_erratum_stub): Add 1 argument.
(Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.

9 years agoUpdate testsuite/pr18689.sh for older GCC
H.J. Lu [Mon, 20 Jul 2015 19:18:06 +0000 (12:18 -0700)]
Update testsuite/pr18689.sh for older GCC

Older GCC, like 4.2, generates .debug_macinfo section instead of
.debug_macro section.  This patch updates testsuite/pr18689.sh to
support it.

9 years agoProperly set arm-specific elf flags wrt hardfp.
Han Shen [Thu, 16 Jul 2015 22:59:16 +0000 (15:59 -0700)]
Properly set arm-specific elf flags wrt hardfp.

gold/ChangeLog:
* arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.

9 years agoClear SHF_COMPRESSED flag bit from input to output
H.J. Lu [Mon, 20 Jul 2015 17:14:26 +0000 (10:14 -0700)]
Clear SHF_COMPRESSED flag bit from input to output

For relocatable link, we should clear the SHF_COMPRESSED flag bit from
input group section.

PR gold/18689
* layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
from input group section for relocatable link.
* testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
(check_DATA): Add pr18689.stdout.
(MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
(pr18689.stdout): New rule.
(pr18689a.o): Likewise.
(pr18689b.o): Likewise.
(pr18689.o): Likewise.
* testsuite/pr18689.c: New file.
* testsuite/pr18689.sh: Likewise.
* testsuite/Makefile.in: Regenerated.

9 years agoMakefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.
Doug Evans [Mon, 20 Jul 2015 16:21:51 +0000 (09:21 -0700)]
Makefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.

gdb/doc/ChangeLog:

* Makefile.in (STABS_DOC_BUILD_INCLUDES): Add gdb-cfg.texi, GDBvn.texi.

9 years agoRemove warning about references from shared objects to hidden symbols.
Yiran Wang [Mon, 20 Jul 2015 15:47:57 +0000 (08:47 -0700)]
Remove warning about references from shared objects to hidden symbols.

gold/
PR gold/15574
* resolve.cc (Symbol_table): Remove warning about references
from shared objects to hidden symbols.
* testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
* testsuite/Makefile.in: Regenerate.
* testsuite/hidden_test.sh: Check dynamic symbol table; update
expected error messages.

9 years agoFix ARI warnings to nat/aarch64-linux-hw-point.{c,h}
Yao Qi [Mon, 20 Jul 2015 15:29:16 +0000 (16:29 +0100)]
Fix ARI warnings to nat/aarch64-linux-hw-point.{c,h}

This patch is to fix two ARI warnings for nat/aarch64-linux-hw-point.{c,h}.

gdb:

2015-07-20  Yao Qi  <yao.qi@linaro.org>

* nat/aarch64-linux-hw-point.c (aarch64_handle_unaligned_watchpoint):
Re-indent the code.
* nat/aarch64-linux-hw-point.h: Use ULONGEST rather than
"unsigned long long".

9 years agoMake binutils abort message GDB friendly
H.J. Lu [Fri, 17 Jul 2015 15:29:26 +0000 (08:29 -0700)]
Make binutils abort message GDB friendly

We used to generate abort messages like:

internal error, aborting at .../bfd/elf64-x86-64.c line 1554 in elf_x86_64_check_relocs

We can't cut and paste "file line ???" to GDB.  This patch changes those
abort messages to

internal error, aborting at .../bfd/elf64-x86-64.c:1554 in elf_x86_64_check_relocs

so that we can cut and paste "file:???" to GDB.

bfd/

* bfd.c (_bfd_abort): Replace " line " with ":" in output
message.

gas/

* messages.c (as_assert): Replace " line " with ":" in output
message.
(as_abort): Likewise.

ld/

* ldmisc.c (ld_abort): Replace " line " with ":" in output
message.

9 years agoRegen two files
Alan Modra [Mon, 20 Jul 2015 05:01:23 +0000 (14:31 +0930)]
Regen two files

bfd/
* po/SRC-POTFILES.in: Regenerate.
binutils/
* doc/Makefile.in: Regenerate.

9 years agoALIGN change affects cris scripts
Alan Modra [Mon, 20 Jul 2015 04:59:37 +0000 (14:29 +0930)]
ALIGN change affects cris scripts

More fallout from a2c59f28.  This one could have been fixed by simply
using ". = ALIGN (ABSOLUTE (.), 2);" but it's nicer to align the
section.

* emulparams/criself.sh (INIT_ADDR, FINI_ADDR): Define.
(INIT_START, FINI_START): Don't ALIGN.
* scriptempl/elf.sc (.init, .fini): Apply INIT_ADDR/FINI_ADDR.

9 years agoALIGN change affects standard scripts
Alan Modra [Mon, 20 Jul 2015 04:59:21 +0000 (14:29 +0930)]
ALIGN change affects standard scripts

a2c59f28 changed the way the unary ALIGN behaved inside output sections,
resulting in cris-elf testsuite regressions.  This patch pads out .bss
in the same manner as it was prior to the ALIGN change.

* scripttempl/elf.sc (.ldata, .bss): Align absolute value of dot.
* ldexp.c (is_align_conditional): Handle binary ALIGN.
(exp_fold_tree_1): Move code setting SEC_KEEP for assignments to
dot inside output sections.  Handle absolute expressions.

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

9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 19 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agodwarf2read: Allow SEC_ALLOC sections to be located at address 0.
Kevin Buettner [Sat, 11 Jul 2015 00:41:55 +0000 (17:41 -0700)]
dwarf2read: Allow SEC_ALLOC sections to be located at address 0.

GDB already allows statically initialized variables, located in
SEC_LOAD sections, to be placed at address 0.  This change allows
uninitialized variables (which are in SEC_ALLOC sections) to be placed
address 0 as well.

gdb/ChangeLog:

* dwarf2read.c (dwarf2_locate_sections): Allow has_section_at_zero
to be set for SEC_ALLOC sections too.

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 18 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoMove common aarch64 HW breakpoint/watchpoint code to nat/
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
Move common aarch64 HW breakpoint/watchpoint code to nat/

When I look at test fails related to watchpoint on aarch64-linux,
I find there are some code duplicates between GDB and GDBserver.
This patch is to move some of them to a nat/aarch64-linux-hw-point.{h,c}.

The only change I do is about the dr_changed_t typedef, which was
ULONGEST in GDB and 'unsigned long long' in GDBserver.  Each bit
of dr_changed_t represents a status of each HW breakpoint or
watchpoint register, and the max number of HW breakpoint or watchpoint
registers is 16, so the width of 'unsigned long long' is sufficient.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (HFILES_NO_SRCDIR): Add
nat/aarch64-linux-hw-point.h.
(aarch64-linux-hw-point.o): New rule.
* nat/aarch64-linux-hw-point.h: New file.
* nat/aarch64-linux-hw-point.c: New file.
* aarch64-linux-nat.c: Include nat/aarch64-linux-hw-point.h.
(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
(AARCH64_HWP_ALIGNMENT): Likewise.
(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
(struct aarch64_debug_reg_state): Likewise.
(struct arch_lwp_info): Likewise.
(aarch64_linux_set_debug_regs): Likewise.
(aarch64_notify_debug_reg_change): Remove static.
(aarch64_align_watchpoint): Likewise.
(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
(aarch64_watchpoint_length): Likewise.
(aarch64_point_encode_ctrl_reg): Likewise
(aarch64_point_is_aligned): Likewise.
(aarch64_dr_state_insert_one_point): Likewise.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
* config/aarch64/linux.mh (NAT_FILE): Add
aarch64-linux-hw-point.o.

gdb/gdbserver:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (aarch64-linux-hw-point.o): New rule.
* configure.srv (srv_tgtobj): Append aarch64-linux-hw-point.o.
* linux-aarch64-low.c: Include nat/aarch64-linux-hw-point.h.
(AARCH64_HBP_MAX_NUM): Move to nat/aarch64-linux-hw-point.h.
(AARCH64_HWP_MAX_NUM, AARCH64_HBP_ALIGNMENT): Likewise.
(AARCH64_HWP_ALIGNMENT): Likewise.
(AARCH64_HWP_MAX_LEN_PER_REG): Likewise.
(AARCH64_DEBUG_NUM_SLOTS, AARCH64_DEBUG_ARCH): Likewise.
(aarch64_num_bp_regs, aarch64_num_wp_regs): Likewise.
(AARCH64_DEBUG_ARCH_V8, DR_MARK_ALL_CHANGED): Likewise.
(DR_MARK_N_CHANGED, DR_CLEAR_CHANGED): Likewise.
(DR_HAS_CHANGED, DR_N_HAS_CHANGE): Likewise.
(struct aarch64_debug_reg_state): Likewise.
(struct arch_lwp_info): Likewise.
(aarch64_align_watchpoint): Likewise.
(DR_CONTROL_ENABLED, DR_CONTROL_LENGTH): Likewise.
(aarch64_watchpoint_length): Likewise.
(aarch64_point_encode_ctrl_reg): Likewise
(aarch64_point_is_aligned): Likewise.
(aarch64_align_watchpoint): Likewise.
(aarch64_linux_set_debug_regs):
(aarch64_dr_state_insert_one_point): Likewise.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.

9 years agoPass aarch64_debug_reg_state to functions
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
Pass aarch64_debug_reg_state to functions

Some functions on handling HW watchpoint in GDB and GDBserver looks the
same except the code getting debug register state from current inferior.
In GDB, we get debug register state like this:

  state = aarch64_get_debug_reg_state (ptid_get_pid (inferior_ptid));

while in GDBserver, we get debug register state like this:

  state = aarch64_get_debug_reg_state ();

This patch is to move two lines above out of some functions, and pass
aarch64_debug_reg_state to these functions, in this way, these functions
are the same, and can be moved to a common place.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_handle_breakpoint): Add argument
state and don't call aarch64_get_debug_reg_state.  All callers
update.
(aarch64_linux_insert_hw_breakpoint): Call
aarch64_get_debug_reg_state earlier.
(aarch64_linux_remove_hw_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Add argument state and
don't call aarch64_get_debug_reg_state.  All callers update.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Add argument state.
(aarch64_linux_insert_watchpoint): Call aarch64_get_debug_reg_state
earlier.
(aarch64_linux_remove_watchpoint): Likewise.

gdb/gdbserver:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_handle_breakpoint): Add argument state
and don't aarch64_get_debug_reg_state.  All callers update.
(aarch64_handle_aligned_watchpoint): Likewise.
(aarch64_handle_unaligned_watchpoint): Likewise.
(aarch64_handle_watchpoint): Likewise.
(aarch64_insert_point): Call aarch64_get_debug_reg_state earlier.
(aarch64_remove_point): Likewise.

9 years agoUse debug_printf to print debug message
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
Use debug_printf to print debug message

Some functions in aarch64-linux-nat.c and linux-aarch64-low.c looks
the same except for the code printing debug message.  In GDB, we use
fprintf_unfiltered (gdb_stdlog, ...) while in GDBserver, we use
fprintf (stderr, ...).  This patch is to change them to use debug_printf
so that these functions are the same, and I can move them to a common
place in the following patch.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_show_debug_reg_state): Use
debug_printf.
(aarch64_handle_unaligned_watchpoint): Likewise.

gdb/gdbserver:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* linux-aarch64-low.c (aarch64_show_debug_reg_state): Use
debug_printf.
(aarch64_handle_unaligned_watchpoint): Likewise.

9 years agoint -> enum target_hw_bp_type in aarch64-linux-nat.c
Yao Qi [Fri, 17 Jul 2015 13:32:40 +0000 (14:32 +0100)]
int -> enum target_hw_bp_type in aarch64-linux-nat.c

This patch is to use 'enum target_hw_bp_type' instead of int for
breakpoint type, in order to make some functions in GDB and
GDBserver looks similar.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_dr_state_insert_one_point): Change
argument type's type to 'enum target_hw_bp_type'.
(aarch64_dr_state_remove_one_point): Likewise.
(aarch64_handle_breakpoint): Likewise.
(aarch64_linux_insert_hw_breakpoint): Likewise.
(aarch64_linux_remove_hw_breakpoint): Likewise.
(aarch64_handle_aligned_watchpoint): Likewise.

9 years agoCall ptid_get_pid instead of get_thread_id in aarch64_linux_get_debug_reg_capacity
Yao Qi [Fri, 17 Jul 2015 13:06:34 +0000 (14:06 +0100)]
Call ptid_get_pid instead of get_thread_id in aarch64_linux_get_debug_reg_capacity

aarch64_linux_get_debug_reg_capacity is called by
aarch64_linux_child_post_startup_inferior, and argument ptid is created in
inf-ptrace.c:inf_ptrace_create_inferior,

  /* On some targets, there must be some explicit actions taken after
     the inferior has been started up.  */
  target_post_startup_inferior (pid_to_ptid (pid));

so in aarch64_linux_get_debug_reg_capacity, we can get pid by ptid_get_pid,
and don't need to use get_thread_id.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* aarch64-linux-nat.c (aarch64_linux_get_debug_reg_capacity): Call
ptid_get_pid instead of get_thread_id.

9 years ago[AArch64] Sort TLS reloc types alphabetically
Jiong Wang [Fri, 17 Jul 2015 12:03:26 +0000 (13:03 +0100)]
[AArch64] Sort TLS reloc types alphabetically

9 years agoFix using uninitialised values
Yao Qi [Fri, 17 Jul 2015 11:14:59 +0000 (12:14 +0100)]
Fix using uninitialised values

We did a code refacotr here
https://sourceware.org/ml/gdb-patches/2013-11/msg00063.html

> (get_current_thread): New function, factored out from ...
> (add_current_inferior_and_thread): ... this.  Adjust.
>
>@@ -3332,18 +3371,8 @@ add_current_inferior_and_thread (char *wait_status)
>
>   inferior_ptid = null_ptid;
>
>-  /* Now, if we have thread information, update inferior_ptid.  First
>-     if we have a stop reply handy, maybe it's a T stop reply with a
>-     "thread" register we can extract the current thread from.  If
>-     not, ask the remote which is the current thread, with qC.  The
>-     former method avoids a roundtrip.  Note we don't use
>-     remote_parse_stop_reply as that makes use of the target
>-     architecture, which we haven't yet fully determined at this
>-     point.  */
>-  if (wait_status != NULL)
>-    ptid = stop_reply_extract_thread (wait_status);
>-  if (ptid_equal (ptid, null_ptid))
>-    ptid = remote_current_thread (inferior_ptid);
>+  /* Now, if we have thread information, update inferior_ptid.  */
>+  ptid = get_current_thread (wait_status);

but after the refactor, local variable ptid is used without
initialisation.  However, before this change, ptid is initialised to
null_ptid.  This error can be found by valgrind too...

==3298==    at 0x6B99BA: ptid_equal (ptid.c:80)
==3298==    by 0x4C67FF: get_current_thread (remote.c:3484)
==3298==    by 0x4C6951: add_current_inferior_and_thread (remote.c:3511)
==3298==    by 0x4C762C: extended_remote_create_inferior (remote.c:8506)
==3298==    by 0x5A5312: run_command_1 (infcmd.c:606)
==3298==    by 0x68B4FB: execute_command (top.c:463)
==3298==    by 0x5C7214: command_handler (event-top.c:494)
==3298==    by 0x5C78A3: command_line_handler (event-top.c:692)
==3298==    by 0x6DEB57: rl_callback_read_char (callback.c:220)
==3298==    by 0x5C7278: rl_callback_read_char_wrapper (event-top.c:171)
==3298==    by 0x5C72C2: stdin_event_handler (event-top.c:432)
==3298==    by 0x5C6194: gdb_wait_for_event (event-loop.c:834)

This patch initialises local variable ptid to null in get_current_thread.
We don't need to initialise ptid in add_current_inferior_and_thread,
so this patch also removes the ptid initialisation.

gdb:

2015-07-17  Yao Qi  <yao.qi@linaro.org>

* remote.c (get_current_thread): Initialise ptid to null_ptid.
(add_current_inferior_and_thread): Don't initialise ptid.

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 17 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agostabs.texinfo: @include gdb-cfg.texi.
Doug Evans [Thu, 16 Jul 2015 16:48:03 +0000 (09:48 -0700)]
stabs.texinfo: @include gdb-cfg.texi.

gdb/doc/ChangeLog:

* stabs.texinfo: @include gdb-cfg.texi.

9 years agoFix gdb.arch/i386-biarch-core.exp FAIL on i386.
Jan Kratochvil [Thu, 16 Jul 2015 16:01:22 +0000 (18:01 +0200)]
Fix gdb.arch/i386-biarch-core.exp FAIL on i386.

This new test fails on i686 buildbot slaves,

(gdb) core-file /home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core
"/home/gdb-buildbot-2/fedora-x86-64-2/fedora-i686/build/gdb/testsuite/gdb.arch/i386-biarch-core.core"
is not a core dump: File format not recognized
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file

There are two problems:

(1) The testcase did not really test if elf64-i386 is supported by GDB (BFD).
That was OK for a Fedora testcase but I forgot about it when submitting it
upstream.

I haven't really verified if the GNU target is elf64-little but it seems so,
no other one seems suitable from:
elf32-x86-64
elf64-big
elf64-k1om
elf64-l1om
elf64-little
elf64-x86-64
pei-x86-64

(2) The output of the "core-file" command itself can be arbitrary as the
elf64-i386 file with x86_64 registers is really broken; but that does not
matter much, important is the following test whether core file memory is
readable.
./configure --enable-64-bit-bfd
(gdb) core-file /home/jkratoch/redhat/gdb-test-build32-plus64/gdb/testsuite/gdb.arch/i386-biarch-core.core^M
warning: Couldn't find general-purpose registers in core file.^M
Failed to read a valid object file image from memory.^M
warning: Couldn't find general-purpose registers in core file.^M
#0  <unavailable> in ?? ()^M
(gdb) FAIL: gdb.arch/i386-biarch-core.exp: core-file
x/i 0x400078^M
   0x400078:    hlt    ^M
(gdb) PASS: gdb.arch/i386-biarch-core.exp: .text is readable

I do not know much dejagnu but I expect 'istarget' tests against the site.exp
'target_triplet' content which is set to the primary GDB target
(--target=...).

GDB is normally never configured for primary target elf64-i386, I think BFD
does not know such explicit target, it gets recognized as elf64-little.

In fact many testfiles of the GDB testsuite are wrong as they require
'istarget' (therefore primary GDB target) even for just loading arch specific
files which would be sufficient with secondary target (--enable-targets=...)
support.

This my new patch removes this 'istarget' check as it is IMO unrelated to what
we need to test.  Although you are right we do 'x/i' and test for 'hlt' so
I think we should test also for available 'set architecture i386'.
We could also test by 'x/bx' instead of 'x/i' to avoid such additional
test/requirement.

This testcase comes from a different bug from 2009:
https://bugzilla.redhat.com/show_bug.cgi?id=457187
http://pkgs.fedoraproject.org/cgit/gdb.git/commit/?id=94cd124608bf0dd359cb48a710800d72c21b30c3

That bug has been fixed in the meantime but the same testcase was reproducing
this new different bug - internal error regression - so I submitted it.

We can remove the "x/bx $address" test but it was useful for the previous bug
from 2009 as that time the internal error regression did not happen, just the
core file was not recognized (which would not be detected by the proposed
ignoring of the "core-file" command output) and so the core file was not
available.  That can be tested by the "x/bx $address" test.

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

* gdb.arch/i386-biarch-core.exp: Replace istarget
by "complete set gnutarget". Remove expectation for the "core-file"
command.

9 years agoUpdates the ARM disassembler's output of floating point constants to include the...
Alessandro Marzocchi [Thu, 16 Jul 2015 15:38:48 +0000 (16:38 +0100)]
Updates the ARM disassembler's output of floating point constants to include the actual floating point value.

opcodes * arm-dis.c (print_insn_coprocessor): Added support for quarter
float bitfield format.
(coprocessor_opcodes): Changed VFP vmov reg,immediate to use new
quarter float bitfield format.

tests * gas/arm/vfpv3-const-conv.d: Update expected result due to change
of comment for vmov reg,immediate with VFP coprocessor.

9 years agoCorrect readelf dynamic section buffer overlow test
Alan Modra [Thu, 16 Jul 2015 14:43:22 +0000 (00:13 +0930)]
Correct readelf dynamic section buffer overlow test

PR binutils/18672
* readelf.c (get_32bit_dynamic_section): Correct buffer limit test.
(get_64bit_dynamic_section): Likewise.

9 years ago[AArch64][3/3] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21
Jiong Wang [Thu, 16 Jul 2015 14:46:21 +0000 (15:46 +0100)]
[AArch64][3/3] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21

9 years ago[AArch64][2/3] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21
Jiong Wang [Thu, 16 Jul 2015 14:43:21 +0000 (15:43 +0100)]
[AArch64][2/3] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21

9 years ago[AArch64][1/3] Add R_AARCH64_P32_TLSLD_ADR_PREL21 in elf header
Jiong Wang [Thu, 16 Jul 2015 14:38:32 +0000 (15:38 +0100)]
[AArch64][1/3] Add R_AARCH64_P32_TLSLD_ADR_PREL21 in elf header

9 years ago[ARM] Add crypto-neon-fp-armv8.1 as an fpu option
Matthew Wahab [Thu, 16 Jul 2015 14:11:30 +0000 (15:11 +0100)]
[ARM] Add crypto-neon-fp-armv8.1 as an fpu option

2015-07-16  Matthew Wahab  <matthew.wahab@arm.com>

gas/
  * config/tc-arm.c (arm_fpus): Add crypto-neon-fp-armv8.1.
  * doc/c-arm.texi (-mfpu=): Likewise.  Correct the entry for
  neon-fp-armv8.1.

9 years ago[ARM] Make human parsing of "processor does not support instruction in mode" error...
James Greenhalgh [Thu, 16 Jul 2015 13:43:00 +0000 (14:43 +0100)]
[ARM] Make human parsing of "processor does not support instruction in mode" error messages easier

2015-07-16  James Greenhalgh  <james.greenhalgh@arm.com>

      gas/
* config/tc-arm.c (md_assemble): Rephrase the "selected processor does
not support ARM mode" error messages.

      gas/testsuite/
* gas/arm/arch7em-bad.l: Update expected errors.
* gas/arm/arch7m-bad.l: Likewise.
* gas/arm/arm-idiv-bad.l: Likewise.
* gas/arm/arm7-bad.l: Likewise.
* gas/arm/armv1-bad.l: Likewise.
* gas/arm/thumb-w-bad.l: Likewise.

9 years ago[AArch64] Mark single precision pseudo registers unavailable if invalid
Pierre Langlois [Thu, 16 Jul 2015 09:16:14 +0000 (10:16 +0100)]
[AArch64] Mark single precision pseudo registers unavailable if invalid

I noticed two failure in gdb.trace/mi-trace-frame-collected.exp:

FAIL: gdb.trace/mi-trace-frame-collected.exp: live:
  -trace-frame-collected (register)
FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile:
  -trace-frame-collected (register)

In these cases, we are not collecting registers so the MI command
-trace-frame-collected should only give us the value of the PC.
However, it also gives us all of the single precision pseudo registers,
initialized with 0x0.

We can reproduce this error by simply issuing the
'maint print cooked-register' when no inferior is connected:

~~~
...
(gdb) maint print cooked-register
 Name         Nr  Rel Offset    Size  Type            Cooked value
 x0            0    0      0       8 long            <unavailable>
 x1            1    1      8       8 long            <unavailable>
 ...
 d30         130   62   1540       8 *1              <unavailable>
 d31         131   63   1548       8 *1              <unavailable>
 s0          132   64   1556       4 *1              0x00000000
 s1          133   65   1560       4 *1              0x00000000
 s2          134   66   1564       4 *1              0x00000000
 ...
 s28         160   92   1668       4 *1              0x00000000
 s29         161   93   1672       4 *1              0x00000000
 s30         162   94   1676       4 *1              0x00000000
 s31         163   95   1680       4 *1              0x00000000
 h0          164   96   1684       2 *1              <unavailable>
 h1          165   97   1686       2 *1              <unavailable>
 h2          166   98   1688       2 *1              <unavailable>
 ...
~~~

It turns out GDB does not check if S registers are valid before returning
a value for them.  It should return <unavailable> in this case.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_pseudo_read_value): Mark S register as
unavailable if invalid.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 16 Jul 2015 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRevert the previous 7 commits of: Validate binary before use
Jan Kratochvil [Wed, 15 Jul 2015 18:27:32 +0000 (20:27 +0200)]
Revert the previous 7 commits of: Validate binary before use

ddc98fbf2fd9e244a215a4d09e559180dc573a14 Create empty nat/linux-maps.[ch] and common/target-utils.[ch]
6e5b4429db0d66e2d0b27e1bcfe4709f3dae73ed Move gdb_regex* to common/
f7af1fcd759fa126612018a5916cf808df7bb8bc Prepare linux_find_memory_regions_full & co. for move
9904185cfde13d6c6849f1f042c8e3b74974cf08 Move linux_find_memory_regions_full & co.
700ca40f6fc1addd7238f4ab57f76c095ad3c99f gdbserver build-id attribute generator
ca5268b6be265580b91ef75c1a1a9815f581ae42 Validate symbol file using build-id
0a94970d663a053c523f23ac0d71deb25a77f709 Tests for validate symbol file using build-id

gdb/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

Revert the previous 6 commits:
Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
Move gdb_regex* to common/
Prepare linux_find_memory_regions_full & co. for move
Move linux_find_memory_regions_full & co.
gdbserver build-id attribute generator
Validate symbol file using build-id

gdb/gdbserver/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

Revert the previous 3 commits:
Move gdb_regex* to common/
Move linux_find_memory_regions_full & co.
gdbserver build-id attribute generator

gdb/doc/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

Revert the previous 2 commits:
gdbserver build-id attribute generator
Validate symbol file using build-id

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

Revert the previous commit:
Tests for validate symbol file using build-id.

9 years agoTests for validate symbol file using build-id
Jan Kratochvil [Sun, 12 Jul 2015 18:59:03 +0000 (20:59 +0200)]
Tests for validate symbol file using build-id

New testcase.

gdb/testsuite/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com

Tests for validate symbol file using build-id.
* gdb.base/solib-mismatch-lib.c: New file.
* gdb.base/solib-mismatch-libmod.c: New file.
* gdb.base/solib-mismatch.c: New file.
* gdb.base/solib-mismatch.exp: New file.

9 years agoValidate symbol file using build-id
Jan Kratochvil [Wed, 15 Jul 2015 15:37:28 +0000 (17:37 +0200)]
Validate symbol file using build-id

Consumer part of the "build-id" attribute.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Validate symbol file using build-id.
* NEWS (Changes since GDB 7.10): Add 'set validate-build-id'
and 'show validate-build-id'.  Add build-id attribute.
* solib-darwin.c (_initialize_darwin_solib): Assign validate value.
* solib-dsbt.c (_initialize_dsbt_solib): Ditto.
* solib-frv.c (_initialize_frv_solib): Ditto.
* solib-spu.c (set_spu_solib_ops): Ditto.
* solib-svr4.c: Include rsp-low.h.
(NOTE_GNU_BUILD_ID_NAME): New define.
(svr4_validate): New function.
(svr4_copy_library_list): Duplicate field build_id.
(library_list_start_library): Parse 'build-id' attribute.
(svr4_library_attributes): Add 'build-id' attribute.
(_initialize_svr4_solib): Assign validate value.
* solib-target.c (solib.h): Include.
(_initialize_solib_target): Assign validate value.
* solib.c (validate_build_id, show_validate_build_id): New.
(solib_map_sections): Use ops->validate.
(clear_so): Free build_id.
(default_solib_validate): New function.
(_initialize_solib): Add "validate-build-id".
* solib.h (default_solib_validate): New declaration.
* solist.h (struct so_list): New fields 'build_idsz' and 'build_id'.
(target_so_ops): New field 'validate'.

gdb/doc/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.texinfo (Files): Add 'set validate-build-id'
and 'show validate-build-id'.

9 years agogdbserver build-id attribute generator
Jan Kratochvil [Wed, 15 Jul 2015 15:37:28 +0000 (17:37 +0200)]
gdbserver build-id attribute generator

Producer part of the new "build-id" XML attribute.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

gdbserver build-id attribute generator.
* features/library-list-svr4.dtd (library-list-svr4): New
'build-id' attribute.

gdb/doc/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

gdbserver build-id attribute generator.
* gdb.texinfo (Library List Format for SVR4 Targets): Add
'build-id' in description, example, new attribute in dtd.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

gdbserver build-id attribute generator.
* linux-low.c (nat/linux-maps.h, search.h, rsp-low.h): Include.
(ElfXX_Ehdr, ElfXX_Phdr, ElfXX_Nhdr): New.
(ELFXX_FLD, ELFXX_SIZEOF, ELFXX_ROUNDUP, BUILD_ID_INVALID): New.
(find_phdr): New.
(get_dynamic): Use find_pdhr to traverse program headers.
(struct mapping_entry, mapping_entry_s, free_mapping_entry_vec)
(compare_mapping_entry_range, struct find_memory_region_callback_data)
(read_build_id, find_memory_region_callback, lrfind_mapping_entry)
(get_hex_build_id): New.
(linux_qxfer_libraries_svr4): Add optional build-id attribute
to reply XML document.

9 years agoMove linux_find_memory_regions_full & co.
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Move linux_find_memory_regions_full & co.

This should be just a move with no changes.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Move linux_find_memory_regions_full & co.
* linux-tdep.c (nat/linux-maps.h): Include.
(gdb_regex.h): Remove the include.
(enum filterflags, struct smaps_vmflags, read_mapping, decode_vmflags)
(mapping_is_anonymous_p, dump_mapping_p): Moved to nat/linux-maps.c.
(linux_find_memory_region_ftype): Moved typedef to nat/linux-maps.h.
(linux_find_memory_regions_full): Moved definition to nat/linux-maps.c.
* nat/linux-maps.c: Include ctype.h, target/target-utils.h, gdb_regex.h
and target/target.h.
(struct smaps_vmflags, read_mapping, decode_vmflags)
(mapping_is_anonymous_p, dump_mapping_p): Move from linux-tdep.c.
(linux_find_memory_regions_full): Move from linux-tdep.c.
* nat/linux-maps.h (read_mapping): New declaration.
(linux_find_memory_region_ftype, enum filterflags): Moved from
linux-tdep.c.
(linux_find_memory_regions_full): New declaration.
* target.c (target/target-utils.h): Include.
(read_alloc_pread_ftype): Moved typedef to target/target-utils.h.
(read_alloc, read_stralloc_func_ftype, read_stralloc): Moved
definitions to target/target-utils.c.
* target.h (target_fileio_read_stralloc): Move it to target/target.h.
* target/target-utils.c (read_alloc, read_stralloc): Move definitions
from target.c.
* target/target-utils.h (read_alloc_pread_ftype): New typedef.
(read_alloc): New declaration.
(read_stralloc_func_ftype): New typedef.
(read_stralloc): New declaration.
* target/target.h (target_fileio_read_stralloc): Move it from target.h.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

* target.c: Include target/target-utils.h and fcntl.h.
(target_fileio_read_stralloc_1_pread, target_fileio_read_stralloc_1)
(target_fileio_read_stralloc): New functions.

9 years agoPrepare linux_find_memory_regions_full & co. for move
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Prepare linux_find_memory_regions_full & co. for move

Prepare code for move into gdb/common/.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Prepare linux_find_memory_regions_full & co. for move.
* linux-tdep.c (linux_find_memory_region_ftype): Comment.
(linux_find_memory_regions_full): Change signature and prepare
for moving to linux-maps.
(linux_find_memory_regions_data): Rename field 'obfd' to 'data'.
(linux_find_memory_regions_thunk): New.
(linux_find_memory_regions_thunk): Use 'data' field instead of 'obfd'.
(linux_find_memory_regions_gdb): New.
(linux_find_memory_regions): Rename argument 'obfd' to 'func_data'.
(linux_make_mappings_corefile_notes): Use
linux_find_memory_regions_gdb.
* target.c (read_alloc_pread_ftype): New typedef.
(target_fileio_read_alloc_1_pread): New function.
(read_alloc): Refactor from target_fileio_read_alloc_1.
(read_stralloc_func_ftype): New typedef.
(target_fileio_read_alloc_1): New implementation. Use read_alloc.
(read_stralloc): Refactored from target_fileio_read_stralloc.
(target_fileio_read_stralloc): New implementation, use read_stralloc.

9 years agoMove gdb_regex* to common/
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Move gdb_regex* to common/

Later patches need regex support also in gdbserver.

gdb/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* Makefile.in (HFILES_NO_SRCDIR): Change gdb_regex.h to
common/gdb_regex.h.
(COMMON_OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* common/common.m4 (GDB_AC_COMMON): Add gdb_use_included_regex,
--without-included-regex and USE_INCLUDED_REGEX.
* common/gdb_regex.c: New file from utils.c functions.
* common/gdb_regex.h: Move it here from gdb_regex.h, update include
file wrapping define name.
* configure: Rebuilt.
* configure.ac (gdb_use_included_regex, --without-included-regex)
(USE_INCLUDED_REGEX): Move them to common/common.m4.
* gdb_regex.h: Move it to common/gdb_regex.h.
* utils.c: Remove include gdb_regex.h.
(do_regfree_cleanup, make_regfree_cleanup, get_regcomp_error)
(compile_rx_or_error): Move them to common/gdb_regex.c.

gdb/gdbserver/ChangeLog
2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

* Makefile.in (OBS): Add gdb_regex.o.
(gdb_regex.o): New.
* config.in: Rebuilt.
* configure: Rebuilt.

9 years agoCreate empty nat/linux-maps.[ch] and common/target-utils.[ch]
Jan Kratochvil [Wed, 15 Jul 2015 15:37:27 +0000 (17:37 +0200)]
Create empty nat/linux-maps.[ch] and common/target-utils.[ch]

Prepare new files for later move.

gdb/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
* Makefile.in (HFILES_NO_SRCDIR); Add nat/linux-maps.h,
common/target-utils.h.
(COMMON_OBS): Add target-utils.o.
(linux-maps.o, target-utils.o): New.
* target/target-utils.c: New file.
* target/target-utils.h: New file.
* config/i386/linux.mh (NATDEPFILES): Add linux-maps.o.
* config/i386/linux64.mh (NATDEPFILES): Ditto.
* nat/linux-maps.c: New file.
* nat/linux-maps.h: New file.

gdb/gdbserver/ChangeLog
2015-07-15  Aleksandar Ristovski  <aristovski@qnx.com
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Create empty nat/linux-maps.[ch] and common/target-utils.[ch].
* Makefile.in (OBS): Add target-utils.o.
(linux-maps.o, target-utils.o): New.
* configure.srv (srv_linux_obj): Add linux-maps.o.

9 years agoUnbreak nios2-*-linux* GDB testing.
Sandra Loosemore [Wed, 15 Jul 2015 15:30:14 +0000 (08:30 -0700)]
Unbreak nios2-*-linux* GDB testing.

2015-07-15  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/sigaltstack.exp (finish_test): Add kfail for
nios2-*-linux*.
* gdb.base/sigbpt.exp (stepi_out): Likewise.
* gdb.base/siginfo.exp: Likewise.
* gdb.base/sigstep.exp (advance, advancei): Likewise.

9 years agoMake x86 Linux assembler default to gABI compliant
H.J. Lu [Wed, 15 Jul 2015 14:31:55 +0000 (07:31 -0700)]
Make x86 Linux assembler default to gABI compliant

The default compression is gABI compliant now.  This patch makes the
x86 Linux assembler default to gABI compliant.

* config/tc-i386.c (flag_compress_debug): Replace
COMPRESS_DEBUG_GNU_ZLIB with COMPRESS_DEBUG_GABI_ZLIB.

9 years agoMove ChangeLog entry to gdbserver
Pierre Langlois [Wed, 15 Jul 2015 14:03:01 +0000 (15:03 +0100)]
Move ChangeLog entry to gdbserver

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_supports_range_stepping): New
function, return 1.
(the_low_target): Install it.

9 years ago[GDBserver][AArch64] Enable support for range stepping
Pierre Langlois [Wed, 15 Jul 2015 13:58:32 +0000 (14:58 +0100)]
[GDBserver][AArch64] Enable support for range stepping

gdb/gdbserver/Changelog:

* linux-aarch64-low.c (aarch64_supports_range_stepping): New
function, return 1.
(the_low_target): Install it.

9 years ago[testsuite] Skip gdb.trace/range-stepping.exp test case if not supported
Pierre Langlois [Wed, 15 Jul 2015 13:33:32 +0000 (14:33 +0100)]
[testsuite] Skip gdb.trace/range-stepping.exp test case if not supported

Tracepoints and range stepping are independent features.  This patch
skips the gdb.trace/range-stepping.exp test case if the target does not
support range stepping.

gdb/testsuite/ChangeLog:

* gdb.base/range-stepping.exp (gdb_range_stepping_enabled):
Move it to ...
* lib/range-stepping-support.exp (gdb_range_stepping_enabled):
... here.
* gdb.trace/range-stepping.exp: Check that the target supports
range stepping.

9 years agoari, btrace: avoid unsigned long long
Markus Metzger [Wed, 8 Jul 2015 07:38:16 +0000 (09:38 +0200)]
ari, btrace: avoid unsigned long long

Fix the ARI warning about the use of unsigned long long.  We can't use
ULONGEST as this is defined unsigned long on 64-bit systems.  This will
result in a compile error when storing a pointer to an unsigned long long
structure field (declared in perf_event.h as __u64) in a ULONGEST * variable.

Use size_t to hold the buffer size inside GDB and __u64 when interfacing the
Linux kernel.

gdb/
* nat/linux-btrace.c (perf_event_read): Change the type of DATA_HEAD.
(perf_event_read_all): Change the type of SIZE and DATA_HEAD.
(perf_event_read_bts): Change the type of SIZE and READ.
(linux_enable_bts): Change the type of SIZE, PAGES, DATA_SIZE,
and DATA_OFFSET.  Move DATA_SIZE declaration.  Restrict the buffer size
to UINT_MAX.  Check for overflows when using DATA_HEAD from the perf
mmap page.
(linux_enable_pt): Change the type of PAGES and SIZE.  Restrict the
buffer size to UINT_MAX.
(linux_read_bts): Change the type of BUFFER_SIZE, SIZE, DATA_HEAD, and
DATA_TAIL.
* nat/linux-btrace.h (struct perf_event_buffer)<size, data_head>
<last_head>: Change type.
* common/btrace-common.h (struct btrace_dat_pt) <size>: Change type.
* common/btrace-common.c (btrace_data_append): Change the type of
SIZE.
* btrace.c (parse_xml_raw): Change the type of SIZE.  Change oddness
check.

9 years agoAutomatic date update in version.in
GDB Administrator [Wed, 15 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoRemove CHECK_TYPEDEF, use check_typedef instead
Simon Marchi [Mon, 6 Jul 2015 20:05:06 +0000 (16:05 -0400)]
Remove CHECK_TYPEDEF, use check_typedef instead

I think that the CHECK_TYPEDEF macro is not necessary, and even a bit
annoying.  It makes unclear the fact that the "type" variables gets
overwritten.  It has actually bitten me a few times.  I think the
following, explicit form, is better.

  type = check_typedef (type);

This patches changes all instances of CHECK_TYPEDEF for an equivalent
call to check_typedef.  The bulk of the change was done with this sed:

  sed -i 's/CHECK_TYPEDEF (\([^)]*\));/\1 = check_typedef (\1);/' <file>.c

The ChangeLog was generated using David Malcom's generate_changelog.py.
I manually fixed those places where it gets the wrong function name,
hopefully all of them.

The patch was built-tested, and I ran a few smoke tests.

gdb/ChangeLog:
* gdbtypes.h (CHECK_TYPEDEF): Remove.
* aarch64-tdep.c (aarch64_return_in_memory): Replace CHECK_TYPEDEF
        with check_typedef.
* ada-lang.c (decode_constrained_packed_array_type): Likewise.
(ada_array_length): Likewise.
(find_parallel_type_by_descriptive_type): Likewise.
(ada_check_typedef): Likewise.
* arm-tdep.c (arm_return_in_memory): Likewise.
* ax-gdb.c (gen_trace_static_fields): Likewise.
(gen_struct_ref_recursive): Likewise.
* c-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
(variable: block COLONCOLON name): Likewise.
(qualified_name: TYPENAME COLONCOLON name): Likewise.
* c-lang.c (classify_type): Likewise.
* c-typeprint.c (c_print_type): Likewise.
(c_print_typedef): Likewise.
(c_type_print_base): Likewise.
* c-valprint.c (c_val_print): Likewise.
* compile/compile-c-types.c (convert_type): Likewise.
* compile/compile-object-load.c (get_out_value_type): Likewise.
* completer.c (add_struct_fields): Likewise.
(expression_completer): Likewise.
* cp-namespace.c (cp_find_type_baseclass_by_name): Likewise.
(cp_lookup_nested_symbol_1): Likewise.
(cp_lookup_nested_symbol): Likewise.
* cp-valprint.c (cp_print_value_fields): Likewise.
(cp_print_static_field): Likewise.
* d-valprint.c (d_val_print): Likewise.
* eval.c (evaluate_subexp_standard): Likewise.
(evaluate_subexp_for_sizeof): Likewise.
* f-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
* f-typeprint.c (f_type_print_base): Likewise.
* f-valprint.c (f_val_print): Likewise.
* gdbtypes.c (get_discrete_bounds): Likewise.
(create_array_type_with_stride): Likewise.
(type_name_no_tag_or_error): Likewise.
(lookup_struct_elt_type): Likewise.
(get_unsigned_type_max): Likewise.
(internal_type_vptr_fieldno): Likewise.
(set_type_vptr_fieldno): Likewise.
(internal_type_vptr_basetype): Likewise.
(set_type_vptr_basetype): Likewise.
        (get_vptr_fieldno): Likewise.
(is_integral_type): Likewise.
(is_scalar_type): Likewise.
        (is_scalar_type_recursive): Likewise.
(distance_to_ancestor): Likewise.
(is_unique_ancestor_worker): Likewise.
(check_types_equal): Likewise.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise.
* gnu-v3-abi.c (gnuv3_dynamic_class): Likewise.
(gnuv3_get_vtable): Likewise.
(gnuv3_pass_by_reference): Likewise.
* go-exp.y (exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY): Likewise.
* go-lang.c (gccgo_string_p): Likewise.
(go_classify_struct_type): Likewise.
* go-typeprint.c (go_print_type): Likewise.
* go-valprint.c (go_val_print): Likewise.
* guile/scm-math.c (vlscm_binop): Likewise.
* guile/scm-value.c (gdbscm_value_dynamic_type): Likewise.
(gdbscm_value_to_bytevector): Likewise.
(gdbscm_value_to_bool): Likewise.
(gdbscm_value_to_integer): Likewise.
(gdbscm_value_to_real): Likewise.
* infcall.c (call_function_by_hand_dummy): Likewise.
* infcmd.c (get_return_value): Likewise.
* jv-lang.c (is_object_type): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* jv-valprint.c (java_print_value_fields): Likewise.
(java_val_print): Likewise.
* linespec.c (find_methods): Likewise.
(collect_one_symbol): Likewise.
* m2-typeprint.c (m2_print_type): Likewise.
(m2_print_typedef): Likewise.
(m2_get_discrete_bounds): Likewise.
* m2-valprint.c (m2_print_long_set): Likewise.
(m2_print_unbounded_array): Likewise.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* opencl-lang.c (opencl_print_type): Likewise.
* p-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise.
* p-typeprint.c (pascal_print_type): Likewise.
(pascal_print_typedef): Likewise.
(pascal_type_print_base): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
(pascal_object_print_value_fields): Likewise.
(pascal_object_print_static_field): Likewise.
* python/py-type.c (typy_fields_items): Likewise.
(typy_get_composite): Likewise.
* python/py-value.c (valpy_get_dynamic_type): Likewise.
(valpy_binop): Likewise.
(valpy_long): Likewise.
(valpy_float): Likewise.
* stack.c (return_command): Likewise.
* symtab.c (check_field): Likewise.
(lookup_symbol_aux): Likewise.
* tic6x-tdep.c (tic6x_return_value): Likewise.
* typeprint.c (print_type_scalar): Likewise.
* valarith.c (value_vector_widen): Likewise.
* valops.c (value_cast): Likewise.
(value_assign): Likewise.
(do_search_struct_field): Likewise.
(search_struct_method): Likewise.
(find_method_list): Likewise.
* valprint.c (val_print_scalar_type_p): Likewise.
(valprint_check_validity): Likewise.
(generic_val_print): Likewise.
* value.c (unpack_double): Likewise.
(value_primitive_field): Likewise.
(unpack_bits_as_long): Likewise.

9 years agoAdd support reading D modules from DWARF
Iain Buclaw [Tue, 14 Jul 2015 18:31:21 +0000 (20:31 +0200)]
Add support reading D modules from DWARF

Extends existing support for namespaces/modules in C++/Fortran/Java to
include language_d too.  However unlike Fortran/C++, the separator for
qualified names is a single dot.

2015-07-14  Iain Buclaw  <ibuclaw@gdcproject.org>

* dwarf2read.c (find_slot_in_mapped_hash): Extend language support to
also test for language_d.
(dwarf2_compute_name): Likewise.
(read_func_scope): Likewise.
(read_structure_type): Likewise.
(determine_prefix): Likewise.
(read_import_statement): Use dot as the separator for language_d.
(typename_concat): Likewise, but don't prefix the D main function.

9 years agoi386-biarch-core.exp: Fix comment typo
Jan Kratochvil [Tue, 14 Jul 2015 17:50:20 +0000 (19:50 +0200)]
i386-biarch-core.exp: Fix comment typo

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

* gdb.arch/i386-biarch-core.exp: Fix comment typo.

9 years agoMake default compression gABI compliant
H.J. Lu [Tue, 14 Jul 2015 17:25:52 +0000 (10:25 -0700)]
Make default compression gABI compliant

All programs in binutils+gdb git repo now support gABI compression
with the SHF_COMPRESSED bit.  This patch makes the zlib-gabi option
as compression default for gas, gold, ld and objcopy, instead of the
zlib-gnu option whose outputs are incompatible with gABI.

binutils/

* objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not
zlib-gnu.
* doc/binutils.texi: Change --compress-debug-sections and
--compress-debug-sections=zlib to zlib-gabi.

binutils/testsuite/

* binutils-all/compress.exp: Update.

gas/

* as.c (parse_args): Make --compress-debug-sections and
--compress-debug-sections=zlib the same as
--compress-debug-sections=zlib-gabi.
* doc/as.texinfo: Change --compress-debug-sections and
--compress-debug-sections=zlib to zlib-gabi.

gold/

* compressed_output.cc (Output_compressed_section::set_final_data_size):
Make --compress-debug-sections=zlib the same as
--compress-debug-sections=zlib-gabi.
* testsuite/Makefile.am (flagstest_compress_debug_sections.check):
Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
".zdebug_".
* testsuite/Makefile.in: Regenerated.

ld/

* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make
--compress-debug-sections=zlib the same as
--compress-debug-sections=zlib-gabi.
* ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi.

ld/testsuite/

* ld-elf/zlibbegin.rS: Updated to .debug_.* with the
SHF_COMPRESSED bit.
* ld-elf/zlibnormal.rS: Likewise.

9 years agoSync Makefile.tpl with GCC
H.J. Lu [Tue, 14 Jul 2015 16:52:36 +0000 (09:52 -0700)]
Sync Makefile.tpl with GCC

* Makefile.in: Regenerated.

Sync with GCC
2015-05-21  Jason Merrill  <jason@redhat.com>

* Makefile.tpl: Update comments.

2015-04-22  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

* Makefile.tpl: Remove surplus whitespace throughout.

2015-03-25  Martin Liska  <mliska@suse.cz>
    Yury Gribov  <y.gribov@samsung.com>

* Makefile.tpl: Fix ln source location for vimrc file.

9 years agoSync longlong.h with GCC
H.J. Lu [Tue, 14 Jul 2015 16:17:41 +0000 (09:17 -0700)]
Sync longlong.h with GCC

Sync with GCC
2014-10-28  Richard Henderson  <rth@redhat.com>

* longlong.h [__alpha] (umul_ppmm): Disable for c++.

9 years agoSync hashtab.h, splay-tree.h with GCC
H.J. Lu [Tue, 14 Jul 2015 16:16:33 +0000 (09:16 -0700)]
Sync hashtab.h, splay-tree.h with GCC

Sync with GCC
2014-12-09  Trevor Saunders  <tsaunders@mozilla.com>

* hashtab.h, splay-tree.h: Remove GTY markers.

9 years agoRemove trailing spaces in demangle.h
H.J. Lu [Tue, 14 Jul 2015 16:14:50 +0000 (09:14 -0700)]
Remove trailing spaces in demangle.h

9 years agoSync ansidecl.h with GCC
H.J. Lu [Tue, 14 Jul 2015 16:10:59 +0000 (09:10 -0700)]
Sync ansidecl.h with GCC

Sync with GCC
2015-03-02  Markus Trippelsdorf  <markus@trippelsdorf.de>

PR target/65261
* ansidecl.h (ATTRIBUTE_NO_SANITIZE_UNDEFINED): New macro.

9 years agoSync config files with GCC
H.J. Lu [Tue, 14 Jul 2015 15:43:24 +0000 (08:43 -0700)]
Sync config files with GCC

Sync with GCC
2015-05-13  Eric Botcazou  <ebotcazou@adacore.com>

* sjlj.m4: New file.

2015-05-04  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

* bitfields.m4: Change int to long long, and use bitfields of
width 1 instead of 0.

2015-05-01  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

* bitfields.m4: New file.

2015-04-14  H.J. Lu  <hongjiu.lu@intel.com>

* bootstrap-mpx.mk: New file.

2015-03-25  Uros Bizjak  <ubizjak@gmail.com>

PR bootstrap/65537
* bootstrap-lto-noplugin.mk: New build configuration.

2014-11-13  Kirill Yukhin  <kirill.yukhin@intel.com>

* target-posix: New file.

2014-10-27  Tom Tromey  <tromey@redhat.com>

* gcc-plugin.m4: New file.

9 years agoFix build issue with nat/linux-namespaces.c.
Peter Bergner [Tue, 14 Jul 2015 15:46:16 +0000 (10:46 -0500)]
Fix build issue with nat/linux-namespaces.c.

* nat/linux-namespaces.c (setns): Rename from this ...
(do_setns): ... to this.  Support calling setns if it exists.
(mnsh_handle_setns): Call do_setns.

9 years agoSync config/warnings.m4 with GCC
H.J. Lu [Tue, 14 Jul 2015 15:39:12 +0000 (08:39 -0700)]
Sync config/warnings.m4 with GCC

config/

Sync with GCC
2015-05-27  Jason Merrill  <jason@redhat.com>

PR bootstrap/66304
* warnings.m4 (ACX_PROG_CXX_WARNING_OPTS)
(ACX_PROG_CXX_WARNINGS_ARE_ERRORS)
(ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC): New.
(ACX_PROG_CC_WARNING_OPTS, ACX_PROG_CC_WARNING_ALMOST_PEDANTIC)
(ACX_PROG_CC_WARNINGS_ARE_ERRORS): Push into C language context.

libdecnumber/

* configure: Regenerated.

libiberty/

* configure: Regenerated.

opcodes/

* configure: Regenerated.

9 years agoSync toplevel configure with GCC
H.J. Lu [Tue, 14 Jul 2015 15:17:27 +0000 (08:17 -0700)]
Sync toplevel configure with GCC

Sync with GCC
2015-05-16  James Bowman  <james.bowman@ftdichip.com>

* configure.ac: FT32 target added.
* configure: Regenerate.

9 years agoSync toplevel configure.ac with GCC
H.J. Lu [Tue, 14 Jul 2015 14:49:50 +0000 (07:49 -0700)]
Sync toplevel configure.ac with GCC

Sync with GCC
2015-06-02  Jason Merrill  <jason@redhat.com>

PR bootstrap/66319
* configure.ac: Use -std=gnu++98.

2015-05-28  Mike Frysinger  <vapier@gentoo.org>

* configure.ac (--vtable-verify): Use AS_HELP_STRING for help.
* configure: Regenerate.

2015-05-11  Paulo Matos  <paulo@matos-sorge.com>

* configure.ac: Fix typo.
* configure: Regenerate.

2015-05-03  Matthias Klose  <doko@ubuntu.com>

* configure.ac: Match $host configured with triplets.
* configure: Regenerate.

2015-04-17  Jakub Jelinek  <jakub@redhat.com>

PR bootstrap/62077
* configure.ac (--enable-stage1-checking): Default to
release,misc,gimple,rtlflag,tree,types if --disable-checking
or --enable-checking is not specified and DEV-PHASE is not
experimental.
* configure: Regenerated.

2015-03-27  Uros Bizjak  <ubizjak@gmail.com>

Install back PR target/47230 fix (Revert the revert).

config/

Sync with GCC
* mh-alpha-linux: Restored.

9 years agoRemove extraneous whitespace from ARM sim sources.
Nick Clifton [Tue, 14 Jul 2015 11:06:33 +0000 (12:06 +0100)]
Remove extraneous whitespace from ARM sim sources.

* armcopro.c: Remove extraneous whitespace.
* armdefs.h: Likewise.
* armfpe.h: Likewise.
* arminit.c: Likewise.
* armopts.h: Likewise.
* armos.c: Likewise.
* armos.h: Likewise.
* armrdi.c: Likewise.
* armsupp.c: Likewise.
* armvirt.c: Likewise.
* bag.c: Likewise.
* bag.h: Likewise.
* communicate.c: Likewise.
* communicate.h: Likewise.
* dbg_conf.h: Likewise.
* dbg_cp.h: Likewise.
* dbg_hif.h: Likewise.
* dbg_rdi.h: Likewise.
* gdbhost.c: Likewise.
* gdbhost.h: Likewise.
* iwmmxt.c: Likewise.
* iwmmxt.h: Likewise.
* kid.c: Likewise.
* main.c: Likewise.
* maverick.c: Likewise.
* parent.c: Likewise.
* thumbemu.c: Likewise.
* wrapper.c: Likewise.

9 years agoFix texinfo problem by adding the required period after an @xref.
Nick Clifton [Tue, 14 Jul 2015 10:31:42 +0000 (11:31 +0100)]
Fix texinfo problem by adding the required period after an @xref.

* ld.texinfo (Options): Add missing period after @xref.

9 years agoAdd test that exercises the inferior being killed while stopped under GDB
Pedro Alves [Wed, 11 Mar 2015 15:20:31 +0000 (15:20 +0000)]
Add test that exercises the inferior being killed while stopped under GDB

This exercises the case of the inferior disappearing while GDB is
debugging it, such as something doing "kill -9 PID" while the program
is stopped under GDB or GDBserver.  This triggered a set of internal
errors, fixed by previous patches.

gdb/testsuite/ChangeLog:
2015-07-14  Pedro Alves  <palves@redhat.com>

* gdb.base/killed-outside.exp: New file.
* gdb.base/killed-outside.c: New file.

9 years agogdbserver/Linux: internal error when killing a process that is already gone
Pedro Alves [Tue, 14 Jul 2015 09:10:50 +0000 (10:10 +0100)]
gdbserver/Linux: internal error when killing a process that is already gone

If the process disappears (e.g., killed with "kill -9" from the shell)
while it was stopped under GDBserver's control, and the GDBserver
tries to kill it, GDBserver asserts:

 (gdb) shell kill -9 23084
 (gdb) kill
 ...
 Killing process(es): 23084
 /home/pedro/gdb/mygit/src/gdb/gdbserver/linux-low.c:972: A problem internal to GDBserver has been detected.
 kill_wait_lwp: Assertion `res > 0' failed.
 ...

gdb/gdbserver/ChangeLog:
2015-07-14  Pedro Alves  <palves@redhat.com>

* linux-low.c (kill_wait_lwp): Don't assert if waitpid fails.
Instead, ignore ECHILD, and throw an error for other errnos.

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

9 years agoFix attach-pie-noexec.exp fail on native-extended-gdbserver
Yao Qi [Mon, 13 Jul 2015 16:14:13 +0000 (17:14 +0100)]
Fix attach-pie-noexec.exp fail on native-extended-gdbserver

When I examine the buildbot fails, I see this fail on
native-extended-gdbserver,

 Attaching to process 13529^M
 "target:/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/attach-pie-noexec (deleted)": could not open as an executable file: No such file or directory^M
 (gdb) FAIL: gdb.base/attach-pie-noexec.exp: attach

if I run tests with board file unix, it doesn't exist,

 Attaching to process 13869^M
 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/gdb.base/attach-pie-noexec (deleted): No such file or directory.^M
 (gdb) PASS: gdb.base/attach-pie-noexec.exp: attach

the test expects to see the period at the end of the error message,

  gdb_test "attach $testpid" "Attaching to process $testpid\r\n.*: No such file or directory\\." "attach"

however the period is missing when running with native-extended-gdbserver.

in exec.c:exec_file_attach, GDB has two places may throw errors [1] and [2],

      if (load_via_target)
{
  ...
}
      else
{
    ...
  if (scratch_chan < 0)
    perror_with_name (filename);  <--- [1]
}

...
      if (!exec_bfd)
{
  error (_("\"%s\": could not open as an executable file: %s"), <-- [2]
 scratch_pathname, bfd_errmsg (bfd_get_error ()));
}

perror_with_name [1] append a period at the end of error message,
but error [2] doesn't.  This fix is to add a period at the end of the
error message.  Note that this fail is shown up on 7.9 release as well.

gdb:

2015-07-13  Yao Qi  <yao.qi@linaro.org>

* exec.c (exec_file_attach): Add period at the end of error
message.

9 years agogdb/tui: Add command completion to winheight command.
Andrew Burgess [Fri, 10 Jul 2015 13:06:28 +0000 (14:06 +0100)]
gdb/tui: Add command completion to winheight command.

Share the window name completion code from the focus command with the
winheight command, providing window name completion for the winheight
command.

gdb/ChangeLog:

* tui/tui-win.c (window_name_completer): New function.
(focus_completer): Call window_name_completer.  All old content
moved into window_name_completer.
(winheight_completer): New function.
(_initialize_tui_win): Rename variable.  Add completer to
winheight command.  Update doc string on winheight.

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

9 years agoExtend --compress-debug-sections in gold
H.J. Lu [Sun, 12 Jul 2015 17:56:41 +0000 (10:56 -0700)]
Extend --compress-debug-sections in gold

This patch extends --compress-debug-sections= with [zlib-gnu|zlib-gabi]
in gold.

PR gold/18322
* compressed_output.cc (zlib_compress): Add argument for
compression header size.  Set header size to compression header
size if it isn't 0.  Don't write out the zlib header here.
(Output_compressed_section::set_final_data_size): Support
zlib-gnu and zlib-gabi compressions.  Pass compression header
size to zlib_compress and write out compression header.  Set
the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
clear the SHF_COMPRESSED bit
* options.h (compress_debug_sections): Add zlib-gnu and
zlib-gabi.
* output.h (Output_section::set_flags): New.
* testsuite/Makefile.am (check_PROGRAMS): Add
flagstest_compress_debug_sections_none,
flagstest_compress_debug_sections_gnu and
flagstest_compress_debug_sections_gabi.
(check_DATA): Add flagstest_compress_debug_sections_none.stdout.
flagstest_compress_debug_sections.stdout,
flagstest_compress_debug_sections.cmp,
flagstest_compress_debug_sections.check,
flagstest_compress_debug_sections_gnu.stdout,
flagstest_compress_debug_sections_gnu.cmp,
flagstest_compress_debug_sections_gnu.check,
flagstest_compress_debug_sections_gabi.stdout,
flagstest_compress_debug_sections_gabi.cmp and
flagstest_compress_debug_sections_gabi.check.
(flagstest_compress_debug_sections_none): New.
(flagstest_compress_debug_sections_none.stdout): Likewise.
(flagstest_compress_debug_sections.stdout): Likewise.
(flagstest_compress_debug_sections.check): Likewise.
(flagstest_compress_debug_sections.cmp): Likewise.
(flagstest_compress_debug_sections_gnu): Likewise.
(flagstest_compress_debug_sections_gnu.stdout): Likewise.
(flagstest_compress_debug_sections_gnu.check): Likewise.
(flagstest_compress_debug_sections_gnu.cmp): Likewise.
(flagstest_compress_debug_sections_gabi): Likewise.
(flagstest_compress_debug_sections_gabi.stdout): Likewise.
(flagstest_compress_debug_sections_gnu.check): Likewise.
(flagstest_compress_debug_sections_gnu.cmp): Likewise.
* testsuite/Makefile.in: Regenerated.

9 years agoAdd SHF_COMPRESSED section decompression to gold
H.J. Lu [Sun, 12 Jul 2015 17:50:25 +0000 (10:50 -0700)]
Add SHF_COMPRESSED section decompression to gold

This patch adds SHF_COMPRESSED section decompression to gold.

PR gold/18321
* compressed_output.h (decompress_input_section): Add arguments
for ELF class, big endian and sh_flags.
* compressed_output.cc (decompress_input_section): Likewise.
Support the SHF_COMPRESSED section.
* dynobj.h (Dynobj): Add elfsize and is_big_endian member
functions.
* plugin.h (Pluginobj): Likewise.
* layout.cc (Layout::get_output_section_flags): Also clear the
SHF_COMPRESSED bit.
* object.h (Compressed_section_info): Add flag to store sh_flags.
(Object): Add pure virtual elfsize and is_big_endian member
functions.
* object.cc (need_decompressed_section): Don't skip the ".zdebug"
prefix here.
(build_compressed_section_map): Check SHF_COMPRESSED for
uncompressed size.  Store sh_flags in Compressed_section_info.
Pass size, big_endian and sh_flags to decompress_input_section.
Skip the ".debug"/".zdebug" prefix when passing section name to
need_decompressed_section.
(Sized_relobj_file<size, big_endian>::do_find_special_section):
Don't check ".zdebug_*" sections.
(Object::decompressed_section_contents): Pass ELF class, big
endian and sh_flags to decompress_input_section.
* reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
Likewise.
* testsuite/Makefile.am (check_DATA): Add
debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
(MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
gdb_index_test_2_gabi.stdout.
(debug_msg_cdebug_gabi.o): New.
(odr_violation1_cdebug_gabi.o): Likewise.
(odr_violation2_cdebug_gabi.o): Likewise.
(debug_msg_cdebug_gabi.err): Likewise.
(check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
(gdb_index_test_cdebug_gabi.o): Likewise.
(gdb_index_test_2_gabi): Likewise.
(gdb_index_test_2_gabi.stdout): Likewise.
* testsuite/gdb_index_test_2_gabi.sh: New file.
* testsuite/Makefile.in: Regenerated.

9 years agoFix GDB breakage due to addition of new nios2 mach types in BFD.
Sandra Loosemore [Sun, 12 Jul 2015 14:13:12 +0000 (07:13 -0700)]
Fix GDB breakage due to addition of new nios2 mach types in BFD.

2015-07-12  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Register
all nios2 mach variants.

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

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 11 Jul 2015 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoProperly convert objects between different ELF classes
H.J. Lu [Fri, 10 Jul 2015 21:20:20 +0000 (14:20 -0700)]
Properly convert objects between different ELF classes

The output SHF_COMPRESSED section size is different from input if
ELF classes of input and output aren't the same.  We must adjust
the section sizes as well as the compression headers in
SHF_COMPRESSED sections when converting objects between different
ELF classes.

bfd/

 PR binutils/18656
 * bfd.c (bfd_convert_section_size): New function.
 (bfd_convert_section_contents): Likewise.
 * bfd-in2.h: Regenerated.

binutils/

2015-07-10  H.J. Lu  <hongjiu.lu@intel.com>

 PR binutils/18656
 * objcopy.c (setup_section): Call bfd_convert_section_size
 to get the output section size.
 (copy_section): Get the section size from the output section
 and call bfd_get_full_section_contents to convert section
 contents for output.

binutils/testsuite/

 PR binutils/18656
 * binutils-all/compress.exp (convert_test): New proc.
 Run conversion tests between x86-64 and x32.

9 years agorx-tdep.c: Use target_read_code instead of target_read_memory.
Kevin Buettner [Thu, 9 Jul 2015 23:05:31 +0000 (16:05 -0700)]
rx-tdep.c: Use target_read_code instead of target_read_memory.

This change causes the prologue scanner and the frame type scanner in
rx-tdep.c to use target_read_code() instead of target_read_memory().
This change allows these instruction scanners to operate much more
quickly due to the fact that target_read_code() can potentially read
from a cache maintained by GDB.

gdb/ChangeLog:

* rx-tdep.c (rx_get_opcode_byte): Use target_read_code instead
of target_read_memory.

9 years agogdbserver/event-loop.c: type mismatch
Pedro Alves [Fri, 10 Jul 2015 18:47:17 +0000 (19:47 +0100)]
gdbserver/event-loop.c: type mismatch

Building with C++ catches a buglet here:

../../../src/gdb/gdbserver/event-loop.c:205:19: warning: invalid conversion from ‘gdb_client_data {aka void*}’ to ‘void**’ [-fpermissive]
   event_ptr->data = data;
                   ^

This works in practice because gdb_client_data is a pointer already
(hence in C we get an implicit conversion), and nothing deferences the
pointer.  It's passed from client at event registration/creation time,
only to pass straight back to client callback.

Well, that and nothing in gdbserver uses the event data anyway.

gdb/gdbserver/ChangeLog:
2015-07-10  Pedro Alves  <palves@redhat.com>

* event-loop.c (struct callback_event) <data>: Change type to
gdb_client_data instance instead of gdb_client_data pointer.
(append_callback_event): Adjust.

9 years agoWarn unsupported compress type and corrupted compressed section
H.J. Lu [Fri, 10 Jul 2015 17:23:12 +0000 (10:23 -0700)]
Warn unsupported compress type and corrupted compressed section

* readelf.c (dump_section_as_strings): Warn unsupported compress
type and corrupted compressed section.
(dump_section_as_bytes): Likewise.
(load_specific_debug_section): Likewise.

9 years agoUpdated to accept .debug_* sections
H.J. Lu [Fri, 10 Jul 2015 15:41:10 +0000 (08:41 -0700)]
Updated to accept .debug_* sections

* gas/i386/dw2-compress-1.d: Updated to accept .debug_* sections.

9 years agoUpdated to accept .debug_* sections
H.J. Lu [Fri, 10 Jul 2015 15:14:59 +0000 (08:14 -0700)]
Updated to accept .debug_* sections

* binutils-all/dw2-3.W: Updated to accept .debug_* sections.

9 years agoFix testsuite regression by: Do not skip prologue for asm (.S) files
Jan Kratochvil [Fri, 10 Jul 2015 13:04:51 +0000 (15:04 +0200)]
Fix testsuite regression by: Do not skip prologue for asm (.S) files

I have somehow missed gdb.asm/asm-source.exp PASS->FAIL even on x86_64.

It has no longer valid assumption that "break" breaks after the prologue even
in assembler.  So I have changed this assumption of the testfile.

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

* gdb.asm/asm-source.exp (f at main): Stop at gdbasm_enter.
(n at main): New.
* gdb.asm/asmsrc1.s: Add comment "mark: main enter".

9 years ago[GDBserver][AArch64] Cleanup comments for each linux_target_ops method
Pierre Langlois [Thu, 2 Jul 2015 11:11:47 +0000 (12:11 +0100)]
[GDBserver][AArch64] Cleanup comments for each linux_target_ops method

This patch cleans up the comments for each linux_target_ops methods.  We
should mention which method each function implements but there is no
need to duplicate information already mentionned in the base target_ops
or linux_target_ops definitions.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c: Add comments for each linux_target_ops
method.  Remove comments already covered in target_ops and
linux_target_ops definitions.
(the_low_target): Add comments for each unimplemented method.

9 years agogdb/tui: Use cleanups to free string copies.
Andrew Burgess [Mon, 6 Jul 2015 17:16:24 +0000 (18:16 +0100)]
gdb/tui: Use cleanups to free string copies.

In parse_scrolling_args it is possible for a string copy to leak if an
error occurs.  Switching to using a cleanup fixes this leak.

In tui_set_win_height the string can't be leaked, but switching to using
a cleanup guards against the possibility that a leak could be introduced
in the future (by adding an error somewhere in the call stack).

gdb/ChangeLog:

* tui/tui-win.c (tui_set_win_height): Use a cleanup to free the
string copy.
(parse_scrolling_args): Likewise.

9 years agogdb/tui: Define tui window names once.
Andrew Burgess [Mon, 6 Jul 2015 16:50:28 +0000 (17:50 +0100)]
gdb/tui: Define tui window names once.

Don't duplicate the window names inside the completion function.
Instead make use of the existing defines, and the tui_win_name function
to obtain the window names.

gdb/ChangeLog:

* tui/tui-win.c (focus_completer): Don't duplicate the tui window
names in this function.