external/binutils.git
8 years agoRefine .cfi_sections check to only consider compact eh_frame
Matthew Fortune [Thu, 29 Sep 2016 10:13:46 +0000 (11:13 +0100)]
Refine .cfi_sections check to only consider compact eh_frame

The .cfi_sections directive can be safely used multiple times
with different sections named at any time unless the compact form
of exception handling is requested after CFI information has
been emitted.  Only the compact form of CFI information changes
the way in which CFI is generated and therefore cannot be
retrospectively requested after generating CFI information.

gas/

PR gas/20648
* dw2gencfi.c (dot_cfi_sections): Refine the check for
inconsistent .cfi_sections to only consider compact vs non
compact forms.
* testsuite/gas/cfi/cfi-common-9.d: New file.
* testsuite/gas/cfi/cfi-common-9.s: New file.
* testsuite/gas/cfi/cfi.exp: Run new test.

8 years agoMake "end" field in feature specs required again.
Doug Evans [Thu, 6 Oct 2016 11:12:33 +0000 (12:12 +0100)]
Make "end" field in feature specs required again.

Newer gdbservers may be talking to older gdbs,
and older gdbs will flag a missing "end" as an error.
So just make "end" required again, and for compatibility
change the default field type to "bool".

gdb/ChangeLog:
2016-10-06  Doug Evans  <dje@google.com>

* features/aarch64-core.xml (cpsr_flags): Elide "type" and specify
"end" in all fields.
* features/aarch64.c: Regenerate.
* features/i386/32bit-mpx.xml (_bndcfgu): Specify type of "preserved"
and "enabled" fields. Correct size of "enabled" field.
* features/i386/64bit-mpx.xml (_bndcfgu): Specify type of "preserved"
and "enabled" fields.
* features/i386/i386-avx-mpx-linux.c: Regenerate.
* features/i386/i386-avx-mpx.c: Regenerate.
* features/i386/i386-avx512-linux.c: Regenerate.
* features/i386/i386-avx512.c: Regenerate.
* features/i386/i386-mpx-linux.c: Regenerate.
* features/i386/i386-mpx.c: Regenerate.
* features/arc-arcompact.c: Regenerate.
* features/arc-v2.c: Regenerate.
* xml-tdesc.c (tdesc_start_field): Require "end" spec.  Single bit
fields default to "bool" type.

Revert 2016-03-15  Doug Evans  <dje@google.com>
* features/i386/32bit-core.xml (i386_eflags): Remove "end" spec.
* features/i386/32bit-sse.xml (i386_eflags): Ditto.
* features/i386/64bit-core.xml (i386_eflags): Ditto.
* features/i386/64bit-sse.xml (i386_eflags): Ditto.
* features/i386/x32-core.xml (i386_eflags): Ditto.

gdb/doc/ChangeLog:
2016-10-06  Doug Evans  <dje@google.com>

* gdb.texinfo (Target Description Format): Update docs on "end"
field spec and field default type.

gdb/testsuite/ChangeLog:
2016-10-06  Doug Evans  <dje@google.com>

* gdb.xml/extra-regs.xml: Update, end field now required, default type
for single bitfields is bool.
* gdb.xml/tdesc-regs.exp: Ditto.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Oct 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years ago-Wimplicit-fallthrough warning fixes
Alan Modra [Wed, 5 Oct 2016 07:47:02 +0000 (18:17 +1030)]
-Wimplicit-fallthrough warning fixes

Comment changes.

bfd/
* coff-h8300.c: Spell fall through comments consistently.
* coffgen.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf64-ppc.c: Likewise.
* elfxx-aarch64.c: Likewise.
* elfxx-mips.c: Likewise.
* cpu-ns32k.c: Add missing fall through comments.
* elf-m10300.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-rl78.c: Likewise.
* elf32-rx.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-x86-64.c: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* ieee.c: Likewise.
* oasys.c: Likewise.
* pdp11.c: Likewise.
* srec.c: Likewise.
* versados.c: Likewise.
opcodes/
* aarch64-opc.c: Spell fall through comments consistently.
* i386-dis.c: Likewise.
* aarch64-dis.c: Add missing fall through comments.
* aarch64-opc.c: Likewise.
* arc-dis.c: Likewise.
* arm-dis.c: Likewise.
* i386-dis.c: Likewise.
* m68k-dis.c: Likewise.
* mep-asm.c: Likewise.
* ns32k-dis.c: Likewise.
* sh-dis.c: Likewise.
* tic4x-dis.c: Likewise.
* tic6x-dis.c: Likewise.
* vax-dis.c: Likewise.
binutils/
* dlltool.c: Spell fall through comments consistently.
* objcopy.c: Likewise.
* readelf.c: Likewise.
* dwarf.c: Add missing fall through comments.
* elfcomm.c: Likewise.
* sysinfo.y: Likewise.
* readelf.c: Likewise.  Also remove extraneous comments.
gas/
* app.c: Add missing fall through comments.
* dw2gencfi.c: Likewise.
* expr.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-crx.c: Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-h8300.c: Likewise.
* config/tc-hppa.c: Likewise.
* config/tc-i370.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-m68hc11.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-mep.c: Likewise.
* config/tc-metag.c: Likewise.
* config/tc-microblaze.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-ns32k.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-vax.c: Likewise.
* config/tc-xstormy16.c: Likewise.
* config/tc-z80.c: Likewise.
* config/tc-z8k.c: Likewise.
* config/obj-elf.c: Likewise.
* config/tc-i386.c: Likewise.
* depend.c: Spell fall through comments consistently.
* config/tc-arm.c: Likewise.
* config/tc-d10v.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-mcore.c: Likewise.
* config/tc-mep.c: Likewise.
* config/tc-ns32k.c: Likewise.
* config/tc-visium.c: Likewise.
* config/tc-xstormy16.c: Likewise.
* config/tc-z8k.c: Likewise.
gprof/
* gprof.c: Add missing fall through comments.
ld/
* lexsup.c: Spell fall through comments consistently and add
missing fall through comments.

8 years ago-Wimplicit-fallthrough noreturn fixes
Alan Modra [Wed, 5 Oct 2016 06:14:07 +0000 (16:44 +1030)]
-Wimplicit-fallthrough noreturn fixes

binutils/
* cxxfilt.c (usage): Add ATTRIBUTE_NORETURN.
* elfedit.c (usage): Likewise.
* nm.c (usage): Likewise.
* objcopy.c (copy_usage, strip_usage): Likewise.
* srconv.c (show_usage): Likewise.
* strings.c (usage): Likewise.
* sysdump.c (show_usage): Likewise.
* srconv.c: Remove unneeded forward function declarations.
* strings.c: Likewise.
* sysdump.c: Likewise.
gas/
* as.h (as_assert): Add ATTRIBUTE_NORETURN.

8 years ago-Wimplicit-fallthrough error fixes
Alan Modra [Wed, 5 Oct 2016 06:22:24 +0000 (16:52 +1030)]
-Wimplicit-fallthrough error fixes

Well, not all are errors, but a little more substantive than just
fiddling with comments.

bfd/
* coffcode.h (coff_slurp_symbol_table): Revert accidental commit
made 2015-01-08.
* elf32-nds32.c (nds32_elf_grok_psinfo): Add missing break.
* reloc.c (bfd_default_reloc_type_lookup): Add missing breaks.
opcodes/
* arc-ext.c (create_map): Add missing break.
* msp430-decode.opc (encode_as): Likewise.
* msp430-decode.c: Regenerate.
binutils/
* coffdump.c (dump_coff_where): Add missing break.
* stabs.c (stab_xcoff_builtin_type): Likewise.
gas/
* config/tc-arc.c (find_opcode_match): Add missing break.
* config/tc-i960.c (get_cdisp): Likewise.
* config/tc-metag.c (parse_swap, md_apply_fix): Likewise.
* config/tc-mt.c (md_parse_option): Likewise.
* config/tc-nds32.c (nds32_apply_fix): Likewise.
* config/tc-hppa.c (pa_ip): Assert rather than testing last
condition of multiple if statements.
* config/tc-s390.c (s390_exp_compare): Return 0 on error.
* config/tc-tic4x.c (tic4x_operand_parse): Add as_bad and break
out of case rather than falling into next case.  Formatting.
ld/
* plugin.c (asymbol_from_plugin_symbol): Avoid compiler warning
by adding return.

8 years ago[GOLD] -Wimplicit-fallthrough warning fixes
Alan Modra [Wed, 5 Oct 2016 05:10:11 +0000 (15:40 +1030)]
[GOLD] -Wimplicit-fallthrough warning fixes

* aarch64.cc: Spell fall through comments as "// Fall through.".
* arm.cc: Likewise.
* mips.cc: Likewise.
* powerpc.cc: Likewise.
* s390.cc: Likewise.
* sparc.cc: Likewise.
* x86_64.cc: Likewise.
* powerpc.cc (Target_powerpc::Relocate::relocate): Add missing
fall through comments.
* sparc.cc: (Target_sparc::Scan::global): Likewise.
(Target_sparc::Relocate::relocate): Likewise.
* tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
* resolve.cc (symbol_to_bits): Add missing break.

8 years agobison warning fixes
Alan Modra [Wed, 5 Oct 2016 22:25:23 +0000 (08:55 +1030)]
bison warning fixes

* config/rl78-parse.y: Don't use deprecated %name-prefix.
* config/rx-parse.y: Likewise.

8 years agoDon't use boolean OR in arithmetic expressions
Alan Modra [Wed, 5 Oct 2016 21:38:25 +0000 (08:08 +1030)]
Don't use boolean OR in arithmetic expressions

bfd/
* elf32-epiphany.c (epiphany_final_link_relocate): Use bitwise
OR in arithmetic expression, not boolean OR.
opcodes/
* cr16-dis.c (print_insn_cr16): Don't use boolean OR in arithmetic.
* crx-dis.c (print_insn_crx): Likewise.

8 years agotestsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp
Jan Kratochvil [Wed, 5 Oct 2016 19:56:46 +0000 (21:56 +0200)]
testsuite: Fix recent GCC FAIL: gdb.arch/i386-signal.exp

gcc-6.2.1-2.fc24.x86_64

(gdb) backtrace 10^M
(gdb) FAIL: gdb.arch/i386-signal.exp: backtrace 10

(gdb) disas/s
Dump of assembler code for function main:
.../gdb/testsuite/gdb.arch/i386-signal.c:
30      {
   0x000000000040057f <+0>:     push   %rbp
   0x0000000000400580 <+1>:     mov    %rsp,%rbp
31        setup ();
   0x0000000000400583 <+4>:     callq  0x400590 <setup>
=> 0x0000000000400588 <+9>:     mov    $0x0,%eax
32      }
   0x000000000040058d <+14>:    pop    %rbp
   0x000000000040058e <+15>:    retq
End of assembler dump.

The .exp patch is an obvious typo fix I think.  The regex was written to
accept "ADDR in main" and I find it OK as checking .debug_line validity is not
the purpose of this testfile.

gcc-4.8.5-11.el7.x86_64 did not put the 'mov $0x0,%eax' instruction there at
all so there was no problem with .debug_line.

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

* gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo.

8 years agoPR remote/20655 - small fix in handle_tracepoint_bkpts
Tom Tromey [Fri, 30 Sep 2016 21:45:26 +0000 (15:45 -0600)]
PR remote/20655 - small fix in handle_tracepoint_bkpts

handle_tracepoint_bkpts has two parallel "if"s.  This changes the
second one to check ipa_error_tracepoint, which seems to be what was
intended.

2016-10-05  Tom Tromey  <tom@tromey.com>

PR remote/20655:
* tracepoint.c (handle_tracepoint_bkpts): Check
ipa_error_tracepoint, not ipa_stopping_tracepoint.

8 years agoPR gdb/20653 - small cleanup in string_to_explicit_location
Tom Tromey [Fri, 30 Sep 2016 21:43:40 +0000 (15:43 -0600)]
PR gdb/20653 - small cleanup in string_to_explicit_location

This bug points out that string_to_explicit_location compares a char*
against '\0'; whereas comparing against NULL is more normal.

2016-10-05  Tom Tromey  <tom@tromey.com>

PR breakpoints/20653:
* location.c (string_to_explicit_location): Use NULL, not '\0'.

8 years agoPR symtab/20652 - fix psymbol_compare
Tom Tromey [Fri, 30 Sep 2016 21:42:28 +0000 (15:42 -0600)]
PR symtab/20652 - fix psymbol_compare

This fixes an oversight in psymbol_compare.

2016-10-05  Tom Tromey  <tom@tromey.com>

PR symtab/20652:
* psymtab.c (psymbol_compare): Correctly compare "ginfo.value"
fields.

8 years agoSkip complex types tests if gdb_skip_float_test
Yao Qi [Wed, 5 Oct 2016 16:04:31 +0000 (17:04 +0100)]
Skip complex types tests if gdb_skip_float_test

If the target doesn't support float, we don't run float complex types
tests.

gdb/testsuite:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

* lib/gdb.exp (support_complex_tests): Return zero if
gdb_skip_float_test return true.

8 years agoFix incorrect formatting of a ChangeLog entry
Anton Kolesov [Wed, 5 Oct 2016 14:04:17 +0000 (17:04 +0300)]
Fix incorrect formatting of a ChangeLog entry

My previous commit had an invalid formatting of a ChangeLog entry.  This commit
fixes that.

8 years agoAllow DW_OP_GNU_uninit in dwarf_expr_require_composition
Andreas Arnez [Wed, 5 Oct 2016 10:36:29 +0000 (12:36 +0200)]
Allow DW_OP_GNU_uninit in dwarf_expr_require_composition

In DWARF expression handling, some operators are required to be either
at the end of an expression or followed by a composition operator.  So
far only the operators DW_OP_reg0-31 were allowed to be followed by
DW_OP_GNU_uninit instead, and particularly DW_OP_regx was not, which is
obviously inconsistent.

This patch allows DW_OP_GNU_uninit after all operators requiring a
composition, to simplify the code and make it more consistent.  This
policy may be more permissive than necessary, but in the worst case just
leads to a DWARF location description resulting in an uninitialized
value instead of an error message.

gdb/ChangeLog:

* dwarf2expr.c (dwarf_expr_require_composition): Allow
DW_OP_GNU_uninit.
(execute_stack_op): Use dwarf_expr_require_composition instead of
copying its logic.

8 years agoarc: Remove annoying debug message
Anton Kolesov [Wed, 5 Oct 2016 10:06:08 +0000 (13:06 +0300)]
arc: Remove annoying debug message

The logging message is called too often - once for each register when it's
value has to be evaluated. This floods the screen for commands like "info
register all", but doesn't give really any help at debugging GDB issues.
Between increasing the debug level of this message and removing it altogether I
think that removing it is preferable.

gdb/ChangeLog:

arc-tdep.c (arc_frame_prev_register): Remove annoying log message.

8 years agoUpdate the path arm-*.xml files for aarch64
Yao Qi [Wed, 5 Oct 2016 09:00:24 +0000 (10:00 +0100)]
Update the path arm-*.xml files for aarch64

0a69eedb (Clean up the XML files for ARM) breaks the GDBserver build
on aarch64 because some arm-*.xml files can't be found.

This patch is to fix the build failure.

gdb/gdbserver:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

* configure.srv: Update the path of arm-*.xml files.

8 years agoRegenerate some regformats/rs6000/*.dat files
Yao Qi [Wed, 5 Oct 2016 08:31:13 +0000 (09:31 +0100)]
Regenerate some regformats/rs6000/*.dat files

If I remove all regformats/*.dat files and run
make GDB=/scratch/yao/gdb/build-git/all-targets/gdb/gdb all, some
powerpc .dat files are not generated.

This patch fixes it by adding them to WHICH, so these .dat files can
be generated.

gdb:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

* features/Makefile (WHICH): Add
rs6000/powerpc-isa205-32l, rs6000/powerpc-isa205-64l,
rs6000/powerpc-isa205-altivec32l, rs6000/powerpc-isa205-altivec64l,
rs6000/powerpc-isa205-vsx32l and rs6000/powerpc-isa205-vsx64l.
* regformats/rs6000/powerpc-isa205-32l.dat: Regenerated.
* regformats/rs6000/powerpc-isa205-64l.dat: Likewise.
* regformats/rs6000/powerpc-isa205-altivec32l.dat: Likewise.
* regformats/rs6000/powerpc-isa205-altivec64l.dat: Likewise.
* regformats/rs6000/powerpc-isa205-vsx32l.dat: Likewise.
* regformats/rs6000/powerpc-isa205-vsx64l.dat: Likewise.

8 years agoGenerate s390 target description c files
Yao Qi [Wed, 5 Oct 2016 08:31:13 +0000 (09:31 +0100)]
Generate s390 target description c files

If I delete all target description c files under features/ directory,
and run make GDB=/scratch/yao/gdb/build-git/all-targets/gdb/gdb cfiles,
some s390 target description c files are not generated.

This patch adds these s390 xml files to XMLTOC, so these c files can
be generated.

gdb:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

* features/Makefile (XMLTOC): Add s390-tevx-linux64.xml,
s390-vx-linux64.xml, s390x-tevx-linux64.xml and
s390x-vx-linux64.xml.

8 years agoSimplify i386, amd64 and x32 expedite registers
Yao Qi [Wed, 5 Oct 2016 08:31:13 +0000 (09:31 +0100)]
Simplify i386, amd64 and x32 expedite registers

Nowadays, there are a lot of duplication about
i386/{i386, amd64, x32}*-expedite in features/Makefile.  However,
in features/Makefile, we have

 echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
  >> $(outdir)/$*.tmp

which means for a given bar/foo-baz.xml, we'll look for either
bar/foo-baz-expedite or foo-expedite.  In x86 expedite registers, we
use the former now, but it will be much simpler if we use the latter.
This is what this patch does.  This patch removes them, and defines
three generic expedite.  Re-run 'make GDB=/path/build/gdb all' to
regenerate regformats/*.dat files, and they are not changed.

gdb:

2016-10-05  Yao Qi  <yao.qi@linaro.org>

* features/Makefile: Remove i386/*-expedite. Add i386-expedite,
amd64-expedite, and x32-expedite.

8 years agoClean up the XML files for ARM
Yao Qi [Wed, 5 Oct 2016 08:31:13 +0000 (09:31 +0100)]
Clean up the XML files for ARM

This patch is move features/arm-*.xml to features/arm/, and it is based
on Terry's patch posted here
https://sourceware.org/ml/gdb-patches/2014-06/msg00794.html

One comment to Terry's patch is about losing "arm" prefix, and the new
patch fixes this problem.

gdb:

2016-10-05  Terry Guo  <terry.guo@arm.com>
    Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c: Adjust includes.
* features/Makefile (WHICH): Add "arm/" directory to arm
target descriptions.
(XMLTOC): Likewise.
(arm/arm-with-iwmmxt.dat): Adjust the path for
dependencies.
* features/arm-core.xml: Moved to ...
* features/arm/arm-core.xml: ... it.
* features/arm-fpa.xml: Moved to ...
* features/arm/arm-fpa.xml: ... it.
* features/arm-m-profile.xml: Moved to ...
* features/arm/arm-m-profile.xm: ... it.
* features/arm-vfpv2.xml: Moved to ...
* features/arm/arm-vfpv2.xm: ... it.
* features/arm-vfpv3.xml: Moved to ...
* features/arm/arm-vfpv3.xml: ... it.
* features/arm-with-iwmmxt.c: Moved to ...
* features/arm/arm-with-iwmmxt.c: ... it.
* features/arm-with-iwmmxt.xml: Moved to ...
* features/arm/arm-with-iwmmxt.xml: ... it.
* features/arm-with-m-fpa-layout.c: Moved to ...
* features/arm/arm-with-m-fpa-layout.c: ... it.
* features/arm-with-m-fpa-layout.xml: Moved to ...
* features/arm/arm-with-m-fpa-layout.xml: ... it.
* features/arm-with-m-vfp-d16.c: Moved to ...
* features/arm/arm-with-m-vfp-d16.c: ... it.
* features/arm-with-m-vfp-d16.xml: Moved to ...
* features/arm/arm-with-m-vfp-d16.xml: ... it.
* features/arm-with-m.c: Moved to ...
* features/arm/arm-with-m.c: ... it.
* features/arm-with-m.xml: Moved to ...
* features/arm/arm-with-m.xm: ... it.
* features/arm-with-neon.c: Moved to ...
* features/arm/arm-with-neon.c: ... it.
* features/arm-with-neon.xml: Moved to ...
* features/arm/arm-with-neon.xml: ... it.
* features/arm-with-vfpv2.c: Moved to ...
* features/arm/arm-with-vfpv2.c: ... it.
* features/arm-with-vfpv2.xml: Moved to ...
* features/arm/arm-with-vfpv2.xml: ... it.
* features/arm-with-vfpv3.c: Moved to ...
* features/arm/arm-with-vfpv3.c: ... it.
* features/arm-with-vfpv3.xml: Moved to ...
* features/arm/arm-with-vfpv3.xml: ... it.
* features/xscale-iwmmxt.xml: Moved to ...
* features/arm/xscale-iwmmxt.xml: ... it.

gdb/gdbserver:

2016-10-05  Terry Guo  <terry.guo@arm.com>
    Yao Qi  <yao.qi@linaro.org>

* Makefile.in: Adjust the path of rules.
* configure.srv: Update the path of xml files.
* regformats/arm-with-iwmmxt.dat: Regenerated.
* regformats/arm-with-neon.dat: Likewise.
* regformats/arm-with-vfpv2.dat: Likewise.
* regformats/arm-with-vfpv3.dat Likewise.

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

8 years agold expression section
Alan Modra [Tue, 4 Oct 2016 00:13:50 +0000 (10:43 +1030)]
ld expression section

Changes the result of ld expressions that were previously plain
numbers to be an absolute address, in the same circumstances where
numbers are treated as absolute addresses.

* ld.texinfo (Expression Section): Update result of arithmetic
expressions.
* ldexp.c (arith_result_section): New function.
(fold_binary): Use it.

8 years agoFold arithmetic integer expressions
Alan Modra [Tue, 4 Oct 2016 00:11:26 +0000 (10:41 +1030)]
Fold arithmetic integer expressions

Commit b751e639 regressed arm linux kernel builds, that have an
ASSERT (((__hyp_idmap_text_end - (__hyp_idmap_text_start
                  & ~ (((0x1 << 0xc) - 0x1))))
         <= (0x1 << 0xc)), HYP init code too big or misaligned)

Due to some insanity in ld expression evaluation, the integer values
0x1 and 0xc above are treated as absolute addresses (ie. they have an
associated section, *ABS*, see exp_fold_tree_1 case etree_value) while
the expression (0x1 << 0xc) has a plain number result.  The left hand
side of the inequality happens to evaluate to a "negative" .text
section relative value.  Comparing a section relative value against an
absolute value works since the section relative value is first
converted to absolute.  Comparing a section relative value against a
number just compares the offsets, which fails since the "negative"
offset is really a very large positive number.

This patch works around the problem by folding integer expressions, so
the assert again becomes
ASSERT (((__hyp_idmap_text_end - (__hyp_idmap_text_start
                  & 0xfffffffffffff000))
         <= 0x1000), HYP init code too big or misaligned)

* ldexp.c (exp_value_fold): New function.
(exp_unop, exp_binop, exp_trinop): Use it.

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

8 years agoAdd test for user context selection sync
Antoine Tremblay [Mon, 3 Oct 2016 20:55:35 +0000 (16:55 -0400)]
Add test for user context selection sync

This patch adds a test to verify that events are sent properly to all
UIs when the user selection context (inferior, thread, frame) changes.

The goal of the C test file is to provide two threads that are stopped with the
same predictable backtrace (so that we can test frame switching).  The barrier
helps us know when the child threads are started.  Then, scheduler-locking is
used to bring each thread one by one to the position we expect them to be
during the test.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

PR gdb/20487
* gdb.mi/user-selected-context-sync.exp: New file.
* gdb.mi/user-selected-context-sync.c: New file.

8 years agoEmit inferior, thread and frame selection events to all UIs
Antoine Tremblay [Mon, 3 Oct 2016 20:52:44 +0000 (16:52 -0400)]
Emit inferior, thread and frame selection events to all UIs

With this patch, when an inferior, thread or frame is explicitly
selected by the user, notifications will appear on all CLI and MI UIs.
When a GDB console is integrated in a front-end, this allows the
front-end to follow a selection made by the user ont he CLI, and it
informs the user about selection changes made behind the scenes by the
front-end.

This patch addresses PR gdb/20487.

In order to communicate frame changes to the front-end, this patch adds
a new field to the =thread-selected event for the selected frame.  The
idea is that since inferior/thread/frame can be seen as a composition,
it makes sense to send them together in the same event.  The vision
would be to eventually send the inferior information as well, if we find
that it's needed, although the "=thread-selected" event would be
ill-named for that job.

Front-ends need to handle this new field if they want to follow the
frame selection changes that originate from the console.  The format of
the frame attribute is the same as what is found in the *stopped events.

Here's a detailed example for each command and the events they generate:

thread
------

1. CLI command:

     thread 1.3

   MI event:

     =thread-selected,id="3",frame={...}

2. MI command:

     -thread-select 3

   CLI event:

     [Switching to thread 1.3 ...]

3. MI command (CLI-in-MI):

     thread 1.3

   MI event/reply:

     &"thread 1.3\n"
     ~"#0  child_sub_function () ...
     =thread-selected,id="3",frame={level="0",...}
     ^done

frame
-----

1. CLI command:

     frame 1

   MI event:

     =thread-selected,id="3",frame={level="1",...}

2. MI command:

     -stack-select-frame 1

   CLI event:

     #1  0x00000000004007f0 in child_function...

3. MI command (CLI-in-MI):

     frame 1

   MI event/reply:

     &"frame 1\n"
     ~"#1  0x00000000004007f9 in ..."
     =thread-selected,id="3",frame={level="1"...}
     ^done

inferior
--------

Inferior selection events only go from the console to MI, since there's
no way to select the inferior in pure MI.

1. CLI command:

     inferior 2

   MI event:

     =thread-selected,id="3"

Note that if the user selects an inferior that is not started or exited,
the MI doesn't receive a notification.  Since there is no threads to
select, the =thread-selected event does not apply...

2. MI command (CLI-in-MI):

     inferior 2

   MI event/reply:

     &"inferior 2\n"
     ~"[Switching to inferior 2 ...]"
     =thread-selected,id="4",frame={level="0"...}
     ^done

Internal implementation detail: this patch makes it possible to suppress
notifications caused by a CLI command, like what is done in mi-interp.c.
This means that it's now possible to use the
add_com_suppress_notification function to register a command with some
event suppressed.  It is used to implement the select-frame command in
this patch.

The function command_notifies_uscc_observer was added to extract
the rather complicated logical expression from the if statement.  It is
also now clearer what that logic does: if the command used by the user
already notifies the user_selected_context_changed observer, there is
not need to notify it again.  It therefore protects again emitting the
event twice.

No regressions, tested on ubuntu 14.04 x86 with target boards unix and
native-extended-gdbserver.

gdb/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

PR gdb/20487
* NEWS: Mention new frame field of =thread-selected event.
* cli/cli-decode.c (add_cmd): Initialize c->suppress_notification.
(add_com_suppress_notification): New function definition.
(cmd_func): Set and restore the suppress_notification flag.
* cli/cli-deicode.h (struct cmd_list_element)
<suppress_notification>: New field.
* cli/cli-interp.c (cli_suppress_notification): New global variable.
(cli_on_user_selected_context_changed): New function.
(_initialize_cli_interp): Attach to user_selected_context_changed
observer.
* command.h (struct cli_suppress_notification): New structure.
(cli_suppress_notification): New global variable declaration.
(add_com_suppress_notification): New function declaration.
* defs.h (enum user_selected_what_flag): New enum.
(user_selected_what): New enum flag type.
* frame.h (print_stack_frame_to_uiout): New function declaration.
* gdbthread.h (print_selected_thread_frame): New function declaration.
* inferior.c (print_selected_inferior): New function definition.
(inferior_command): Remove printing of inferior/thread/frame switch
notifications, notify user_selected_context_changed observer.
* inferior.h (print_selected_inferior): New function declaration.
* mi/mi-cmds.c (struct mi_cmd): Add user_selected_context
suppression to stack-select-frame and thread-select commands.
* mi/mi-interp.c (struct mi_suppress_notification)
<user_selected_context>: Initialize.
(mi_user_selected_context_changed): New function definition.
(_initialize_mi_interp): Attach to user_selected_context_changed.
* mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply.
(mi_execute_command): Handle notification suppression.  Notify
user_selected_context_changed observer on thread change instead of printing
event directly.  Don't send it if command already sends the notification.
(command_notifies_uscc_observer): New function.
(mi_cmd_execute): Don't handle notification suppression.
* mi/mi-main.h (struct mi_suppress_notification)
<user_selected_context>: New field.
* stack.c (print_stack_frame_to_uiout): New function definition.
(select_frame_command): Notify user_selected_context_changed
observer.
(frame_command): Call print_selected_thread_frame if there's no frame
change or notify user_selected_context_changed observer if there is.
(up_command): Notify user_selected_context_changed observer.
(down_command): Likewise.
(_initialize_stack): Suppress user_selected_context notification for
command select-frame.
* thread.c (thread_command): Notify
user_selected_context_changed if the thread has changed, print
thread info directly if it hasn't.
(do_captured_thread_select): Do not print thread switch event.
(print_selected_thread_frame): New function definition.
* tui/tui-interp.c (tui_on_user_selected_context_changed):
New function definition.
(_initialize_tui_interp): Attach to user_selected_context_changed
observer.

gdb/doc/ChangeLog:

PR gdb/20487
* gdb.texinfo (Context management): Update mention of frame
change notifications.
(gdb/mi Async Records): Document frame field in
=thread-select event.
* observer.texi (GDB Observers): New user_selected_context_changed
observer.

gdb/testsuite/ChangeLog:

PR gdb/20487
* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt
=thread-select-event check.

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

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Oct 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Oct 2016 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoPR 20627: Use resume_stop to stop lwp
Yao Qi [Fri, 30 Sep 2016 17:39:12 +0000 (18:39 +0100)]
PR 20627: Use resume_stop to stop lwp

Commit 049a8570 (Use target_continue{,_no_signal} instead of target_resume)
replaces the code stopping lwp with target_continue_no_signal in
target_stop_and_wait, like this,

-  resume_info.thread = ptid;
-  resume_info.kind = resume_stop;
-  resume_info.sig = GDB_SIGNAL_0;
-  (*the_target->resume) (&resume_info, 1);
+  target_continue_no_signal (ptid);

the replacement is not equivalent, and it causes PR 20627.  This patch
is just to revert that change.

Regression testing it on x86_64-linux.

gdb/gdbserver:

2016-09-30  Yao Qi  <yao.qi@linaro.org>

PR gdbserver/20627
* target.c (target_stop_and_wait): Don't call
target_continue_no_signal, use resume_stop instead.

8 years agoDon't assign alt twice
H.J. Lu [Fri, 30 Sep 2016 15:54:43 +0000 (08:54 -0700)]
Don't assign alt twice

PR binutils/20657
* i386-dis.c (putop): Don't assign alt twice.

8 years agoAdd missing dependencies to BFD_H_FILES
Alan Modra [Fri, 30 Sep 2016 08:57:36 +0000 (18:27 +0930)]
Add missing dependencies to BFD_H_FILES

* Makefile.am (BFD_H_FILES): Add linker.c and simple.c.  Sort
as per comment at head of bfd-in2.h.
* Makefile.in: Regenerate.

8 years ago[AArch64] PR target/20553, fix opcode mask for SIMD multiply by element
Jiong Wang [Fri, 30 Sep 2016 13:16:54 +0000 (14:16 +0100)]
[AArch64] PR target/20553, fix opcode mask for SIMD multiply by element

opcode/
PR target/20553
        * aarch64-tbl.h (fmla, fmls, fmul, fmulx): Fix opcode mask field.

gas/
        * testsuite/gas/aarch64/advsimd-fp16.s (indexed_elem): New high index
        testcases for H and S variants.  New low index testcases for D variant.
        * testsuite/gas/aarch64/advsimd-fp16.d: Update expected results.

8 years agov850 linker scripts
Alan Modra [Fri, 30 Sep 2016 08:22:48 +0000 (17:52 +0930)]
v850 linker scripts

This should mean the 2010-10-28 change for ld -r --gc-sections can
be reverted.

* scripttempl/v850.sc: Don't reference __ctbp, __ep, __gp when
not relocating.
* scripttempl/v850_rh850.sc: Likewise.

8 years agoFix pr20528 testsuite
Alan Modra [Fri, 30 Sep 2016 06:39:42 +0000 (16:09 +0930)]
Fix pr20528 testsuite

PR ld/20528
* testsuite/ld-elf/pr20528a.d: xfail generic elf targets.  Allow
multiple .text sections for hppa-linux.
* testsuite/ld-elf/pr20528b.d: Likewise.

8 years agoRemove syntactic sugar
Alan Modra [Fri, 30 Sep 2016 03:30:18 +0000 (13:00 +0930)]
Remove syntactic sugar

Now that _bfd_error_handler is not a function pointer.

* aout-adobe.c: Replace (*_bfd_error_handler) (...) with
_bfd_error_handler (...) throughout.
* aout-cris.c, * aoutx.h, * archive.c, * bfd.c, * binary.c,
* cache.c, * coff-alpha.c, * coff-arm.c, * coff-h8300.c,
* coff-i860.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
* coff-sh.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* coffswap.h, * cpu-arm.c, * cpu-m68k.c, * cpu-sh.c, * dwarf2.c,
* ecoff.c, * elf-eh-frame.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cris.c, * elf32-crx.c, * elf32-dlx.c, * elf32-frv.c,
* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
* elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-mips.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c,
* elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-s390.c,
* elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c,
* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c,
* elf32-v850.c, * elf32-vax.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c,
* elf64-x86-64.c, * elfcode.h, * elfcore.h, * elflink.c,
* elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-mips.c,
* elfxx-sparc.c, * elfxx-tilegx.c, * hpux-core.c, * i386linux.c,
* ieee.c, * ihex.c, * libbfd.c, * linker.c, * m68klinux.c,
* mach-o.c, * merge.c, * mmo.c, * oasys.c, * osf-core.c, * pdp11.c,
* pe-mips.c, * peXXigen.c, * pef.c, * plugin.c, * reloc.c,
* rs6000-core.c, * sco5-core.c, * som.c, * sparclinux.c, * srec.c,
* stabs.c, * syms.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c,
* xcofflink.c: Likewise.

8 years agoBetter ld --fatal-warnings support
Alan Modra [Fri, 30 Sep 2016 02:03:13 +0000 (11:33 +0930)]
Better ld --fatal-warnings support

* ldmain.c (default_bfd_error_handler): New function pointer.
(ld_bfd_error_handler): New function.
(main): Arrange to call it on bfd errors/warnings.
(ld_bfd_assert_handler): Enable tail call.

8 years agoMake bfd_error_handler_type like vprintf
Alan Modra [Fri, 30 Sep 2016 01:33:52 +0000 (11:03 +0930)]
Make bfd_error_handler_type like vprintf

It was like printf, which means you can't use bfd_set_error_handler to
hook in a function to do something and then call the original handler.

The patch also deletes some unused functions and makes pointers local.

bfd/
* bfd-in.h: Include stdarg.h.
* bfd.c (bfd_error_handler_type): Make like vprintf.
(_bfd_error_internal): Rename from _bfd_error_handler.  Make static.
(error_handler_internal): New function, split out from..
(_bfd_default_error_handler): ..here.  Rename to _bfd_error_handler.
(bfd_set_error_handler): Update.
(bfd_get_error_handler, bfd_get_assert_handler): Delete.
(_bfd_assert_handler): Make static.
* coffgen.c (null_error_handler): Update params.
* elf-bfd.h (struct elf_backend_data <link_order_error_handler>):
Don't use bfd_error_handler_type.
* elf64-mmix.c (mmix_dump_bpo_gregs): Likewise.
* elfxx-target.h (elf_backend_link_order_error_handler): Default
to _bfd_error_handler.
* libbfd-in.h (_bfd_default_error_handler): Don't declare.
(bfd_assert_handler_type): Likewise.
(_bfd_error_handler): Update.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
ld/
* ldlang.c (ignore_bfd_errors): Update params.

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

8 years agoUpdate tests to account for the L operand being compulsory.
Peter Bergner [Thu, 29 Sep 2016 20:21:55 +0000 (15:21 -0500)]
Update tests to account for the L operand being compulsory.

* gdb.arch/powerpc-power.exp <cmprb>: Update tests to account for
the compulsory L operand changes.
* gdb.arch/powerpc-power.s: Likewise.

8 years agoDon't merge 2 sections with different SHF_EXCLUDE
H.J. Lu [Thu, 29 Sep 2016 19:58:29 +0000 (12:58 -0700)]
Don't merge 2 sections with different SHF_EXCLUDE

SEC_EXCLUDE is ignored when doing a relocatable link.  But we can't
merge 2 input sections with the same name when only one of them has
SHF_EXCLUDE.

PR ld/20528
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
merge 2 sections with different SHF_EXCLUDE.
* testsuite/ld-elf/pr20528a.d: New file.
* testsuite/ld-elf/pr20528a.s: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr20528b.s: Likewise.

8 years agoPR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
Jan Kratochvil [Thu, 29 Sep 2016 15:38:16 +0000 (17:38 +0200)]
PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression

Regression: gdb --pid $(pidof qemu-system-x86_64) stopped working with gdb 7.11.1
https://sourceware.org/bugzilla/show_bug.cgi?id=20609

It was reported for qemu-system-x86_64 but it happens for any multithreaded
inferior with a JIT debugging hook.

136613ef0c6850427317e57be1b644080ff6decb is the first bad commit
Author: Pedro Alves <palves@redhat.com>
    Fix PR gdb/19828: gdb -p <process from a container>: internal error
Message-ID: <cbdf2e04-4fa8-872a-2a23-08c9c1b26e00@redhat.com>
https://sourceware.org/ml/gdb-patches/2016-05/msg00450.html

jit_breakpoint_re_set() is specific by trying to insert a breakpoint into the
main executable, not into a shared library.  During attachment GDB thinks it
needs to use 'breakpoint always-inserted' from
breakpoints_should_be_inserted_now() as a newly attached thread is
'thread_info->executing' due to 'lwp_info->must_set_ptrace_flags' enabled and
the task not yet stopped.  This did not happen before the 'bad commit' above
which adds tracking of such thread.

GDB then fails to insert the breakpoints to invalid address as PIE executable
gets properly relocated during later phase of attachment.  One can see in the
backtraces below:
 -> jit_breakpoint_re_set_internal()
later:
 -> svr4_exec_displacement()

One can suppress the initial breakpoint_re_set() call as there will be another
breakpoint_re_set() done from the final post_create_inferior() call in
setup_inferior().

BTW additionally 'threads_executing' cache bool is somehow stale (somewhere is
missing update_threads_executing()).  I was trying to deal with that in my
first/second attempt below but in my final third attempt (attached) I have
left it as it is.

First attempt trying not to falsely require 'breakpoint always-inserted':
  https://people.redhat.com/jkratoch/rhbz1375553-fix1.patch
Reduced first attempt:
  https://people.redhat.com/jkratoch/rhbz1375553-fix2.patch

The third attempt suppresses breakpoint insertion until PIE executable gets
relocated by svr4_exec_displacement().  Applied.

gdb/ChangeLog
2016-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
* exec.c (exec_file_locate_attach): Add parameter defer_bp_reset.
Use it.
* gdbcore.h (exec_file_locate_attach): Add parameter defer_bp_reset.
* infcmd.c (setup_inferior): Update caller.
* remote.c (remote_add_inferior): Likewise.

gdb/testsuite/ChangeLog
2016-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
* gdb.base/jit-attach-pie.c: New file.
* gdb.base/jit-attach-pie.exp: New file.

8 years agoFrame info dump: Fix bad register marks.
Andreas Krebbel [Thu, 29 Sep 2016 08:04:44 +0000 (10:04 +0200)]
Frame info dump: Fix bad register marks.

On S/390 we see quite often registers marked as "bad register" in the
readelf --debug-dump=frames or objdump -Wf output.

00000000 0000000000000014 00000000 CIE
      Version:               1
      Augmentation:          "zR"
      Code alignment factor: 1
      Data alignment factor: -8
      Return address column: 14
      Augmentation data:     1b

      DW_CFA_def_cfa: r15 ofs 160
      DW_CFA_nop
      DW_CFA_nop
      DW_CFA_nop

    ...

    00000050 000000000000001c 00000054 FDE cie=00000000 pc=0000000080000e58..0000000080000e84
      DW_CFA_advance_loc: 6 to 0000000080000e5e
      DW_CFA_offset: r14 at cfa-48
      DW_CFA_offset: r15 at cfa-40
      DW_CFA_advance_loc: 6 to 0000000080000e64
      DW_CFA_def_cfa_offset: 320
      DW_CFA_advance_loc: 18 to 0000000080000e76
      DW_CFA_restore: bad register: r15              <------
      DW_CFA_restore: r14
      DW_CFA_def_cfa_offset: 160

    This is triggered by this check in display_debug_frames (dwarf.c):

case DW_CFA_restore:
  if (opa >= (unsigned int) cie->ncols
      || opa >= (unsigned int) fc->ncols)
    reg_prefix = bad_reg;

cie->ncols is number of registers referenced in the CIE which is 15 due
to r14 being given as return address column.  So for the CFA_restore of
r15 a "bad register" is being printed while the same rule on r14 is ok.

The reason for this check is to prevent wild memory accesses when
reading input with corrupted register values while accessing the
col_type/col_offset arrays. However in that case r15 is a perfectly
valid register. It just happens not to be mentioned in the CIE.  Hence
restoring the CIE rule for r15 should end up with the default rule which
is DW_CFA_undefined.

This probably wasn't observed on other platforms because they either do
not use CFA_restore (x86-64) or do not issue CFA_restore on registers
with a higher number than the return address column.

binutils/ChangeLog:

2016-09-29  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* dwarf.c (frame_display_row): Fix formatting of return address
register column.
(display_debug_frames): Ignore invalid indices into
cie->col_type/cie->col_offset arrays and default to
DW_CF_undefined instead.

8 years agoAdd .cfi_val_offset GAS command.
Andreas Krebbel [Wed, 28 Sep 2016 15:54:06 +0000 (17:54 +0200)]
Add .cfi_val_offset GAS command.

This patch adds support for .cfi_val_offset GAS pseudo command which
maps to DW_CFA_val_offset and DW_CFA_val_offset_sf.

gas/ChangeLog:

2016-09-29  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* doc/as.texinfo: Add docu for .cfi_val_offset.
* dw2gencfi.c (cfi_add_CFA_val_offset): New function.
(dot_cfi): Add case for DW_CFA_val_offset.
(output_cfi_insn): Likewise.
(cfi_pseudo_table): Add entry for cfi_val_offset.
* dw2gencfi.h: Add prototype for cfi_add_CFA_val_offset.
* testsuite/gas/cfi/cfi-common-8.d: New test.
* testsuite/gas/cfi/cfi-common-8.s: New test.
* testsuite/gas/cfi/cfi.exp: Run cfi-common-8 testcase.

binutils/ChangeLog:

2016-09-29  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* dwarf.c (display_debug_frames): Adjust output line.

8 years agoDisallow 3-operand cmp[l][i] for ppc64
Alan Modra [Thu, 29 Sep 2016 05:42:47 +0000 (15:12 +0930)]
Disallow 3-operand cmp[l][i] for ppc64

cmp[l][o] get an optional L field only when generating 32-bit code.
dcbf, tlbie and tlbiel keep their optional L field, ditto for R field
of tbegin.  cmprb, tsr., wlcr[all] and mtsle all change to a
compulsory L field.

L field of dcbf and wclr is 2 bits.

PR 20641
include/
* opcode/ppc.h (PPC_OPERAND_OPTIONAL32): Define.
opcodes/
* ppc-opc.c (L): Make compulsory.
(LOPT): New, optional form of L.
(HTM_R): Define as LOPT.
(L0, L1): Delete.
(L32OPT): New, optional for 32-bit L.
(L2OPT): New, 2-bit L for dcbf.
(SVC_LEC): Update.
(L2): Define.
(insert_l0, extract_l0, insert_l1, extract_l2): Delete.
(powerpc_opcodes <cmpli, cmpi, cmpl, cmp>): Use L32OPT.
<dcbf>: Use L2OPT.
<tlbiel, tlbie>: Use LOPT.
<wclr, wclrall>: Use L2.
gas/
* config/tc-ppc.c (md_assemble): Handle PPC_OPERAND_OPTIONAL32.
* testsuite/gas/ppc/power8.s: Provide tbegin. operand.
* testsuite/gas/ppc/power9.d: Update cmprb disassembly.

8 years agoDisplay .gnu.attributes tags for powerpc64
Alan Modra [Thu, 29 Sep 2016 05:40:39 +0000 (15:10 +0930)]
Display .gnu.attributes tags for powerpc64

* readelf.c (process_arch_specific): Call process_power_specific
for EM_PPC64.

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

8 years agoFix PR 20345 - call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_...
Pedro Alves [Wed, 28 Sep 2016 21:44:57 +0000 (17:44 -0400)]
Fix PR 20345 - call_function_by_hand_dummy: Assertion `tp->thread_fsm == &sm->thread_fsm' failed

If you run an infcall from the command line, and immediately after run
some other command, GDB incorrectly processes the other command before
the infcall finishes.

The problem is that the fix for PR gdb/20418 (Problems with
synchronous commands and new-ui, git 3eb7562a983b) moved the
add_file_handler/delete_file_handler calls out of
target_terminal_$foo, and missed adjusting the infcall code.

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

* infcall.c (run_inferior_call): Remove input from the event
loop while running the infcall.

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

* gdb.base/infcall-input.c: New file.
* gdb.base/infcall-input.exp: New file.

8 years agoSmall improvements to the remote protocol manual
Tom Tromey [Tue, 13 Sep 2016 22:50:34 +0000 (16:50 -0600)]
Small improvements to the remote protocol manual

I was reading the gdb RSP manual recently and I found a number of
small problems in the documentation.  This patch attempts to improve
these areas.  Specfically:

* The term "memory breakpoint" is used only in this section of the
  manual, and there inconsistently.  I found this term confusing --
  initially I thought it might be a watchpoint.  This patch changes it
  to use the term "software breakpoint", which is used in the rest of
  the manual.

* The z0 packet didn't document how "kind" was written.  And, it had a
  stray link to the architecture-specific protocol details node.  This
  patch moves this link to a better spot.

* The z1 patch didn't document that it accepts cmd_list.

* I couldn't find any text saying what response is given to a command
  like vCont in non-stop mode.  The answer is that OK is sent, and
  then a stop reply is sent as a notification.  This patch adds a note
  about this.

* The "create" stop reply did not document that the "R" argument is
  ignored.

* The "W", "X", and "w" packets did not document how the "AA" part is
  formatted.

* The %Stop notification example said "%%Stop", but I think this is
  incorrect.

2016-09-28  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Packets) <z0>: Use "software breakpoint" rather
than "memory breakpoint".  Further document "kind".  Move
protocol-details link earlier.
<z1>: Document the cmd_list argument.  Fix typo.
<g>: Remove incorrect sentence.
(Stop Reply Packets): Document "OK" response to requests when in
non-stop mode.
<swbreak>: Use "software breakpoint" rather than "memory
breakpoint".
<create>: Document that "R" is ignored.
<W, X, w>: Document formatting of "AA".
(Notification Packets): Use "%Stop", not "%%Stop".

8 years agoFix seg-fault in the linker introduced by the previous delta.
Akihiko Odaki [Wed, 28 Sep 2016 10:50:41 +0000 (11:50 +0100)]
Fix seg-fault in the linker introduced by the previous delta.

PR ld/20636
* elf-bfd.h (struct elf_backend_data): Delete
elf_backend_count_output_relocs callback and add
elf_backend_update_relocs.
* elf32-arm.c (elf32_arm_count_output_relocs): Deleted.
(emit_relocs): Deleted.
(elf32_arm_emit_relocs): Deleted.
(elf_backend_emit_relocs): Updated not to use the old functions.
(elf32_arm_update_relocs): New function.
(elf_backend_update_relocs): New define.
* elflink.c (bfd_elf_final_link): Add additional_reloc_count to the
relocation count. Call elf_backend_emit_relocs.
(_bfd_elf_size_reloc_section): Do not call
elf_backend_count_output_relocs.
* elfxx-target.h (elf_backend_count_output_relocs): Deleted.
(elf_backend_update_relocs): New define.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Sep 2016 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years ago[ARM] PR ld/20608 Relocation truncated to fit: R_ARM_THM_JUMP24 for relocation to...
Christophe Lyon [Tue, 27 Sep 2016 23:37:52 +0000 (01:37 +0200)]
[ARM] PR ld/20608 Relocation truncated to fit: R_ARM_THM_JUMP24 for relocation to PLT entry

2016-09-28  Christophe Lyon  <christophe.lyon@linaro.org>

PR ld/20608
bfd/
* elf32-arm.c (arm_type_of_stub): Handle the case when the pre-PLT
Thumb-ARM stub is too far.

ld
* testsuite/ld-arm/arm-elf.exp: Handle new testcase.
* testsuite/ld-arm/farcall-mixed-app2.d: New file.
* testsuite/ld-arm/farcall-mixed-app2.r: Likewise.
* testsuite/ld-arm/farcall-mixed-app2.s: Likewise.
* testsuite/ld-arm/farcall-mixed-app2.sym: Likewise.

8 years agoDon't treat as separate symbols if unversioned symbol is undefined.
Cary Coutant [Tue, 27 Sep 2016 19:08:19 +0000 (12:08 -0700)]
Don't treat as separate symbols if unversioned symbol is undefined.

When we see an unversioned symbol reference in a shared library, followed
by a default definition of the symbol in another shared library, we were
treating them as separate symbols. That should only happen when both are
definitions.

gold/
PR gold/20238
* symtab.cc (Symbol_table::define_default_version): Check that
unversioned symbol is defined.

8 years agoAdd archives and make stamps to the .gitignore file.
Simon Marchi [Tue, 27 Sep 2016 14:10:42 +0000 (15:10 +0100)]
Add archives and make stamps to the .gitignore file.

8 years agoEnsure that the timestamp in PE/COFF headers is always initialised.
Nick Clifton [Tue, 27 Sep 2016 11:08:19 +0000 (12:08 +0100)]
Ensure that the timestamp in PE/COFF headers is always initialised.

PR ld/20634
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Put 0 in the
timestamp field if real time values are not being stored.

8 years agoDetect the magic address of EXC_RETURN in ARM coretx-m profile
Fredrik Hederstierna [Tue, 27 Sep 2016 01:02:47 +0000 (02:02 +0100)]
Detect the magic address of EXC_RETURN in ARM coretx-m profile

On ARMv6-M and ARMv7-M, the exception return address is sort of magic
address defined by the manual.  This patch is to let GDB well handle
these magic addresses.

2016-09-27  Fredrik Hederstierna  <fredrik.hederstierna@verisure.com>

* arm-tdep.c (arm_m_addr_is_magic): New function.
(arm_addr_bits_remove): Call arm_m_addr_is_magic.
(arm_m_exception_unwind_sniffer): Likewise.

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

8 years agotc-xtensa.c: fixup xg_reverse_shift_count typo
Trevor Saunders [Mon, 26 Sep 2016 16:42:11 +0000 (12:42 -0400)]
tc-xtensa.c: fixup xg_reverse_shift_count typo

gas/ChangeLog:

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

* config/tc-xtensa.c (xg_reverse_shift_count): Pass cnt_arg instead of
cnt_argp to concat.

8 years agoWhen building target binaries, ensure that the warning flags selected for the command...
Vlad Zakharov [Mon, 26 Sep 2016 15:36:08 +0000 (16:36 +0100)]
When building target binaries, ensure that the warning flags selected for the command line match the target compiler.

bfd * warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro
to verify CC_FOR_BUILD compiler.
(AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable
and add CC_FOR_BUILD compiler checks.
* Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.

binutils * Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD
when building with CC_FOR_BUILD compiler.
* Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.

gas * Makefile.in: Regenerate.
* configure: Likewise.
* doc/Makefile.in: Likewise.

gold * Makefile.in: Regenerate.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.

gprof * Makefile.in: Regenerate.
* configure: Likewise.

ld * Makefile.in: Regenerate.
* configure: Likewise.

opcodes * Makefile.in: Regenerate.
* configure: Likewise.

8 years agoFix the calculation of AMD64_PCRQUAD relocations.
Awson [Mon, 26 Sep 2016 15:16:25 +0000 (16:16 +0100)]
Fix the calculation of AMD64_PCRQUAD relocations.

PR ld/17955
* coff-x86_64.c (coff_amd64_rtype_to_howto): Use an 8 byte offset
for R_AMD64_PCRQUAD relocations.

8 years ago[ARC] ISA alignment.
Claudiu Zissulescu [Wed, 14 Sep 2016 11:40:38 +0000 (13:40 +0200)]
[ARC] ISA alignment.

include/
2016-09-26  Claudiu Zissulescu  <claziss@synopsys.com>

* opcode/arc.h (insn_class_t): Add two new classes.

opcodes/
2016-09-26  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-ext-tbl.h (EXTINSN2OPF): Define.
(EXTINSN2OP): Use EXTINSN2OPF.
(bspeekm, bspop, modapp): New extension instructions.
* arc-opc.c (F_DNZ_ND): Define.
(F_DNZ_D): Likewise.
(F_SIZEB1): Changed.
(C_DNZ_D): Define.
(C_HARD): Changed.
* arc-tbl.h (dbnz): New instruction.
(prealloc): Allow it for ARC EM.
(xbfu): Likewise.

8 years agoPowerPC .gnu.attributes
Alan Modra [Mon, 26 Sep 2016 08:34:57 +0000 (18:04 +0930)]
PowerPC .gnu.attributes

This patch extends Tag_GNU_Power_ABI_FP to cover long double ABIs,
makes the assembler warn about undefined tag values, and removes
similar warnings from the linker.  I think it is better to not
warn in the linker about undefined tag values as future extensions to
the tags then won't result in likely bogus warnings.  This is
consistent with the fact that an older linker won't warn on an
entirely new tag.

include/
* elf/ppc.h (Tag_GNU_Power_ABI_FP): Comment.
bfd/
* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Declare.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): New function.
(ppc_elf_merge_obj_attributes): Use it.  Don't copy first file
attributes, merge them.  Don't warn about undefined tag bits,
or copy unknown values to output.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Call
_bfd_elf_ppc_merge_fp_attributes.
binutils/
* readelf.c (display_power_gnu_attribute): Catch truncated section
for all powerpc attributes.  Display long double ABI.  Don't
capitalize words, except for names.  Show known bits of tag values
when some unknown bits are present.  Whitespace fixes.
gas/
* config/tc-ppc.c (ppc_elf_gnu_attribute): New function.
(md_pseudo_table <ELF>): Handle "gnu_attribute".
ld/
* testsuite/ld-powerpc/attr-gnu-4-4.s: Delete.
* testsuite/ld-powerpc/attr-gnu-4-14.d: Delete.
* testsuite/ld-powerpc/attr-gnu-4-24.d: Delete.
* testsuite/ld-powerpc/attr-gnu-4-34.d: Delete.
* testsuite/ld-powerpc/attr-gnu-4-41.d: Delete.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Adjust expected warning.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-01.d: Adjust expected output.
* testsuite/ld-powerpc/attr-gnu-4-02.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-03.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-10.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-11.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-20.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-22.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-33.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-8-11.d: Likewise.
* testsuite/ld-powerpc/powerpc.exp: Don't run deleted tests.

8 years ago[GOLD] regen testsuite/Makefile.in
Alan Modra [Mon, 26 Sep 2016 08:34:35 +0000 (18:04 +0930)]
[GOLD] regen testsuite/Makefile.in

8 years ago[GOLD] warning fixes
Alan Modra [Mon, 26 Sep 2016 08:34:18 +0000 (18:04 +0930)]
[GOLD] warning fixes

* aarch64.cc (Target_aarch64::is_erratum_835769_sequence): Avoid
compiler warning.
* output.cc (Output_segment::set_section_addresses): Likewise.

8 years agoFix nm potential buffer overflow
Alan Modra [Mon, 26 Sep 2016 08:25:08 +0000 (17:55 +0930)]
Fix nm potential buffer overflow

get_coff_symbol_type had a potenial buffer overflow even with
untranslated messages.

* nm.c (get_elf_symbol_type): Don't use sprintf with translated
strings, use asprintf instead.
(get_coff_symbol_type): Likewise.

8 years agoCall debug_exit in linux_wait_1
Yao Qi [Mon, 26 Sep 2016 03:01:19 +0000 (04:01 +0100)]
Call debug_exit in linux_wait_1

When I read the GDBserver debug message, I find the "entering" of
linux_wait_1 doesn't match the "existing" of linux_wait_1.  Looks
we don't call debug_exit somewhere in linux_wait_1 on return.

gdb/gdbserver:

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

* linux-low.c (linux_wait_1): Call debug_exit.

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

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Sep 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

8 years agoFix a use of target_mourn_inferior in windows-nat.c
Jon Turney [Fri, 23 Sep 2016 13:07:55 +0000 (14:07 +0100)]
Fix a use of target_mourn_inferior in windows-nat.c

One use of target_mourn_interior seems to have been missed in bc1e6c81

gdb/ChangeLog:

2016-09-23  Jon Turney  <jon.turney@dronecode.org.uk>

* windows-nat.c (windows_delete_thread): Adjusting call to
target_mourn_inferior to include ptid_t argument.

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

8 years agoUse std::string rather than dyn-string
Tom Tromey [Thu, 22 Sep 2016 14:41:33 +0000 (08:41 -0600)]
Use std::string rather than dyn-string

This patch changes some code in cli-cmds.c to use std::string rather
than dyn-string, removing some cleanups.  Since this was the last use
of dyn-string in gdb, this patch also removes
make_cleanup_dyn_string_delete.

2016-09-23  Tom Tromey  <tom@tromey.com>

* utils.h (make_cleanup_dyn_string_delete): Remove declaration.
* utils.c: Don't include dyn-string.h.
(do_dyn_string_delete, make_cleanup_dyn_string_delete): Remove.
* cli/cli-cmds.c: Include <string>.  Don't include dyn-string.h.
(argv_to_string): Rename.  Change return type to std::string.
(alias_command): Use std::string.

8 years agoUse std::vector in objfiles.c
Tom Tromey [Thu, 22 Sep 2016 14:33:13 +0000 (08:33 -0600)]
Use std::vector in objfiles.c

This patch changes a spot in objfiles.c to use a std::vector, removing
a cleanup.

2016-09-23  Tom Tromey  <tom@tromey.com>

* objfiles.c: Include <vector>.
(objfile_relocate): Use std::vector.

8 years agoUse std::string, std::vector in rust-lang.c
Tom Tromey [Thu, 22 Sep 2016 15:51:20 +0000 (09:51 -0600)]
Use std::string, std::vector in rust-lang.c

This patch changes some spots in rust-lang.c to use std::string or
std::vector, removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

* rust-lang.c: Include <string> and <vector>.
(rust_evaluate_funcall): Use std::vector, std::string.
(rust_evaluate_subexp): Use std::string.
(rust_lookup_symbol_nonlocal): Use std::string.

8 years agoUse std::string in cp-namespace.c
Tom Tromey [Thu, 22 Sep 2016 15:51:03 +0000 (09:51 -0600)]
Use std::string in cp-namespace.c

This changes a few spots in cp-namespace.c to use std::string,
removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

* cp-namespace.c: Include <string>.
(cp_search_static_and_baseclasses)
(cp_lookup_symbol_imports_or_template, find_symbol_in_baseclass):
Use std::string.

8 years agoUse std::string in break-catch-sig.c
Tom Tromey [Thu, 22 Sep 2016 15:50:50 +0000 (09:50 -0600)]
Use std::string in break-catch-sig.c

This changes one spot in break-catch-sig.c to use std::string,
removing some cleanups.

2016-09-23  Tom Tromey  <tom@tromey.com>

* break-catch-sig.c: Include <string>.
(signal_catchpoint_print_one): Use std::string.

8 years agoRemove some unnecessary code
Tom Tromey [Fri, 23 Sep 2016 16:40:36 +0000 (10:40 -0600)]
Remove some unnecessary code

This patch removes some unnecessary code.  In particular,
terminate_minimal_symbol_table is declared in minsyms.h, so it doesn't
need to be declared in objfiles.h as well.  And,
restore_ui_out_closure was rendered unnecessary by an earlier patch,
so the structure definition can be removed now.

I'm checking this in as obvious.

Tested by rebuilding on x86-64 Fedora 24 with --enable-targets=all;
which would notice any missing includes of minsyms.h.

2016-09-23  Tom Tromey  <tom@tromey.com>

* utils.c (struct restore_ui_out_closure): Remove.
* objfiles.h (terminate_minimal_symbol_table): Don't declare.

8 years agoReplace sprintf with xsnprintf in nat/linux-osdata.c
Yao Qi [Fri, 23 Sep 2016 16:27:26 +0000 (17:27 +0100)]
Replace sprintf with xsnprintf in nat/linux-osdata.c

I see the following build warning when I build GDB with GCC trunk.

../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_fds(gdb_byte*, ULONGEST, ULONGEST)’:
../../binutils-gdb/gdb/nat/linux-osdata.c:767:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
 linux_xfer_osdata_fds (gdb_byte *readbuf,
 ^~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/nat/linux-osdata.c:800:51: note: format output between 7 and 262 bytes into a destination of size 17
        sprintf (procentry, "/proc/%s", dp->d_name);
                                                   ^
../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_threads(gdb_byte*, ULONGEST, ULONGEST)’:
../../binutils-gdb/gdb/nat/linux-osdata.c:555:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
 linux_xfer_osdata_threads (gdb_byte *readbuf,
 ^~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/nat/linux-osdata.c:588:51: note: format output between 7 and 262 bytes into a destination of size 17
        sprintf (procentry, "/proc/%s", dp->d_name);
                                                   ^
cc1plus: all warnings being treated as errors

The warning is a false positive, but we can workaround it by replacing
sprintf with xsnprintf.  On the other hand, it is always preferred to
use xsnprintf.

gdb:

2016-09-23  Yao Qi  <yao.qi@linaro.org>

* nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
sprintf with xsnprintf.
(linux_xfer_osdata_fds): Likewise.

8 years agogdb: Replace operator new / operator new[]
Pedro Alves [Fri, 23 Sep 2016 15:42:24 +0000 (16:42 +0100)]
gdb: Replace operator new / operator new[]

If xmalloc fails allocating memory, usually because something tried a
huge allocation, like xmalloc(-1) or some such, GDB asks the user what
to do:

  .../src/gdb/utils.c:1079: internal-error: virtual memory exhausted.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)

If the user says "n", that throws a QUIT exception, which is caught by
one of the multiple CATCH(RETURN_MASK_ALL) blocks somewhere up the
stack.

The default implementations of operator new / operator new[] call
malloc directly, and on memory allocation failure throw
std::bad_alloc.  Currently, if that happens, since nothing catches it,
the exception escapes out of main, and GDB aborts from unhandled
exception.

This patch replaces the default operator new variants with versions
that, just like xmalloc:

 #1 - Raise an internal-error on memory allocation failure.

 #2 - Throw a QUIT gdb_exception, so that the exact same CATCH blocks
      continue handling memory allocation problems.

A minor complication of #2 is that operator new can _only_ throw
std::bad_alloc, or something that extends it:

  void* operator new (std::size_t size) throw (std::bad_alloc);

That means that if we let a gdb QUIT exception escape from within
operator new, the C++ runtime aborts due to unexpected exception
thrown.

So to bridge the gap, this patch adds a new gdb_quit_bad_alloc
exception type that inherits both std::bad_alloc and gdb_exception,
and throws _that_.

If we decide that we should be catching memory allocation errors in
fewer places than all the places we currently catch them (everywhere
we use RETURN_MASK_ALL currently), then we could change operator new
to throw plain std::bad_alloc then.  But I'm considering such a change
as separate matter from this one -- it'd make sense to do the same to
xmalloc at the same time, for instance.

Meanwhile, this allows using new/new[] instead of xmalloc/XNEW/etc.
without losing the "virtual memory exhausted" internal-error
safeguard.

Tested on x86_64 Fedora 23.

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

* Makefile.in (SFILES): Add common/new-op.c.
(COMMON_OBS): Add common/new-op.o.
(new-op.o): New rule.
* common/common-exceptions.h: Include <new>.
(struct gdb_quit_bad_alloc): New type.
* common/new-op.c: New file.

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

* Makefile.in (SFILES): Add common/new-op.c.
(OBS): Add common/new-op.o.
(new-op.o): New rule.

8 years agoDelete relocations associatesd with deleted exidx entries.
Akihiko Odaki [Fri, 23 Sep 2016 15:32:04 +0000 (16:32 +0100)]
Delete relocations associatesd with deleted exidx entries.

PR ld/20595
ld * testsuite/ld-arm/unwind-4.d: Add -q option to linker command
line and -r option to objdump command line.  Match emitted relocs
to make sure that superflous relocs are not generated.

bfd * elf-bfd.h (struct elf_backend_data): Add
elf_backend_count_output_relocs callback to count relocations in
the final output.
* elf-arm.c (elf32_arm_add_relocation): Deleted.
(elf32_arm_write_section): Move additional relocation to emit_relocs.
(elf32_arm_count_output_relocs): New function.
(emit_relocs): New function.
(elf32_arm_emit_relocs): New function.
(elf32_arm_vxworks_emit_relocs): New function.
(elf_backend_emit_relocs): Updated to use the new functions.
(elf_backend_count_output_relocs): New define.
* bfd/elflink.c (bfd_elf_final_link): Do not add additional_reloc_count
to the relocation count.
(_bfd_elf_link_size_reloc_section): Use callback to count the
relocations which will be in output.
(_bfd_elf_default_count_output_relocs): New function.
* bfd/elfxx-target.h (elf_backend_count_output_relocs): New define.

8 years agoS/390: Move start of 64 bit binaries from 2GB to 256MB.
Andreas Krebbel [Fri, 23 Sep 2016 09:26:05 +0000 (11:26 +0200)]
S/390: Move start of 64 bit binaries from 2GB to 256MB.

ld/ChangeLog:

2016-09-23  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* emulparams/elf64_s390.sh: Change TEXT_START_ADDR to 256MB.
* testsuite/ld-s390/tlsbin_64.dd: Adjust testcase accordingly.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.

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

8 years agoClose gdbserver in mi_gdb_exit
Yao Qi [Thu, 22 Sep 2016 15:04:03 +0000 (16:04 +0100)]
Close gdbserver in mi_gdb_exit

In commit 6423214f (testsuite: Don't use expect_background to reap
gdbserver), we override gdb_exit in lib/gdbserver-support.exp, so
that we can close gdbserver first.  However, we don't close gdbserver
in mi_gdb_exit.  This makes a problem in my aarch64 mulit-arch testing,
in which I run some mi tests, mi-watch.exp for example, in different
variations (aarch64 and arm),

Schedule of variations:
    junor0-2
    junor0-2-arm/-marm
    junor0-2-arm/-mthumb

When the test is done in the first variation (aarch64), test case is
recompiled for arm, but GDBserver with aarch64 program is still
running.  When the second variation is started, GDB loads arm program,
but GDBserver still loads aarch64 program because the old GDBserver
process is using it.  We'll get,

47-target-select remote junor0-2:2350^M
&"warning: Selected architecture arm is not compatible with reported target architecture aarch64\n"^M
&"warning: Architecture rejected target-supplied description\n"

This patch fixes this problem by closing GDBserver in mi_gdb_exit.

gdb/testsuite:

2016-09-22  Yao Qi  <yao.qi@linaro.org>

* lib/gdbserver-support.exp: Rename mi_gdb_exit.
(gdb_exit): Rename it to ...
(gdbserver_gdb_exit): ...  Close GDBserver.
(gdb_exit): New proc, call gdbserver_gdb_exit.
(mi_gdb_exit): Likewise.

8 years agoFix build breakage from commit 6ec2b2
Edjunior Barbosa Machado [Thu, 22 Sep 2016 14:33:56 +0000 (11:33 -0300)]
Fix build breakage from commit 6ec2b2

I was notified by buildbot that my patch (commit 6ec2b2) has broken the build
on x86_64:

../../binutils-gdb/gdb/rs6000-tdep.c: In function int ppc_process_record_op31(gdbarch*, regcache*, CORE_ADDR, uint32_t):
../../binutils-gdb/gdb/rs6000-tdep.c:4705:50: error: cannot convert CORE_ADDR* {aka long unsigned int*} to ULONGEST* {aka long long unsigned int*} for argument 3 to register_status regcache_raw_read_unsigned(regcache*, int, ULONGEST*)
         tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
                                                  ^
../../binutils-gdb/gdb/rs6000-tdep.c:4718:50: error: cannot convert CORE_ADDR* {aka long unsigned int*} to ULONGEST* {aka long long unsigned int*} for argument 3 to register_status regcache_raw_read_unsigned(regcache*, int, ULONGEST*)
         tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
                                                  ^
The patch below should fix it.

gdb/ChangeLog:
2016-09-22  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* rs6000-tdep.c (ppc_process_record_op31): Fix
regcache_raw_read_unsigned call using the correct parameter type.

8 years agoUse gdbserver-base in remote-gdbserver-on-localhost.exp
Yao Qi [Wed, 21 Sep 2016 10:43:22 +0000 (11:43 +0100)]
Use gdbserver-base in remote-gdbserver-on-localhost.exp

This patch is to make remote-gdbserver-on-localhost.exp use gdbserver-base
and remove duplicated code.

gdb/testsuite:

2016-09-22  Yao Qi  <yao.qi@linaro.org>

* boards/gdbserver-base.exp (gdb_server_prog): Set the absolute
path.
* boards/remote-gdbserver-on-localhost.exp: Use gdbserver-base.
Remove duplication.

8 years agoReport failed attempts to locate DT_NEEDED files when --verbose is in effect.
Nick Clifton [Thu, 22 Sep 2016 13:29:49 +0000 (14:29 +0100)]
Report failed attempts to locate DT_NEEDED files when --verbose is in effect.

* emultempl/elf32.em (_try_needed): In verbose mode, report failed
attempts to find a needed library.

8 years agoarc: Fix ARI warning for printf(%p)
Anton Kolesov [Thu, 22 Sep 2016 10:29:43 +0000 (13:29 +0300)]
arc: Fix ARI warning for printf(%p)

Replace printf ("%p") with printf ("%s", host_address_to_string ()). Printing
host addrss might make sense here because pointers can be null and this would
affect how function behaves.

This particular warning is printed only when option -Wari is passed to
contrib/ari/gdb_ari.sh

gdb/ChangeLog:

* arc-tdep.c: Fix ARI warning for printf(%p).

8 years agoRemove legacy basepri_mask MRS/MSR special reg
Thomas Preud'homme [Thu, 22 Sep 2016 10:30:24 +0000 (11:30 +0100)]
Remove legacy basepri_mask MRS/MSR special reg

2016-09-22  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.c (v7m_psrs): Remove BASEPRI_MASK MRS/MSR special
register and redundant basepri_max.

8 years agoCheck the right proc name
Yao Qi [Wed, 21 Sep 2016 08:20:12 +0000 (09:20 +0100)]
Check the right proc name

In lib/gdbserver-support.exp, we rename gdb_exit to
gdbserver_orig_gdb_exit, but we check the existence gdbserver_gdb_exit.
We should check gdbserver_orig_gdb_exit instead.  Looks it is a typo
or an oversight.

gdb/testsuite:

2016-09-22  Yao Qi  <yao.qi@linaro.org>

* lib/gdbserver-support.exp: Check the existence of
gdbserver_orig_gdb_exit rather than gdbserver_gdb_exit.

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

8 years agoAdd myself as a write-after-approval GDB maintainer
Anton Kolesov [Fri, 26 Aug 2016 13:14:55 +0000 (16:14 +0300)]
Add myself as a write-after-approval GDB maintainer

gdb/ChangeLog:

* MAINTAINERS (Write After Approval): Add Anton Kolesov.

8 years agoarc: New Synopsys ARC port
Anton Kolesov [Fri, 12 Aug 2016 17:02:20 +0000 (20:02 +0300)]
arc: New Synopsys ARC port

ARC is a family of licensable processors developed by Synopsys.

This is an initial patch that doesn't yet support some of the features, that
are already available in Synopsys' fork of GDB, namely:

  * longjmp support
  * signal frame handling
  * prologue analysis
  * Linux targets support
  * native Linux support

ARC cores are configurable and extensible, which means from debugger
perspective that some registers and debug capabilities are optional, therefore
it is up to the GDB stub to determine exact list of register available on
target and supply it to GDB via XML target descriptions.  List of registers
that is known to GDB and is required is intentionally kept small to simplify
requirements to GDB stub and implementation of a GDB client.

gdb/ChangeLog:

* Makefile.in (ALL_TARGET_OBS): Add arc-tdep.o.
(HFILES_NO_SRCDIR): Add arc-tdep.h.
(ALLDEPFILES): Add arc-tdep.c.
* NEWS: Mention new ARC port.
* configure.tgt: Add ARC.
* arc-tdep.c: New file.
* arc-tdep.h: New file.
* features/Makefile (XMLTOC): Add arc-v2.xml and arc-arcompact.xml.
* features/arc-v2.xml: New file.
* features/arc-v2.c: New file (generated).
* features/arc-arcompact.xml: New file.
* features/arc-arcompact.c: New file (generated).

gdb/doc/ChangeLog:

* gdb.texinfo (Embedded Processors): Document ARC.
(Synopsys ARC): New section.
(Standard Target Features): Document ARC features.
(ARC Features): New section.

gdb/testsuite/ChangeLog:

* gdb.xml/tdesc-regs.exp: set core-regs for arc*-*-elf32.

8 years agoppc: Fix return of instruction handlers in ppc_process_record_op63
Edjunior Barbosa Machado [Wed, 21 Sep 2016 17:47:43 +0000 (14:47 -0300)]
ppc: Fix return of instruction handlers in ppc_process_record_op63

some instruction handlers in ppc_process_record_op63() seem to be missing
return or incorrectly using break. This patch aims to fix that.

gdb/ChangeLog:
2016-09-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* rs6000-tdep.c (ppc_process_record_op63): Fix return of instruction
handlers.

8 years agoPR gdb/20604 - fix "quit" when an invalid expression is used
Tom Tromey [Wed, 14 Sep 2016 17:48:31 +0000 (11:48 -0600)]
PR gdb/20604 - fix "quit" when an invalid expression is used

This fixes PR gdb/20604.  The bug here is that passing an invalid
expression to "quit" -- e.g., "quit()" -- causes gdb to enter a
non-functioning state.

The immediate problem is that quit_force resets the terminal before
evaluating the expression.  However, it seemed to me that it doesn't
really make sense to pass the quit_force argument to kill_or_detach
(which passes it to to_detach), first because conflating the exit
status for "quit" and the signal to pass when detaching doesn't make
sense, and second because to_detach implementations generally only
accept a constant here, while "quit" accepts an expression.  So, I
removed that.

As an aside, I think the "detach SIGNO" functionality is not
documented.

Built and regtested on x86-64 Fedora 24.

2016-09-21  Tom Tromey  <tom@tromey.com>

PR gdb/20604:
* top.h (quit_force): Update.
* top.c (quit_force): Changed type of first argument.  Don't
evaluate expression.  Pass NULL to kill_or_detach.
* cli/cli-cmds.c (quit_command): Evaluate "args".

2016-09-21  Tom Tromey  <tom@tromey.com>

PR gdb/20604:
* gdb.base/quit.exp: New file.

8 years agoUpdate and add .gitignore's
Simon Marchi [Wed, 21 Sep 2016 17:12:21 +0000 (13:12 -0400)]
Update and add .gitignore's

This patch adds a bunch of generated files to gdb's gitignore files.
There are still a bunch of "stamp" files that are not ignored, but I
think the rule for them should be put in the top-level gitignore.

Users and developers are encouraged to build out-of-tree, but some
people prefer the simplicity to build in-tree, so it should be useful
for them.

gdb/ChangeLog:

* .gitignore: Ignore more files.
* data-directory/.gitignore: Likewise.

gdb/doc/ChangeLog:

* .gitignore: New file.

gdb/gdbserver/ChangeLog:

* .gitinore: Ignore more files.

gdb/testsuite/ChangeLog:

* .gitignore: New file.

8 years agoppc: Add Power ISA 3.0/POWER9 instructions record support
Edjunior Barbosa Machado [Wed, 21 Sep 2016 16:30:39 +0000 (13:30 -0300)]
ppc: Add Power ISA 3.0/POWER9 instructions record support

gdb/ChangeLog:
2016-09-21  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* rs6000-tdep.c (PPC_DQ): New macro.
(ppc_process_record_op4): Add Power ISA 3.0 instructions.
(ppc_process_record_op19): Likewise.
(ppc_process_record_op31): Likewise.
(ppc_process_record_op59): Likewise.
(ppc_process_record_op60): Likewise.
(ppc_process_record_op63): Likewise.
(ppc_process_record): Likewise.
(ppc_process_record_op61): New function.

8 years ago[AArch64] Print spaces after commas in addresses
Richard Sandiford [Wed, 21 Sep 2016 16:11:52 +0000 (17:11 +0100)]
[AArch64] Print spaces after commas in addresses

I got an off-list request to make the AArch64 disassembler print
spaces after commas in addresses.  This patch does that.

The same code is used to print operands in "did you mean" errors,
so to keep things consistent, the patch also prints spaces between
operands in those messages.

opcodes/
* aarch64-opc.c (print_immediate_offset_address): Print spaces
after commas in addresses.
(aarch64_print_operand): Likewise.

gas/
* config/tc-aarch64.c (print_operands): Print spaces between
operands.
* testsuite/gas/aarch64/ilp32-basic.d: Expect spaces after ","
in addresses.
* testsuite/gas/aarch64/ldst-reg-imm-post-ind.d: Likewise.
* testsuite/gas/aarch64/ldst-reg-imm-pre-ind.d: Likewise.
* testsuite/gas/aarch64/ldst-reg-pair.d: Likewise.
* testsuite/gas/aarch64/ldst-reg-reg-offset.d: Likewise.
* testsuite/gas/aarch64/ldst-reg-uns-imm.d: Likewise.
* testsuite/gas/aarch64/ldst-reg-unscaled-imm.d: Likewise.
* testsuite/gas/aarch64/reloc-insn.d: Likewise.
* testsuite/gas/aarch64/sve.d: Likewise.
* testsuite/gas/aarch64/symbol.d: Likewise.
* testsuite/gas/aarch64/system.d: Likewise.
* testsuite/gas/aarch64/tls-desc.d: Likewise.
* testsuite/gas/aarch64/sve-invalid.l: Expect spaces after ","
in suggested alternatives.
* testsuite/gas/aarch64/verbose-error.l: Likewise.

ld/
* testsuite/ld-aarch64/emit-relocs-28.d: Expect spaces after ","
in addresses.
* testsuite/ld-aarch64/emit-relocs-301-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-301.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-302-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-302.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-310-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-310.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-313.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-515-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-515.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-516-be.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-516.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-531.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-532.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-533.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-534.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-535.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-536.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-537.d: Likewise.
* testsuite/ld-aarch64/emit-relocs-538.d: Likewise.
* testsuite/ld-aarch64/erratum835769.d: Likewise.
* testsuite/ld-aarch64/erratum843419.d: Likewise.
* testsuite/ld-aarch64/farcall-b-plt.d: Likewise.
* testsuite/ld-aarch64/farcall-bl-plt.d: Likewise.
* testsuite/ld-aarch64/gc-plt-relocs.d: Likewise.
* testsuite/ld-aarch64/ifunc-21.d: Likewise.
* testsuite/ld-aarch64/ifunc-7c.d: Likewise.
* testsuite/ld-aarch64/tls-desc-ie.d: Likewise.
* testsuite/ld-aarch64/tls-large-desc-be.d: Likewise.
* testsuite/ld-aarch64/tls-large-desc.d: Likewise.
* testsuite/ld-aarch64/tls-large-ie-be.d: Likewise.
* testsuite/ld-aarch64/tls-large-ie.d: Likewise.
* testsuite/ld-aarch64/tls-relax-all.d: Likewise.
* testsuite/ld-aarch64/tls-relax-gd-ie.d: Likewise.
* testsuite/ld-aarch64/tls-relax-gdesc-ie-2.d: Likewise.
* testsuite/ld-aarch64/tls-relax-gdesc-ie.d: Likewise.
* testsuite/ld-aarch64/tls-relax-large-desc-ie-be.d: Likewise.
* testsuite/ld-aarch64/tls-relax-large-desc-ie.d: Likewise.
* testsuite/ld-aarch64/tls-tiny-desc.d: Likewise.
* testsuite/ld-aarch64/tls-tiny-gd.d: Likewise.

8 years ago[AArch64] Use "must" rather than "should" in error messages
Richard Sandiford [Wed, 21 Sep 2016 16:11:04 +0000 (17:11 +0100)]
[AArch64] Use "must" rather than "should" in error messages

One of the review comments from the SVE series was that it would
be better to use "must" rather than "should" in error messages.
I think this patch fixes all cases in the AArch64 code.
It also uses "must be" instead of "expected to be".

opcodes/
* aarch64-opc.c (operand_general_constraint_met_p): Use "must be"
rather than "should be" or "expected to be" in error messages.

gas/
* config/tc-aarch64.c (output_operand_error_record): Use "must be"
rather than "should be" or "expected to be" in error messages.
(parse_operands): Likewise.
* testsuite/gas/aarch64/diagnostic.l: Likewise.
* testsuite/gas/aarch64/legacy_reg_names.l: Likewise.
* testsuite/gas/aarch64/sve-invalid.l: Likewise.
* testsuite/gas/aarch64/sve-reg-diagnostic.l: Likewise.

8 years ago[AArch64] Add SVE condition codes
Richard Sandiford [Wed, 21 Sep 2016 16:09:59 +0000 (17:09 +0100)]
[AArch64] Add SVE condition codes

SVE defines new names for existing NZCV conditions, to reflect the
result of instructions like PTEST.  This patch adds support for these
names.

The patch also adds comments to the disassembly output to show the
alternative names of a condition code.  For example:

cinv x0, x1, cc

becomes:

      cinv x0, x1, cc  // cc = lo, ul, last

and:

b.cc f0 <...>

becomes:

      b.cc f0 <...>  // b.lo, b.ul, b.last

Doing this for the SVE names follows the practice recommended by the
SVE specification and is definitely useful when reading SVE code.
If the feeling is that it's too distracting elsewhere, we could add
an option to turn it off.

include/
* opcode/aarch64.h (aarch64_cond): Bump array size to 4.

opcodes/
* aarch64-dis.c (remove_dot_suffix): New function, split out from...
(print_mnemonic_name): ...here.
(print_comment): New function.
(print_aarch64_insn): Call it.
* aarch64-opc.c (aarch64_conds): Add SVE names.
(aarch64_print_operand): Print alternative condition names in
a comment.

gas/
* config/tc-aarch64.c (opcode_lookup): Search for the end of
a condition name, rather than assuming that it will have exactly
2 characters.
(parse_operands): Likewise.
* testsuite/gas/aarch64/alias.d: Add new condition-code comments
to the expected output.
* testsuite/gas/aarch64/beq_1.d: Likewise.
* testsuite/gas/aarch64/float-fp16.d: Likewise.
* testsuite/gas/aarch64/int-insns.d: Likewise.
* testsuite/gas/aarch64/no-aliases.d: Likewise.
* testsuite/gas/aarch64/programmer-friendly.d: Likewise.
* testsuite/gas/aarch64/reloc-insn.d: Likewise.
* testsuite/gas/aarch64/b_c_1.d, testsuite/gas/aarch64/b_c_1.s:
New test.

ld/
* testsuite/ld-aarch64/emit-relocs-280.d: Match branch comments.
* testsuite/ld-aarch64/weak-undefined.d: Likewise.