binutils-gdb.git
8 years agoFix AIX gdb build with C++ compiler
Pedro Alves [Thu, 21 Apr 2016 13:02:20 +0000 (14:02 +0100)]
Fix AIX gdb build with C++ compiler

We currently get:

 ../../src/gdb/aix-thread.c: In function 'int pdc_read_data(pthdb_user_t, void*, pthdb_addr_t, size_t)':
 ../../src/gdb/aix-thread.c:465:46: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive]
    status = target_read_memory (addr, buf, len);
       ^

 ../../src/gdb/aix-thread.c: In function 'void aix_thread_resume(target_ops*, ptid_t, int, gdb_signal)':
 ../../src/gdb/aix-thread.c:1010:46: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
 gdb_signal_to_host (sig), (void *) tid);
       ^
 ../../src/gdb/aix-thread.c:243:1: error:   initializing argument 5 of 'int ptrace64aix(int, int, long long int, int, int*)' [-fpermissive]
  ptrace64aix (int req, int id, long long addr, int data, int *buf)

 ../../src/gdb/rs6000-nat.c: In function 'gdb_byte* rs6000_ptrace_ldinfo(ptid_t)':
 ../../src/gdb/rs6000-nat.c:596:36: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive]
    gdb_byte *ldi = xmalloc (ldi_size);
     ^
 ../../src/gdb/rs6000-nat.c:615:36: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive]
ldi = xrealloc (ldi, ldi_size);
     ^

(and more instances of the same).

gdb/ChangeLog:
2016-04-21  Pedro Alves  <palves@redhat.com>

* aix-thread.c (pdc_read_data, pdc_write_data): Add cast.
(aix_thread_resume): Use PTRACE_TYPE_ARG5.
* rs6000-nat.c (rs6000_ptrace64): Use PTRACE_TYPE_ARG5.
(rs6000_ptrace_ldinfo): Change type of 'ldi' local to void
pointer, and cast return to gdb_byte pointer.

8 years agoFix s390 GNU/Linux gdb and gdbserver builds
Pedro Alves [Thu, 21 Apr 2016 10:42:13 +0000 (06:42 -0400)]
Fix s390 GNU/Linux gdb and gdbserver builds

Now that gdb/gdbserver compile as C++ programs by default, the s390
GNU/Linux build started failing with:

 In file included from ../../src/gdb/common/common-defs.h:64:0,
  from ../../src/gdb/defs.h:28,
  from ../../src/gdb/s390-linux-nat.c:22:
 ../../src/gdb/s390-linux-nat.c: In function ‘void fetch_regset(regcache*, int, int, int, const regset*)’:
 ../../src/gdb/../include/libiberty.h:711:38: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
  # define alloca(x) __builtin_alloca(x)
       ^
 ../../src/gdb/s390-linux-nat.c:297:19: note: in expansion of macro ‘alloca’
    gdb_byte *buf = alloca (regsize);
    ^

etc.

gdb/ChangeLog:
2016-04-21  Pedro Alves  <palves@redhat.com>

* s390-linux-nat.c (fetch_regset, store_regset, check_regset): Use
void * instead of gdb_byte *.

gdb/gdbserver/ChangeLog:
2016-04-21  Pedro Alves  <palves@redhat.com>

* linux-s390-low.c (s390_collect_ptrace_register)
(s390_supply_ptrace_register, s390_get_hwcap): Use gdb_byte * and
add casts.
(s390_check_regset): Use void * instead of gdb_byte *.

8 years agoAdd missing sentinel 'char *' casts in concat/reconcat calls
Pedro Alves [Thu, 21 Apr 2016 10:34:18 +0000 (11:34 +0100)]
Add missing sentinel 'char *' casts in concat/reconcat calls

The wildebeest-debian-wheezy-i686 buildslave's build is broken due to:

 ../../binutils-gdb/gdb/python/python.c: In function void _initialize_python():
 ../../binutils-gdb/gdb/python/python.c:1709:36: error: missing sentinel in function call [-Werror=format]

Reproduced on Fedora 23 by sticking a few:

 #undef NULL
 #define 0

in build/gdb/build-gnulib/{stddef|signal|stdio}.h.  Hopefully this
caught all instances.

gdb/ChangeLog:
2016-04-21  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (try_open_dwop_file, open_dwo_file)
(file_file_name, file_full_name): Add char * cast to sentinel in
concat/reconcat calls.
* event-top.c (top_level_prompt): Likewise.
* guile/guile.c (initialize_scheme_side): Likewise.
* linux-tdep.c (linux_fill_prpsinfo): Likewise.
* macrotab.c (macro_source_fullname): Likewise.
* main.c (get_init_files, captured_main): Likewise.
* psymtab.c (psymtab_to_fullname): Likewise.
* python/python.c (_initialize_python)
(gdbpy_finish_initialization): Likewise.
* source.c (symtab_to_fullname): Likewise.

8 years agoNew NOCROSSREFS_TO tests
Alan Modra [Thu, 21 Apr 2016 01:35:41 +0000 (11:05 +0930)]
New NOCROSSREFS_TO tests

Fixes failures on hppa-linux and alpha-linux due to not merging
.data.* and .sdata into .data.  cross3.t modified too since it is the
template for the NOCROSSREFS_TO scripts.

* testsuite/ld-scripts/cross3.t: Add commonly used data
and text section names to output section statements.
* testsuite/ld-scripts/cross4.t: Likewise.
* testsuite/ld-scripts/cross5.t: Likewise.
* testsuite/ld-scripts/cross6.t: Likewise.
* testsuite/ld-scripts/cross7.t: Likewise.

8 years agoRemove x86 gc_sweep_hook
H.J. Lu [Thu, 21 Apr 2016 00:12:46 +0000 (17:12 -0700)]
Remove x86 gc_sweep_hook

Since x86 backends never see the removed sections, there is no need
for gc_sweep_hook.

* elf32-i386.c (elf_i386_gc_sweep_hook): Removed.
(elf_backend_gc_sweep_hook): Likewise.
* elf64-x86-64.c (elf_x86_64_gc_sweep_hook): Likewise.
(elf_backend_gc_sweep_hook): Likewise.

8 years agoDon't check relocations in excluded sections
H.J. Lu [Thu, 21 Apr 2016 00:10:55 +0000 (17:10 -0700)]
Don't check relocations in excluded sections

When checking relocations after gc-sections has run, the unused sections
have been removed.  Don't check relocations in excluded sections.

* elflink.c (_bfd_elf_link_check_relocs): Don't check relocations
in excluded sections

8 years agoMove ELF relocation check after lang_gc_sections
H.J. Lu [Thu, 21 Apr 2016 00:06:58 +0000 (17:06 -0700)]
Move ELF relocation check after lang_gc_sections

Move ELF relocation check after lang_gc_sections so that all the
reference counting code for plt and got relocs can be removed.  This
only affects ELF targets which check relocations after opening all
input file.

* ldlang.c (lang_check_relocs): New function.
(lang_process): Call lang_check_relocs after lang_gc_sections.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't
call _bfd_elf_link_check_relocs here.

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

8 years agoBuild GDB as a C++ program by default
Pedro Alves [Wed, 20 Apr 2016 22:20:15 +0000 (23:20 +0100)]
Build GDB as a C++ program by default

This makes --enable-build-with-cxx be "yes" by default.

One must now configure with --enable-build-with-cxx=no in order to
build with a C compiler.

gdb/ChangeLog:
2016-04-20  Pedro Alves  <palves@redhat.com>

* build-with-cxx.m4 (GDB_AC_BUILD_WITH_CXX): Default to yes.
* configure: Renegerate.

gdb/gdbserver/ChangeLog:
2016-04-20  Pedro Alves  <palves@redhat.com>

* configure: Renegerate.

8 years agoFix host signal vs gdb signal mixup in gdb/darwin-nat.c
Pedro Alves [Wed, 20 Apr 2016 19:13:23 +0000 (20:13 +0100)]
Fix host signal vs gdb signal mixup in gdb/darwin-nat.c

Building in C++ mode caught a bug here:

 .../src/gdb/darwin-nat.c: In function 'ptid_t darwin_decode_message(mach_msg_header_t*, darwin_thread_t**, inferior**, target_waitstatus*)':
 .../src/gdb/darwin-nat.c:1016:25: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
      status->value.sig = WTERMSIG (wstatus);
  ^

gdb/ChangeLog:
2016-04-20  Pedro Alves  <palves@redhat.com>

* darwin-nat.c (darwin_decode_message): Use gdb_signal_from_host.

8 years agoFix "incompatible pointer type" warning in gdb/aarch64-tdep.c
Pedro Alves [Wed, 20 Apr 2016 19:15:21 +0000 (20:15 +0100)]
Fix "incompatible pointer type" warning in gdb/aarch64-tdep.c

Fixes, with x86_64-apple-darwin15-gcc (gcc 5.3.0):

 .../src/gdb/aarch64-tdep.c: In function 'aarch64_record_load_store':
 .../src/gdb/aarch64-tdep.c:3479:67: error: passing argument 3 of 'regcache_raw_read_unsigned' from incompatible pointer type [-Werror=incompatible-pointer-types]
       bits (aarch64_insn_r->aarch64_insn, 16, 20), &reg_rm_val);
    ^
 In file included from .../src/gdb/regcache.h:23:0,
  from .../src/gdb/gdbarch.h:69,
  from .../src/gdb/defs.h:620,
  from .../src/gdb/aarch64-tdep.c:21:
 .../src/gdb/common/common-regcache.h:60:29: note: expected 'ULONGEST * {aka long unsigned int *}' but argument is of type 'uint64_t * {aka long long unsigned int *}'
  extern enum register_status regcache_raw_read_unsigned
      ^

gdb/ChangeLog:
2016-04-20  Pedro Alves  <palves@redhat.com>

* aarch64-tdep.c (aarch64_record_load_store): Change type of
'reg_rm_val' local to ULONGEST.

8 years agogdb/darwin-nat.c: Fix "cast to pointer from integer of different size" warning
Pedro Alves [Wed, 20 Apr 2016 20:42:57 +0000 (21:42 +0100)]
gdb/darwin-nat.c: Fix "cast to pointer from integer of different size" warning

Fixes, with gcc 5.3.0:

 .../src/gdb/darwin-nat.c: In function 'void darwin_resume_thread(inferior*, darwin_thread_t*, int, int)':
 .../src/gdb/darwin-nat.c:731:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     (caddr_t)thread->gdb_port, nsignal);
      ^
 .../src/gdb/darwin-nat.c:84:35: note: in definition of macro 'PTRACE'
   darwin_ptrace(#CMD, CMD, (PID), (ADDR), (SIG))
    ^

thread->gdb_port is an unsigned int, caddr_t is a void pointer.

gdb/ChangeLog:
2016-04-20  Pedro Alves  <palves@redhat.com>

* darwin-nat.c (darwin_resume_thread): Add uintptr_t cast.

8 years agoCheck R_386_NONE/R_X86_64_NONE in eh6.d
H.J. Lu [Wed, 20 Apr 2016 18:15:05 +0000 (11:15 -0700)]
Check R_386_NONE/R_X86_64_NONE in eh6.d

There is no need for run-time relocation when converting pointers
in .eh_frame section to DW_EH_PE_pcrel encoding.  R_386_NONE and
R_X86_64_NONE are expected since the space for run-time relocation
has been allocated.  This is an optimization.

PR ld/19972
* testsuite/ld-elf/eh6.d: Pass -rW to readelf and check for
R_386_NONE or R_X86_64_NONE.

8 years agoAdd ld-x86-64/pic1 test
H.J. Lu [Wed, 20 Apr 2016 18:13:38 +0000 (11:13 -0700)]
Add ld-x86-64/pic1 test

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

8 years agoAdd ld-x86-64/pie2 test
H.J. Lu [Wed, 20 Apr 2016 18:12:06 +0000 (11:12 -0700)]
Add ld-x86-64/pie2 test

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

8 years agoCheck run-time R_X86_64_32 relocation overflow
H.J. Lu [Wed, 20 Apr 2016 18:10:21 +0000 (11:10 -0700)]
Check run-time R_X86_64_32 relocation overflow

Since elf_x86_64_check_relocs is called after opening all input files,
we can detect dynamic R_X86_64_32 relocation overflow there.

bfd/

PR ld/19969
* elf64-x86-64.c (check_relocs_failed): New.
(elf_x86_64_need_pic): Moved before elf_x86_64_check_relocs.
Support relocation agaist local symbol.  Set check_relocs_failed.
(elf_x86_64_check_relocs): Use elf_x86_64_need_pic.  Check
R_X86_64_32 relocation overflow.
(elf_x86_64_relocate_section): Skip if check_relocs failed.
Update one elf_x86_64_need_pic and remove one elf_x86_64_need_pic.

ld/

PR ld/19969
* testsuite/ld-x86-64/pr19969.d: New file.
* testsuite/ld-x86-64/pr19969a.S: Likewise.
* testsuite/ld-x86-64/pr19969b.S: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr19969 tests.

8 years agosymmisc.c (dump_symtab_1): Print owning compunit for identical blockvectors.
Doug Evans [Wed, 20 Apr 2016 17:17:12 +0000 (10:17 -0700)]
symmisc.c (dump_symtab_1): Print owning compunit for identical blockvectors.

* symmisc.c (dump_symtab_1): Print owning compunit for identical
blockvectors.

8 years agoInclude arch/arm-linux.h in aarch32-linux-nat.c
Yao Qi [Wed, 20 Apr 2016 14:02:54 +0000 (15:02 +0100)]
Include arch/arm-linux.h in aarch32-linux-nat.c

Fix the compilation failure by including arch/arm-linux.h in
aarch32-linux-nat.c.

gdb:

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

* aarch32-linux-nat.c: Include "arch/arm-linux.h".

8 years agoCall _bfd_elf_create_ifunc_sections only for ifunc
H.J. Lu [Wed, 20 Apr 2016 12:34:02 +0000 (05:34 -0700)]
Call _bfd_elf_create_ifunc_sections only for ifunc

Since x86 check_relocs is called after opening all input files, we
need to call _bfd_elf_create_ifunc_sections only for STT_GNU_IFUNC
symbols.

* elf32-i386.c (elf_i386_check_relocs): Call
_bfd_elf_create_ifunc_sections only for STT_GNU_IFUNC symbol.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.

8 years agoCheck ELF relocs after opening all input files
H.J. Lu [Wed, 20 Apr 2016 12:26:37 +0000 (05:26 -0700)]
Check ELF relocs after opening all input files

Delaying checking ELF relocations until opening all input files so
that symbol information is final when relocations are checked.  This
is only enabled for x86 targets.

bfd/

* elf-bfd.h (_bfd_elf_link_check_relocs): New.
* elflink.c (_bfd_elf_link_check_relocs): New function.
(elf_link_add_object_symbols): Call _bfd_elf_link_check_relocs
if check_relocs_after_open_input is FALSE.

include/

* bfdlink.h (bfd_link_info): Add check_relocs_after_open_input.

ld/

* emulparams/elf32_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
New.
* emulparams/elf_i386.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/elf_i386_be.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/elf_i386_chaos.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/elf_i386_ldso.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/elf_i386_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/elf_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emulparams/i386nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT):
Likewise.
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse):
Set check_relocs_after_open_input to TRUE if
CHECK_RELOCS_AFTER_OPEN_INPUT is yes.
(gld${EMULATION_NAME}_after_open): Call
_bfd_elf_link_check_relocs on all inputs if
check_relocs_after_open_input is TRUE.

8 years agoMove ARM_CPSR_GREGNUM to arch/arm-linux.h
Yao Qi [Wed, 20 Apr 2016 11:31:53 +0000 (12:31 +0100)]
Move ARM_CPSR_GREGNUM to arch/arm-linux.h

This patch moves macro ARM_CPSR_GREGNUM to arch/arm-linux.h so that it
can be used in GDBserver side.

gdb:

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

* arm-linux-tdep.h (ARM_CPSR_GREGNUM): Move it to ...
* arch/arm-linux.h: ... here.

gdb/gdbserver:

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

* linux-aarch32-low.c: Include "arch/arm-linux.h".
(arm_fill_gregset): Use ARM_CPSR_GREGNUM rather than magic
number 16.
(arm_store_gregset): Likewise.

8 years agoReplace .long with .dc.a on my_personality_v0
H.J. Lu [Wed, 20 Apr 2016 11:27:47 +0000 (04:27 -0700)]
Replace .long with .dc.a on my_personality_v0

We should use .dc.a instead of .long to take address of a symbol.

* testsuite/ld-elf/eh6.s: Replace .long with .dc.a on
my_personality_v0.

8 years agoupdate many old style function definitions
Trevor Saunders [Wed, 13 Apr 2016 22:30:46 +0000 (18:30 -0400)]
update many old style function definitions

This includes regenerating a bunch of files in opcodes/ with trunk cgen.

gprof/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* basic_blocks.c: Update old style function definitions.
* cg_arcs.c: Likewise.
* cg_print.c: Likewise.
* gen-c-prog.awk: Likewise.
* gmon_io.c: Likewise.
* hertz.c: Likewise.
* hist.c: Likewise.
* sym_ids.c: Likewise.

bfd/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* cache.c: Update old style function definitions.
* elf32-m68k.c: Likewise.
* elf64-mmix.c: Likewise.
* stab-syms.c: Likewise.

opcodes/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* alpha-dis.c: Regenerate.
* crx-dis.c: Likewise.
* disassemble.c: Likewise.
* epiphany-opc.c: Likewise.
* fr30-opc.c: Likewise.
* frv-opc.c: Likewise.
* ip2k-opc.c: Likewise.
* iq2000-opc.c: Likewise.
* lm32-opc.c: Likewise.
* lm32-opinst.c: Likewise.
* m32c-opc.c: Likewise.
* m32r-opc.c: Likewise.
* m32r-opinst.c: Likewise.
* mep-opc.c: Likewise.
* mt-opc.c: Likewise.
* or1k-opc.c: Likewise.
* or1k-opinst.c: Likewise.
* tic80-opc.c: Likewise.
* xc16x-opc.c: Likewise.
* xstormy16-opc.c: Likewise.

ld/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* emultempl/scoreelf.em: Likewise.

binutils/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* resres.c: Likewise.

gas/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* cgen.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-mep.c: Likewise.
* config/tc-metag.c: Likewise.
* config/tc-nios2.c: Likewise.
* config/tc-rl78.c: Likewise.

8 years agochange argument type to bfd_byte
Trevor Saunders [Wed, 13 Apr 2016 08:41:23 +0000 (04:41 -0400)]
change argument type to bfd_byte

We operate on the pointer's target as a set of bytes, and this avoids doing
arithmetic on void * which is undefined in ISO C.

bfd/ChangeLog:

2016-04-20  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* elf32-arm.c (put_thumb2_insn): Change argument type to bfd_byte *.

8 years agogas/doc/arc: Add nps400 references into the documentation
Andrew Burgess [Tue, 19 Apr 2016 18:02:27 +0000 (19:02 +0100)]
gas/doc/arc: Add nps400 references into the documentation

Add nps400 to the list of acceptable values for the -mcpu command line
switch, and to the .cpu directive.

I've added an extra cross reference from -mcpu to .cpu to improve
navigation of the documentation.

gas/ChangeLog:

* doc/c-arc.texi (ARC Options): Add nps400 to list of valus for
-mcpu.  Add cross reference to .cpu directive from -mcpu option.
(ARC Directives): Add NPS400 to .cpu directive list.

8 years agoarc: Fix relocation formula for ARC_NPS_CMEM16 relocation
Andrew Burgess [Tue, 19 Apr 2016 16:40:41 +0000 (17:40 +0100)]
arc: Fix relocation formula for ARC_NPS_CMEM16 relocation

The ME modifier was missing from the relocation formula for the
ARC_NPS_CMEM16 relocation, and as such the relocation would not patch
correctly on little endian targets.

include/ChangeLog:

* elf/arc-reloc.def (ARC_NPS_CMEM16): Add ME modifier to formula.

8 years ago[AArch64] Support RAS extension for ARMv8 onwards.
Matthew Wahab [Wed, 20 Apr 2016 08:31:49 +0000 (09:31 +0100)]
[AArch64] Support RAS extension for ARMv8 onwards.

The RAS extension was introduced as part of the ARMv8.2 architecture
where it is a required feature. It is also available as an optional
feature for ARMv8 and ARMv8.1. In binutils, the RAS extension is
currently enabled by default for -march=armv8.2-a but is not available
for -march=armv8 or -march=armv8.1-a.

This patch adds the feature extension '+ras' to enable the RAS extension
for ARMv8 and ARMv8.1, it is disabled by default.

gas/
2016-04-20  Matthew Wahab  <matthew.wahab@arm.com>

* config/tc-aarch64.c (aarch64_features): Add "ras".
* doc/c-aarch64.texi (AArch64 Extensions): Add "ras".
* testsuite/gas/aarch64/armv8-ras-1.d: New.
* testsuite/gas/aarch64/armv8-ras-1.s: New.
* testsuite/gas/aarch64/illegal-ras-1.d: New.
* testsuite/gas/aarch64/illegal-ras-1.s: New.

Change-Id: I824fb9bc8cf846bcc03aa17a726efb1350d78b9d

8 years agoAdd another testcase for PR ld/19719
H.J. Lu [Wed, 20 Apr 2016 03:11:55 +0000 (20:11 -0700)]
Add another testcase for PR ld/19719

This test checks run-time relocation overflow with GOT relocation and
32-bit relocation against the same symbol.

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

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

8 years agoHandle void * conversions in FreeBSD/x86 native code to fix C++ build.
John Baldwin [Tue, 19 Jan 2016 19:02:09 +0000 (11:02 -0800)]
Handle void * conversions in FreeBSD/x86 native code to fix C++ build.

gdb/ChangeLog:

* amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Change xstateregs
to void *.
(amd64bsd_store_inferior_registers): Likewise.
* fbsd-nat.c (resume_one_thread_cb): Explicitly cast data to ptid_t *.
(resume_all_threads_cb): Likewise.
* i386bsd-nat.c (i386bsd_supply_gregset): Cast gregs to char *.
(i386bsd_collect_gregset): Likewise.
(i386bsd_fetch_inferior_registers): Change xstateregs to void *.
(i386bsd_store_inferior_registers): Likewise.

8 years agoCast the pointer assigned to ss_sp to char *.
John Baldwin [Tue, 19 Apr 2016 20:51:05 +0000 (13:51 -0700)]
Cast the pointer assigned to ss_sp to char *.

FreeBSD versions older than 11.0 use char * as the type of ss_sp in
stack_t instead of the standards-defined void *.  C++ allows a char *
pointer to be converted to a void *, so it is safe to cast the return
value of xmalloc to char * if ss_sp is either a char * or void *.
Just always use the cast to char * since that is less ugly than having
to add a special case.

gdb/ChangeLog:

* main.c (setup_alternate_signal_stack): Cast to char *.

8 years agoopcodes/arc: Add yet more nps instructions
Andrew Burgess [Fri, 1 Apr 2016 18:51:50 +0000 (19:51 +0100)]
opcodes/arc: Add yet more nps instructions

Add some more arc/nps400 instructions and the associated operands.
There's also a test added into the assembler.

gas/ChangeLog:

* testsuite/gas/arc/nps400-6.d: New file.
* testsuite/gas/arc/nps400-6.s: New file.

include/ChangeLog:

* opcode/arc.h (MAX_INSN_ARGS): Increase 6 to 8.

opcodes/ChangeLog:

* arc-nps400-tbl.h: Add addb, subb, adcb, sbcb, andb, xorb, orb,
fxorb, wxorb, shlb, shrb, notb, cntbb, div, mod, divm, and qcmp
instructions.
* arc-opc.c (insert_nps_bitop_size): Delete.
(extract_nps_bitop_size): Delete.
(MAKE_SRC_POS_INSERT_EXTRACT_FUNCS): Define, and use.
(extract_nps_qcmp_m3): Define.
(extract_nps_qcmp_m2): Define.
(extract_nps_qcmp_m1): Define.
(arc_flag_operands): Add F_NPS_SX, F_NPS_AR, F_NPS_AL.
(arc_flag_classes): Add C_NPS_SX, C_NPS_AR_AL
(arc_operands): Add NPS_SRC2_POS, NPS_SRC1_POS, NPS_ADDB_SIZE,
NPS_ANDB_SIZE, NPS_FXORB_SIZ, NPS_WXORB_SIZ, NPS_R_XLDST,
NPS_DIV_UIMM4, NPS_QCMP_SIZE, NPS_QCMP_M1, NPS_QCMP_M2, and
NPS_QCMP_M3.

8 years agoopcodes/arc: Add more nps instructions
Andrew Burgess [Thu, 31 Mar 2016 18:51:14 +0000 (19:51 +0100)]
opcodes/arc: Add more nps instructions

Add dctcp, dcip, dcet, and dcacl instructions.

gas/ChangeLog:

* testsuite/gas/arc/nps400-4.d: New file.
* testsuite/gas/arc/nps400-4.s: New file.
* testsuite/gas/arc/nps400-5.d: New file.
* testsuite/gas/arc/nps400-5.s: New file.

include/ChangeLog:

* opcode/arc.h (insn_class_t): Add NET and ACL class.

opcodes/ChangeLog:

* arc-nps400-tbl.h: Add dctcp, dcip, dcet, and dcacl instructions.

8 years agoAdd pr number to earlier entry.
Doug Evans [Tue, 19 Apr 2016 16:57:04 +0000 (09:57 -0700)]
Add pr number to earlier entry.

8 years agosymmisc.c (dump_symtab_1, dump_symtab): Delete arg objfile.
Doug Evans [Tue, 19 Apr 2016 16:52:45 +0000 (09:52 -0700)]
symmisc.c (dump_symtab_1, dump_symtab): Delete arg objfile.

gdb/ChangeLog:

* symmisc.c (dump_symtab_1, dump_symtab): Delete arg objfile.
All callers updated.

8 years agoFix copyright year, remove linux only test.
Doug Evans [Tue, 19 Apr 2016 16:06:53 +0000 (09:06 -0700)]
Fix copyright year, remove linux only test.

8 years ago* source.c (is_regular_file): New arg errno_ptr.
Doug Evans [Tue, 19 Apr 2016 16:01:44 +0000 (09:01 -0700)]
* source.c (is_regular_file): New arg errno_ptr.

gdb/ChangeLog:

* source.c (is_regular_file): New arg errno_ptr.
All callers updated.

gdb/testsuite/ChangeLog:

* gdb.base/bad-file.exp: New file.

8 years agolinux-record: Squash cases with identical handling
Andreas Arnez [Tue, 19 Apr 2016 14:53:40 +0000 (16:53 +0200)]
linux-record: Squash cases with identical handling

In record_linux_system_call there are some cases with identical
handling.  These are merged together to reduce code duplication.

gdb/ChangeLog:

* linux-record.c (record_linux_system_call): Merge handling for
readlink/recv/read and pipe/pipe2.

8 years agoRe-factor (i386|amd64)mpx target descriptions.
Walfred Tedeschi [Tue, 19 Apr 2016 13:45:50 +0000 (15:45 +0200)]
Re-factor (i386|amd64)mpx target descriptions.

In the previous patch a new set of target descriptions
(i386|amd64)-avx-mpx were added  being same as the (i386|amd64)-mpx.
This patch removes AVX feature from  (i386|amd64)-mpx target
description set.

This way the (i386|amd64)avx_mpx(_linux|) set has AVX and MPX features
and (i386|amd64)mpx(_linux|) only MPX.

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

* features/i386/amd64-mpx-linux.xml: Remove AVX feature.
* features/i386/amd64-mpx.xml: Remove AVX feature.
* features/i386/i386-mpx-linux.xml: Remove AVX feature.
* features/i386/i386-mpx.xml: Remove AVX feature.
* features/i386/amd64-mpx-linux.c: Regenerate.
* features/i386/amd64-mpx.c: Regenerate.
* features/i386/i386-mpx-linux.c: Regenerate.
* features/i386/i386-mpx.c: Regenerate.
* regformats/i386/amd64-mpx-linux.dat: Regenerate.
* regformats/i386/amd64-mpx.dat: Regenerate.
* regformats/i386/i386-mpx-linux.dat: Regenerate.
* regformats/i386/i386-mpx.dat: Regenerate.

8 years agoAdd target descriptions for AVX + MPX
Walfred Tedeschi [Tue, 19 Apr 2016 13:44:32 +0000 (15:44 +0200)]
Add target descriptions for AVX + MPX

The current MPX target descriptions assume that MPX is always combined
with AVX, however that's not correct.  We can have machines with MPX
and without AVX; or machines with AVX and without MPX.

This patch adds new target descriptions for machines that support
both MPX and AVX, as duplicates of the existing MPX descriptions.

The following commit will remove AVX from the MPX-only descriptions.

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

gdb/ChangeLog:

* amd64-linux-tdep.c (features/i386/amd64-avx-mpx-linux.c):
New include.
(amd64_linux_core_read_description): Add case for
 X86_XSTATE_AVX_MPX_MASK.
(_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_avx_mpx_linux.
* amd64-linux-tdep.h (tdesc_amd64_avx_mpx_linux): New definition.
* amd64-tdep.c (features/i386/amd64-avx-mpx.c): New include.
(amd64_target_description): Add case for  X86_XSTATE_AVX_MPX_MASK.
(_initialize_amd64_tdep): Call initialize_tdesc_amd64_avx_mpx.
* common/x86-xstate.h (X86_XSTATE_MPX_MASK): Remove AVX bits.
(X86_XSTATE_AVX_MPX_MASK): New case.
* features/Makefile (i386/i386-avx-mpx, i386/i386-avx-mpx-linux)
(i386/amd64-avx-mpx, i386/amd64-avx-mpx-linux): New rules.
(i386/i386-avx-mpx-expedite, i386/i386-avx-mpx-linux-expedite)
(i386/amd64-avx-mpx-expedite, i386/amd64-avx-mpx-linux-expedite):
New expedites.
* i386-linux-tdep.c (features/i386/i386-avx-mpx-linux.c): New
include.
(i386_linux_core_read_description): Add case
X86_XSTATE_AVX_MPX_MASK.
(_initialize_i386_linux_tdep): Call
initialize_tdesc_i386_avx_mpx_linux.
* i386-linux-tdep.h (tdesc_i386_avx_mpx_linux): New include.
* i386-tdep.c (features/i386/i386-avx-mpx.c): New include.
(i386_target_description): Add case for X86_XSTATE_AVX_MPX_MASK.
* x86-linux-nat.c (x86_linux_read_description): Add case for
X86_XSTATE_AVX_MPX_MASK.
* features/i386/amd64-avx-mpx-linux.xml: New file.
* features/i386/i386-avx-mpx-linux.xml: New file.
* features/i386/i386-avx-mpx.xml: New file.
* features/i386/amd64-avx-mpx.xml: New file.
* features/i386/amd64-avx-mpx-linux.c: Generated.
* features/i386/amd64-avx-mpx.c: Generated.
* features/i386/i386-avx-mpx-linux.c: Generated.
* features/i386/i386-avx-mpx.c: Generated.
* regformats/i386/amd64-avx-mpx-linux.dat: Generated.
* regformats/i386/amd64-avx-mpx.dat: Generated.
* regformats/i386/i386-avx-mpx-linux.dat: Generated.
* regformats/i386/i386-avx-mpx.dat: Generated.

gdb/gdbserver/ChangeLog:

* Makefile.in (clean): Add removal for i386-avx-mpx.c,
i386-avx-mpx-linux.c, amd64-avx-mpx.c and amd64-avx-mpx-linux.c.
(i386-avx-mpx.c, i386-avx-mpx-linux.c, amd64-avx-mpx.c)
(amd64-avx-mpx-linux.c): New rules.
(amd64-avx-mpx-linux-ipa.o, i386-avx-mpx-linux-ipa.o): New rule.
* configure.srv (srv_i386_regobj): Add i386-avx-mpx.o.
(srv_i386_linux_regobj): Add i386-avx-mpx-linux.o.
(srv_amd64_regobj): Add amd64-avx-mpx.o.
(srv_amd64_linux_regobj): Add amd64-avx-mpx-linux.o.
(srv_i386_xmlfiles): Add i386/i386-avx-mpx.xml.
(srv_amd64_xmlfiles): Add i386/amd64-avx-mpx.xml.
(srv_i386_linux_xmlfiles): Add i386/i386-avx-mpx-linux.xml.
(srv_amd64_linux_xmlfiles): Add i386/amd64-avx-mpx-linux.xml.
(ipa_i386_linux_regobj): Add i386-avx-mpx-linux-ipa.o.
(ipa_amd64_linux_regobj): Add amd64-avx-mpx-linux-ipa.o.
* linux-x86-low.c (x86_linux_read_description): Add case for
X86_XSTATE_AVX_MPX_MASK.
(x86_get_ipa_tdesc_idx): Add cases for avx_mpx.
(initialize_low_arch): Call init_registers_amd64_avx_mpx_linux and
init_registers_i386_avx_mpx_linux.
* linux-i386-ipa.c (get_ipa_tdesc): Add case for avx_mpx.
(initialize_low_tracepoint): Call
init_registers_i386_avx_mpx_linux.
* linux-amd64-ipa.c (get_ipa_tdesc):  Add case for avx_mpx.
(initialize_low_tracepoint): Call
init_registers_amd64_avx_mpx_linux.
* linux-x86-tdesc.h (X86_TDESC_AVX_MPX): New enum value.
(init_registers_amd64_avx_mpx_linux, tdesc_amd64_avx_mpx_linux)
(init_registers_i386_avx_mpx_linux, tdesc_i386_avx_mpx_linux): New
declarations.

8 years agoSync Makefile.tpl with gcc.
Nick Clifton [Tue, 19 Apr 2016 08:26:16 +0000 (09:26 +0100)]
Sync Makefile.tpl with gcc.

2016-04-13  Segher Boessenkool  <segher@kernel.crashing.org>

PR bootstrap/70173
* Makefile.tpl (local-distclean): Delete the libcc1, gnattools,
and gotools directories.  Delete the stage_final file.
* Makefile.in: Regenerate.

8 years ago.cfi_remember_state/.cfi_restore_state documentation
Martin Galvan [Mon, 18 Apr 2016 23:46:09 +0000 (09:16 +0930)]
.cfi_remember_state/.cfi_restore_state documentation

* doc/as.texinfo (.cfi_remember_state, .cfi_restore_state): Improve
documentation.

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

8 years agoFix PR gdb/19250: ptrace prototype is not detected properly in C++ mode
Pedro Alves [Mon, 18 Apr 2016 16:42:50 +0000 (17:42 +0100)]
Fix PR gdb/19250: ptrace prototype is not detected properly in C++ mode

The ptrace args/return types detection doesn't work properly in C++
mode, on non-GNU/Linux hosts.  For example, on gcc70 (NetBSD 5.1),
where the prototype is:

 int ptrace(int, __pid_t, void*, int);

configure misdetects it as:

 $ grep PTRACE_TYPE config.h
 #define PTRACE_TYPE_ARG1 int
 #define PTRACE_TYPE_ARG3 int *
 #define PTRACE_TYPE_ARG4 int
 /* #undef PTRACE_TYPE_ARG5 */
 #define PTRACE_TYPE_RET int

resulting in:

 ../../src/gdb/amd64bsd-nat.c: In function 'void amd64bsd_fetch_inferior_registers(target_ops*, regcache*, int)':
 ../../src/gdb/amd64bsd-nat.c:56: warning: dereferencing type-punned pointer will break strict-aliasing rules
 ../../src/gdb/amd64bsd-nat.c: In function 'void amd64bsd_store_inferior_registers(target_ops*, regcache*, int)':
 ../../src/gdb/amd64bsd-nat.c:104: warning: dereferencing type-punned pointer will break strict-aliasing rules
 ../../src/gdb/amd64bsd-nat.c:110: warning: dereferencing type-punned pointer will break strict-aliasing rules

We could address this [1], however despite ptrace.m4's claim:

 # Needs to be tested in C++ mode, to detect whether we need to cast
 # the first argument to enum __ptrace_request.

it appears that there's actually no need to test in C++ mode.  Always
running the ptrace tests in C mode works just the same on GNU/Linux.

I remember experimenting with several different ways to handle the
original issue back then, and maybe that was needed in some other
attempt and then I didn't realize it ended up not really necessary.

Confirmed that this fixes the NetBSD 5.1 C++ build, and confirmed that
C and C++ builds on Fedora 23 are unaffected.

[1] - https://sourceware.org/ml/gdb-patches/2016-04/msg00374.html

gdb/ChangeLog:
2016-04-18  Pedro Alves  <palves@redhat.com>

* ptrace.m4 (GDB_AC_PTRACE): Don't run tests in C++ mode.
* configure: Regenerate.

gdb/gdbserver/ChangeLog:
2016-04-18  Pedro Alves  <palves@redhat.com>

* configure: Regenerate.

8 years agoFix gdb crash when trying to print the address of a synthetic C++ reference
Martin Galvan [Mon, 18 Apr 2016 13:58:14 +0000 (10:58 -0300)]
Fix gdb crash when trying to print the address of a synthetic C++ reference

After compiling a program which uses C++ references some optimizations may
convert the references into synthetic "pointers".  Trying to print the address
of one of such synthetic references causes gdb to crash with the following
error:

(gdb) print &ref
/build/buildd/gdb-7.7.1/gdb/dwarf2loc.c:1624: internal-error: Should not be able to create a lazy value with an enclosing type
A problem internal to GDB has been detected,
further debugging may prove unreliable.

Apparently, what was causing it was that value_addr returns a copy of the value
that represents the reference with its type set to T* instead of T&.  However,
its enclosing_type is left untouched, which fails a check made in
read_pieced_value.  We only see the crash happen for references that are
synthetic because they're treated as pieced values, thus the call to
read_pieced_value.

On a related note, it seems that in general there are all sorts of breakage
when working with synthetic references.  This is reported here:

https://sourceware.org/bugzilla/show_bug.cgi?id=19893

gdb/ChangeLog:
2016-04-18  Martin Galvan  <martin.galvan@tallertechnologies.com>

* valops.c (value_addr): For C++ references, set the copied value's
enclosing_type as well.

gdb/testsuite/ChangeLog:
2016-04-18  Martin Galvan  <martin.galvan@tallertechnologies.com>

* gdb.dwarf2/implref.exp: New file.

8 years agofortran: Testsuite, fix different type naming across compilers.
Bernhard Heckel [Thu, 7 Apr 2016 08:28:14 +0000 (10:28 +0200)]
fortran: Testsuite, fix different type naming across compilers.

Gfortran and ifort have different names for data types.  Encapsulate
type names in a library to increase number of supported compilers.
gfortran -4.2 : int4
gfortran>=4.3 : integer(kind=4)
ifort         : INTEGER(4)

2016-04-18  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:
* gdb.fortran/common-block.exp: Use type naming defined in lib fortran.
* gdb.fortran/derived-type.exp: Use type naming defined in lib fortran.
* gdb.fortran/multi-dim.exp: Use type naming defined in lib fortran.
* gdb.fortran/vla-datatypes.exp: Use type naming defined in lib fortran.
* gdb.fortran/vla-ptype-sub.exp: Use type naming defined in lib fortran.
* gdb.fortran/vla-ptype.exp: Use type naming defined in lib fortran.
* gdb.fortran/whatis_type.exp: Use type naming defined in lib fortran.
* lib/fortran.exp (fortran_int4): New procedure.
(fortran_real4, fortran_real8, fortran_complex4): Likewise.
(fortran_logical4): Likewise.

8 years agoTestsuite: Fix compiling of shared libraries with ICC.
Bernhard Heckel [Mon, 18 Apr 2016 09:49:07 +0000 (11:49 +0200)]
Testsuite: Fix compiling of shared libraries with ICC.

We are missing "-fpic" flag when compiling shared libraries with ICC.

2016-04-18  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Testsuite/Changelog:
* lib/gdb.exp (gdb_compile_shlib): Add flag for ICC compiler.

8 years agotestsuite: Support detection of Intel compilers via test_compiler_version.
Bernhard Heckel [Fri, 15 Apr 2016 09:03:42 +0000 (11:03 +0200)]
testsuite: Support detection of Intel compilers via test_compiler_version.

Add Intel specific preprocessor macros to query the version of the compiler.

2016-04-18  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Testsuite/Changelog:
* lib/compiler.c: Add Intel specific preprocessor macros.
* lib/compiler.cc: Likewise.

8 years agoAdd new NOCROSSREFS_TO linker script command
Matthew Fortune [Thu, 14 Apr 2016 10:49:53 +0000 (11:49 +0100)]
Add new NOCROSSREFS_TO linker script command

NOCROSSREFS_TO is similar to the existing NOCROSSREFS command but only
checks one direction of cross referencing.

ld/ChangeLog

* ld.texinfo: Document NOCROSSREFS_TO script command.
* ldlang.h (struct lang_nocrossrefs): Add onlyfirst field.
(lang_add_nocrossref_to): New prototype.
* ldcref.c (check_local_sym_xref): Use onlyfirst to only look for
symbols defined in the first section.
(check_nocrossref): Likewise.
* ldgram.y (NOCROSSREFS_TO): New script command.
* ldlang.c (lang_add_nocrossref): Set onlyfirst to FALSE.
(lang_add_nocrossref_to): New function.
* ldlex.l (NOCROSSREFS_TO): New token.
* NEWS: Mention NOCROSSREFS_TO.
* testsuite/ld-scripts/cross4.t: New file.
* testsuite/ld-scripts/cross5.t: Likewise.
* testsuite/ld-scripts/cross6.t: Likewise.
* testsuite/ld-scripts/cross7.t: Likewise.
* testsuite/ld-scripts/crossref.exp: Run 4 new NOCROSSREFS_TO
tests.

8 years agoRevert 415fa612
Yao Qi [Mon, 18 Apr 2016 07:50:09 +0000 (08:50 +0100)]
Revert 415fa612

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

Revert:
2016-04-15  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (thumb_stack_frame_destroyed_p): Return zero if
PC is far from the end of function.

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

8 years agoRevert "gas/arc: Make .cpu directive case-insensitive"
Andrew Burgess [Sun, 17 Apr 2016 22:17:44 +0000 (23:17 +0100)]
Revert "gas/arc: Make .cpu directive case-insensitive"

This reverts commit 9a452709fe126ea6da23a53426362e4435d2dc06.

This change was committed as obvious, but it has been rightly been
pointed out to me that this change is not obvious, and as such I am
reverting it.

gas/ChangeLog:

Revert prevous change.
* config/tc-arc.c (arc_option): Make .cpu directive
case-sensitive again.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 17 Apr 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agogas/arc: Make .cpu directive case-insensitive
Andrew Burgess [Sat, 16 Apr 2016 15:21:32 +0000 (16:21 +0100)]
gas/arc: Make .cpu directive case-insensitive

gas/ChangeLog:

* config/tc-arc.c (arc_option): Make .cpu directive
case-insensitive.

8 years agogas/arc: Support NPS400 in .cpu directive
Andrew Burgess [Sat, 16 Apr 2016 15:19:40 +0000 (16:19 +0100)]
gas/arc: Support NPS400 in .cpu directive

gas/ChangeLog:

* config/tc-arc.c (arc_option): Allow NPS400 in .cpu directive.

8 years agoremove pointless assignment
Trevor Saunders [Wed, 13 Apr 2016 09:03:22 +0000 (05:03 -0400)]
remove pointless assignment

Presumably this was supposed to be regname[sizeof (regname) - 1] but was typoed
to regname[sizeof (rename) - 1].  However that should be unnecessary because
sprintf should null terminate.  As is this assignment is invalid ISO C because
rename refers to the function rename (), and sizeof on functions is undefined.
In GNU C C the size of functions is 1 so the expression is the same as
regname[0].  The following call to sprintf () clearly will over right that, so
the statement either has no effect or is invalid.  Given that it seems safe to
just remove it.  While we are there correct the size of regname, and switch
from snprintf to sprintf since we know the exact length of the result.

gas/ChangeLog:

2016-04-15  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-mips.c (md_begin): Remove useless assignment.

8 years agogdb/ada-exp.y: Remap yydefred
Pedro Alves [Sat, 16 Apr 2016 00:24:08 +0000 (01:24 +0100)]
gdb/ada-exp.y: Remap yydefred

On:

 $ uname -a
 NetBSD gcc70.fsffrance.org 5.1 NetBSD 5.1 (GENERIC) #0: Sat Nov  6 13:19:33 UTC 2010  builds@b6.netbsd.org:/home/builds/ab/netbsd-5-1-RELEASE/amd64/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/amd64/compile/GENERIC amd64

The link fails with:

 (...)
 d-exp.o: In function `parse_number':
 ../../src/gdb/d-exp.y:762: multiple definition of `yydefred'
 ada-exp.o:/home/palves/gdb/build/gdb/ada-lex.c:925: first defined here
 ld: Warning: size of symbol `yydefred' changed from 464 in ada-exp.o to 336 in d-exp.o
 Makefile:1404: recipe for target 'gdb' failed

NetBSD's yacc uses a "yydefred" symbol that we missed renaming in the
Ada parser.  All other gdb parsers do this already.

gdb/ChangeLog:
2016-04-16  Pedro Alves  <palves@redhat.com>

* ada-exp.y (yydefred): Define as ada_yydefred.

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

8 years agoFix gdb build with --enable-build-with-cxx --disable-nls
Pedro Alves [Fri, 15 Apr 2016 16:08:53 +0000 (17:08 +0100)]
Fix gdb build with --enable-build-with-cxx --disable-nls

Compiling gdb with --enable-build-with-cxx --disable-nls, we get:

 .../src/gdb/ada-lang.c:7657:16: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
type_str = (type != NULL
 ^
 In file included from .../src/gdb/common/common-defs.h:67:0,
  from .../src/gdb/defs.h:28,
  from .../src/gdb/ada-lang.c:21:
 .../src/gdb/common/gdb_locale.h:40:27: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
  # define _(String) (String)
    ^
 .../src/gdb/ada-lang.c:7730:46: note: in expansion of macro ‘_’
char *name_str = name != NULL ? name : _("<null>");
       ^
 Makefile:1140: recipe for target 'ada-lang.o' failed

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

* ada-lang.c (ada_lookup_struct_elt_type): Constify 'type_str' and
'name_str' locals.

8 years agoFix gdb C++ build when libipt is available
Pedro Alves [Fri, 15 Apr 2016 20:14:07 +0000 (21:14 +0100)]
Fix gdb C++ build when libipt is available

With libipt's headers installed, a build with --enable-build-with-cxx
fails with:

 .../src/gdb/btrace.c: In function ‘btrace_insn_flag pt_btrace_insn_flags(const pt_insn*)’:
 .../src/gdb/btrace.c:734:33: error: invalid conversion from ‘int’ to ‘btrace_insn_flag’ [-fpermissive]
    enum btrace_insn_flag flags = 0;
  ^
 .../src/gdb/btrace.c:737:11: error: invalid conversion from ‘int’ to ‘btrace_insn_flag’ [-fpermissive]
      flags |= BTRACE_INSN_FLAG_SPECULATIVE;
    ^

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

* btrace.c (pt_btrace_insn_flags): Change return type to
btrace_insn_flags.  Use btrace_insn_flags for local.

8 years agoRegenerate Makefile.in/aclocal.m4 automake 1.11.6
H.J. Lu [Fri, 15 Apr 2016 23:20:02 +0000 (16:20 -0700)]
Regenerate Makefile.in/aclocal.m4 automake 1.11.6

bfd/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.
* doc/Makefile.in: Likewise.

binutils/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.
* doc/Makefile.in: Likewise.

gas/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.
* doc/Makefile.in: Likewise.

gold/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.
* testsuite/Makefile.in: Likewise.

gprof/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.

ld/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.

opcodes/

* Makefile.in: Regenerated with automake 1.11.6.
* aclocal.m4: Likewise.

8 years agoMIPS/Linux: Also recognize TRAP_BRKPT and TRAP_HWBKPT
Pedro Alves [Fri, 15 Apr 2016 22:52:00 +0000 (23:52 +0100)]
MIPS/Linux: Also recognize TRAP_BRKPT and TRAP_HWBKPT

This makes the MIPS Linux backends recognize TRAP_BRKPT and
TRAP_HWBKPT in siginfo.si_code in addition to SI_KERNEL, since Linux
4.6 now reports the finer-grained si_code values too.

Refs:
 https://sourceware.org/ml/gdb-patches/2016-02/msg00756.html
 https://sourceware.org/ml/gdb-patches/2016-04/msg00090.html

On kernels that report SI_KERNEL (<= 4.5), we'll enter the "ambiguous"
path of save_stop_reason:

  if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
      && GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
    {
      /* The si_code is ambiguous on this arch -- check debug
 registers.  */
      if (!check_stopped_by_watchpoint (lp))
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
    }

while on kernels that report the finer-grained si_code values (>= 4.6),
we'll enter the corresponding branches:

  else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
    {
    }
  else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
    {
      ...

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

* nat/linux-ptrace.h [__mips__] (GDB_ARCH_IS_TRAP_BRKPT): Also
accept TRAP_BRKPT.
 [__mips__] (GDB_ARCH_IS_TRAP_HWBKPT): Also accept TRAP_HWBKPT.

8 years ago[ARM] minor opt in thumb_stack_frame_destroyed_p
Yao Qi [Fri, 15 Apr 2016 14:30:01 +0000 (15:30 +0100)]
[ARM] minor opt in thumb_stack_frame_destroyed_p

thumb_stack_frame_destroyed_p scans the instructions from PC to the
end of the function, but if PC is far from the end of pc, we don't
have to scan, because PC should be in epilogue if it is still
far from the end of the function.  The criterion I use here is 16
bytes, which is more than 4 instructions.

Regression tested on aarch64-linux with mutli-arch debug.

gdb:

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

* arm-tdep.c (thumb_stack_frame_destroyed_p): Return zero if
PC is far from the end of function.

8 years agoFix non-ELF powerpc build breakage
Alan Modra [Fri, 15 Apr 2016 14:07:30 +0000 (23:37 +0930)]
Fix non-ELF powerpc build breakage

* config/tc-ppc.c (toc_reloc_types): Wrap in #ifdef OBJ_ELF

8 years agoAdd missing ChangeLog entry for PR gas/19909 fix
H.J. Lu [Fri, 15 Apr 2016 12:59:16 +0000 (05:59 -0700)]
Add missing ChangeLog entry for PR gas/19909 fix

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 15 Apr 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agomake a few variables static
Trevor Saunders [Wed, 13 Apr 2016 08:15:10 +0000 (04:15 -0400)]
make a few variables static

They are only used in one file, so we might as well restrict there scope to
that file, and theoretically this might slightly improve compilers ability to
optimize usage of these variables.

gas/ChangeLog:

2016-04-14  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-nios2.c (nios2_as_options): Make file static.
* config/tc-ppc.c (toc_reloc_ypes): Likewise.
* config/tc-sparc.c (native_op_table): Likewise.

8 years agoremove some unused globals
Trevor Saunders [Tue, 12 Apr 2016 14:02:58 +0000 (10:02 -0400)]
remove some unused globals

gas/ChangeLog:

2016-04-14  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

* config/tc-m32c.c (M32C_Macros): Remove.
* config/tc-msp430.c (option_numbers): Likewise.

8 years agoarc/nps400 : New cmem instructions and associated relocation
Andrew Burgess [Tue, 29 Mar 2016 23:02:19 +0000 (00:02 +0100)]
arc/nps400 : New cmem instructions and associated relocation

Add support for arc/nps400 cmem instructions, these load and store
instructions are hard-wired to access "0x57f00000 + 16-bit-offset".

Supporting this relocation required some additions to the arc relocation
handling in the bfd library, as well as the standard changes required to
add a new relocation type.

There's a test of the new instructions in the assembler, and a test of
the relocation in the linker.

bfd/ChangeLog:

* reloc.c: Add BFD_RELOC_ARC_NPS_CMEM16 entry.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* elf32-arc.c: Add 'opcode/arc.h' include.
(struct arc_relocation_data): Add symbol_name.
(arc_special_overflow_checks): New function.
(arc_do_relocation): Use arc_special_overflow_checks, reindent as
required, add an extra comment.
(elf_arc_relocate_section): Setup symbol_name in reloc_data.

gas/ChangeLog:

* testsuite/gas/arc/nps400-3.d: New file.
* testsuite/gas/arc/nps400-3.s: New file.

include/ChangeLog:

* elf/arc-reloc.def: Add ARC_NPS_CMEM16 reloc.
* opcode/arc.h (NPS_CMEM_HIGH_VALUE): Define.

ld/ChangeLog:

* testsuite/ld-arc/arc.exp: New file.
* testsuite/ld-arc/nps-1.s: New file.
* testsuite/ld-arc/nps-1a.d: New file.
* testsuite/ld-arc/nps-1b.d: New file.
* testsuite/ld-arc/nps-1b.err: New file.

opcodes/ChangeLog:

* arc-nps400-tbl.h: Add xldb, xldw, xld, xstb, xstw, and xst
instructions.
* arc-opc.c (insert_nps_cmem_uimm16): New function.
(extract_nps_cmem_uimm16): New function.
(arc_operands): Add NPS_XLDST_UIMM16 operand.

8 years agobfd/arc: Rename enum entries to avoid conflicts
Andrew Burgess [Wed, 6 Apr 2016 17:55:23 +0000 (18:55 +0100)]
bfd/arc: Rename enum entries to avoid conflicts

In bfd/elf32-arc.c an enum is created that contains entries with generic
names like 'NONE' and 'OFF'.  This has been fine for now, but I had a
need to include opcode/arc.h into bfd/elf32-arc.c.  Unfortunately
opcode/arc.h includes a different enum with identical generic names.

Given that changing the enum in the header file could mean wide-ranging
changes, while changing the enum in the .c file is limited to only
changing the one file, I've added a prefix to the enum in the .c file.

This commit does not add the new include, that will come later.  There
should be no functional change with this commit.

bfd/ChangeLog:

* elf32-arc.c (tls_got_entries): Add 'TLS_GOT_' prefix to all
entries.
(elf_arc_relocate_section): Update enum uses.
(elf_arc_check_relocs): Likewise.
(elf_arc_finish_dynamic_symbol): Likewise.

8 years agoopcodes/arc: Move instruction length logic to new function
Andrew Burgess [Thu, 24 Mar 2016 16:54:37 +0000 (16:54 +0000)]
opcodes/arc: Move instruction length logic to new function

Move the logic that calculates the instruction length out to a new
function.  Restructure the code to make it simpler.

opcodes/ChangeLog:

* arc-dis.c (arc_insn_length): New function.
(print_insn_arc): Use arc_insn_length, change insnLen to unsigned.
(find_format): Change insnLen parameter to unsigned.

8 years agoReplace "link" with "sh_link"
H.J. Lu [Thu, 14 Apr 2016 15:36:32 +0000 (08:36 -0700)]
Replace "link" with "sh_link"

On Linux/x86, GCC 4.2 issues a warning:

bfd/elf.c: In function ‘_bfd_elf_copy_private_bfd_data’:
bfd/elf.c:1334: warning: declaration of ‘link’ shadows a global declaration
/usr/include/unistd.h:757: warning: shadowed declaration is here
make[6]: *** [elf.lo] Error 1

Replace "link" with "sh_link" fixes it.

* elf.c (_bfd_elf_copy_private_bfd_data): Replace "link" with
"sh_link".

8 years agogas/arc: Unify tests run on big/little endian arc assembler
Andrew Burgess [Thu, 7 Apr 2016 21:56:44 +0000 (22:56 +0100)]
gas/arc: Unify tests run on big/little endian arc assembler

We were running a slightly different set of assembler tests on big and
little endian arc targets.  This commit unifies the set of tests run.

gas/ChangeLog:

* testsuite/gas/arc/add_s-err.s: Update target pattern.
* testsuite/gas/arc/warn.s: Likewise.
* testsuite/gas/elf/elf.exp: Run test for arc.

8 years agoAvoid "format not a string literal" warnings
Pedro Alves [Thu, 14 Apr 2016 11:58:03 +0000 (12:58 +0100)]
Avoid "format not a string literal" warnings

On:

 $ uname -a
 NetBSD gcc70.fsffrance.org 5.1 NetBSD 5.1 (GENERIC) #0: Sat Nov  6 13:19:33 UTC 2010  builds@b6.netbsd.org:/home/builds/ab/netbsd-5-1-RELEASE/amd64/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/amd64/compile/GENERIC amd64

With:

 $ g++ -v
 Using built-in specs.
 Target: x86_64--netbsd
 Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc4/configure --enable-long-long --disable-multilib --enable-threads --disable-symvers --build=x86_64-unknown-netbsd4.99.72 --host=x86_64--netbsd --target=x86_64--netbsd --enable-__cxa_atexit
 Thread model: posix
 gcc version 4.1.3 20080704 prerelease (NetBSD nb2 20081120)

I saw:

 cc1plus: warnings being treated as errors
 ../../src/gdb/ctf.c: In function 'void ctf_save_metadata_header(trace_write_handler*)':
 ../../src/gdb/ctf.c:267: warning: format not a string literal, argument types not checked
 cc1plus: warnings being treated as errors
 ../../src/gdb/cli/cli-cmds.c: In function 'void alias_command(char*, int)':
 ../../src/gdb/cli/cli-cmds.c:1428: warning: format not a string literal and no format arguments
 ../../src/gdb/cli/cli-cmds.c:1457: warning: format not a string literal and no format arguments

gdb/ChangeLog:
2016-04-14  Pedro Alves  <palves@redhat.com>

* cli/cli-cmds.c (alias_usage_error): New function.
(alias_command): Use it.
* ctf.c (ctf_save_metadata_header): Inline metadata_fmt local in
ctf_save_write_metadata call.

8 years agoAvoid implicit float <-> integer conversion warnings
Pedro Alves [Thu, 14 Apr 2016 11:58:03 +0000 (12:58 +0100)]
Avoid implicit float <-> integer conversion warnings

On:

 $ uname -a
 NetBSD gcc70.fsffrance.org 5.1 NetBSD 5.1 (GENERIC) #0: Sat Nov  6 13:19:33 UTC 2010  builds@b6.netbsd.org:/home/builds/ab/netbsd-5-1-RELEASE/amd64/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/amd64/compile/GENERIC amd64

With:

 $ g++ -v
 Using built-in specs.
 Target: x86_64--netbsd
 Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc4/configure --enable-long-long --disable-multilib --enable-threads --disable-symvers --build=x86_64-unknown-netbsd4.99.72 --host=x86_64--netbsd --target=x86_64--netbsd --enable-__cxa_atexit
 Thread model: posix
 gcc version 4.1.3 20080704 prerelease (NetBSD nb2 20081120)

I saw:

 ../../src/gdb/ada-typeprint.c: In function 'void print_fixed_point_type(type*, ui_file*)':
 ../../src/gdb/ada-typeprint.c:366: warning: passing 'float' for argument 2 to 'DOUBLEST ada_fixed_to_float(type*, LONGEST)'

 ../../src/gdb/value.c: In function 'LONGEST unpack_long(type*, const gdb_byte*)':
 ../../src/gdb/value.c:2833: warning: converting to 'LONGEST' from 'DOUBLEST'
 ../../src/gdb/value.c:2838: warning: converting to 'LONGEST' from 'DOUBLEST'

gdb/ChangeLog:
2016-04-14  Pedro Alves  <palves@redhat.com>

* ada-typeprint.c (print_fixed_point_type): Don't pass float as
argument to function expecting LONGEST.
* value.c (unpack_long): Add casts to LONGEST.

8 years agoFix copying Solaris binaries with objcopy.
Nick Clifton [Thu, 14 Apr 2016 11:04:09 +0000 (12:04 +0100)]
Fix copying Solaris binaries with objcopy.

PR target/19938
bfd * elf-bbfd.h (struct elf_backend_data): New field:
elf_strtab_flags.
New field: elf_backend_set_special_section_info_and_link
* elfxx-target.h (elf_backend_strtab_flags): Define if not already
defined.
(elf_backend_set_special_section_info_and_link): Define if not
already defined.
(elfNN_bed): Use elf_backend_set_special_section_info_and_link and
elf_backend_strtab_flags macros to initialise fields in structure.
* elf.c (_bfd_elf_make_section_from_shdr): Check for SHF_STRINGS
being set even if SHF_MERGE is not set.
(elf_fake_sections): Likewise.
(section_match): New function.  Matches two ELF sections based
upon fixed characteristics.
(find_link): New function.  Locates a section in a BFD that
matches a section in a different BFD.
(_bfd_elf_copy_private_bfd_data): Copy the sh_info and sh_link
fields of reserved sections.
(bfd_elf_compute_section_file_positions): Set the flags for the
.shstrtab section based upon the elf_strtab_flags field in the
elf_backend_data structure.
(swap_out_syms): Likewise for the .strtab section.
* elflink.c (bfd_elf_final_link): Set the flags for the
.strtab section based upon the elf_strtab_flags field in the
elf_backend_data structure.
* elf32-i386.c (elf32_i386_set_special_info_link): New function.
(elf_backend_strtab_flags): Set to SHF_STRINGS for Solaris
targets.
(elf_backend_set_special_section_info_and_link): Define for
Solaris targets.
* elf32-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.

binutils* testsuite/binutils-all/i386/compressed-1b.d: Allow for the
string sections possibly having the SHF_STRINGS flag bit set.
* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
* testsuite/binutils-all/readelf.s: Likewise.
* testsuite/binutils-all/readelf.s-64: Likewise.
* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.

gas * testsuite/gas/i386/ilp32/x86-64-unwind.d: Allow for the string
sections possibly having the SHF_STRINGS flag bit set.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.

8 years agoExtend PE matching regexp in PR 19457 test to match cygwin and mingw targets.
Nick Clifton [Thu, 14 Apr 2016 09:38:05 +0000 (10:38 +0100)]
Extend PE matching regexp in PR 19457 test to match cygwin and mingw targets.

PR 19457
* testsuite/ld-scripts/script.exp (extract_symbol_test): Add
exceptions for Mingw and Cygwin.

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

8 years agoTest GDB connection to GDBserver with no symbol files
Luis Machado [Wed, 13 Apr 2016 20:22:14 +0000 (15:22 -0500)]
Test GDB connection to GDBserver with no symbol files

This test exercises the scenarios where we attempt to connect GDB to GDBserver
in standard remote mode, query the symbol file path, attempt to open said
symbol file on GDB's end and fail, causing the connection to drop abruptly.

Regression-tested on x86-64/Ubuntu.

With an unpatched GDB we should see this:

FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=: action=permission: connection to GDBserver succeeded (the program is no longer running)
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=: action=delete: connection to GDBserver succeeded (the program is no longer running)
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=target:: action=permission: connection to GDBserver succeeded (the program is no longer running)
FAIL: gdb.server/connect-with-no-symbol-file.exp: sysroot=target:: action=delete: connection to GDBserver succeeded (the program is no longer running)

A patched GDB should have full passes.

gdb/testsuite/ChangeLog:

2016-04-13  Luis Machado  <lgustavo@codesourcery.com>

* gdb.server/connect-with-no-symbol-file.c: New file.
* gdb.server/connect-with-no-symbol-file.exp: New file.

8 years agoDebugging without a binary (regression)
Luis Machado [Wed, 13 Apr 2016 20:17:22 +0000 (15:17 -0500)]
Debugging without a binary (regression)

When we attempt to debug a process using GDBserver in standard remote mode
without a symbol file on GDB's end, we may run into an issue where GDB cuts
the connection attempt short due to an error. The error is caused by not
being able to open a symbol file, like so:

--

(gdb) set sysroot
(gdb) tar rem :2345
Remote debugging using :2345
/proc/23769/exe: Permission denied.
(gdb) i r
The program has no registers now.
(gdb)

It should've been like this:

(gdb) set sysroot
(gdb) tar rem :2345
Remote debugging using :2345
warning: /tmp/symbol-file: Permission denied.
0xf7ddb2d0 in ?? ()
(gdb) i r
eax            0x0  0
ecx            0x0  0
edx            0x0  0
ebx            0x0  0
esp            0xffffdfa0 0xffffdfa0
ebp            0x0  0x0
esi            0x0  0
edi            0x0  0
eip            0xf7ddb2d0 0xf7ddb2d0
eflags         0x200  [ IF ]
cs             0x33 51
ss             0x2b 43
ds             0x0  0
es             0x0  0
fs             0x0  0
gs             0x0  0
(gdb)

This is caused by a couple of function calls within exec_file_locate_attach
that can potentially throw errors.

The following patch guards both exec_file_attach and symbol_file_add_main to
prevent the errors from disrupting the connection process.

There was also a case where native GDB tripped on this problem, but it was
mostly fixed by bf74e428bca61022bd5cdf6bf28789a184748b4d.

Regression-tested on x86-64/Ubuntu.

gdb/ChangeLog:

2016-04-13  Luis Machado  <lgustavo@codesourcery.com>

* exec.c (exec_file_locate_attach): Guard a couple functions
that can throw errors.
(exception_print_same): New helper function.

8 years agoFix zero_ext documentation
Antoine Tremblay [Wed, 13 Apr 2016 16:36:24 +0000 (12:36 -0400)]
Fix zero_ext documentation

This patch fixes the documentation for the zero_ext bytecode description.

It removes parts that seemed like a copy/paste from ext, since zero_ext
zeros the bits to the left.

gdb/doc/ChangeLog:

* agentexpr.texi (zero_ext): Fix zero_ext description.

8 years ago[ARC] Fix setting private elf flags when parsing .cpu.
Claudiu Zissulescu [Tue, 12 Apr 2016 12:51:57 +0000 (14:51 +0200)]
[ARC] Fix setting private elf flags when parsing .cpu.

gas/
2016-04-12  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (mach_type_specified_p): Change type to
bfd_boolean.
(arc_option): Set private flags when parsing cpu pseudo-op.
(md_parse_option): Set mach_type_specified_p to TRUE.

8 years agoFix and improve comment in gdb_remote_download
Simon Marchi [Wed, 13 Apr 2016 14:47:29 +0000 (10:47 -0400)]
Fix and improve comment in gdb_remote_download

This patch fixes the current comment in gdb_remote_download, which is
false (the "except if that's already where it is" part).  It also
improves it, by explaining why pass TOFILE through standard_output_file,
even it is an absolute path.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (gdb_remote_download): Fix and extend comment.

8 years agoAdd support to readelf for detecting and reporting Solaris specific section types...
Nick Clifton [Wed, 13 Apr 2016 14:37:55 +0000 (15:37 +0100)]
Add support to readelf for detecting and reporting Solaris specific section types and symbol visibility.

PR target/19983
* readelf.c (get_solaris_section_type): New function: Returns the
name of Solaris specific section types.
(get_solaris_dynamic_type): New function: Return the name of
Solaris specific dynamic types.
(get_dynamic_type): Use get_solaris_dynamic_type.
(get_section_type_name): Use get_solaris_section_type.
(get_solaris_symbol_visibility): New function: Returns Solaris
specific symbol visibilities.
(print_dynamic_symbol): Use get_solaris_symbol_visibility.
(process_symbol_table): Likewise.

8 years agold/testsuite: Initialise a variable to prevent tcl errors
Andrew Burgess [Tue, 12 Apr 2016 10:04:19 +0000 (11:04 +0100)]
ld/testsuite: Initialise a variable to prevent tcl errors

In some cases a variable could be left uninitialised and then an attempt
made to read this variable, resulting in a tcl error.  This commit
initialises the variable in all cases.

ld/ChangeLog:

* testsuite/lib/ld-lib.exp (run_dump_test): Initialise
check_ld(terminal).

8 years agogdbserver-base.exp: Copy file to standard output directory in ${board}_download
Simon Marchi [Wed, 13 Apr 2016 14:15:40 +0000 (10:15 -0400)]
gdbserver-base.exp: Copy file to standard output directory in ${board}_download

gdbserver-base.exp is used as the base for both native-gdbserver.exp and
native-extended-gdbserver.exp.  (Despite its name, it should really be
considered as a "local-gdbserver-base", as it's not really appropriate to
implement a remote gdbserver board.)

Currently, the _download procedure is implemented as a no-op (it returns
the source file path).  Because of the SONAME change, The fast
tracepoint tests now require the executable and the IPA
(libinproctrace.so) to be located in the same directory (see [1]).  When
using the native-gdbserver board, because _download returns the original
file path, the executable does not end up in the same directory as the
library, and it fails to execute.

In more general terms, with the recent changes, the testsuite now
assumes that when it does

  ${board}_download <source path 1> <destination path 1>
  ${board}_download <source path 2> <destination path 2>

where the destination paths are relative (generally just the file name),
both files will end up in the same base directory.  That assumption does
not hold for the current implementation in gdbserver-base.exp.

The proper fix would be to make native-gdbserver non-remote, so that
gdb_remote_download would not call DejaGnu's remote_download (see [2]).
We could then get rid of ${board}_download in gdbserver-base.exp.
However, that will likely take some time to complete.  In the mean time,
in order to make the fast tracepoint tests pass, we can simply copy the
file to the standard output directory.  Basically, it just mimics what
gdb_remote_download would do if the board wasn't flagged as remote.

Note that I missed these failures originally because I had a
libinproctrace.so in /usr/local/lib.  So, even though libinproctrace.so
wasn't copied to the test output directory, it did find the one in
/usr/local/lib.  It would be nice to find a way to protect against this,
as it could easily happen again...

Regtested with unix, native-gdbserver and native-extended-gdbserver, and
didn't see anything notable, except the ftrace tests now passing for
native-gdbserver.

[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6e774b13c3b81ac2599812adf058796948ce7e95
[2] https://sourceware.org/ml/gdb-patches/2016-04/msg00112.html

gdb/testsuite/ChangeLog:

* boards/gdbserver-base.exp (${board}_download): Copy source file to
standard output directory.

8 years agooops - omitted from previous delta.
Nick Clifton [Wed, 13 Apr 2016 14:10:48 +0000 (15:10 +0100)]
oops - omitted from previous delta.

8 years agoFix disassembly of the V850's LD.BU instruction.
Nick Clifton [Wed, 13 Apr 2016 14:09:25 +0000 (15:09 +0100)]
Fix disassembly of the V850's LD.BU instruction.

PR target/19937
opcode * v850-opc.c (v850_opcodes): Correct masks for long versions of
the LD.B and LD.BU instructions.

gas * testsuite/gas/v850/pr19937.s: New test.
* testsuite/gas/v850/pr19937.d: New test control file.
* testsuite/gas/v850/basic.exp: Run the new test.

8 years agoFix aarch64 ftrace JIT condition testcase
Antoine Tremblay [Wed, 13 Apr 2016 13:40:00 +0000 (09:40 -0400)]
Fix aarch64 ftrace JIT condition testcase

This patch fixes the following failure:
FAIL: gdb.trace/trace-condition.exp: ftrace: -(21 << 1) == -42: check 10
frames were collected.

This was due to aarch64_emit_sub using the wrong order in its operands, so the
operation would end up being 42 - 0 rather than 0 - 42.

This patch also fixes the order of aarch64_emit_add for clarity.

The test case for emit_sub is fixed so that the proper order of
the operands is needed for the test to pass.

Tested on aarch64-native-extended-gdbserver.

Note: trace-condition.exp was broken a bit so I had to modify it to run
the test. A fix is coming for that in another patch.

gdb/gdbserver/ChangeLog:

* linux-aarch64-low.c (aarch64_emit_add): Switch x1 and x0.
(aarch64_emit_sub): Likewise.

gdb/testsuite/ChangeLog:

* gdb.trace/trace-condition.exp (foreach): Fix emit_sub testcase.

8 years agoFix PR remote/19840: gdb crashes on reverse-stepi
Pedro Alves [Wed, 13 Apr 2016 13:34:00 +0000 (14:34 +0100)]
Fix PR remote/19840: gdb crashes on reverse-stepi

Reverse debugging against a remote target that does reverse debugging
itself (with the bs/bc packets) always trips on:

 (gdb) target remote localhost:...
 (gdb) reverse-stepi
 ../../gdb/target.c:602: internal-error: default_execution_direction: to_execution_direction must be implemented for reverse async

I missed adding a to_execution_direction method to remote.c in commit
3223143295b5 (Adds target_execution_direction to make record targets
support async mode), GDB 7.4 time.  Later, GDB 7.8 switched to
target-async on by default, making the regression user-visible by
default too.

Fix is simply to add the missing to_execution_direction implementation
to target remote.

Tested by Andi Kleen against Simics.

gdb/ChangeLog:
2016-04-13  Pedro Alves  <palves@redhat.com>

PR remote/19840
* remote.c (struct remote_state) <last_resume_exec_dir>: New
field.
(new_remote_state): Default last_resume_exec_dir to EXEC_FORWARD.
(remote_open_1): Reset last_resume_exec_dir to EXEC_FORWARD.
(remote_resume): Store the last execution direction.
(remote_execution_direction): New function.
(init_remote_ops): Install it as to_execution_direction target_ops
method.

8 years agobtrace: fix test build error in gdb.btrace/instruction_history.c
Markus Metzger [Wed, 13 Apr 2016 12:06:51 +0000 (14:06 +0200)]
btrace: fix test build error in gdb.btrace/instruction_history.c

On systems with a newer version of GCC the gdb.btrace/instruction_history.exp
test fails to build like this:

    Running .../gdb.btrace/instruction_history.exp ...
    gdb compile failed, .../gdb.btrace/instruction_history.c:
    In function 'main': .../gdb.btrace/instruction_history.c:24:3: warning:
    implicit declaration of function 'loop' [-Wimplicit-function-declaration]
       loop ();
       ^

Declare loop to fix it.

testsuite/
* gdb.btrace/instruction_history.c (loop): Add declaration.

8 years agoUpdate x86-64 tests for --as-needed
H.J. Lu [Wed, 13 Apr 2016 12:41:36 +0000 (05:41 -0700)]
Update x86-64 tests for --as-needed

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

PR ld/19774
* testsuite/ld-x86-64/x86-64.exp: Link tmpdir/pr17689b.o before
tmpdir/pr17689.so, fix gotpcrel1 test and add more --as-needed
tests.

8 years agoMIPS/GAS: Correct branch relaxation for weak symbols
Maciej W. Rozycki [Sat, 9 Apr 2016 10:59:36 +0000 (11:59 +0100)]
MIPS/GAS: Correct branch relaxation for weak symbols

Weak symbols can be preempted at link time so always choose the longer
sequence in branch relaxation, according to the relaxation level chosen,
so that any symbol finally used as the branch target is reachable.

2016-04-13  Maciej W. Rozycki  <macro@imgtec.com>
            Andrew Bennett  <andrew.bennett@imgtec.com>

gas/
* config/tc-mips.c (relaxed_branch_length): Use the long
sequence where the target is a weak symbol.
(relaxed_micromips_32bit_branch_length): Likewise.
(relaxed_micromips_16bit_branch_length): Likewise.
* testsuite/gas/mips/branch-weak-1.d: New test.
* testsuite/gas/mips/branch-weak-2.d: New test.
* testsuite/gas/mips/branch-weak-3.d: New test.
* testsuite/gas/mips/branch-weak-4.d: New test.
* testsuite/gas/mips/branch-weak-5.d: New test.
* testsuite/gas/mips/branch-weak.l: New stderr output.
* testsuite/gas/mips/branch-weak.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

8 years agoMIPS/GAS: Relax branches to symbols resolved at link time
Maciej W. Rozycki [Fri, 8 Apr 2016 23:20:35 +0000 (00:20 +0100)]
MIPS/GAS: Relax branches to symbols resolved at link time

Where branch relaxation is enabled emit the long sequence for branches
whose distance cannot be determined, i.e. to symbols that are undefined
or in a different segment.  These symbols are only resolved at link time
and therefore the longer sequence ensures the branch target is in range,
which cannot be guaranteed with a direct branch.

This is the opposite to the current implementation, originally proposed
here: <https://sourceware.org/ml/binutils/2002-09/msg00218.html>.  The
proposal was then extensively discussed before the final version was
posted here: <https://sourceware.org/ml/binutils/2002-10/msg00191.html>
and eventually committed:

commit 4a6a3df43dbb37853a7b88b10ae97d9ec5daf987
Author: Alexandre Oliva <aoliva@redhat.com>
Date:   Sat Oct 12 05:23:33 2002 +0000

The case considered here was not commented in the review however and the
original version remains.  With branch relaxation enabled it makes more
sense to do it consistently, so that all code impure with respect to
branch distances can be linked.  Direct branches are still produced for
the cases concerned where branch relaxation is disabled, which is the
default.

gas/
* config/tc-mips.c (relaxed_branch_length): Use the long
sequence where the distance cannot be determined.
(relaxed_micromips_32bit_branch_length): Likewise.
* testsuite/gas/mips/branch-extern-1.d: New test.
* testsuite/gas/mips/branch-extern-2.d: New test.
* testsuite/gas/mips/branch-extern-3.d: New test.
* testsuite/gas/mips/branch-extern-4.d: New test.
* testsuite/gas/mips/branch-extern.l: New stderr output.
* testsuite/gas/mips/branch-extern.s: New test source.
* testsuite/gas/mips/branch-section-1.d: New test.
* testsuite/gas/mips/branch-section-2.d: New test.
* testsuite/gas/mips/branch-section-3.d: New test.
* testsuite/gas/mips/branch-section-4.d: New test.
* testsuite/gas/mips/branch-section.l: New stderr output.
* testsuite/gas/mips/branch-section.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

8 years agoAdd init_dwarf_regnames_s390
Andreas Arnez [Wed, 13 Apr 2016 08:56:30 +0000 (10:56 +0200)]
Add init_dwarf_regnames_s390

Define and use DWARF register names for s390.

binutils/ChangeLog:

* dwarf.h (init_dwarf_regnames_s390): Declare.
* dwarf.c (dwarf_regnames_s390): New.
(init_dwarf_regnames_s390): New.
(init_dwarf_regnames): Call it.
* objdump.c (dump_dwarf): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 13 Apr 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix typo in ftrace.exp condition testing
Antoine Tremblay [Tue, 12 Apr 2016 18:43:12 +0000 (14:43 -0400)]
Fix typo in ftrace.exp condition testing

This obvious patch replaces "ond" wiht "cond" as the test prefix for
conditional tests.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace.exp (proc): Change test prefix from "ond" to "cond".

8 years ago[C++] Switch TRY/CATCH to real C++ try/catch by default again
Pedro Alves [Tue, 12 Apr 2016 16:49:24 +0000 (17:49 +0100)]
[C++] Switch TRY/CATCH to real C++ try/catch by default again

Now that we don't ever throw GDB exceptions from signal handlers [1],
we can switch back to having TRY/CATCH implemented in terms of C++
try/catch instead of sigjmp/longjmp.

[1] - https://sourceware.org/ml/gdb-patches/2016-03/msg00351.html

Tested on x86_64 Fedora 23, native and gdbserver.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.h (GDB_XCPT_TRY): Update comment.
[__cplusplus] (GDB_XCPT): Define as GDB_XCPT_TRY.

8 years agoUse setjmp/longjmp for TRY/CATCH instead of sigsetjmp/siglongjmp
Pedro Alves [Tue, 12 Apr 2016 16:20:04 +0000 (17:20 +0100)]
Use setjmp/longjmp for TRY/CATCH instead of sigsetjmp/siglongjmp

Now that we don't ever throw GDB exceptions from signal handlers [1],
we can switch to have TRY/CATCH implemented in terms of plain
setjmp/longjmp instead of sigsetjmp/siglongjmp.

In https://sourceware.org/ml/gdb-patches/2015-02/msg00114.html, Yichun
Zhang mentions a 11%/14%+ speedup in his GDB python scripts with a
patch that did something similar to only a specific set of TRY/CATCH
calls.

[1] - https://sourceware.org/ml/gdb-patches/2016-03/msg00351.html

Tested on x86_64 Fedora 23, native and gdbserver.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.c (struct catcher) <buf>: Now a
'jmp_buf' instead of SIGJMP_BUF.
(exceptions_state_mc_init): Change return type to 'jmp_buf'.
(throw_exception): Use longjmp instead of SIGLONGJMP.
* common/common-exceptions.h: Include <setjmp.h> instead of
"gdb_setjmp.h".
(exceptions_state_mc_init): Change return type to 'jmp_buf'.
[GDB_XCPT == GDB_XCPT_SJMP] (TRY): Use setjmp instead of
SIGSETJMP.
* cp-support.c: Include "gdb_setjmp.h".

8 years agoEliminate prepare_to_throw_exception
Pedro Alves [Tue, 12 Apr 2016 16:17:13 +0000 (17:17 +0100)]
Eliminate prepare_to_throw_exception

No longer necessary.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* common/common-exceptions.c (exception_rethrow): Remove
prepare_to_throw_exception call.
* common/common-exceptions.h (prepare_to_throw_exception): Delete
declaration.
* exceptions.c (prepare_to_throw_exception): Delete.

gdb/gdbserver/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* utils.c (prepare_to_throw_exception): Delete.