binutils-gdb.git
8 years agolinux-record.c: Fix whitespace issues
Andreas Arnez [Thu, 17 Mar 2016 08:58:57 +0000 (09:58 +0100)]
linux-record.c: Fix whitespace issues

This patch changes whitespace only, fixing whitespace issues in
linux-record.c.

gdb/ChangeLog:

* linux-record.c: Fix whitespace issues; tabify, remove trailing
spaces.

8 years agolinux-record: Fix bad fall-through for pipe/pipe2
Andreas Arnez [Thu, 17 Mar 2016 08:58:56 +0000 (09:58 +0100)]
linux-record: Fix bad fall-through for pipe/pipe2

This patch added handling for some syscalls to linux-record.c:

  https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html

But for both `pipe' and `pipe2' the patch lacks a statement after an
`if', such that the following `break' is interpreted as the `if'-body
instead.

This adds the missing (return-) statements for the conditionals.

gdb/ChangeLog:

* linux-record.c (record_linux_system_call): Add missing return
statements to handling of pipe and pipe2 syscalls.

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

8 years agotestsuite/ChangeLog is no longer supposed to exist
Alan Modra [Wed, 16 Mar 2016 23:27:50 +0000 (09:57 +1030)]
testsuite/ChangeLog is no longer supposed to exist

move entries to main ChangeLog

8 years agoPR remote/19496, interrupted syscall in forking-threads-plus-bkpt
Don Breazeal [Wed, 16 Mar 2016 22:13:44 +0000 (15:13 -0700)]
PR remote/19496, interrupted syscall in forking-threads-plus-bkpt

This patch addresses "fork:Interrupted system call" (or wait:) failures
in gdb.threads/forking-threads-plus-breakpoint.exp.

The test program spawns ten threads, each of which do ten fork/waitpid
sequences.  The cause of the problem was that when one of the fork
children exited before the corresponding fork parent could initiate its
waitpid for that child, a SIGCHLD and/or SIGSTOP was delivered and
interrupted a fork or waitpid in another thread.

The fix was to wrap the system calls in a loop to retry the call if
it was interrupted, like:

do
  {
    pid = fork ();
  }
while (pid == -1 && errno == EINTR);

Since this is a Linux-only test I figure it is OK to use errno and EINTR.
I tried a number of alternative fixes using SIG_IGN, SA_RESTART,
pthread_sigblock, and bsd_signal, but none of these worked as well.

Tested on Nios II Linux target with x86 Linux host.

gdb/testsuite/ChangeLog:
2016-03-16  Don Breazeal  <donb@codesourcery.com>

* gdb.threads/forking-threads-plus-breakpoint.c (thread_forks):
Retry fork and waitpid on interrupted system call errors.
* gdb.threads/forking-threads-plus-breakpoint.exp: (do_test):
Use with_timeout_factor to increase timeout to 90.

8 years agoxml-tdesc.c (tdesc_start_enum): Fix c++ build.
Doug Evans [Wed, 16 Mar 2016 17:30:41 +0000 (10:30 -0700)]
xml-tdesc.c (tdesc_start_enum): Fix c++ build.

gdb/ChangeLog:

* xml-tdesc.c (tdesc_start_enum): Fix c++ build.

8 years ago[ARM] Support ARMv8.2 FP16 simd instructions
Jiong Wang [Wed, 16 Mar 2016 16:11:59 +0000 (16:11 +0000)]
[ARM] Support ARMv8.2 FP16 simd instructions

gas/
* config/tc-arm.c (N_S_32): New.
(N_F_16_32): Likewise.
(N_SUF_32): Support N_F16.
(N_IF_32): Likewise.
(neon_dyadic_misc): Likewise.
(do_neon_cmp): Likewise.
(do_neon_cmp_inv): Likewise.
(do_neon_mul): Likewise.
(do_neon_fcmp_absolute): Likewise.
(do_neon_step): Likewise.
(do_neon_abs_neg): Likewise.
(CVT_FLAVOR_VAR): Likewise.
(do_neon_cvt_1): Likewise.
(do_neon_recip_est): Likewise.
(do_vmaxnm): Likewise.
(do_vrint_1): Likewise.
(neon_check_type): Check architecture support for FP16 extension.
(insns): Update comments.
* testsuite/gas/arm/armv8-2-fp16-simd.s: New test source.
* testsuite/gas/arm/armv8-2-fp16-simd.d: New testcase for arm mode.
* testsuite/gas/arm/armv8-2-fp16-simd-thumb.d: Likewise for thumb mode.
* testsuite/gas/arm/armv8-2-fp16-simd-warning.d: New rejection test for
arm mode.
* testsuite/gas/arm/armv8-2-fp16-simd-warning-thumb.d: Likewise for
thumb mode.
* testsuite/gas/arm/armv8-2-fp16-simd-warning.l: New expected rejection
error file.

opcode/
* arm-dis.c (neon_opcodes): Support new FP16 instructions.

8 years agoProcess record: Fix arm-linux syscall arguments
Yao Qi [Wed, 16 Mar 2016 14:55:56 +0000 (14:55 +0000)]
Process record: Fix arm-linux syscall arguments

Arguments are passed in r0-r6 on arm linux syscall (both EABI and OABI).
This patch is to set arm_linux_record_tdep.arg{1-7} to the right
register number.

This patch fixes the following test failures...

-FAIL: gdb.reverse/getresuid-reverse.exp: check ruid record
-FAIL: gdb.reverse/getresuid-reverse.exp: check rgid record
-FAIL: gdb.reverse/pipe-reverse.exp: check pipe record
-FAIL: gdb.reverse/readv-reverse.exp: check readv record
-FAIL: gdb.reverse/readv-reverse.exp: check readv record
-FAIL: gdb.reverse/readv-reverse.exp: check readv record
-FAIL: gdb.reverse/readv-reverse.exp: check readv record
-FAIL: gdb.reverse/waitpid-reverse.exp: check waitpid record

gdb:

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

* arm-linux-tdep.c (arm_linux_init_abi): Fix
arm_linux_record_tdep.arg1, arm_linux_record_tdep.arg2 and
arm_linux_record_tdep.arg3.  Set arm_linux_record_tdep.arg4,
arm_linux_record_tdep.arg5, arm_linux_record_tdep.arg6, and
arm_linux_record_tdep.arg7.

8 years agoFix checking bignum values that are being inserted into byte sized containers.
Nick Clifton [Wed, 16 Mar 2016 11:33:55 +0000 (11:33 +0000)]
Fix checking bignum values that are being inserted into byte sized containers.

* read.c (emit_expr_with_reloc): Add code check a bignum with
nbytes == 1.
* config/rx/rx-parse.y (rx_intop): Accept bignum values for sizes
other than 32-bits.
* testsuite/gas/elf/bignum.s: New test source file.
* testsuite/gas/elf/bignum.d: New test driver file.
* testsuite/gas/elf/elf.exp: Run the new test.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Mar 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR 18303, Tolerate malformed input for lookup_symbol-called functions
Don Breazeal [Tue, 15 Mar 2016 22:18:28 +0000 (15:18 -0700)]
PR 18303, Tolerate malformed input for lookup_symbol-called functions

lookup_symbol is often called with user input.  Consequently, any
function called from lookup_symbol{,_in_language} should attempt to
deal with malformed input gracefully.  After all, malformed user
input is not a programming/API error.

This patch does not attempt to find/correct all instances of this.  It
only fixes locations in the code that trigger test suite failures.

This patch fixes PR breakpoints/18303, "Assertion: -breakpoint-insert
with windows paths of file in non-current directory".

The patch includes three new tests related to this.  One is just
gdb.linespec/ls-errs.exp copied and converted to use C++ instead of C, and
to add a case using a file name containing a Windows-style logical drive
specifier.  The others include an MI test to provide a regression test for
the specific case reported in PR 18303, and a C++ test for proper error
handling of access to a program variable when using a file scope specifier
that refers to a non-existent file.

Tested on x86_64 native Linux.

gdb/ChangeLog
2016-01-28  Keith Seitz  <keiths@redhat.com>

PR breakpoints/18303
* cp-namespace.c (cp_lookup_bare_symbol): Change assertion to
look for "::" instead of simply ":".
(cp_search_static_and_baseclasses): Return null_block_symbol for
malformed input.
Remove assertions.
* cp-support.c (cp_find_first_component_aux): Do not return
a prefix length for ':' unless the next character is also ':'.

gdb/testsuite/ChangeLog
2016-01-28  Don Breazeal  <donb@codesourcery.com>

* gdb.cp/scope-err.cc: New test program.
* gdb.cp/scope-err.exp: New test script.
* gdb.linespec/ls-errs.c (myfunction): Expanded to have multiple
lines and "set breakpoint here" comment.
* gdb.linespec/ls-errs.exp: Added C++ testing and new test case.
Fixed some whitespace and format issues.
* gdb.mi/mi-linespec-err-cp.cc: New test program.
* gdb.mi/mi-linespec-err-cp.exp: New test script.

8 years agoAdd cole945@ to earlier entry. Fix typo in same entry.
Doug Evans [Tue, 15 Mar 2016 22:02:13 +0000 (15:02 -0700)]
Add cole945@ to earlier entry. Fix typo in same entry.

8 years agoAdd cpsr_flags to aarch64 core regs.
Doug Evans [Tue, 15 Mar 2016 21:43:49 +0000 (14:43 -0700)]
Add cpsr_flags to aarch64 core regs.

gdb/ChangeLog:

* features/aarch64-core.xml (cpsr_flags): New flags type.
(cpsr): Use it.
* features/aarch64.c: Regenerate.

8 years agoRemove "end" spec.
Doug Evans [Tue, 15 Mar 2016 21:41:52 +0000 (14:41 -0700)]
Remove "end" spec.

gdb/ChangeLog:

* features/i386/32bit-core.xml (i386_eflags): Remove "end" spec.
* features/i386/32bit-sse.xml (i386_eflags): Ditto.
* features/i386/64bit-core.xml (i386_eflags): Ditto.
* features/i386/64bit-sse.xml (i386_eflags): Ditto.
* features/i386/x32-core.xml (i386_eflags): Ditto.

8 years agoExtend flags to support multibit and enum bitfields.
Doug Evans [Tue, 15 Mar 2016 21:37:29 +0000 (14:37 -0700)]
Extend flags to support multibit and enum bitfields.

gdb/ChangeLog:

Extend flags to support multibit and enum bitfields.
NEWS: Document new features.
* c-typeprint.c (c_type_print_varspec_prefix): Handle TYPE_CODE_FLAGS.
(c_type_print_varspec_suffix, c_type_print_base): Ditto.
* gdbtypes.c (arch_flags_type): Don't assume all fields are one bit.
(append_flags_type_field): New function.
(append_flags_type_flag): Call it.
* gdbtypes.h (append_flags_type_field): Declare.
* target-descriptions.c (struct tdesc_type_flag): Delete.
(enum tdesc_type_kind) <TDESC_TYPE_BOOL>: New enum value.
(enum tdesc_type_kind) <TDESC_TYPE_ENUM>: Ditto.
(struct tdesc_type) <u.f>: Delete.
(tdesc_predefined_types): Add "bool".
(tdesc_predefined_type): New function.
(tdesc_gdb_type): Handle TDESC_TYPE_BOOL, TDESC_TYPE_ENUM.
Update TDESC_TYPE_FLAGS support.
(tdesc_free_type): Handle TDESC_TYPE_ENUM.  Update TDESC_TYPE_FLAGS.
(tdesc_create_flags): Update.
(tdesc_create_enum): New function.
(tdesc_add_field): Initialize start,end to -1.
(tdesc_add_typed_bitfield): New function.
(tdesc_add_bitfield): Call it.
(tdesc_add_flag): Allow TDESC_TYPE_STRUCT.  Update.
(tdesc_add_enum_value): New function.
(maint_print_c_tdesc_cmd): Fold TDESC_TYPE_FLAGS support into
TDESC_TYPE_STRUCT.  Handle TDESC_TYPE_ENUM.
* target-descriptions.h (tdesc_create_enum): Declare.
(tdesc_add_typed_bitfield, tdesc_add_enum_value): Declare.
* valprint.c (generic_val_print_enum_1): New function.
(generic_val_print_enum): Call it.
(val_print_type_code_flags): Make static.  Handle multibit bitfields
and enum bitfields.
* valprint.h (val_print_type_code_flags): Delete.
* xml-tdesc.c (struct tdesc_parsing_data) <current_type_is_flags>:
Delete.  All uses removed.
(tdesc_start_enum): New function.
(tdesc_start_field): Handle multibit and enum bitfields.
(tdesc_start_enum_value): New function.
(enum_value_attributes, enum_children, enum_attributes): New static
globals.
(feature_children): Add "enum".
* features/gdb-target.dtd (enum, evalue): New elements.

gdb/doc/ChangeLog:

* gdb.texinfo (Target Descriptions): New menu item "Enum Target Types".
(Target Description Format): Mention enum types.  Update docs on
flags types.
(Predefined Target Types): Add "bool".
(Enum Target Types): New node.

gdb/testsuite/ChangeLog:

* gdb.xml/extra-regs.xml: Add enum, mixed_flags values.
* gdb.xml/tdesc-regs.exp (load_description): New arg xml_file.
All callers updated.  Add tests for enums, mixed flags register.

8 years agoUse int instead of LONGEST in tdesc_type sizes.
Doug Evans [Tue, 15 Mar 2016 19:57:06 +0000 (12:57 -0700)]
Use int instead of LONGEST in tdesc_type sizes.

gdb/ChangeLog:

* target-descriptions.c (struct tdesc_type) <u.u.size>: Change type
from LONGEST to int.
(struct tdesc_type) <u.f.size>: Ditto.
(tdesc_set_struct_size): Change type of "size" arg from LONGEST
to int.  Add assertion size > 0.
(tdesc_create_flags): Ditto.
* target-descriptions.h (tdesc_set_struct_size): Update.
(tdesc_create_flags): Update.
* xml-tdesc.c (MAX_FIELD_SIZE, MAX_FIELD_BITSIZE): New macros.
(MAX_VECTOR_SIZE): New macro.
(tdesc_start_struct): Catch conversion errors from LONGEST to int.
(tdesc_start_flags, tdesc_start_field, tdesc_start_vector): Ditto.

8 years agomaint_print_c_tdesc_cmd: Use type for TYPE_CODE_FLAGS instead of field_type.
Doug Evans [Tue, 15 Mar 2016 19:53:55 +0000 (12:53 -0700)]
maint_print_c_tdesc_cmd: Use type for TYPE_CODE_FLAGS instead of field_type.

gdb/ChangeLog:

* target-descriptions.c (maint_print_c_tdesc_cmd): Use "type" for
TYPE_CODE_FLAGS instead of "field_type", for consistency.
* features/i386/amd64-avx-linux.c: Regenerate.
* features/i386/amd64-avx.c: Regenerate.
* features/i386/amd64-avx512-linux.c: Regenerate.
* features/i386/amd64-avx512.c: Regenerate.
* features/i386/amd64-linux.c: Regenerate.
* features/i386/amd64-mpx-linux.c: Regenerate.
* features/i386/amd64-mpx.c: Regenerate.
* features/i386/amd64.c: Regenerate.
* features/i386/i386-avx-linux.c: Regenerate.
* features/i386/i386-avx.c: Regenerate.
* features/i386/i386-avx512-linux.c: Regenerate.
* features/i386/i386-avx512.c: Regenerate.
* features/i386/i386-linux.c: Regenerate.
* features/i386/i386-mmx-linux.c: Regenerate.
* features/i386/i386-mmx.c: Regenerate.
* features/i386/i386-mpx-linux.c: Regenerate.
* features/i386/i386-mpx.c: Regenerate.
* features/i386/i386.c: Regenerate.
* features/i386/x32-avx-linux.c: Regenerate.
* features/i386/x32-avx.c: Regenerate.
* features/i386/x32-avx512-linux.c: Regenerate.
* features/i386/x32-avx512.c: Regenerate.
* features/i386/x32-linux.c: Regenerate.
* features/i386/x32.c: Regenerate.

8 years agoRemove hand-called function from test.
Doug Evans [Tue, 15 Mar 2016 19:44:34 +0000 (12:44 -0700)]
Remove hand-called function from test.

gdb/testsuite/ChangeLog:

* gdb.base/skip.c (main): Call test_skip_file_and_function.
* gdb.base/skip.exp: Remove hand calling test_skip_file_and_function.

8 years agoBind defined symbol locally in PIE
H.J. Lu [Tue, 15 Mar 2016 18:46:51 +0000 (11:46 -0700)]
Bind defined symbol locally in PIE

Symbols defined in PIE should be bound locally, the same as -shared
-Bsymbolic.

bfd/

PR ld/19827
* elf32-i386.c (elf_i386_check_relocs): Bind defined symbol
locally in PIE.
(elf_i386_relocate_section): Likewise.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.

ld/

PR ld/19827
* testsuite/ld-i386/i386.exp: Run PR ld/19827 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr19827.rd: New file.
* testsuite/ld-i386/pr19827a.S: Likewise.
* testsuite/ld-i386/pr19827b.S: Likewise.
* testsuite/ld-x86-64/pr19827.rd: Likewise.
* testsuite/ld-x86-64/pr19827a.S: Likewise.
* testsuite/ld-x86-64/pr19827b.S: Likewise.

8 years agoAdd -z noreloc-overflow option to x86-64 ld
H.J. Lu [Tue, 15 Mar 2016 18:07:06 +0000 (11:07 -0700)]
Add -z noreloc-overflow option to x86-64 ld

Add -z noreloc-overflow command-line option to the x86-64 ELF linker to
disable relocation overflow check.  This can be used to avoid relocation
overflow check if there will be no dynamic relocation overflow at
run-time.

bfd/

PR ld/19807
* elf64-x86-64.c (elf_x86_64_relocate_section): Check
no_reloc_overflow_check to diable R_X86_64_32/R_X86_64_32S
relocation overflow check.

include/

PR ld/19807
* bfdlink.h (bfd_link_info): Add no_reloc_overflow_check.

ld/

PR ld/19807
* Makefile.am (ELF_X86_DEPS): Add
$(srcdir)/emulparams/reloc_overflow.sh.
* Makefile.in: Regenerated.
* NEWS: Mention -z noreloc-overflow.
* ld.texinfo: Document -z noreloc-overflow.
* emulparams/elf32_x86_64.sh: Source
${srcdir}/emulparams/reloc_overflow.sh.
* emulparams/elf_x86_64.sh: Likewise.
* emulparams/reloc_overflow.sh: New file.
* testsuite/ld-x86-64/pr19807-1.s: New file.
* testsuite/ld-x86-64/pr19807-1a.d: Likewise.
* testsuite/ld-x86-64/pr19807-1b.d: Likewise.
* testsuite/ld-x86-64/pr19807-2.s: Likewise.
* testsuite/ld-x86-64/pr19807-2a.d: Likewise.
* testsuite/ld-x86-64/pr19807-2b.d: Likewise.
* testsuite/ld-x86-64/pr19807-2c.d: Likewise.
* testsuite/ld-x86-64/pr19807-2d.d: Likewise.
* testsuite/ld-x86-64/pr19807-2e.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/19807 tests.

8 years agoFix PR gdb/19676: Internal error in linux-thread.db.c if /proc not mounted
Pedro Alves [Tue, 15 Mar 2016 16:33:04 +0000 (16:33 +0000)]
Fix PR gdb/19676: Internal error in linux-thread.db.c if /proc not mounted

If /proc is not mounted, GDB fails an assertion in find_new_threads_once:

 Continuing.
 .../src/gdb/linux-thread-db.c:1249: internal-error: find_new_threads_once: Assertion `!target_has_execution' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)

That was supposed to catch misuses of td_ta_thr_iter, which is unsafe
for live debugging.  However, if /proc is not mounted, we still
fallback to using it.

I didn't bother with a warning, because GDB already prints several
others related to failing to open /proc files.

gdb/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>

PR gdb/19676
* linux-thread-db.c (try_thread_db_load_1): Leave
info->td_ta_thr_iter_p NULL iff debugging a live process and we
have /proc access.
(find_new_threads_once): Assert that we have a non-NULL
info->td_ta_thr_iter_p instead of checking whether the target has
execution.

8 years agoFix PR gdb/19676: Disable displaced stepping if /proc not mounted
Pedro Alves [Tue, 15 Mar 2016 16:33:04 +0000 (16:33 +0000)]
Fix PR gdb/19676: Disable displaced stepping if /proc not mounted

On GNU/Linux archs that support displaced stepping, if /proc is not
mounted, GDB gets stuck not able to step past breakpoints:

 (gdb) c
 Continuing.
 dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2163
 2163      LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
 Cannot find AT_ENTRY auxiliary vector entry.
 (gdb) c
 Continuing.
 dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2163
 2163      LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
 Cannot find AT_ENTRY auxiliary vector entry.
 (gdb)

That's because GDB can't figure out where the scratch pad is.

This is a regression introduced by the earlier changes to make the
Linux native target always work in non-stop mode.

This commit makes GDB detect the case and fallback to stepping over
breakpoints in-line.

gdb/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>

PR gdb/19676
* infrun.c (displaced_step_prepare): Also disable displaced
stepping on NOT_SUPPORTED_ERROR.
* linux-tdep.c (linux_displaced_step_location): If reading auxv
fails, throw NOT_SUPPORTED_ERROR instead of generic error.

8 years agoFix typo in previous gdb/doc/ commit
Pedro Alves [Tue, 15 Mar 2016 11:29:03 +0000 (11:29 +0000)]
Fix typo in previous gdb/doc/ commit

Should be s/reliability/reliably/.

gdb/doc/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Tracepoint Actions): Fix typo.

8 years agoDocument possible unreliability of '$_ret'
Pedro Alves [Tue, 15 Mar 2016 11:08:52 +0000 (11:08 +0000)]
Document possible unreliability of '$_ret'

gdb/doc/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>
    Andreas Arnez  <arnez@linux.vnet.ibm.com>
    Marcin Kościelnicki  <koriakin@0x04.net>

* gdb.texinfo (Tracepoint Actions): Document possible
unreliability of '$_ret'.

8 years agoUpdate x86 register name documentation.
Ulrich Drepper [Tue, 15 Mar 2016 11:00:28 +0000 (11:00 +0000)]
Update x86 register name documentation.

* doc/c-i386.texi (Register Naming): Update to details of the
        latest architecture version.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Mar 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRegenerate bfd-in2.h
H.J. Lu [Mon, 14 Mar 2016 20:17:22 +0000 (13:17 -0700)]
Regenerate bfd-in2.h

* bfd-in2.h: Regenerated.

8 years agogdb.base/default.exp: Add missing $_as_string to "show convenience" test
Simon Marchi [Mon, 14 Mar 2016 16:42:54 +0000 (12:42 -0400)]
gdb.base/default.exp: Add missing $_as_string to "show convenience" test

When adding the $_as_string convenience function, I missed a new test
failure in default.exp.  The tests lists the convenience functions, so
$_as_string should be added to the expected list.

Fixes:

+FAIL: gdb.base/default.exp: show convenience ($_caller_is = <internal function _caller_is> not found)

gdb/testsuite/ChangeLog:

* gdb.base/default.exp: Add $_as_string to the list of expected
convenience functions.

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

8 years agoAdd more tests for PR ld/19539
H.J. Lu [Sun, 13 Mar 2016 15:57:10 +0000 (08:57 -0700)]
Add more tests for PR ld/19539

PR ld/19539
* testsuite/ld-i386/i386.exp: Run pr19539.
* testsuite/ld-i386/pr19539.d: New file.
* testsuite/ld-i386/pr19539.s: Likewise.
* testsuite/ld-i386/pr19539.t: Likewise.
* testsuite/ld-x86-64/pr19539.s: Likewise.
* testsuite/ld-x86-64/pr19539.t: Likewise.
* testsuite/ld-x86-64/pr19539a.d: Likewise.
* testsuite/ld-x86-64/pr19539b.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr19539a and pr19539b.

8 years agogdb/s390: Fill gen_return_address hook.
Marcin Kościelnicki [Sat, 14 Nov 2015 22:08:07 +0000 (23:08 +0100)]
gdb/s390: Fill gen_return_address hook.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_gen_return_address): New function.
(s390_gdbarch_init): Fill gen_return_address hook.

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

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Mar 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogdb: New maint info line-table command.
Andrew Burgess [Thu, 21 Jan 2016 10:03:32 +0000 (11:03 +0100)]
gdb: New maint info line-table command.

Add a new command 'maint info line-table' to display the contents of
GDB's internal line table structure.  Useful when trying to understand
problems (within gdb) relating to line tables.

gdb/ChangeLog:

* symmisc.c (maintenance_info_line_tables): New function.
(maintenance_print_one_line_table): New function.
(_initialize_symmisc): Register 'maint info line-table' command.
* NEWS: Mention new command.

gdb/doc/ChangeLog:

* gdb.texinfo (Symbols): Document new 'maint info line-table'
command.

gdb/testsuite/ChangeLog:

* gdb.base/maint.exp: New tests for 'maint info line-table'.

8 years agogdb/s390: Fill pseudo register agent expression hooks.
Marcin Kościelnicki [Sat, 14 Nov 2015 20:18:18 +0000 (21:18 +0100)]
gdb/s390: Fill pseudo register agent expression hooks.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_ax_pseudo_register_collect): New function.
(s390_ax_pseudo_register_push_stack): New function.
(s390_gdbarch_init): Fill ax_pseudo_register_collect and
ax_pseudo_register_push_stack hooks.

8 years agoFix some places where octet to byte conversions are needed.
Dan Gissel [Fri, 11 Mar 2016 09:17:28 +0000 (09:17 +0000)]
Fix some places where octet to byte conversions are needed.

PR 19713
* elf.c (_bfd_elf_section_offset): Ensure that the returned offset
uses bytes not octets.
* elflink.c (resolve_section): Likewise.
Add a bfd parameter.
(eval_section): Pass the input_bfd to resolve_section.
(bfd_elf_perform_complex_relocation): Convert byte offset to
octets before read and writing values.
(elf_link_input_bfd): Add byte to octet conversions.
(elf_reloc_link_order): Likewise.
(elf_fixup_link_order): Likewise.
(bfd_elf_final_link): Likewise.
* reloc.c (_bfd_final_link_relocate): Likewise.
* syms.c (_bfd_stab_section_find_nearest_line): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Mar 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAdd $_as_string convenience function
Simon Marchi [Thu, 10 Mar 2016 22:12:30 +0000 (17:12 -0500)]
Add $_as_string convenience function

This patch is a follow-up to "Add printf format specifier for printing
enumerator":

  https://sourceware.org/ml/gdb-patches/2016-02/msg00144.html

Instead of having a solution specific to the printf command, Pedro
suggested adding a general purpose function $_as_string() that would
cover this use case and more.

So, in order to print the textual label of an enum, one can use:

  (gdb) printf "Visiting node of type %s\n", $_as_string(node)
  Visiting node of type NODE_INTEGER

gdb/ChangeLog:

* data-directory/Makefile.in (PYTHON_FILE_LIST): Install
gdb/function/as_string.py.
* python/lib/gdb/function/as_string.py: New file.
* NEWS: Mention the new $_as_string function.

gdb/testsuite/ChangeLog:

* gdb.python/py-as-string.exp: New file.
* gdb.python/py-as-string.c: New file.

gdb/doc/ChangeLog:

* gdb.texinfo (Convenience Functions): Document $_as_string.

8 years agoPR gas/19744: Thumb-1 pcrop relocations don't work on Thumb-2 targets
Mickael Guene [Thu, 10 Mar 2016 16:05:29 +0000 (17:05 +0100)]
PR gas/19744: Thumb-1 pcrop relocations don't work on Thumb-2 targets

gas/
* config/tc-arm.c (do_arit): Protect against bad relocations usage.
(do_mov): Likewise.
(do_t_add_sub): Allow pcrop relocations for Thumb-2 targets.
(do_t_mov_cmp): Likewise.
(do_t_add_sub): Protect against bad relocations usage.
(do_t_mov_cmp): Likewise.

gas/testsuite/
* gas/arm/adds-thumb1-reloc-local-armv7-m.s: New.
* gas/arm/adds-thumb1-reloc-local-armv7-m.d: New.
* gas/arm/movs-thumb1-reloc-local-armv7-m.s: New.
* gas/arm/movs-thumb1-reloc-local-armv7-m.d: New.

ld/
* testsuite/ld-arm/arm-elf.exp: New tests.
* testsuite/ld-arm/thumb1-adds-armv7-m.s: New.
* testsuite/ld-arm/thumb1-movs-armv7-m.s: New.

8 years agoMark the i370 target as obsolete.
Nick Clifton [Thu, 10 Mar 2016 15:29:42 +0000 (15:29 +0000)]
Mark the i370 target as obsolete.

* config.bfd: Mark the i370 target as obsolete.

8 years agoRemove bogus LONG(0) from MSP430 built in linker script.
Nick Clifton [Thu, 10 Mar 2016 10:37:19 +0000 (10:37 +0000)]
Remove bogus LONG(0) from MSP430 built in linker script.

ld * scripttempl/elf32msp430.sc (.rodata): Remove spurious LONG(0).

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

8 years agoMore "Program" -> "Thread NN received signal" testsuite adjustment
Pedro Alves [Wed, 9 Mar 2016 20:24:14 +0000 (20:24 +0000)]
More "Program" -> "Thread NN received signal" testsuite adjustment

These tests should have been adjusted by f303dbd60d9c (Fix PR
threads/19422 - show which thread caused stop), but clearly I had
missed grepping for potential-fail cases.

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

* gdb.threads/attach-into-signal.exp: Adjust to "Program received
signal" -> "Thread NN received signal" output change.
* gdb.threads/ia64-sigill.exp: Likewise.
* gdb.threads/linux-dp.exp: Likewise.
* gdb.threads/manythreads.exp: Likewise.
* gdb.threads/pending-step.exp: Likewise.
* gdb.threads/print-threads.exp: Likewise.
* gdb.threads/sigstep-threads.exp: Likewise.
* gdb.threads/staticthreads.exp: Likewise.
* gdb.threads/tls.exp: Likewise.

8 years agogdb: fix doc string of target_can_use_hardware_watchpoint.
Jose E. Marchesi [Wed, 9 Mar 2016 19:17:54 +0000 (11:17 -0800)]
gdb: fix doc string of target_can_use_hardware_watchpoint.

gdb/ChangeLog

2016-03-09  Jose E. Marchesi  <jose.marchesi@oracle.com>

* target.h: Fix doc string of target_can_use_hardware_watchpoint.

8 years agoCommand line input handling TLC
Pedro Alves [Wed, 9 Mar 2016 18:25:00 +0000 (18:25 +0000)]
Command line input handling TLC

I didn't manage to usefully split this further into smaller
independent pieces, so:

 - Use "struct buffer" more.

 - Split out the responsibility of composing a complete command line
   from multiple input lines split with backslash

    (
    E.g.:

       (gdb) print \
       1 + \
       2
       $1 = 3
       (gdb)
    )

   to a separate function.  Note we don't need the separate
   readline_input_state and more_to_come globals at all.  They were
   just obfuscating the logic.

 - Factor out the tricky mostly duplicated code in
   command_line_handler and command_line_input.

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

* event-top.c (more_to_come): Delete.
(struct readline_input_state): Delete.
(readline_input_state): Delete.
(get_command_line_buffer): New function.
(command_handler): Update comments.  Don't handle NULL commands
here.  Do not execute commented lines.
(command_line_append_input_line): New function.
(handle_line_of_input): New function, partly based on
command_line_handler and command_line_input.
(command_line_handler): Rewrite.
* event-top.h (command_handler): New declaration.
(command_loop): Defer command execution to command_handler.
(command_line_input): Update comments.  Simplify, using struct
buffer and handle_line_of_input.
* top.h (struct buffer): New forward declaration.
(handle_line_of_input): New declaration.

8 years agoSimplify saved_command_line handling
Pedro Alves [Wed, 9 Mar 2016 18:25:00 +0000 (18:25 +0000)]
Simplify saved_command_line handling

There doesn't seem to be much point in trying to reuse this buffer.
Prefer simplicity instead.

(In case you're wondering whether this fixes an off-by-one: linelength
is misnamed; it's really a size including terminating null char.)

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

* event-top.c (command_line_handler): Use xfree + xstrdup instead
of xrealloc + strcpy.
* main.c (captured_main): Use xstrdup instead of xmalloc plus
manual clear.
* top.c (saved_command_line): Rewrite comment.
(saved_command_line_size): Delete.
(command_line_input): Use xfree + xstrdup instead of xrealloc +
strcpy.
* top.h (saved_command_line_size): Delete declaration.

8 years agoUse struct buffer in gdb_readline_no_editing_callback
Pedro Alves [Wed, 9 Mar 2016 18:25:00 +0000 (18:25 +0000)]
Use struct buffer in gdb_readline_no_editing_callback

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

* event-top.c: Include buffer.h.
(gdb_readline_no_editing_callback): Use struct buffer instead
of xrealloc.

8 years agoUse struct buffer in gdb_readline_no_editing
Pedro Alves [Wed, 9 Mar 2016 18:25:00 +0000 (18:25 +0000)]
Use struct buffer in gdb_readline_no_editing

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

* common/buffer.h (buffer_grow_char): New function.
* top.c: Include buffer.h.
(gdb_readline_no_editing): Rename 'prompt_arg' parameter to
'prompt'.  Use struct buffer instead of xrealloc.

8 years agogdb_readline -> gdb_readline_no_editing
Pedro Alves [Wed, 9 Mar 2016 18:24:59 +0000 (18:24 +0000)]
gdb_readline -> gdb_readline_no_editing

Name this such that it's clearer that this is not a wrapper for the
real readline, but instead a replacement that provides no command line
editing features.

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

* defs.h (gdb_readline): Delete declaration.
* top.c (gdb_readline): Rename to ...
(gdb_readline_no_editing): ... this, and make static.

8 years agoUpdate prompt_for_continue comments
Pedro Alves [Wed, 9 Mar 2016 18:24:59 +0000 (18:24 +0000)]
Update prompt_for_continue comments

These comments are out of date -- we no longer call gdb_readline.  And
I think that mentioning the event loop is more useful here than
whatever GO32 issue had with gdb_readline, which may even no longer be
an issue.

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

* utils.c (prompt_for_continue): Update comments.

8 years agoEliminate async_annotation_suffix
Pedro Alves [Wed, 9 Mar 2016 18:24:59 +0000 (18:24 +0000)]
Eliminate async_annotation_suffix

The comments and existence of this global are a bit of misleading
obfuscation, since this is only ever used to print the prompt
annotation, and never changes.  Just hardcode "prompt" where
necessary, as done for most other annotations.

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

* event-top.c (async_annotation_suffix): Delete.
(top_level_prompt, command_line_handler): Don't use
'async_annotation_suffix' and simplify.
* event-top.h (async_annotation_suffix): Delete declaration.
(init_main): Remove reference to 'async_annotation_suffix'.

8 years agogdb_readline2 -> gdb_readline_no_editing_callback
Pedro Alves [Wed, 9 Mar 2016 18:24:59 +0000 (18:24 +0000)]
gdb_readline2 -> gdb_readline_no_editing_callback

The "2" in "gdb_readline2" doesn't really convey much.  Rename for
clarity.

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

* event-top.c (gdb_readline2): Rename to ...
(gdb_readline_no_editing_callback): ... this.
(change_line_handler, stdin_event_handler)
(gdb_setup_readline): Adjust.
* event-top.h (gdb_readline2): Rename to ...
(gdb_readline_no_editing_callback): ... this, and move closer to
other readline-related declarations.
* mi/mi-interp.c (mi_interpreter_resume): Adjust.

8 years agoGarbage collect window_hook
Pedro Alves [Wed, 9 Mar 2016 18:24:59 +0000 (18:24 +0000)]
Garbage collect window_hook

I checked, and Insight doesn't set this.

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

* top.c (window_hook): Delete.
(command_loop): Remove references to window_hook.

8 years agoTest issuing a command split in multiple lines with continuation chars
Pedro Alves [Wed, 9 Mar 2016 18:24:58 +0000 (18:24 +0000)]
Test issuing a command split in multiple lines with continuation chars

I happened to break this locally and the testsuite didn't notice it.
Add some tests.

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

* gdb.base/command-line-input.exp: New file.

8 years agogdb: Add tracepoint support for powerpc.
Marcin Kościelnicki [Thu, 7 Jan 2016 15:48:02 +0000 (16:48 +0100)]
gdb: Add tracepoint support for powerpc.

gdb/gdbserver/ChangeLog:

* linux-ppc-low.c (ppc_supports_tracepoints): New function.
(struct linux_target_ops): Wire in the above.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace.exp: Set arg0exp for ppc.
* gdb.trace/mi-trace-unavailable.exp: Set pcnum for ppc.
* gdb.trace/pending.exp: Accept leading dot before function name.
* gdb.trace/trace-common.h: Add fast tracepoint dummy insn for ppc.
* lib/trace-support.exp: Set registers for ppc.

8 years agogdb.trace/entry-values.exp: Fixes for powerpc64.
Marcin Kościelnicki [Sun, 6 Mar 2016 16:20:08 +0000 (17:20 +0100)]
gdb.trace/entry-values.exp: Fixes for powerpc64.

On powerpc64, "disassemble foo" doesn't work properly on object files
(it can't process the relocations in .opd section) - instead, let's
link it into an executable and load that.

Also, backtrace displays .main, not main.  Accept both.

gdb/testsuite/ChangeLog:

* gdb.trace/entry-values.exp: Link ${binfile}1.o to ${binfile}1 and
use it for disassembly; accept .main in addition to main in backtrace.

8 years agogdb.trace/tfind.exp: Force call via global entry point on ppc64le.
Marcin Kościelnicki [Fri, 19 Feb 2016 04:04:13 +0000 (05:04 +0100)]
gdb.trace/tfind.exp: Force call via global entry point on ppc64le.

tfind.exp sets a breakpoint on *gdb_recursion_test, which is the global
entry point on ppc64le, and won't be hit, since the call uses
the local entry.  Fix by calling the function via a pointer in a global
variable, forcing use of the global entry.

This patch is a slightly modified hunk extracted from
https://sourceware.org/ml/gdb-patches/2015-07/msg00353.html

gdb/testsuite/ChangeLog:

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

* gdb.trace/actions.c (gdb_recursion_test_fp): New typedef.
(gdb_recursion_test_ptr): New global variable.
(gdb_recursion_test): Call gdb_recursion_test_ptr instead of
gdb_recursion_test.
(gdb_c_test): Ditto.

8 years agogdb.trace/change-loc.exp: Don't depend on tracepoint ordering.
Marcin Kościelnicki [Sat, 5 Mar 2016 17:55:40 +0000 (18:55 +0100)]
gdb.trace/change-loc.exp: Don't depend on tracepoint ordering.

powerpc (32-bit) loads shared libraries below the main executable, so
the PENDING location is the first one, which the current regex doesn't
match.  Split it into two tests instead, one looking for the pending
tracepoint location, and the other for two installed locations.

gdb/testsuite/ChangeLog:

* gdb.trace/change-loc.exp: Don't depend on tracepoint location
ordering.

8 years agogdb.trace: Use manually-defined start labels in unavailable-dwarf-piece.exp
Marcin Kościelnicki [Sat, 5 Mar 2016 13:48:47 +0000 (14:48 +0100)]
gdb.trace: Use manually-defined start labels in unavailable-dwarf-piece.exp

On powerpc64, foo/bar point to a function descriptor, not to function code.
Since there are no global labels pointing at the actual function code,
let's make our own.

Regression-tested on x86_64.

gdb/testsuite/ChangeLog:

* gdb.trace/unavailable-dwarf-piece.c (foo): Add foo_start_lbl label.
(bar): Add bar_start_lbl label.
* gdb.trace/unavailable-dwarf-piece.exp: Use foo/bar_start_lbl instead
of foo/bar for emitting DWARF and tracing.

8 years agogdb/rs6000: Read backchain as unsigned.
Marcin Kościelnicki [Sun, 6 Mar 2016 15:38:52 +0000 (16:38 +0100)]
gdb/rs6000: Read backchain as unsigned.

Previously, backchain was read as a signed quantity, resulting in
addresses like 0xfffffffffffeded0 instead of 0xfffeded0 returned by
unwinder on 32-bit powerpc.  While normally such addresses are masked
off, this causes problems for tracepoints, since 0xfffffffffffeded0
is considered unavailable.

Fixes a test failure in gdb.trace/entry-values.exp.

gdb/ChangeLog:

* corefile.c (safe_read_memory_unsigned_integer): New function.
* gdbcore.h (safe_read_memory_unsigned_integer): New prototype.
* rs6000-tdep.c (rs6000_frame_cache): Read backchain as unsigned.

8 years agogdb: Add gen_return_address for powerpc.
Marcin Kościelnicki [Thu, 7 Jan 2016 16:24:48 +0000 (17:24 +0100)]
gdb: Add gen_return_address for powerpc.

gdb/ChangeLog:

* rs6000-tdep.c: Add "ax.h" and "ax-gdb.h" includes.
(rs6000_gen_return_address): New function.
(rs6000_gdbarch_init): Wire in the above.

8 years agogdb: Add ax_pseudo_register_collect for powerpc.
Marcin Kościelnicki [Thu, 7 Jan 2016 16:19:25 +0000 (17:19 +0100)]
gdb: Add ax_pseudo_register_collect for powerpc.

gdb/ChangeLog:

* rs6000-tdep.c (rs6000_ax_pseudo_register_collect): New function.
(rs6000_gdbarch_init): Wire in the above.

8 years agoWorkaround a C++ bug in GCC 4.2 in gold test
H.J. Lu [Wed, 9 Mar 2016 16:27:03 +0000 (08:27 -0800)]
Workaround a C++ bug in GCC 4.2 in gold test

G++ in GCC 4.2 silently ignores

---
__attribute__ ((section(".rodata.v1_a2")))
const short rodata_item1 = 101;
---

which leads to plugin_layout_with_alignment test failure with

Expected 12 sections, found 8 sections

since 4 .rodata sections are missing.  As a workaround, this patch
changes plugin_layout_with_alignment test from C++ to C.

* testsuite/plugin_layout_with_alignment.cc: Renamed to ..
* testsuite/plugin_layout_with_alignment.c: This.
* testsuite/Makefile.am (plugin_layout_with_alignment.o): Updated.
(plugin_layout_with_alignment): Likewise.
* testsuite/Makefile.in: Regenerated.

8 years agoS390: Recognize special jumps in prologue parser
Andreas Arnez [Wed, 9 Mar 2016 16:12:29 +0000 (17:12 +0100)]
S390: Recognize special jumps in prologue parser

Functions compiled with the gcc option `-mhotpatch' may start with a
branch-never BRCL instruction as a 6-byte NOP.  And functions compiled
with `-mstack-size' contain a BRC instruction in their prologue that is
actually a conditional trap.  Both of these special jumps cause the
prologue parser to stop and yield bad unwinding results.

This change makes the prologue analyzer recognize such special jumps and
ignore them.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_analyze_prologue): Ignore BRC and BRCL
instructions that do nothing or are conditional traps.

8 years agoS390: Add use of unavailable-stack frame ID
Andreas Arnez [Wed, 9 Mar 2016 16:12:29 +0000 (17:12 +0100)]
S390: Add use of unavailable-stack frame ID

When determining the frame ID of an inline frame, GDB currently asserts
that a valid ID of the underlying real frame is found, and that it does
not match outer_frame_id.  From inline_frame_this_id():

  /* For now, require we don't match outer_frame_id either (see
     comment above).  */
  gdb_assert (!frame_id_eq (*this_id, outer_frame_id));

However, this assertion may fail when the real frame's unwinder can not
determine the frame ID.  This happened on an s390x target with a binary
that lacked call frame information and also confused the prologue
analyzer, because then s390_frame_this_id() left the frame ID at its
default.

To fix this, this change enhances s390_frame_this_id such that an
unavailable-stack frame ID is built if no frame base can be determined
but the function address is available.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_prologue_frame_unwind_cache): Store
frame func's PC in info->func before any other failure can occur.
(s390_frame_this_id): Use frame_id_build_unavailable_stack if
info->func has been filled out.

8 years agoAvoid spaces in osabi names
Pedro Alves [Wed, 9 Mar 2016 15:52:43 +0000 (15:52 +0000)]
Avoid spaces in osabi names

It's not possible today to select some of the osabis by name.
Specifically, those that have spaces in their names and then the first
word is ambiguous...

For example:
 (gdb) set osabi <TAB>
 [...]
 FreeBSD ELF
 FreeBSD a.out
 [...]
 (gdb) set osabi FreeBSD ELF
 Ambiguous item "FreeBSD ELF".

In reality, because "set osabi" is an enum command, that was
equivalent to trying "set osabi FreeBSD", which is then obviously
ambiguous, because of "FreeBSD ELF" and "FreeBSD a.out".

Also, even if the first word is not ambiguous, we actually ignore
whatever comes after the first word:

 (gdb) set osabi GNU/Linux
 (gdb) show osabi
 The current OS ABI is "GNU/Linux".
 The default OS ABI is "GNU/Linux".
 (gdb) set osabi Windows SomeNonsense
                         ^^^^^^^^^^^^
 (gdb) show osabi
 The current OS ABI is "Windows CE".
 The default OS ABI is "GNU/Linux".
 (gdb)

Fix this by avoiding spaces in osabi names.

We could instead make "set osabi" have a custom set hook, or
alternatively make the enum set hook (in cli-setshow.c) handle values
with spaces, but OTOH, I have a feeling that could cause trouble.
E.g., in cases where we might want to write more than one enum value
in the same line.  We could support quoting as workaround, but, not
sure we want that.  "No spaces" seems like a simpler rule.

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

* osabi.c (gdb_osabi_names): Avoid spaces in osabi names.

8 years ago[FR-V] Handle FR300
Pedro Alves [Wed, 9 Mar 2016 15:46:31 +0000 (15:46 +0000)]
[FR-V] Handle FR300

Even though "set architecture" presents fr300 as option:

 (gdb) set architecture fr<TAB>
 fr300  fr400  fr450  fr500  fr550  frv

Actually selecting fr300 doesn't work:

 (gdb) set architecture fr300
 Architecture `fr300' not recognized.
 The target architecture is set automatically (currently i386)
 (gdb)

This just looks like an obvious oversight.  Looking around gcc and
binutils sources, FR300 is basically a FR500 specialized for DSP and
low power.

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

* frv-tdep.c (frv_gdbarch_init): Handle bfd_mach_fr300.

8 years agoFix v850 bfd arch info printable names
Pedro Alves [Wed, 9 Mar 2016 15:43:13 +0000 (15:43 +0000)]
Fix v850 bfd arch info printable names

Currently, it's not possible to manually set some of the v850 archs in
gdb:

 (gdb) set architecture v850<TAB>
 v850 (using old gcc ABI)
 v850-rh850
 v850e
 v850e (using old gcc ABI)
 v850e1
 [...]
 (gdb) set architecture v850 (using old gcc ABI)
 Ambiguous item "v850 (using old gcc ABI)".

The problem is that "set architecture" is a GDB "enum command", and
GDB only considers an enum value to be the string up until the first
space.  So writing "v850 (using old gcc ABI)" is the same as writing
"v850", and then that's not an unambiguous arch printable name prefix.

v850 is actually the only arch that has spaces in its printable name.
One can conveniently see that with e.g.:

 (gdb) set max-completions unlimited
 (gdb) complete set architecture
 ...

Rather than hack GDB into accepting this somehow, make v850 arch
printable names more like the printable names of the other archs, and
put the abi variant in the "machine" part, after a ':'.

We now get:

 (gdb) set architecture v850<TAB>
 v850:old-gcc-abi
 v850:rh850
 v850e
 v850e1
 v850e1:old-gcc-abi
 v850e2
 v850e2:old-gcc-abi
 [...]

And now "set architecture v850:old-gcc-abi" works as expected.

I ran the binutils/gas/ld testsuites, and found no regressions.  I
don't have a cross compiler handy, but I ran the gdb tests anyway,
which covers at least some snoke testing.

I think that the OUTPUT_ARCH in ld/scripttempl/v850.sc may have got
broken with the previous 2012 change, since I hacked v850_rh850.sc to
output "v850" and ld failed to grok it.  I think it only works if the
old GCC ABI is the configured v850 default ABI.  That's now fixed by
changing to use explicit v850:old-gcc-abi.

Also, this actually "fixes" an existing GDB test, which isn't likewise
expecting spaces in arch names, when GDB is configured for
--target=v850:

  (gdb) FAIL: gdb.xml/tdesc-arch.exp: read valid architectures

bfd/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

* cpu-v850.c (N): Append ":old-gcc-abi" instead of " (using old
gcc ABI)" to printable name.
* cpu-v850_rh850.c (bfd_v850_rh850_arch): Use "v850:rh850" instead
of "v850-rh850" as printable name.

ld/ChangeLog:
2016-03-09  Pedro Alves  <palves@redhat.com>

* scripttempl/v850.sc: Use "v850:old-gcc-abi" as OUTPUT_ARCH.
* scripttempl/v850_rh850.sc: Use "v850:rh850" as OUTPUT_ARCH.

8 years agoFor COFF and COFF/PE targets, skip relocations against absolute symbols.
Leon Winter [Wed, 9 Mar 2016 15:26:45 +0000 (15:26 +0000)]
For COFF and COFF/PE targets, skip relocations against absolute symbols.

PR ld/19623
* cofflink.c (_bfd_coff_generic_relocate_section): Do not apply
relocations against absolute symbols.

8 years agofixup -Wshadow warnings on gcc-4.7
Trevor Saunders [Wed, 9 Mar 2016 01:02:07 +0000 (20:02 -0500)]
fixup -Wshadow warnings on gcc-4.7

gcc 4.7 complains about variables that shadow function names, which now happens
in tc-arm.c because there is a global function do_align (), and local variables
do_align.  The simplest fix for this seems to be to rename those variables to
do_alignment.

gas/ChangeLog:

2016-03-09  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-arm.c (neon_alignment_bit): Rename do_align to
do_alignment.
(do_neon_ld_st_lane): Likewise.
(do_neon_ld_dup): Likewise.

8 years agoAllow zero length archive elements
Alan Modra [Wed, 9 Mar 2016 05:40:53 +0000 (16:10 +1030)]
Allow zero length archive elements

PR binutils/19775
* coff-alpha.c (alpha_ecoff_openr_next_archived_file): Allow zero
length elements in the archive.

8 years agoDon't create dynamic sections when relocatable
H.J. Lu [Wed, 9 Mar 2016 04:41:41 +0000 (20:41 -0800)]
Don't create dynamic sections when relocatable

Since dynamic sections aren't applicable to relocatable file, don't
create dynamic sections for -E/--dynamic-list when relocatable.

bfd/

PR ld/19789
* elflink.c (elf_link_add_object_symbols): Create dynamic sections
for -E/--dynamic-list only when not relocatable.

ld/

PR ld/19789
* testsuite/ld-elf/pr19789.d: New file.
* testsuite/ld-elf/pr19789.s: Likewise.

8 years agoRemove checks for constructors that might have been eliminated by GCC.
Cary Coutant [Wed, 9 Mar 2016 04:30:26 +0000 (20:30 -0800)]
Remove checks for constructors that might have been eliminated by GCC.

GCC 6 does not generate constructors for two of gold's test cases.
This patch simply removes the checks for them.

gold/
PR 19751
* testsuite/Makefile.am (retain_symbols_file_test): Remove check
for constructor.
* testsuite/Makefile.in: Regenerate.
* testsuite/dynamic_list.sh: Likewise.
* testsuite/retain_symbols_file_test.sh: Likewise.

8 years agoAdd unused attribute where necessary to quiet GCC 6 warnings.
Cary Coutant [Thu, 3 Mar 2016 22:13:10 +0000 (14:13 -0800)]
Add unused attribute where necessary to quiet GCC 6 warnings.

gold/
PR 19751
* arm.cc (Reloc_stub::Key::name): Add unused attribute.
* dirsearch.cc (Dir_caches::~Dir_caches): Likewise.

8 years agoFix Makefile so make clean removes overlooked files.
Cary Coutant [Wed, 9 Mar 2016 03:52:07 +0000 (19:52 -0800)]
Fix Makefile so make clean removes overlooked files.

gold/
* testsuite/Makefile.am: Add to MOSTLYCLEANFILES.
* testsuite/Makefile.in: Regenerate.

8 years ago[CRIS] Don't internal error if forced big endian
Pedro Alves [Tue, 8 Mar 2016 01:45:09 +0000 (01:45 +0000)]
[CRIS] Don't internal error if forced big endian

This fixes:

  $ ./gdb -q -ex "set endian big" -ex "set architecture cris"
  The target is assumed to be big endian
  .../src/gdb/cris-tdep.c:4051: internal-error: cris_gdbarch_init: big endian byte order in info
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)

The "set cris-version" command can likewise cause internal errors.

The gdbarch init routine should be returning 0 to reject the
architecture instead of internal erroring on user input.

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

* cris-tdep.c (cris_gdbarch_init): Return 0 if the info's byte
order is BFD_ENDIAN_BIG or if the cris version is unsupported.

8 years agoFix floating conversion buffer overrun when host/target format matches
Pedro Alves [Wed, 9 Mar 2016 03:01:06 +0000 (03:01 +0000)]
Fix floating conversion buffer overrun when host/target format matches

Running the testsuite with a gdb configured with --enable-libmcheck
reveals a problem:

  (gdb) ptype 3 * 2.0
  type = <12-byte float>
  memory clobbered past end of allocated block
  ERROR: Process no longer exists
  UNRESOLVED: gdb.ada/ptype_arith_binop.exp: ptype 3 * 2.0

  (gdb) PASS: gdb.dlang/expression.exp: ptype 0x1.FFFFFFFFFFFFFp1023
  ptype 0x1p-52L
  type = real
  memory clobbered past end of allocated block
  ERROR: Process no longer exists
  UNRESOLVED: gdb.dlang/expression.exp: ptype 0x1p-52L

Even though this shows up with Ada and D, it's easy to reproduce in C
too.  We just need to print a long double, when the current arch is
32-bit, which is the default when gdb starts up:

 $ ./gdb -q -ex "ptype 1.0L"
 type = long double
 memory clobbered past end of allocated block
 Aborted (core dumped)

Valgrind shows:

 ==22159== Invalid write of size 8
 ==22159==    at 0x8464A9: floatformat_from_doublest (doublest.c:756)
 ==22159==    by 0x846822: store_typed_floating (doublest.c:867)
 ==22159==    by 0x6A7959: value_from_double (value.c:3662)
 ==22159==    by 0x6A9F2D: evaluate_subexp_standard (eval.c:745)
 ==22159==    by 0x7F31AF: evaluate_subexp_c (c-lang.c:716)
 ==22159==    by 0x6A8986: evaluate_subexp (eval.c:79)
 ==22159==    by 0x6A8BA3: evaluate_type (eval.c:174)
 ==22159==    by 0x817CCF: whatis_exp (typeprint.c:456)
 ==22159==    by 0x817EAA: ptype_command (typeprint.c:508)
 ==22159==    by 0x5F267B: do_cfunc (cli-decode.c:105)
 ==22159==    by 0x5F5618: cmd_func (cli-decode.c:1885)
 ==22159==    by 0x83622A: execute_command (top.c:475)
 ==22159==  Address 0x8c6cb28 is 8 bytes inside a block of size 12 alloc'd
 ==22159==    at 0x4C2AA98: calloc (vg_replace_malloc.c:711)
 ==22159==    by 0x87384A: xcalloc (common-utils.c:83)
 ==22159==    by 0x873889: xzalloc (common-utils.c:93)
 ==22159==    by 0x6A34CB: allocate_value_contents (value.c:1036)
 ==22159==    by 0x6A3501: allocate_value (value.c:1047)
 ==22159==    by 0x6A790A: value_from_double (value.c:3656)
 ==22159==    by 0x6A9F2D: evaluate_subexp_standard (eval.c:745)
 ==22159==    by 0x7F31AF: evaluate_subexp_c (c-lang.c:716)
 ==22159==    by 0x6A8986: evaluate_subexp (eval.c:79)
 ==22159==    by 0x6A8BA3: evaluate_type (eval.c:174)
 ==22159==    by 0x817CCF: whatis_exp (typeprint.c:456)
 ==22159==    by 0x817EAA: ptype_command (typeprint.c:508)
 ==22159==
 type = long double
 (gdb)

Even if the target and host floating-point formats match, the length
of the types might still be different.  On x86, long double is the
80-bit extended precision type on both 32-bit and 64-bit ABIs, but by
default it is stored as 12 bytes on 32-bit, and 16 bytes on 64-bit,
for alignment reasons.  Several places in doublest.c already consider
this, but floatformat_to_doublest and floatformat_from_doublest miss
it.  E.g., convert_typed_floating and store_typed_floating,

Tested on x86-64 Fedora 23 with --enable-libmcheck, where it fixes the
crashed above.

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

* doublest.c: Extend comments.
(floatformat_to_doublest, floatformat_from_doublest): Copy the
floatformat's total size, not the host type's size.

8 years agoAssert that a floating type's length is at least as long as its format
Pedro Alves [Wed, 9 Mar 2016 02:29:39 +0000 (02:29 +0000)]
Assert that a floating type's length is at least as long as its format

This would have caught the HP/PA bug fixed in the previous patch:

 .../src/gdb/gdbtypes.c:4690: internal-error: arch_float_type: Assertion `len >= floatformat_totalsize_bytes (floatformats[0])' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)

Tested on x86-64 Fedora 23, --enable-targets=all.

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

* doublest.c (floatformat_totalsize_bytes): New function.
(floatformat_from_type): Assert that the type's length is at least
as long as the floatformat's totalsize.
* doublest.h (floatformat_totalsize_bytes): New declaration.
* gdbtypes.c (arch_float_type): Assert that the type's length is
at least as long as the floatformat's totalsize.

8 years agoFix HP/PA GNU/Linux "long double" format
Pedro Alves [Wed, 9 Mar 2016 01:50:02 +0000 (01:50 +0000)]
Fix HP/PA GNU/Linux "long double" format

This:

 $ ./gdb -ex "set architecture hppa1.0" -ex "set osabi GNU/Linux" -ex "ptype 1.0L"

Shows that HPPA/Linux support for long doubles is broken.  It causes
GDB to access memory out of bounds.  With Valgrind, we see:

 The target architecture is assumed to be hppa1.0
 ==4371== Invalid write of size 8
 ==4371==    at 0x4C2F21F: memset (vg_replace_strmem.c:1224)
 ==4371==    by 0x8451C4: convert_doublest_to_floatformat (doublest.c:362)
 ==4371==    by 0x845F86: floatformat_from_doublest (doublest.c:769)
 ==4371==    by 0x84628E: store_typed_floating (doublest.c:873)
 ==4371==    by 0x6A7C3D: value_from_double (value.c:3662)
 ==4371==    by 0x6AA211: evaluate_subexp_standard (eval.c:745)
 ==4371==    by 0x7F306D: evaluate_subexp_c (c-lang.c:716)
 ==4371==    by 0x6A8C6A: evaluate_subexp (eval.c:79)
 ==4371==    by 0x6A8E87: evaluate_type (eval.c:174)
 ==4371==    by 0x817B8D: whatis_exp (typeprint.c:456)
 ==4371==    by 0x817D68: ptype_command (typeprint.c:508)
 ==4371==    by 0x5F2977: do_cfunc (cli-decode.c:105)
 ==4371==  Address 0x8998d18 is 0 bytes after a block of size 8 alloc'd
 ==4371==    at 0x4C2AA98: calloc (vg_replace_malloc.c:711)
 ==4371==    by 0x8732B6: xcalloc (common-utils.c:83)
 ==4371==    by 0x8732F5: xzalloc (common-utils.c:93)
 ==4371==    by 0x6A37AF: allocate_value_contents (value.c:1036)
 ==4371==    by 0x6A37E5: allocate_value (value.c:1047)
 ==4371==    by 0x6A7BEE: value_from_double (value.c:3656)
 ==4371==    by 0x6AA211: evaluate_subexp_standard (eval.c:745)
 ==4371==    by 0x7F306D: evaluate_subexp_c (c-lang.c:716)
 ==4371==    by 0x6A8C6A: evaluate_subexp (eval.c:79)
 ==4371==    by 0x6A8E87: evaluate_type (eval.c:174)
 ==4371==    by 0x817B8D: whatis_exp (typeprint.c:456)
 ==4371==    by 0x817D68: ptype_command (typeprint.c:508)

The trouble is that hppa_linux_init_abi overrides the default
long_double_bit set by the generic hppa-tdep.c:

  set_gdbarch_long_double_bit (gdbarch, 128);
  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);

with:

  /* On hppa-linux, currently, sizeof(long double) == 8.  There has been
     some discussions to support 128-bit long double, but it requires some
     more work in gcc and glibc first.  */
  set_gdbarch_long_double_bit (gdbarch, 64);

which misses overriding the long_double_format, so we end with a weird
combination of:

  set_gdbarch_long_double_bit (gdbarch, 64);
  set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);

Weird because floatformats_ia64_quad's totalsize is longer than 64-bits.

The floatformat conversion routines use the struct floatformat's
totalsize (in bits) to know how much to copy/convert, thus the buffer
overruns.

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

* hppa-linux-tdep.c (hppa_linux_init_abi): Set the long double
format to floatformats_ieee_double.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Mar 2016 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoRefactor Output_data_reloc_base::do_write for MIPS-specific relocs.
Cary Coutant [Tue, 8 Mar 2016 20:24:39 +0000 (12:24 -0800)]
Refactor Output_data_reloc_base::do_write for MIPS-specific relocs.

This patch is a simple refactoring that will allow the MIPS backend to
replace the Output_data_reloc_base::do_write() method without copying
its entire implementation. I've moved the implementation of do_write()
into a function template, which can be instantiated with a custom
class to write the MIPS-specific relocation format. The custom class
for MIPS needs access to the symbol index and address from
Output_reloc, so I've included the part of Vlad's MIPS-64 patch that
makes those accessor methods public.

2016-03-08  Cary Coutant  <ccoutant@gmail.com>
            Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>

gold/
* output.cc (Output_reloc_writer): New type.
(Output_data_reloc_base::do_write): Move implementation to template
in output.h and replace with invocation of template.
* output.h (Output_file): Move to top of file.
(Output_reloc::get_symbol_index): Move to public interface.
(Output_reloc::get_address): Likewise.
(Output_data_reloc_base::do_write_generic): New function template.

8 years agoHandle local IFUNC symbols in shared object
H.J. Lu [Tue, 8 Mar 2016 17:42:01 +0000 (09:42 -0800)]
Handle local IFUNC symbols in shared object

Increment PLT reference count for locally defined local IFUNC symbols
in shared object since STT_GNU_IFUNC symbol must go through PLT even
if it is locally defined and undefined symbol may turn out to be a
STT_GNU_IFUNC symbol later.

bfd/

PR ld/19784
* elf32-i386.c (elf_i386_check_relocs): Increment PLT reference
count for locally defined local IFUNC symbols in shared object.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.

ld/

PR ld/19784
* testsuite/ld-i386/i386.exp: Remove pr19636-2e-nacl test.
* testsuite/ld-i386/pr19636-2e-nacl.d: Moved to ...
* testsuite/ld-i386/pr19636-2e.d: Here.  Remove notarget.
* testsuite/ld-ifunc/ifunc.exp: Run PR ld/19784 tests.
* testsuite/ld-ifunc/pass.out: New file.
* testsuite/ld-ifunc/pr19784a.c: Likewise.
* testsuite/ld-ifunc/pr19784b.c: Likewise.
* testsuite/ld-ifunc/pr19784c.c: Likewise.

8 years agoSupport --as-needed in ifunc tests
H.J. Lu [Tue, 8 Mar 2016 16:43:12 +0000 (08:43 -0800)]
Support --as-needed in ifunc tests

Since compiler may pass --as-needed to ld by default, link .o file
before .so file in ifunc tests.

PR ld/19774
* testsuite/ld-ifunc/ifunc.exp: Link tmpdir/pr18808a.o before
tmpdir/libpr18808.so.  Link tmpdir/pr18841a.o before
tmpdir/libpr18841b.so and tmpdir/libpr18841c.so.  Test
--as-needed for pr18841c.

8 years agoGroup common symbol checking together
H.J. Lu [Tue, 8 Mar 2016 13:28:55 +0000 (05:28 -0800)]
Group common symbol checking together

PR ld/19579
* elflink.c (_bfd_elf_merge_symbol): Group common symbol checking
together.

8 years ago[ARC] Allow non-instruction relocations within .text sections
Claudiu Zissulescu [Tue, 8 Mar 2016 13:19:52 +0000 (14:19 +0100)]
[ARC] Allow non-instruction relocations within .text sections

bfd/
2016-03-08  Cupertino Miranda  <Cupertino.Miranda@synopsys.com>
    Andrew Burgess  <andrew.burgess@embecosm.com>

* elf32-arc.c (arc_bfd_get_32): Becomes an alias for bfd_get_32.
(arc_bfd_put_32): Becomes an alias for bfd_put_32.
(arc_elf_howto_init): Added assert to validate relocations.
(get_middle_endian_relocation): Delete.
(middle_endian_convert): New function.
(ME): Redefine, now does nothing.
(IS_ME): New define.
(arc_do_relocation): Extend the attached 'ARC_RELOC_HOWTO'
definition to call middle_endian_convert.  Add a new local
variable and make use of this throughout. Added call to
arc_bfd_get_8 and arc_bfd_put_8 for 8 bit relocations.

gas/
2016-03-08  Andrew Burgess  <andrew.burgess@embecosm.com>

* testsuite/gas/arc/inline-data-1.d: New file.
* testsuite/gas/arc/inline-data-1.s: New file.

include/
2016-03-08  Cupertino Miranda  <Cupertino.Miranda@synopsys.com>
    Andrew Burgess  <andrew.burgess@embecosm.com>

* elf/arc-reloc.def: Add a call to ME within the formula for each
relocation that requires middle-endian correction.

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

8 years ago[ARM] Add support for Cortex-R8
Thomas Preud'homme [Mon, 7 Mar 2016 17:31:57 +0000 (17:31 +0000)]
[ARM] Add support for Cortex-R8

2016-03-07  Andre Vieira  <andre.simoesdiasvieira@arm.com>

gas/
    * config/tc-arm.c (arm_cpus): Add cortex-r8.
    * doc/c-arm.texi: Add cortex-r8.

8 years agoAllow zero length archive elements.
Nick Clifton [Mon, 7 Mar 2016 17:29:25 +0000 (17:29 +0000)]
Allow zero length archive elements.

bfd PR binutils/19775
* archive.c (bfd_generic_openr_next_archived_file): Allow zero
length elements in the archive.

binutils PR binutils/19775
* testsuite/binutils-all/ar.exp (proc empty_archive): New proc.
Run the new proc.
* testsuite/binutils-all/empty: New, empty, file.

8 years agoSupport --as-needed in i386/x86-64 tests
H.J. Lu [Mon, 7 Mar 2016 17:03:24 +0000 (09:03 -0800)]
Support --as-needed in i386/x86-64 tests

Since compiler may pass --as-needed to ld by default, link .o file
before .so file in i386/x86-64 tests.

PR ld/19774
* testsuite/ld-i386/i386.exp: Link tmpdir/pr18900.o before
tmpdir/pr18900.so and test --as-needed.  Link tmpdir/gotpc1.o
before tmpdir/got1d.so and test --as-needed.
* testsuite/ld-x86-64/x86-64.exp: Link tmpdir/pr18900.o before
tmpdir/pr18900.so and test --as-needed.

8 years agoFix "set architecture mips:10000" crash
Pedro Alves [Mon, 7 Mar 2016 00:10:30 +0000 (00:10 +0000)]
Fix "set architecture mips:10000" crash

Fix this GDB crash:

  $ gdb -ex "set architecture mips:10000"
  Segmentation fault (core dumped)

Backtrace:

  Program received signal SIGSEGV, Segmentation fault.
  0x0000000000495b1b in mips_gdbarch_init (info=..., arches=0x0) at /home/pedro/gdb/mygit/cxx-convertion/src/gdb/mips-tdep.c:8436
  8436              if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
  (top-gdb) bt
  #0  0x0000000000495b1b in mips_gdbarch_init (info=..., arches=0x0) at .../src/gdb/mips-tdep.c:8436
  #1  0x00000000007348a6 in gdbarch_find_by_info (info=...) at .../src/gdb/gdbarch.c:5155
  #2  0x000000000073563c in gdbarch_update_p (info=...) at .../src/gdb/arch-utils.c:522
  #3  0x0000000000735585 in set_architecture (ignore_args=0x0, from_tty=1, c=0x26bc870) at .../src/gdb/arch-utils.c:496
  #4  0x00000000005f29fd in do_sfunc (c=0x26bc870, args=0x0, from_tty=1) at .../src/gdb/cli/cli-decode.c:121
  #5  0x00000000005fd3f3 in do_set_command (arg=0x7fffffffdcdd "mips:10000", from_tty=1, c=0x26bc870) at .../src/gdb/cli/cli-setshow.c:455
  #6  0x0000000000836157 in execute_command (p=0x7fffffffdcdd "mips:10000", from_tty=1) at .../src/gdb/top.c:460
  #7  0x000000000071abfb in catch_command_errors (command=0x835f6b <execute_command>, arg=0x7fffffffdccc "set architecture mips:10000", from_tty=1)
      at .../src/gdb/main.c:368
  #8  0x000000000071bf4f in captured_main (data=0x7fffffffd750) at .../src/gdb/main.c:1132
  #9  0x0000000000716737 in catch_errors (func=0x71af44 <captured_main>, func_args=0x7fffffffd750, errstring=0x106b9a1 "", mask=RETURN_MASK_ALL)
      at .../src/gdb/exceptions.c:240
  #10 0x000000000071bfe6 in gdb_main (args=0x7fffffffd750) at .../src/gdb/main.c:1164
  #11 0x000000000040a6ad in main (argc=4, argv=0x7fffffffd858) at .../src/gdb/gdb.c:32
  (top-gdb)

We already check whether info.abfd is NULL before all other
bfd_get_flavour calls in the same function.  Just this one case was
missing.

(This was exposed by a WIP test that tries all "set architecture ARCH"
values.)

gdb/ChangeLog:
2016-03-07  Pedro Alves  <palves@redhat.com>

* mips-tdep.c (mips_gdbarch_init): Check whether info.abfd is NULL
before calling bfd_get_flavour.

8 years ago[AArch64] Create .got section if _GLOBAL_OFFSET_TABLE_ referenced
Jiong Wang [Mon, 7 Mar 2016 15:40:50 +0000 (15:40 +0000)]
[AArch64] Create .got section if _GLOBAL_OFFSET_TABLE_ referenced

2016-03-07  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Always create .got section
  if the symbol "_GLOBAL_OFFSET_TABLE_" referenced.

ld/
  * testsuite/ld-aarch64/implicit_got_section_1.s: New test source file.
  * testsuite/ld-aarch64/implicit_got_section_1.d: New test expected result.
  * testsuite/ld-aarch64/aarch64-elf.exp: Run new test.

8 years agoAdd const qualifiers at various places.
Trevor Saunders [Mon, 7 Mar 2016 15:16:28 +0000 (15:16 +0000)]
Add const qualifiers at various places.

opcodes * mcore-opc.h: Add const qualifiers.
* microblaze-opc.h (struct op_code_struct): Likewise.
* sh-opc.h: Likewise.
* tic4x-dis.c (tic4x_print_indirect): Likewise.
(tic4x_print_op): Likewise.

include * opcode/dlx.h (struct dlx_opcode): Add const qualifiers.
* opcode/h8300.h (struct h8_opcode): Likewise.
* opcode/hppa.h (struct pa_opcode): Likewise.
* opcode/msp430.h: Likewise.
* opcode/spu.h (struct spu_opcode): Likewise.
* opcode/tic30.h (struct _register): Likewise.
* opcode/tic4x.h (struct tic4x_register): Likewise.
(struct tic4x_cond): Likewise.
(struct tic4x_indirect): Likewise.
(struct tic4x_inst): Likewise.
* opcode/visium.h (struct reg_entry): Likewise.

gas * config/tc-arc.c: Add const qualifiers.
* config/tc-h8300.c (md_begin): Likewise.
* config/tc-ia64.c (print_prmask): Likewise.
* config/tc-msp430.c (msp430_operands): Likewise.
* config/tc-nds32.c (struct suffix_name): Likewise.
(struct nds32_parse_option_table): Likewise.
(struct nds32_set_option_table): Likewise.
(do_pseudo_pushpopm): Likewise.
(do_pseudo_pushpop_stack): Likewise.
(nds32_relax_relocs): Likewise.
(nds32_flag): Likewise.
(struct nds32_hint_map): Likewise.
(nds32_find_reloc_table): Likewise.
(nds32_match_hint_insn): Likewise.
* config/tc-s390.c: Likewise.
* config/tc-sh.c (get_specific): Likewise.
* config/tc-tic30.c: Likewise.
* config/tc-tic4x.c (tic4x_inst_add): Likewise.
(tic4x_indirect_parse): Likewise.
* config/tc-vax.c (vax_cons): Likewise.
* config/tc-z80.c (struct reg_entry): Likewise.
* config/tc-epiphany.c (md_assemble): Adjust.
(epiphany_assemble): New function.
(epiphany_elf_section_rtn): Call do_align directly.
(epiphany_elf_section_text): Likewise.
* config/tc-ip2k.c (ip2k_elf_section_rtn): Likewise.
(ip2k_elf_section_text): Likewise.
* read.c (do_align): Make it not static.
* read.h (do_align): New prototype.

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

8 years agoSet executable bit on analyze-racy-logs.py
Sergio Durigan Junior [Sun, 6 Mar 2016 22:30:19 +0000 (17:30 -0500)]
Set executable bit on analyze-racy-logs.py

I forgot to do it in my previous commit.  This is necessary because we
execute the script directly on gdb/testsuite/Makefile.in.

gdb/testsuite/ChangeLog:
2016-03-06  Sergio Durigan Junior  <sergiodj@redhat.com>

* analyze-racy-logs.py: Set executable bit.

8 years agoLink tmpdir/copyreloc-main.o before tmpdir/copyreloc-lib.so
H.J. Lu [Sun, 6 Mar 2016 16:26:49 +0000 (08:26 -0800)]
Link tmpdir/copyreloc-main.o before tmpdir/copyreloc-lib.so

Since compiler may pass --as-needed to ld by default, link
tmpdir/copyreloc-main.o before tmpdir/copyreloc-lib.so.

* testsuite/ld-i386/i386.exp: Link tmpdir/copyreloc-main.o
before tmpdir/copyreloc-lib.so and test --as-needed.
* testsuite/ld-x86-64/x86-64.exp: Likewise.

8 years agoImprove analysis of racy testcases
Sergio Durigan Junior [Sun, 6 Mar 2016 01:37:11 +0000 (20:37 -0500)]
Improve analysis of racy testcases

This is an initial attempt to introduce some mechanisms to identify
racy testcases present in our testsuite.  As can be seen in previous
discussions, racy tests are really bothersome and cause our BuildBot
to pollute the gdb-testers mailing list with hundreds of
false-positives messages every month.  Hopefully, identifying these
racy tests in advance (and automatically) will contribute to the
reduction of noise traffic to gdb-testers, maybe to the point where we
will be able to send the failure messages directly to the authors of
the commits.

I spent some time trying to decide the best way to tackle this
problem, and decided that there is no silver bullet.  Racy tests are
tricky and it is difficult to catch them, so the best solution I could
find (for now?) is to run our testsuite a number of times in a row,
and then compare the results (i.e., the gdb.sum files generated during
each run).  The more times you run the tests, the more racy tests you
are likely to detect (at the expense of waiting longer and longer).
You can also run the tests in parallel, which makes things faster (and
contribute to catching more racy tests, because your machine will have
less resources for each test and some of them are likely to fail when
this happens).  I did some tests in my machine (8-core i7, 16GB RAM),
and running the whole GDB testsuite 5 times using -j6 took 23 minutes.
Not bad.

In order to run the racy test machinery, you need to specify the
RACY_ITER environment variable.  You will assign a number to this
variable, which represents the number of times you want to run the
tests.  So, for example, if you want to run the whole testsuite 3
times in parallel (using 2 cores), you will do:

  make check RACY_ITER=3 -j2

It is also possible to use the TESTS variable and specify which tests
you want to run:

  make check TEST='gdb.base/default.exp' RACY_ITER=3 -j2

And so on.  The output files will be put at the directory
gdb/testsuite/racy_outputs/.

After make invokes the necessary rules to run the tests, it finally
runs a Python script that will analyze the resulting gdb.sum files.
This Python script will read each file, and construct a series of sets
based on the results of the tests (one set for FAIL's, one for
PASS'es, one for KFAIL's, etc.).  It will then do some set operations
and come up with a list of unique, sorted testcases that are racy.
The algorithm behind this is:

  for state in PASS, FAIL, XFAIL, XPASS...; do
    if a test's state in every sumfile is $state; then
      it is not racy
    else
      it is racy

(The algorithm is actually a bit more complex than that, because it
takes into account other things in order to decide whether the test
should be ignored or not).

IOW, a test must have the same state in every sumfile.

After processing everything, the script prints the racy tests it could
identify on stdout.  I am redirecting this to a file named racy.sum.

Something else that I wasn't sure how to deal with was non-unique
messages in our testsuite.  I decided to do the same thing I do in our
BuildBot: include a unique identifier in the end of message, like:

  gdb.base/xyz.exp: non-unique message
  gdb.base/xyz.exp: non-unique message <<2>>

This means that you will have to be careful about them when you use
the racy.sum file.

I ran the script several times here, and it did a good job catching
some well-known racy tests.  Overall, I am satisfied with this
approach and I think it will be helpful to have it upstream'ed.  I
also intend to extend our BuildBot and create new, specialized
builders that will be responsible for detecting the racy tests every X
number of days.

2016-03-05  Sergio Durigan Junior  <sergiodj@redhat.com>

* Makefile.in (DEFAULT_RACY_ITER): New variable.
(CHECK_TARGET_TMP): Likewise.
(check-single-racy): New rule.
(check-parallel-racy): Likewise.
(TEST_TARGETS): Adjust rule to account for RACY_ITER.
(do-check-parallel-racy): New rule.
(check-racy/%.exp): Likewise.
* README (Racy testcases): New section.
* analyze-racy-logs.py: New file.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 6 Mar 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix argument passing for call
Denis Chertykov [Sat, 5 Mar 2016 12:17:15 +0000 (15:17 +0300)]
Fix argument passing for call

When calling function with argument of size more than 8 bytes fails with
an error "That operation is not available on integers of more than 8 bytes.".
avr-gdb considers only 8 bytes (sizeof(long long)) in case of passing the
argument in registers. When the argument is of size more than 8 byte
then the utility function to extract bytes failed with the above error.

    gdb/
* avr-tdep.c (AVR_LAST_ARG_REGNUM): Define.
        (avr_push_dummy_call): Correct last needed argument register.
        Write MSB of argument into register and subsequent bytes into
        other registers in decreasing order.

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

8 years agoFix datestamps on ChangeLog entries to read 2015 instead of 2016.
Cary Coutant [Fri, 4 Mar 2016 22:17:39 +0000 (14:17 -0800)]
Fix datestamps on ChangeLog entries to read 2015 instead of 2016.