external/binutils.git
8 years agoFix overflow checking for 32-bit pc-relative relocations on x32.
Cary Coutant [Sat, 6 Feb 2016 22:47:05 +0000 (14:47 -0800)]
Fix overflow checking for 32-bit pc-relative relocations on x32.

The problem here is that x32 is really using 64-bit addressing,
while pretending to be 32-bit. Even though the object file format
is 32-bit, we need to do the overflow checking with 64-bit
arithmetic (because that's what the hardware will be using).
This patch overrides the pcrela32_check functions in reloc.h
with target-specific versions that do 64-bit checking.

I've also updated the test case to use -Tdata instead of adding
a huge .space directive, to reduce the size of the .o files.

gold/
PR gold/19567
* reloc.h (Relocate_functions::Overflow_check): Add comments.
* x86_64.cc (X86_64_relocate_functions): New class.
(Target_x86_64::Relocate::relocate): Use the new class.
* testsuite/Makefile.am (x86_64_overflow_pc32): Add -Tdata option.
(x32_overflow_pc32): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/x32_overflow_pc32.sh: New script.
* testsuite/x86_64_overflow_pc32.s: Remove .space directive.

8 years agoFix incorrect casts.
Cary Coutant [Sat, 6 Feb 2016 18:28:36 +0000 (10:28 -0800)]
Fix incorrect casts.

gold/
PR gold/19577
* reloc.h (Bits::has_unsigned_overflow32): Fix static_cast.
(Bits::has_unsigned_overflow): Remove unnecessary static_cast.

8 years agoAdd PR number to ChangeLog entry.
Cary Coutant [Sat, 6 Feb 2016 17:55:40 +0000 (09:55 -0800)]
Add PR number to ChangeLog entry.

8 years agoFix build failure in gold due to signed vs. unsigned comparisons.
Cary Coutant [Sat, 6 Feb 2016 17:53:58 +0000 (09:53 -0800)]
Fix build failure in gold due to signed vs. unsigned comparisons.

* reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
comparison.
(Bits::has_unsigned_overflow): Likewise.

8 years agosim: mips: fix prog_bfd usage
Mike Frysinger [Sat, 6 Feb 2016 01:16:41 +0000 (20:16 -0500)]
sim: mips: fix prog_bfd usage

We do not want to reference the "base" member directly.  We have the
STATE_PROG_BFD macro instead to look up the prog_bfd member.

8 years agogold: Add view and view_size parameters to is_call_to_non_split.
Marcin Kościelnicki [Sat, 6 Feb 2016 00:52:00 +0000 (01:52 +0100)]
gold: Add view and view_size parameters to is_call_to_non_split.

This is needed by s390 split-stack support, to distinguish call
and load-address relocations.

gold/ChangeLog:

* i386.cc (Target_i386::is_call_to_non_split): Add view and view_size
parameters.
* reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Pass view
and view_size to is_call_to_non_split.
* target.cc (Target::is_call_to_non_split): Add view and view_size
parameters.
* target.h (class Target): Likewise.

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

8 years ago2016-02-05 Sriraman Tallam <tmsriram@google.com>
Sriraman Tallam [Fri, 5 Feb 2016 23:07:45 +0000 (15:07 -0800)]
2016-02-05  Sriraman Tallam  <tmsriram@google.com>

* icf.cc (get_rel_addend): New function.
(get_section_contents):  Move merge section addend computation to a
new function.  Ignore negative values for SHT_REL and SHT_RELA addends.
Fix bug to not read past the length of the section.

Fix bug related to addend computation for MERGE sections.

8 years agoAdd some relocation overflow checks for x86_64.
Cary Coutant [Fri, 5 Feb 2016 17:19:47 +0000 (09:19 -0800)]
Add some relocation overflow checks for x86_64.

2016-02-05  Cary Coutant  <ccoutant@gmail.com>
    Andrew Senkevich  <andrew.senkevich@intel.com>

gold/
PR gold/18695
* x86_64.cc (Target_x86_64::Relocate::relocate): Add overflow
checking for R_X86_64_32, R_X86_64_32S, R_X86_64_PC32, and
R_X86_64_PLT32.
* testsuite/Makefile.am (x86_64_overflow_pc32): New test.
* testsuite/x86_64_overflow_pc32.sh: New test script.
* testsuite/x86_64_overflow_pc32.s: New source file.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

gdb/testsuite:

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

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

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

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

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

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

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

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

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

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

gdb:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

gas/

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

ld/

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

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

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

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

  #define DWARF2_ADDR_SIZE 4

Likewise in gdb/msp430-tdep.c:

  set_gdbarch_dwarf2_addr_size (gdbarch, 4);

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

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

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

gas/ChangeLog:

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

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

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

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

* NEWS: Remove duplicated marker for 2.26.

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

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

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

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

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

gdb/ChangeLog:

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

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

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

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

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

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

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

gas/

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

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

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

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

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

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

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

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

bfd/

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

binutils/

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

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

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

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

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

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

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

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

Now it says:

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

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

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

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

Now it says:

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

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

opcodes/ChangeLog:

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

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

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

gas/ChangeLog:

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

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

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

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

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

gas/ChangeLog:

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

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

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

gas/ChangeLog:

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

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

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

gas/ChangeLog:

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

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

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

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

cpu/ChangeLog:

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

opcodes/ChangeLog:

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

gas/ChangeLog:

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

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

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

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

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

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

Conversion using nat_siginfo is exemplified below:

compat_siginfo_from_siginfo or compat_x32_siginfo_from_siginfo:

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

siginfo_from_compat_x32_siginfo or siginfo_from_compat_siginfo:

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

Caveat: No support for MPX on x32.

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

gdb/ChangeLog:

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

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

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

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

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

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

gdb/ChangeLog:

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

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

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

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

gdb/ChangeLog:

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

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

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

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

gdb/ChangeLog:

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

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

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

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

gdb/ChangeLog:

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

gdb/gdbserver/ChangeLog:

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

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

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

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

bfd/

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

ld/testsuite/

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

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

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

8 years agogdb.base/skip.exp: Clean up multiple references to same test name.
Doug Evans [Mon, 1 Feb 2016 23:22:05 +0000 (15:22 -0800)]
gdb.base/skip.exp: Clean up multiple references to same test name.

8 years agoMention PR remote/19496 in gdb/testsuite/ChangeLog entry
Pedro Alves [Mon, 1 Feb 2016 19:22:25 +0000 (19:22 +0000)]
Mention PR remote/19496 in gdb/testsuite/ChangeLog entry

8 years agoTest gdb.threads/forking-threads-plus-breakpoint.exp with displaced stepping off
Pedro Alves [Mon, 1 Feb 2016 18:48:04 +0000 (18:48 +0000)]
Test gdb.threads/forking-threads-plus-breakpoint.exp with displaced stepping off

This exposes the internal error Don mentioned in PR19496:

  (1) internal error --  gdb/target.c:2713: internal-error: Can't determine the current address space of thread

More analysis here:

  https://sourceware.org/ml/gdb-patches/2016-01/msg00685.html

The (now kfailed) internal error looks like:

 continue &
 Continuing.
 (gdb) PASS: gdb.threads/forking-threads-plus-breakpoint.exp: cond_bp_target=1: detach_on_fork=on: displaced=off: continue &
 [New Thread 2846.2847]
 (...)
 [New Thread 2867.2867]
 /home/pedro/gdb/mygit/src/gdb/target.c:2723: internal-error: Can't determine the current address space of thread Thread 2846.2846

 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n) KFAIL: gdb.threads/forking-threads-plus-breakpoint.exp: cond_bp_target=1: detach_on_fork=on: displaced=off: inferior 1 exited (GDB internal error) (PRMS: remote/19496)
 Resyncing due to internal error.

gdb/testsuite/ChangeLog:
2016-02-01  Pedro Alves  <palves@redhat.com>

PR remote/19496
* gdb.threads/forking-threads-plus-breakpoint.exp
(displaced_stepping_supported): New global.
(probe_displaced_stepping_support): New procedure.
(do_test): Add 'displaced' parameter, and use it.
(top level): Check for displaced stepping support.  Add displaced
stepping on/off testing axis.

8 years agogdb: Guard against undefined behaviour in mi-vla-fortran.exp
Andrew Burgess [Fri, 11 Dec 2015 19:58:50 +0000 (19:58 +0000)]
gdb: Guard against undefined behaviour in mi-vla-fortran.exp

The test gdb.mi/mi-vla-fortran.exp reveals an issue with the DWARF
generated by gfortran.

In the test a pointer variable 'pvla2' is created:
    real, pointer :: pvla2 (:, :)

Initially this variable will be unassociated, so something like this:
    l = associated(pvla2)

should return false.

In the test gdb stops at a point _before_ pvla2 is associated with
anything, and we then try to print pvla2, the expectation is that gdb
should reply <not associated>.

The problem is that the data the DWARF directs gdb to read (to identify
if the variable is associated or not) is not initialised until the first
time pvla2 is accessed.

As a result gdb ends up reading uninitialised memory, sometimes this
uninitialised memory indicates the variable is associated (when it's
not).  This first mistake can lead to a cascade of errors, reading
uninitialised memory, with the result that gdb builds an invalid type to
associate with the variable pvla2.

In some cases, this invalid type can be very large, which when we try to
print pvla2 causes gdb to allocate a large amount of memory.

A recent commit added a new gdb variable 'max-value-size', which
prevents gdb from allocating values of extreme size.  As a result
directly trying to print pvla2 will now now error rather than allocate a
large amount of memory.

However, some of the later tests create a varobj for pvla2, and then
ask for the children of that varobj to be displayed.  In the case where
an invalid type has been computed for pvla2 then the number of children
can be wrong, and very big, in which case trying to display all of these
children can cause gdb to consume an excessive amount of memory.

This commit first detects if printing pvla2 triggers the max-value-size
error, if it does then we avoid all the follow on tests relating to the
unassociated pvla2, which avoids the second error printing the varobj
children.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-vla-fortran.exp: Add XFAIL for accessing unassociated
pointer.  Don't perform further tests on the unassociated pointer
if the first test fails.

8 years agogdb: New set/show max-value-size command.
Andrew Burgess [Fri, 11 Dec 2015 17:37:49 +0000 (17:37 +0000)]
gdb: New set/show max-value-size command.

For languages with dynamic types, an incorrect program, or uninitialised
variables within a program, could result in an incorrect, overly large
type being associated with a value.  Currently, attempting to print such
a variable will result in gdb trying to allocate an overly large buffer.

If this large memory allocation fails then the result can be gdb either
terminating, or (due to memory contention) becoming unresponsive for the
user.

A new user visible variable in gdb helps guard against such problems,
two new commands are available:

   set max-value-size
   show max-value-size

The 'max-value-size' is the maximum size of memory in bytes that gdb
will allocate for the contents of a value.  Any attempt to allocate a
value with a size greater than this will result in an error.  The
initial default for this limit is set at 64k, this is based on a similar
limit that exists within the ada specific code.

It is possible for the user to set max-value-size to unlimited, in which
case the old behaviour is restored.

gdb/ChangeLog:

* value.c (max_value_size): New variable.
(MIN_VALUE_FOR_MAX_VALUE_SIZE): New define.
(show_max_value_size): New function.
(check_type_length_before_alloc): New function.
(allocate_value_contents): Call check_type_length_before_alloc.
(set_value_enclosing_type): Likewise.
(_initialize_values): Add set/show handler for max-value-size.
* NEWS: Mention new set/show command.

gdb/doc/ChangeLog:

* gdb.texinfo (Value Sizes): New section.
(Data): Add the 'Value Sizes' node to the menu.

gdb/testsuite/ChangeLog:

* gdb.base/max-value-size.c: New file.
* gdb.base/max-value-size.exp: New file.
* gdb.base/huge.exp: Disable max-value-size for this test.

8 years agoFix ARC TLS support.
Claudiu Zissulescu [Mon, 1 Feb 2016 17:03:56 +0000 (17:03 +0000)]
Fix ARC TLS support.

       * config/tc-arc.c (md_apply_fix): Allow addendum.
        (arc_reloc_op): Allow complex expressions for tpoff.
        (md_apply_fix): Handle resolved TLS local symbol.

* gas/arc/tls-relocs1.d: New file.
* gas/arc/tls-relocs1.s: Likewise.

8 years agoFix a problem building the ARM assembler using LLVM.
Loria [Mon, 1 Feb 2016 14:32:25 +0000 (14:32 +0000)]
Fix a problem building the ARM assembler using LLVM.

PR target/19311
* config/tc-arm.c (encode_arm_immediate): Recode to improve
efficiency and avoid an LLVM loop optimization bug.

8 years agoAdd support for importing data from ILF images.
Nathaniel Smith [Mon, 1 Feb 2016 13:44:15 +0000 (13:44 +0000)]
Add support for importing data from ILF images.

* peicode.h (pe_ILF_build_a_bfd): Create an import symbol for both
CODE and DATA.

8 years agoFix error building Microblaze assembler on a 32-bit host.
Nick Clifton [Mon, 1 Feb 2016 11:36:59 +0000 (11:36 +0000)]
Fix error building Microblaze assembler on a 32-bit host.

* config/tc-microblaze.c (parse_imm): Fix compile time warning
message extending a negative 32-bit value into a larger signed
value on a 32-bit host.

8 years agox86 synthetic plt symbols
Alan Modra [Mon, 1 Feb 2016 10:57:02 +0000 (21:27 +1030)]
x86 synthetic plt symbols

Changing "pushq $1" in the following to "pushq $too_big" results in an
abort.  BFD shouldn't abort on (deliberately) bad user input.

 400480:       ff 25 9a 0b 20 00       jmpq   *0x200b9a(%rip)
 400486:       68 01 00 00 00          pushq  $0x1
 40048b:       e9 d0 ff ff ff          jmpq   400460 <_init+0x20>

* elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Don't abort on
an out of range reloc_index.
* elf32-i386.c (elf_i386_get_plt_sym_val): Likewise.

8 years agoFix undefined compilation behaviour shifting a value into the sign bit of a signed...
Michael McConville [Mon, 1 Feb 2016 10:41:32 +0000 (10:41 +0000)]
Fix undefined compilation behaviour shifting a value into the sign bit of a signed integer.

* cgen-dis.c (count_decodable_bits): Use unsigned value for mask
test bit.

8 years agoFix NetBSD build with BSD and GNU make(1).
Kamil Rytarowski [Mon, 1 Feb 2016 10:35:38 +0000 (10:35 +0000)]
Fix NetBSD build with BSD and GNU make(1).

* Makefile.am (OPTIONAL_BACKENDS): Add netbsd-core.lo.
(OPTIONAL_BACKENDS_CFILES): Add netbsd-core.c.
* Makefile.in: Regenerated.

8 years agoFix some comments in varobj.{c,h}
Simon Marchi [Mon, 1 Feb 2016 03:22:19 +0000 (22:22 -0500)]
Fix some comments in varobj.{c,h}

A few typos.  The comment about varobj_create has been misplaced since
the dawn of time.

gdb/ChangeLog:

* varobj.h (struct varobj): Fix typos in comments.
(struct lang_varobj_ops): Likewise.
* varobj.c (VAROBJ_TABLE_SIZE): Likewise.
(varobj_create): Move misplaced comment.

8 years agoelf64-s390.c: Fix -Werror=misleading-indentation
Jan Kratochvil [Mon, 1 Feb 2016 02:47:47 +0000 (03:47 +0100)]
elf64-s390.c: Fix -Werror=misleading-indentation

../../bfd/elf64-s390.c: In function 'elf_s390_reloc_name_lookup':
../../bfd/elf64-s390.c:340:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
     if (strcasecmp (elf64_s390_vtinherit_howto.name, r_name) == 0)
     ^~
../../bfd/elf64-s390.c:333:3: note: ...this 'for' clause, but it is not
   for (i = 0;
   ^~~

bfd/
* elf64-s390.c (elf_s390_reloc_name_lookup): Fix indentation.

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

8 years agoFix /usr/bin/ld: final link failed: File truncated error on hppa.
John David Anglin [Sun, 31 Jan 2016 16:52:24 +0000 (11:52 -0500)]
Fix /usr/bin/ld: final link failed: File truncated error on hppa.

8 years agoCheck reloc against IFUNC symbol only with dynamic symbols
H.J. Lu [Sat, 30 Jan 2016 22:11:03 +0000 (14:11 -0800)]
Check reloc against IFUNC symbol only with dynamic symbols

There is no need to check relocation IFUNC symbol if there are no
dynamic symbols.

bfd/

PR ld/19539
* elf32-i386.c (elf_i386_reloc_type_class): Check relocation
against STT_GNU_IFUNC symbol only with dynamic symbols.
* elf64-x86-64.c (elf_x86_64_reloc_type_class): Likewise.

ld/

PR ld/19539
* testsuite/ld-elf/pr19539.d: New file.
* testsuite/ld-elf/pr19539.s: Likewise.
* testsuite/ld-elf/pr19539.t: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 31 Jan 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

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

8 years agoFix two misleading indentation warnings
Simon Marchi [Fri, 29 Jan 2016 20:32:29 +0000 (15:32 -0500)]
Fix two misleading indentation warnings

Two small changes so everything builds with latest GCC and its
-Wmisleading-indentation.

In the aarch64-tdep.c case, the two misindented lines should actually be
part of the for loop.  It looks like the indentation is all done using
spaces in that file though...  I fixed it (changed for tabs + spaces) for
the lines I touched.

In the xcoffread.c case, we can simply remove the braces and fix the
indentation.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_record_asimd_load_store): Add braces
to for include additional lines.
* xcoffread.c (scan_xcoff_symtab): Remove unnecessary braces.

8 years agoReplace == with = in gas/configure.ac
H.J. Lu [Fri, 29 Jan 2016 15:47:45 +0000 (07:47 -0800)]
Replace == with = in gas/configure.ac

PR gas/19532
* configure.ac (compressed_debug_sections): Replace == with =.
* configure: Regenerated.

8 years agoReplace == with = in ld/configure.ac
H.J. Lu [Fri, 29 Jan 2016 15:47:13 +0000 (07:47 -0800)]
Replace == with = in ld/configure.ac

 PR ld/19533
* configure.ac (compressed_debug_sections): Replace == with =.
* configure: Regenerated.

8 years agoAdd testsuite/ to the last gas ChangeLog entry
H.J. Lu [Fri, 29 Jan 2016 13:01:07 +0000 (05:01 -0800)]
Add testsuite/ to the last gas ChangeLog entry

8 years agoAdd option -mfence-as-lock-add=[no|yes].
Andrew Senkevich [Fri, 29 Jan 2016 12:46:50 +0000 (15:46 +0300)]
Add option -mfence-as-lock-add=[no|yes].

With -mfence-as-lock-add=yes lfence, mfence and sfence will be encoded
as lock addl $0x0, (%{r,e}sp).

gas/:

    * config/tc-i386.c (avoid_fence): New.
    (output_insn): Encode as lock addl $0x0, (%{r,e}sp) if avoid_fence
    is true.
    (OPTION_FENCE_AS_LOCK_ADD): New.
    (md_longopts): Add -mfence-as-lock-add.
    (md_parse_option): Handle -mfence-as-lock-add.
    (md_show_usage): Add -mfence-as-lock-add=[no|yes].
    * doc/c-i386.texi (-mfence-as-lock-add): Document.

gas/testsuite/:

    * gas/i386/i386.exp: Run new tests.
    * gas/i386/fence-as-lock-add.s: New.
    * gas/i386/fence-as-lock-add-yes.d: Likewise.
    * gas/i386/fence-as-lock-add-no.d: Likewise.
    * gas/i386/x86-64-fence-as-lock-add-yes.d: Likewise.
    * gas/i386/x86-64-fence-as-lock-add-no.d: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 29 Jan 2016 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoSet BFD_DECOMPRESS to decompress debug sections
H.J. Lu [Thu, 28 Jan 2016 21:29:53 +0000 (13:29 -0800)]
Set BFD_DECOMPRESS to decompress debug sections

We should set BFD_DECOMPRESS to decompress debug sections when reading in
DWARF debug sections.

bfd/

PR binutils/19523
* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Set BFD_DECOMPRESS to
decompress debug sections.

binutils/

PR binutils/19523
* Makefile.am (check-DEJAGNU): Pass CC and CC_FOR_BUILD to
runtest.
* Makefile.in: Regenerated.
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): New
proc.
Run test_gnu_debuglink for native ELF build.

8 years agoAdd ChangeLog entry for update to gdb.dlang demangle tests.
Iain Buclaw [Thu, 28 Jan 2016 20:53:51 +0000 (21:53 +0100)]
Add ChangeLog entry for update to gdb.dlang demangle tests.

8 years agoAlign dlang demangle tests with libiberty.
Iain Buclaw [Thu, 28 Jan 2016 20:47:44 +0000 (21:47 +0100)]
Align dlang demangle tests with libiberty.

gdb/testsuite/ChangeLog:
* gdb.dlang/demangle.exp: Sync tests from libiberty testsuite.

8 years agoSync libiberty with GCC.
Iain Buclaw [Thu, 28 Jan 2016 20:44:42 +0000 (21:44 +0100)]
Sync libiberty with GCC.

libiberty/ChangeLog:
* d-demangle.c (dlang_call_convention): Handle extern Objective-C
function calling convention.
(dlang_call_convention_p): Likewise.
(dlang_type): Likewise.
* testsuite/d-demangle-expected: Add coverage tests.

* d-demangle.c (dlang_function_args): Append ',' for variadic functions
only if parameters were seen before the elipsis symbol.
* testsuite/d-demangle-expected: Add coverage test for parameter-less
variadic functions.

* d-demangle.c (dlang_type): Handle function types only in the context
of seeing a pointer type symbol.
* testsuite/d-demangle-expected: Update function pointer tests.

8 years agoAdd rawmemchr to imported gnulib modules
Simon Marchi [Thu, 28 Jan 2016 18:49:46 +0000 (13:49 -0500)]
Add rawmemchr to imported gnulib modules

rawmemchr is a dependency of strchrnul, so it should be explicitly
listed.

gdb/ChangeLog:

* gnulib/import/Makefile.am: Regenerate.
* gnulib/import/Makefile.in: Regenerate.
* gnulib/import/m4/gnulib-cache.m4: Regenerate.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add rawmemchr.

8 years agoImport strchrnul from gnulib and use it
Simon Marchi [Thu, 28 Jan 2016 15:28:56 +0000 (10:28 -0500)]
Import strchrnul from gnulib and use it

For a forthcoming patch, I need a "skip_to_colon" function.  I noticed
there are two skip_to_semicolon (one in gdb and one in gdbserver). I
thought we could put it in common/, and generalize it for any character.
It turns out that the strchrnul function does exactly that.  I imported
the corresponding module from gnulib, for those systems that do not have
it.

There are probably more places where this function can be used instead
of doing the work by hand (I am looking at
remote-utils.c::look_up_one_symbol).

gdb/ChangeLog:

* remote.c (skip_to_semicolon): Remove.
(remote_parse_stop_reply): Use strchrnul instead of
skip_to_semicolon.
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
strchrnul.
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Regenerate.
* gnulib/import/Makefile.in: Regenerate.
* gnulib/import/m4/gnulib-cache.m4: Regenerate.
* gnulib/import/m4/gnulib-comp.m4: Regenerate.
* gnulib/import/m4/rawmemchr.m4: New file.
* gnulib/import/m4/strchrnul.m4: New file.
* gnulib/import/rawmemchr.c: New file.
* gnulib/import/rawmemchr.valgrind: New file.
* gnulib/import/strchrnul.c: New file.
* gnulib/import/strchrnul.valgrind: New file.

gdb/gdbserver/ChangeLog:

* server.c (skip_to_semicolon):  Remove.
(process_point_options): Use strchrnul instead of
skip_to_semicolon.

8 years ago[testsuite] Fix tiemout fail in gdb.fortran/vla-value.exp
Yao Qi [Thu, 28 Jan 2016 14:27:48 +0000 (14:27 +0000)]
[testsuite] Fix tiemout fail in gdb.fortran/vla-value.exp

In vla.f90, this single line of source is compiled to many instructions,

  vla2(:, :, :) = 1311                ! vla2-allocated

it is quite slow (about several minutes in my testing) to step over this
source line without range stepping.  This patch is to increase the timeout
value by 15 times, which is a magic number to make sure timeout disappears
in my testing with a slow arm-linux board.

gdb/testsuite:

2016-01-28  Yao Qi  <yao.qi@linaro.org>

* gdb.fortran/vla-value.exp: Wrap test with with_timeout_factor.

8 years agoFix GDB crash in dprintf.exp
Yao Qi [Thu, 28 Jan 2016 14:16:42 +0000 (14:16 +0000)]
Fix GDB crash in dprintf.exp

I see GDB crashes in dprintf.exp on aarch64-linux testing,

(gdb) PASS: gdb.base/dprintf.exp: agent: break 29
set dprintf-style agent^M
(gdb) PASS: gdb.base/dprintf.exp: agent: set dprintf style to agent
continue^M
Continuing.
ASAN:SIGSEGV
=================================================================
==22475==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x000000494820 sp 0x7fff389b83a0 bp 0x62d000082417 T0)
    #0 0x49481f in remote_add_target_side_commands /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:9190^M
    #1 0x49e576 in remote_add_target_side_commands /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:9174^M
    #2 0x49e576 in remote_insert_breakpoint /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:9240^M
    #3 0x5278b7 in insert_bp_location /home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:2734^M
    #4 0x52ac09 in insert_breakpoint_locations /home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:3159^M
    #5 0x52ac09 in update_global_location_list /home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:12686

the root cause of this problem in this case is about linespec and
symtab which produces additional incorrect location and a NULL is added to
bp_tgt->tcommands.  I posted a patch
https://sourceware.org/ml/gdb-patches/2015-12/msg00321.html to fix it
in linespec (the fix causes regression), but GDB still shouldn't add
NULL into bp_tgt->tcommands.  The logic of build_target_command_list
looks odd to me.  If we get something wrong in parse_cmd_to_aexpr (it
returns NULL), we shouldn't continue, instead we should set flag
null_command_or_parse_error.  This is what this patch does.  In the
meantime, we find build_target_condition_list has the same problem, so
fix it too.

gdb:

2016-01-28  Yao Qi  <yao.qi@linaro.org>

* breakpoint.c (build_target_command_list): Don't call continue
if aexpr is NULL.
(build_target_condition_list): Likewise.

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

8 years agorx: Treat scalars larger than 8 bytes as aggregates in rx_push_dummy_call.
Kevin Buettner [Sat, 23 Jan 2016 22:06:08 +0000 (15:06 -0700)]
rx: Treat scalars larger than 8 bytes as aggregates in rx_push_dummy_call.

This patch fixes the following failures (which are also GDB internal errors)
for the -m64bit-doubles multilib:

FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc1, dc2) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc3, dc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc1, ldc2) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc3, ldc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1,ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_double_complex_values(dc1, dc2) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_double_complex_values(dc3, dc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_double_complex_many_args(dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1, dc1) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_long_double_complex_values(ldc1, ldc2) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_long_double_complex_values(ldc3, ldc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4) (GDB internal error)
FAIL: gdb.base/callfuncs.exp: noproto: p t_long_double_complex_many_args(ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1,ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1, ldc1) (GDB internal error)
FAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, dc3, dc4) (GDB internal error)
FAIL: gdb.base/varargs.exp: print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4) (GDB internal error)

The assertion failure which is tripped is:

  gdb_assert (arg_size <= 4);

While it may seem that the patch ought to disallow scalars larger than
4, scalars of size 8 are explicitly handled by the code elsewhere.

This came up because gcc has a complex type that is 16 bytes in length
when 64-bit doubles are used.

gdb/ChangeLog:

* rx-tdep.c (rx_push_dummy_call): Treat scalars larger than 8
bytes as aggregates.

8 years agoRemove trailing `]' in --enable-compressed-debug-sections
H.J. Lu [Wed, 27 Jan 2016 18:24:51 +0000 (10:24 -0800)]
Remove trailing `]' in --enable-compressed-debug-sections

* configure.ac (compressed_debug_sections): Remove trailing `]'.
* configure: Regenerated.

8 years agoAdd Keith Seitz as Linespec Maintainer
Joel Brobecker [Wed, 27 Jan 2016 09:54:37 +0000 (13:54 +0400)]
Add Keith Seitz as Linespec Maintainer

gdb/ChangeLog:

        * MAINTAINERS (Responsible Maintainers): Add Keith Seitz as
        Linespec Maintainers.

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

8 years agoFix function comments
Simon Marchi [Tue, 26 Jan 2016 21:30:03 +0000 (16:30 -0500)]
Fix function comments

Two obvious fixes.

gdb/ChangeLog:

* common/common-utils.c (skip_spaces): Fix comment.
(skip_to_space_const): Likewise.

8 years agoFix subject verb agreement in the description of several debug settings.
John Baldwin [Fri, 22 Jan 2016 16:56:18 +0000 (08:56 -0800)]
Fix subject verb agreement in the description of several debug settings.

gdb/doc/ChangeLog:

* gdb.texinfo (Debugging Output): Fix subject verb disagreements.

8 years agoRemove argument pc in get_next_pcs
Yao Qi [Tue, 26 Jan 2016 14:08:26 +0000 (14:08 +0000)]
Remove argument pc in get_next_pcs

Nowadays, get_next_pcs in linux_target_ops has two parameters PC
and REGCACHE.  Parameter PC looks redundant because it can be go
from REGCACHE.  The patch is to remove PC from the arguments for
various functions.

gdb:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw):
Remove argument pc.  Get pc by regcache_read_pc.  Callers updated.
(arm_deal_with_atomic_sequence_raw): Likewise.
(thumb_get_next_pcs_raw): Likewise.
(arm_get_next_pcs_raw): Likewise.
(arm_get_next_pcs): Remove argument pc.  Callers updated.
* arch/arm-get-next-pcs.h (arm_get_next_pcs): Update declaration.

gdb/gdbserver:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* linux-arm-low.c (arm_gdbserver_get_next_pcs): Remove argument pc.
* linux-low.c (install_software_single_step_breakpoints): Don't
call regcache_read_pc.
* linux-low.h (struct linux_target_ops) <get_next_pcs>: Remove
argument pc.

8 years ago[GDBserver] Use regcache_read_pc in install_software_single_step_breakpoints
Yao Qi [Tue, 26 Jan 2016 14:08:26 +0000 (14:08 +0000)]
[GDBserver] Use regcache_read_pc in install_software_single_step_breakpoints

In install_software_single_step_breakpoints, we've got the regcache
of current_thread, so we don't have to bother get_pc to get pc,
instead we can get pc from regcache directly.  Note that the callers
of install_software_single_step_breakpoints have already switched
current_thread to LWP.

Since the pc is got from regcache_read_pc, in the next patch, we can
get pc inside the implementation of *the_low_target.get_next_pcs and
stop passing pc to *the_low_target.get_next_pcs.

gdb/gdbserver:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (install_software_single_step_breakpoints): Call
regcache_read_pc instead of get_pc.

8 years ago[GDBserver] Block and unblock SIGIO
Yao Qi [Tue, 26 Jan 2016 13:50:22 +0000 (13:50 +0000)]
[GDBserver] Block and unblock SIGIO

Nowadays, GDBserver disables async io (by ignoring SIGIO) when process
a serial event, and enables async io (by installing signal handler) when
resume the inferior and wait.  GDBserver may miss SIGIO (by interrupt)
and doesn't process SIGIO in time, which is shown by
gdb.base/interrupt-noterm.exp.  In the test, GDB sends "continue &" and
then "interrupt".  if '\003' arrives at a period between GDBserver
receives vCont;c and enables async io, SIGIO is ignored because signal
handler isn't installed.  GDBserver waits for the inferior and can not
notice '\003' until it returns from wait.

This patch changes the code to install SIGIO handler early, but block
and unblock SIGIO as needed.  In this way, we don't remove SIGIO
handler, so SIGIO can't be ignored.  However, GDBserver needs to
remove the signal handler when connection is closed.

gdb/gdbserver:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* remote-utils.c (remote_close) [!USE_WIN32API]: Ignore SIGIO.
(unblock_async_io): Rename to ...
(block_unblock_async_io): ... it.  New function.
(enable_async_io): Don't install SIGIO handler.  Unblock it
instead.
(disable_async_io): Don't ignore SIGIO.  Block it instead.
(initialize_async_io): Install SIGIO handler.  Don't call
unblock_async_io.

8 years ago[GDBserver] Check input interrupt after reading in a packet
Yao Qi [Tue, 26 Jan 2016 13:50:22 +0000 (13:50 +0000)]
[GDBserver] Check input interrupt after reading in a packet

GDBserver may read some packet together with '\003' in one go.  We've
already checked '\003' first when reading packet by my patch,

  Check input interrupt first when reading packet
  https://sourceware.org/ml/gdb-patches/2016-01/msg00057.html

but if we don't check '\003' *after* each packet, the interrupt will
be processed next time GDBserver reads from the buffer, so that the
interrupt isn't processed in time.  For example, GDB sends vCont;c and
interrupt (see gdb.base/interrupt-noterm.exp), we'll resume the
inferior and wait once packet vCont;c is seen.  If we don't check the
interrupt character after vCont;c packet, interrupt character will stay
in the buffer unattended until GDBserver returns from the wait, which
may take a while.  Note that since we've read '\003' from file
descriptor, SIGIO signal handler input_interrupt doesn't help either.

This issue can be exposed by hacking the end of getpkt like
@@ -1041,6 +1050,9 @@ getpkt (char *buf)
        }
     }

+  if (readchar_bufcnt > 0)
+    gdb_assert (*readchar_bufp != '\003');
+
   return bp - buf;
 }

and this can trigger internal error,
(gdb) PASS: gdb.base/interrupt-noterm.exp: interrupt
Remote connection closed^M
(gdb) FAIL: gdb.base/interrupt-noterm.exp: inferior received SIGINT
Remote debugging from host 10.2.206.40^M
/home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/remote-utils.c:1054: A problem internal to GDBserver has been detected.^M
getpkt: Assertion `*readchar_bufp != '\003'' failed.^M

This patch is to peek the buffer, if it is '\003', consume it and call
*the_target->request_interrupt.

gdb/gdbserver:

2016-01-26  Yao Qi  <yao.qi@linaro.org>

* remote-utils.c (getpkt): If the buffer isn't empty, and the
first character is '\003', call *the_target->request_interrupt.

8 years agoSkip thumb2 conditional backward search test for PE based targets.
Nick Clifton [Tue, 26 Jan 2016 09:13:38 +0000 (09:13 +0000)]
Skip thumb2 conditional backward search test for PE based targets.

* testsuite/gas/arm/thumb2_it_search.d: Skip for PE targets.

8 years agoRename OPTION_OMIT_LOCK_PREFIX to OPTION_MOMIT_LOCK_PREFIX
H.J. Lu [Tue, 26 Jan 2016 01:01:11 +0000 (17:01 -0800)]
Rename OPTION_OMIT_LOCK_PREFIX to OPTION_MOMIT_LOCK_PREFIX

Use OPTION_MXXX for -mxxx option in x86 assembler.

* config/tc-i386.c (OPTION_OMIT_LOCK_PREFIX): Renamed to ...
(OPTION_MOMIT_LOCK_PREFIX): This.
(md_longopts): Updated.
(md_parse_option): Likewise.

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

8 years agoFix GCC6 -Wmisleading-indentation issues.
Mark Wielaard [Mon, 25 Jan 2016 19:29:54 +0000 (20:29 +0100)]
Fix GCC6 -Wmisleading-indentation issues.

GCC6 will warn about misleading indentation issues like:

gdb/ada-lang.c: In function ‘ada_evaluate_subexp’:
ada-lang.c:11423:9: error: statement is indented as if it were guarded by...
         arg1 = unwrap_value (arg1);
         ^~~~

gdb/ada-lang.c:11421:7: note: ...this ‘else’ clause, but it is not
       else
       ^~~~

In this case it would be a bug except for the fact the if clause already
returned early. So this misindented statement really only got executed
for the else case. But it could easily mislead a reader, so adding a
proper else block is the correct solution.

In case of c-typeprint.c (c_type_print_base) the if statement is indeed
misleadingly indented, but not a bug. Just indent correctly. The inflow.c
(terminal_ours_1) misindented block comes from the removal of an if clause
in commit d9d2d8b which looks correct. Just introduce an else to fixup the
indentation of the block. The linux-record.c misleadingly indented return
statements are just that. Misleading to the reader, but not actual bugs.
Just unindent them so they don't look like they fall under the wrong if
clause.

8 years agoAvoid the use of gp-relative addressing when abicalls are in effect.
Catherine Moore [Mon, 25 Jan 2016 20:39:40 +0000 (12:39 -0800)]
Avoid the use of gp-relative addressing when abicalls are in effect.

8 years agoPrevent .noinit section from incorrect placement for AVR.
Denis Chertykov [Mon, 25 Jan 2016 19:33:25 +0000 (22:33 +0300)]
Prevent .noinit section from incorrect placement for AVR.

When .data and .bss sections are empty .noinit section is placed at data
region's start. This will be incorrect for devices that has different
data start address than data region start in linker script.
The patch updates .noinit section's VMA to end of .bss section. So, .noinit
section will be placed at .data section address (-Tdata=<address>) when .data
and .bss sections are empty.

ld/

* scripttempl/avr.sc (.noinit): Force .noinit VMA to end of .bss VMA.
* scripttempl/avrtiny.sc (.noinit): Likewise.

8 years agoRemove new_thread_notify and dead_thread_notify
Yao Qi [Mon, 25 Jan 2016 16:11:43 +0000 (16:11 +0000)]
Remove new_thread_notify and dead_thread_notify

They were added by

  PATCH: Multithreaded debugging for gdbserver
  https://sourceware.org/ml/gdb-patches/2002-06/msg00157.html

but as a no-op, and the last usage of them was removed by

  [gdbserver/RFC/RFA] Implement multiprocess extensions, add linux multiproces support.
  https://sourceware.org/ml/gdb-patches/2009-03/msg00667.html

This patch is to remove them.

gdb/gdbserver:

2016-01-25  Yao Qi  <yao.qi@linaro.org>

* remote-utils.c (new_thread_notify): Remove.
(dead_thread_notify): Likewise.
* remote-utils.h (new_thread_notify): Remove declaration.
(dead_thread_notify): Likewise.