binutils-gdb.git
7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Apr 2017 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoRISC-V: Allow ISA subsets to be disabled
Palmer Dabbelt [Wed, 29 Mar 2017 23:05:40 +0000 (16:05 -0700)]
RISC-V: Allow ISA subsets to be disabled

Without this patch, passing "-march=rv64ic -march=rv64i" results in
you getting a "RV64IC" toolchain, which isn't expected.

gas/ChangeLog:

2017-03-30  Palmer Dabbelt  <palmer@dabbelt.com>

       * config/tc-riscv.c (riscv_clear_subsets): New function.
       (riscv_add_subset): Call riscv_clear_subsets and riscv_set_rvc to
       clear RVC when it's been previously set.

7 years agoRISC-V: Add physical memory protection CSRs
Andrew Waterman [Wed, 22 Mar 2017 09:09:56 +0000 (02:09 -0700)]
RISC-V: Add physical memory protection CSRs

2017-03-27  Andrew Waterman  <andrew@sifive.com>

       * opcode/riscv-opc.h (CSR_PMPCFG0): New define.
       (CSR_PMPCFG1): Likewise.
       (CSR_PMPCFG2): Likewise.
       (CSR_PMPCFG3): Likewise.
       (CSR_PMPADDR0): Likewise.
       (CSR_PMPADDR1): Likewise.
       (CSR_PMPADDR2): Likewise.
       (CSR_PMPADDR3): Likewise.
       (CSR_PMPADDR4): Likewise.
       (CSR_PMPADDR5): Likewise.
       (CSR_PMPADDR6): Likewise.
       (CSR_PMPADDR7): Likewise.
       (CSR_PMPADDR8): Likewise.
       (CSR_PMPADDR9): Likewise.
       (CSR_PMPADDR10): Likewise.
       (CSR_PMPADDR11): Likewise.
       (CSR_PMPADDR12): Likewise.
       (CSR_PMPADDR13): Likewise.
       (CSR_PMPADDR14): Likewise.
       (CSR_PMPADDR15): Likewise.
       (pmpcfg0): Declare register.
       (pmpcfg1): Likewise.
       (pmpcfg2): Likewise.
       (pmpcfg3): Likewise.
       (pmpaddr0): Likewise.
       (pmpaddr1): Likewise.
       (pmpaddr2): Likewise.
       (pmpaddr3): Likewise.
       (pmpaddr4): Likewise.
       (pmpaddr5): Likewise.
       (pmpaddr6): Likewise.
       (pmpaddr7): Likewise.
       (pmpaddr8): Likewise.
       (pmpaddr9): Likewise.
       (pmpaddr10): Likewise.
       (pmpaddr11): Likewise.
       (pmpaddr12): Likewise.
       (pmpaddr13): Likewise.
       (pmpaddr14): Likewise.
       (pmpaddr15): Likewise.

7 years agogdbserver: Suffix generated C files with -generated
Simon Marchi [Fri, 31 Mar 2017 15:19:44 +0000 (11:19 -0400)]
gdbserver: Suffix generated C files with -generated

I noticed that there were some missing files in gdbserver's gitignore
(some generated register format .c files).  Of course the easy fix would
be to add those files to .gitignore, but I think we can do a better job,
so that we don't have to worry about adding generated files to
.gitignore or the clean Makefile target.

I suggest naming all generated source files -generated.c.  This way, we
can use a single rule in .gitignore and do a "rm -f *-generated.c" to
clean them up.

New in v2:

  - Don't rename version.o and xml-builtin.o

gdb/gdbserver/ChangeLog:

* .gitignore: Remove generated files, replace with wildcard.
* (clean): Replace removal of generated files with wildcard.
(version.c): Replace with...
(version-generated.c): ...this.
(xml-builtin.c): Replace with...
(xml-builtin-generated.c): ...this.
(%-ipa.o: %-generated.c, %.o: %-generated.c): New rules.
(%.c: *regformats*): Replace with...
(%-generated.c: *regformats*): ...this.

7 years agoFix minor problems with previous wasm32 binutils commit.
Pip Cet [Fri, 31 Mar 2017 12:07:01 +0000 (13:07 +0100)]
Fix minor problems with previous wasm32 binutils commit.

binutils * NEWS: Use "WebAssembly" consistently.
* testsuite/binutils-all/wasm32/wasm32.exp: Fix copyright notice.

7 years agoReduce the size of s390 symbol tables by allowing relocations in mergeable string...
Nick Clifton [Fri, 31 Mar 2017 11:54:38 +0000 (12:54 +0100)]
Reduce the size of s390 symbol tables by allowing relocations in mergeable string sections (eg .debug_str) to be made section relative rather than symbol relative.

PR gas/21333
* config/tc-s390.c (tc_s390_fix_adjustable): Allow non pc-relative
fixups in mergeable sections to be adjusted.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 31 Mar 2017 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAdd support for the WebAssembly file format and the wasm32 ELF conversion to gas...
Pip Cet [Thu, 30 Mar 2017 09:57:21 +0000 (10:57 +0100)]
Add support for the WebAssembly file format and the wasm32 ELF conversion to gas and the binutils.

binutils * readelf.c: Add support for wasm32 ELF format WebAssembly files.
(guess_is_rela): Likewise.
(dump_relocations): Likewise.
(is_32bit_abs_reloc): Likewise.
(is_none_reloc_): Likewise.
* NEWS: Mention the new support.
* testsuite/lib/binutils-common.exp (is_elf_format): Mark wasm32
as ELF target.
(supports_gnu_unique): Mark wasm32 as supporting STB_GNU_UNIQUE.
* testsuite/binutils-all/nm.exp: Mark wasm32 as requiring .size annotations.
* testsuite/binutils-all/wasm32: New directory.
* testsuite/binutils-all/wasm32/create-wasm.d: New file.
* testsuite/binutils-all/wasm32/create-wasm.s: Likewise.
* testsuite/binutils-all/wasm32/custom-section.d: Likewise.
* testsuite/binutils-all/wasm32/custom-section.s: Likewise.
* testsuite/binutils-all/wasm32/invalid-wasm-1.d: Likewise.
* testsuite/binutils-all/wasm32/invalid-wasm-1.s: Likewise.
* testsuite/binutils-all/wasm32/long-sections.d: Likewise.
* testsuite/binutils-all/wasm32/long-sections.s: Likewise.
* testsuite/binutils-all/wasm32/parse-wasm.d: Likewise.
* testsuite/binutils-all/wasm32/parse-wasm.s: Likewise.
* testsuite/binutils-all/wasm32/parse-wasm-2.d: Likewise.
* testsuite/binutils-all/wasm32/parse-wasm-2.s: Likewise.
* testsuite/binutils-all/wasm32/prepared-section.d: Likewise.
* testsuite/binutils-all/wasm32/prepared-section.s: Likewise.
* testsuite/binutils-all/wasm32/wasm32.exp: New file, run tests.

gas * config/tc-wasm32.h: New file: Add WebAssembly assembler target.
* config/tc-wasm32.c: New file: Add WebAssembly assembler target.
* Makefile.am: Add WebAssembly assembler target.
* configure.tgt: Add WebAssembly assembler target.
* doc/c-wasm32.texi: New file: Start documenting WebAssembly
assembler.
* doc/all.texi: Define WASM32.
* doc/as.texinfo: Add WebAssembly entries.
* NEWS: Mention the new support.
* Makefile.in: Regenerate.
* po/gas.pot: Regenerate.
* po/POTFILES.in: Regenerate.
* testsuite/gas/wasm32: New directory.
* testsuite/gas/wasm32/allinsn.d: New file.
* testsuite/gas/wasm32/allinsn.s: New file.
* testsuite/gas/wasm32/illegal.l: New file.
* testsuite/gas/wasm32/illegal.s: New file.
* testsuite/gas/wasm32/illegal-2.l: New file.
* testsuite/gas/wasm32/illegal-2.s: New file.
* testsuite/gas/wasm32/illegal-3.l: New file.
* testsuite/gas/wasm32/illegal-3.s: New file.
* testsuite/gas/wasm32/illegal-4.l: New file.
* testsuite/gas/wasm32/illegal-4.s: New file.
* testsuite/gas/wasm32/illegal-5.l: New file.
* testsuite/gas/wasm32/illegal-5.s: New file.
* testsuite/gas/wasm32/illegal-6.l: New file.
* testsuite/gas/wasm32/illegal-6.s: New file.
* testsuite/gas/wasm32/illegal-7.l: New file.
* testsuite/gas/wasm32/illegal-7.s: New file.
* testsuite/gas/wasm32/illegal-8.l: New file.
* testsuite/gas/wasm32/illegal-8.s: New file.
* testsuite/gas/wasm32/illegal-9.l: New file.
* testsuite/gas/wasm32/illegal-9.s: New file.
* testsuite/gas/wasm32/illegal-10.l: New file.
* testsuite/gas/wasm32/illegal-10.s: New file.
* testsuite/gas/wasm32/illegal-11.l: New file.
* testsuite/gas/wasm32/illegal-11.s: New file.
* testsuite/gas/wasm32/illegal-12.l: New file.
* testsuite/gas/wasm32/illegal-12.s: New file.
* testsuite/gas/wasm32/illegal-13.l: New file.
* testsuite/gas/wasm32/illegal-13.s: New file.
* testsuite/gas/wasm32/illegal-14.l: New file.
* testsuite/gas/wasm32/illegal-14.s: New file.
* testsuite/gas/wasm32/illegal-15.l: New file.
* testsuite/gas/wasm32/illegal-15.s: New file.
* testsuite/gas/wasm32/illegal-16.l: New file.
* testsuite/gas/wasm32/illegal-16.s: New file.
* testsuite/gas/wasm32/illegal-17.l: New file.
* testsuite/gas/wasm32/illegal-17.s: New file.
* testsuite/gas/wasm32/illegal-18.l: New file.
* testsuite/gas/wasm32/illegal-18.s: New file.
* testsuite/gas/wasm32/illegal-19.l: New file.
* testsuite/gas/wasm32/illegal-19.s: New file.
* testsuite/gas/wasm32/illegal-20.l: New file.
* testsuite/gas/wasm32/illegal-20.s: New file.
* testsuite/gas/wasm32/illegal-21.l: New file.
* testsuite/gas/wasm32/illegal-21.s: New file.
* testsuite/gas/wasm32/illegal-22.l: New file.
* testsuite/gas/wasm32/illegal-22.s: New file.
* testsuite/gas/wasm32/illegal-24.l: New file.
* testsuite/gas/wasm32/illegal-24.s: New file.
* testsuite/gas/wasm32/illegal-25.l: New file.
* testsuite/gas/wasm32/illegal-25.s: New file.
* testsuite/gas/wasm32/reloc.d: New file.
* testsuite/gas/wasm32/reloc.s: New file.
* testsuite/gas/wasm32/wasm32.exp: New tests for WebAssembly
architecture.

opcodes * configure.ac: Add (empty) bfd_wasm32_arch target.
* configure: Regenerate
* po/opcodes.pot: Regenerate.

include * opcode/wasm.h: New file to support wasm32 architecture.
* elf/wasm32.h: Add R_WASM32_32 relocation.

bfd * elf32-wasm32.c: Add relocation code, two relocs.
* reloc.c: Add wasm32 relocations.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
* bfd/po/bfd.pot: Regenerate.

7 years agoFix classification of `module.type' in D lexer.
Iain Buclaw [Thu, 30 Mar 2017 08:43:03 +0000 (10:43 +0200)]
Fix classification of `module.type' in D lexer.

The two-tier lexer in gdb/d-exp.y, which resolves fully qualified names
missed a case where `module.type' was not being classified as one token.
And so when the grammar takes over, it matched the remaining tokens
against the rule `TypeExp . IdentifierExp', where we were expecting to
instead match cast expression `( TypeExp ) UnaryExpression'.

Adding a case for TYPE_CODE_MODULE in type_aggregate_p means that
classify_inner_name will get a chance to lookup the symbol.

This was noticed when using `watch -l', and got the rather confusing
response:

    A syntax error in expression, near `) 0x0add4e55'.

So it's been included in the testsuite, along with another test that
does effectively the same expression, but explicitly.

gdb/ChangeLog:

* d-exp.y (type_aggregate_p): Treat TYPE_CODE_MODULE as being
aggregate-like.

gdb/testsuite/ChangeLog:

* gdb.dlang/watch-loc.c: New file.
* gdb.dlang/watch-loc.exp: New file.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 30 Mar 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix warning: Invalid entry in .debug_gdb_scripts section
Jan Kratochvil [Wed, 29 Mar 2017 19:53:43 +0000 (21:53 +0200)]
Fix warning: Invalid entry in .debug_gdb_scripts section

$ gdb rustc
Reading symbols from rustc...Reading symbols from /usr/lib/debug/usr/bin/rustc.debug...done.
done.
warning: Invalid entry in .debug_gdb_scripts section

/usr/bin/rustc
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [15] .debug_gdb_scripts PROGBITS        00000000000008ed 0008ed 000022 00 AMS  0   0  1

/usr/lib/debug/usr/bin/rustc.debug
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [15] .debug_gdb_scripts NOBITS          00000000000008ed 000280 000022 00 AMS  0   0  1

There remains questionable whether bfd_get_section_by_name() should not return
an error for !SEC_LOAD but I haven't investigated that.

gdb/ChangeLog
2017-03-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

* auto-load.c (auto_load_section_scripts): Check SEC_HAS_CONTENTS.

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

* gdb.python/py-section-script.exp (sepdebug): New testcases.

7 years agoopcodes: sparc: support missing SPARC ASIs from UA2005, UA2007, OSA2011, & OSA2015
Jose E. Marchesi [Wed, 29 Mar 2017 19:20:23 +0000 (21:20 +0200)]
opcodes: sparc: support missing SPARC ASIs from UA2005, UA2007, OSA2011, & OSA2015

7 years agoAdd constructor and destructor to thread_info
Yao Qi [Wed, 29 Mar 2017 15:56:31 +0000 (16:56 +0100)]
Add constructor and destructor to thread_info

This patch adds constructor and destructor to thread_info.

gdb:

2017-03-29  Yao Qi  <yao.qi@linaro.org>

* gdbthread.h (struct thread_info): Declare constructor and
destructor.  Add some in-class member initializers.
* thread.c (free_thread): Remove.
(init_thread_list): Call delete instead of free_thread.
(new_thread): Call thread_info constructor.
(thread_info::thread_info): New function.
(thread_info::~thread_info): New function.
(delete_thread_1): Call delete instead of free_thread.
(make_cleanup_restore_current_thread): Move tp and frame to
inner block.

7 years agoPowerPC -Mraw disassembly
Alan Modra [Wed, 29 Mar 2017 03:13:06 +0000 (13:43 +1030)]
PowerPC -Mraw disassembly

This adds -Mraw for PowerPC objdump, a disassembler option to display
the underlying machine instruction rather than aliases.  For example,
"rlwinm" always rather than "rotlwi" when the instruction is
performing a simple rotate.

binutils/
* doc/binutils.texi (objdump): Document PowerPC -M options.
gas/
* config/tc-ppc.c (md_parse_option): Reject -mraw.
include/
* opcode/ppc.h (PPC_OPCODE_RAW): Define.
(PPC_OPCODE_*): Make them all unsigned long long constants.
opcodes/
* ppc-dis.c (ppc_opts): Set PPC_OPCODE_PPC for "any" flags.  Add
"raw" option.
(lookup_powerpc): Don't special case -1 dialect.  Handle
PPC_OPCODE_RAW.
(print_insn_powerpc): Mask out PPC_OPCODE_ANY on first
lookup_powerpc call, pass it on second.

7 years agoImprove the speed of scanning PE binaries for line number information.
Nick Clifton [Wed, 29 Mar 2017 11:27:44 +0000 (12:27 +0100)]
Improve the speed of scanning PE binaries for line number information.

PR binutils/18025
* coff-bfd.h (struct coff_section_data): Add new fields:
saved_bias and bias.
* coffgen.c (coff_find_nearest_line_with_names): Cache the bias
computed for PE binaries.
* dwarf2.c (scan_unit_for_symbols): Only warn once about each
missing abbrev.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Mar 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix for PR ld/16044: elf32-cris.c h->plt.refcount inconsistency
Hans-Peter Nilsson [Tue, 28 Mar 2017 21:43:09 +0000 (23:43 +0200)]
Fix for PR ld/16044: elf32-cris.c h->plt.refcount inconsistency

7 years agoarc: Add prologue analysis
Anton Kolesov [Fri, 10 Feb 2017 11:12:09 +0000 (14:12 +0300)]
arc: Add prologue analysis

Add a prologue analysis that recognizes all instructions that may happen in
compiler-generated prologue, including various stores, core register moves,
subtraction and ENTER_S instruction that does a lot of prologue actions through
microcode.

Testcases cover various prologue scenarios, including instructions that are
spread across multiple 16-bit encodings (for example there are 7 encodings of
store instruction).

gdb/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* arc-tdep.c (arc_frame_cache): Add support for prologue analysis.
(arc_skip_prologue): Likewise.
(arc_make_frame_cache): Likewise.
(arc_pv_get_operand): New function.
(arc_is_in_prologue): Likewise.
(arc_analyze_prologue): Likewise.
(arc_print_frame_cache): Likewise.
(MAX_PROLOGUE_LENGTH): New constant.

gdb/doc/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* gdb.texinfo (Synopsys ARC): Document "set debug arc 2".

gdb/testsuite/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* gdb.arch/arc-analyze-prologue.S: New file.
* gdb.arch/arc-analyze-prologue.exp: Likewise.

7 years agoarc: Add disassembler helper
Anton Kolesov [Fri, 10 Feb 2017 11:12:06 +0000 (14:12 +0300)]
arc: Add disassembler helper

Add disassembler helper for GDB, that uses opcodes structure arc_instruction
and adds convenience functions to handle instruction operands.  This interface
solves at least those problems with arc_instruction:

  * Some instructions, like "push_s", have implicit operands which are not
    directly present in arc_instruction.
  * Operands of particular meaning, like branch/jump targets, have various
    locations and meaning depending on type of branch/target.
  * Access to operand value is abstracted into a separate function, so callee
    code shouldn't bother if operand value is an immediate value or in a
    register.

Testcases included in this commit are fairly limited - they test exclusively
branch instructions, something that will be used in software single stepping.
Most of the other parts of this disassembler helper are tested during prologue
analysis testing.

gdb/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* configure.tgt: Add arc-insn.o.
* arc-tdep.c (arc_delayed_print_insn): Make non-static.
(dump_arc_instruction_command): New function.
(arc_fprintf_disasm): Likewise.
(arc_disassemble_info): Likewise.
(arc_insn_get_operand_value): Likewise.
(arc_insn_get_operand_value_signed): Likewise.
(arc_insn_get_memory_base_reg): Likewise.
(arc_insn_get_memory_offset): Likewise.
(arc_insn_get_branch_target): Likewise.
(arc_insn_dump): Likewise.
(arc_insn_get_linear_next_pc): Likewise.
* arc-tdep.h (arc_delayed_print_insn): Add function declaration.
(arc_disassemble_info): Likewise.
(arc_insn_get_branch_target): Likewise.
(arc_insn_get_linear_next_pc): Likewise.
* NEWS: Mention new "maint print arc arc-instruction".

gdb/doc/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* gdb.texinfo (Synopsys ARC): Add "maint print arc arc-instruction".

gdb/testsuite/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* gdb.arch/arc-decode-insn.S: New file.
* gdb.arch/arc-decode-insn.exp: Likewise.

7 years agoarc: Add "maintenance print arc" command prefix
Anton Kolesov [Fri, 10 Feb 2017 11:12:01 +0000 (14:12 +0300)]
arc: Add "maintenance print arc" command prefix

Add an "arc" sublist to "maintenance print" command list.  The list is empty
for now, its purpose is to contain commands that print internal state of some
ARC-specific structures.

gdb/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* arc-tdep (maintenance_print_arc_list): New variable.
(maintenance_print_arc_command): New function.

7 years agoarc: Align internal regnums with architectural regnums
Anton Kolesov [Fri, 10 Feb 2017 11:11:46 +0000 (14:11 +0300)]
arc: Align internal regnums with architectural regnums

Add ARC_LIMM_REGNUM to arc_regnum enumeration and assign a number 62 to it.
This ensures that for core registers internal register numbers in this enum are
the same as architectural numbers.  This allows to use internal register
numbers in the contexts where architectural number is implied, for example when
disassembling instruction during prologue analysis.

gdb/ChangeLog:

yyyy-mm-dd  Anton Kolesov  <anton.kolesov@synopsys.com>

* arc-tdep.c (core_v2_register_names, core_arcompact_register_names)
Add "limm" and "reserved".
(arc_cannot_fetch_register, arc_cannot_store_register): Add
ARC_RESERVED_REGNUM and ARC_LIMM_REGNUM.
* arc-tdep.h (arc_regnum): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 28 Mar 2017 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agogdbserver: xtensa: support THREADPTR register
Max Filippov [Sat, 19 Nov 2016 00:08:48 +0000 (16:08 -0800)]
gdbserver: xtensa: support THREADPTR register

Provide aceess to the THREADPTR register to remote gdb.

gdb/gdbserver/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* linux-xtensa-low.c (regnum::R_THREADPTR): New enum member.
(xtensa_fill_gregset): Call collect_register_by_name for
threadptr register.
(xtensa_store_gregset): Call supply_register_by_name for
threadptr register.

7 years agogdb: xtensa-linux: support THREADPTR register
Max Filippov [Fri, 18 Nov 2016 19:39:47 +0000 (11:39 -0800)]
gdb: xtensa-linux: support THREADPTR register

Make THREADPTR user register accessible.

gdb/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* xtensa-linux-nat.c (fill_gregset): Call regcache_raw_collect
for THREADPTR register.
(supply_gregset_reg): Call regcache_raw_supply for THREADPTR
register.
* xtensa-tdep.c (XTENSA_DBREGN_UREG): New definition.
(xtensa_derive_tdep): Initialize tdep->threadptr_regnum.
* xtensa-tdep.h (gdbarch_tdep::threadptr_regnum): New field.

7 years agogdb: xtensa: fix test for privileged register number
Max Filippov [Tue, 21 Feb 2017 23:41:31 +0000 (15:41 -0800)]
gdb: xtensa: fix test for privileged register number

There are no a0-a15 pseudoregisters at the top of the register set in
call0 registers layout. All registers above gdbarch_num_regs (gdbarch)
are privileged. Treat them as such. This fixes the following gdb
assertion seen when 'finish' command is invoked:

  regcache.c:649: internal-error: register_status
  regcache_raw_read(regcache*, int, gdb_byte*):
  Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers'
  failed.

gdb/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* xtensa-tdep.c (xtensa_pseudo_register_read): Treat all
registers above gdbarch_num_regs (gdbarch) as privileged in
call0 ABI.

7 years agogdbserver: xtensa: add call0 support
Max Filippov [Fri, 18 Nov 2016 16:58:21 +0000 (08:58 -0800)]
gdbserver: xtensa: add call0 support

Correctly handle a0- registers on requests from remote gdb. This fixes

  'Register 1 is not available'

and subsequent assertion in the remote gdb connecting to the gdbserver:

  'findvar.c:291: internal-error: value_of_register_lazy:
    Assertion `frame_id_p(get_frame_id (frame))' failed.'

The register structure is the same for windowed and call0 ABIs because
currently linux kernel internally requires windowed registers, so they
are always present.

gdb/gdbserver/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* linux-xtensa-low.c (xtensa_fill_gregset): Call collect_register
for all registers in a0_regnum..a0_regnum + C0_NREGS range.
(xtensa_store_gregset): Call supply_register for all registers in
a0_regnum..a0_regnum + C0_NREGS range.

7 years agogdb: xtensa-linux: add call0 support
Max Filippov [Fri, 18 Nov 2016 17:48:01 +0000 (09:48 -0800)]
gdb: xtensa-linux: add call0 support

Correctly handle a0- registers. This allows debugging call0 code in
linux natively.
The register structure is the same for windowed and call0 ABIs because
currently linux kernel internally requires windowed registers, so they are
always present.

gdb/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* xtensa-linux-nat.c (fill_gregset): Call regcache_raw_collect
for a single specified register or for all registers in
a0_base..a0_base + C0_NREGS range.
(supply_gregset_reg): Call regcache_raw_supply for a single
specified register or for all registers in a0_base..a0_base +
C0_NREGS range.

7 years agogdb: gdbserver: xtensa: make C0_NREGS available
Max Filippov [Wed, 22 Feb 2017 01:14:37 +0000 (17:14 -0800)]
gdb: gdbserver: xtensa: make C0_NREGS available

Both gdb and gdbserver need this definition to properly work with call0
ABI. Make it available to both.

gdb/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* arch/xtensa.h (C0_NREGS): Add definition.
* xtensa-tdep.c (C0_NREGS): Remove definition.

7 years agogdb: xtensa: clean up xtensa_default_isa initialization
Max Filippov [Fri, 18 Nov 2016 17:39:41 +0000 (09:39 -0800)]
gdb: xtensa: clean up xtensa_default_isa initialization

This fixes segfault in native gdb because isa is not initialized at the
point of call to xtensa_isa_maxlength.

gdb/
2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>

* xtensa-tdep.c (xtensa_scan_prologue, call0_analyze_prologue):
Drop xtensa_default_isa initialization.
(xtensa_gdbarch_init): Initialize xtensa_default_isa.

7 years agodwarf2read.c: Clean up out of bounds handling
Pedro Alves [Mon, 27 Mar 2017 14:57:19 +0000 (15:57 +0100)]
dwarf2read.c: Clean up out of bounds handling

Multiple places in dwarf2read.c open code 1-based to 0-based index
conversion and check for out of bounds accesses to lh->include_dirs
and lh->file_names.  This commit factors those out to a couple methods
and uses them throughout.

gdb/ChangeLog:
2017-03-27  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (file_entry) <dir_index>: Add comment.
(file_entry::include_dir): New method.
(line_header::include_dir_at, line_header::file_name_at): New
methods.
(setup_type_unit_groups, setup_type_unit_groups)
(psymtab_include_file_name): Simplify using the new methods.
(lnp_state_machine) <the_line_header>: New field.
<file>: Add comment.
(lnp_state_machine::current_file): New method.
(dwarf_record_line): Simplify using the new methods.
(init_lnp_state_machine): Initialize the "the_line_header" field.
(dwarf_decode_lines_1, dwarf_decode_lines, file_file_name):
Simplify using the new methods.

7 years agogdb/cp-name-parser.y: Eliminate make_empty, use cplus_demangle_fill_component
Pedro Alves [Mon, 27 Mar 2017 12:56:49 +0000 (13:56 +0100)]
gdb/cp-name-parser.y: Eliminate make_empty, use cplus_demangle_fill_component

The demangler exports the cplus_demangle_fill_component function that
clients should use to initialize demangle_component components that
use the "s_binary" union member.  cp-name-parser.y uses it in some
places, via the fill_comp wrapper, but not all.  Several places
instead use a GDB-specific "make_empty" function.  Because this
function does not call any of the demangler "fill" functions, we had
to patch it recently to clear the allocated demangle_component's
"d_printing" field, which is supposedly a "private" demangler field.
To avoid such problems in the future, this commit switches those
places to use "fill_comp" instead, and eliminates the "make_empty"
function.

gdb/ChangeLog:
2017-03-27  Pedro Alves  <palves@redhat.com>

* cp-name-parser.y (make_empty): Delete.
(demangler_special, nested_name, ptr_operator, array_indicator)
(direct_declarator, declarator_1): Use fill_comp instead of
make_empty.

7 years agocplus_demangle_fill_component: Handle DEMANGLE_COMPONENT_RVALUE_REFERENCE
Pedro Alves [Mon, 27 Mar 2017 12:56:49 +0000 (13:56 +0100)]
cplus_demangle_fill_component: Handle DEMANGLE_COMPONENT_RVALUE_REFERENCE

This patch almost a decade ago:

...
    2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>

        * cp-demangle.c (d_dump): Handle
        DEMANGLE_COMPONENT_RVALUE_REFERENCE.
        (d_make_comp): Ditto.
...

... missed doing the same change to cplus_demangle_fill_component that
was done to d_make_comp.  I.e., teach it to only validate that we're
not passing in a "right" subtree.  GDB has recently (finally) learned
about rvalue references, and a change to make it use
cplus_demangle_fill_component more ran into an assertion because of
this.

(GDB is the only user of cplus_demangle_fill_component in both the gcc
and binutils-gdb trees.)

libiberty/ChangeLog:
2017-03-27  Pedro Alves  <palves@redhat.com>

* cp-demint.c (cplus_demangle_fill_component): Handle
DEMANGLE_COMPONENT_RVALUE_REFERENCE.

7 years agoAdd support for the WebAssembly backend to the BFD library.
Pip Cet [Mon, 27 Mar 2017 12:41:39 +0000 (13:41 +0100)]
Add support for the WebAssembly backend to the BFD library.

* wasm-module.c: New file to support WebAssembly modules.
* wasm-module.h: New file to support WebAssembly modules.
* doc/webassembly.texi: Start documenting wasm-module.c.
* config.bfd: Add wasm_vec.
* targets.c: Likewise.
* configure.ac: Likewise.
* Makefile.am: Add entries for wasm-module.c.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.

7 years agoFix gdb_xml_debug/gdb_xml_error ATTRIBUTE_PRINTF use
Pedro Alves [Mon, 27 Mar 2017 11:28:03 +0000 (12:28 +0100)]
Fix gdb_xml_debug/gdb_xml_error ATTRIBUTE_PRINTF use

The declarations of gdb_xml_debug and gdb_xml_error are passing "0" as
"first-to-check" argument to ATTRIBUTE_PRINTF, as if they were va_args
functions.  Consequently, the arguments to gdb_xml_debug /
gdb_xml_error aren't being checked against the format strings.

With that fixed, a couple obvious bugs are exposed, both fixed by this
commit.

gdb/ChangeLog:
2017-03-27  Pedro Alves  <palves@redhat.com>

* xml-support.h (gdb_xml_debug): Pass a "first-to-check" argument
to ATTRIBUTE_PRINTF.
* solib-target.c (library_list_start_list): Print "string" not
"version".
* xml-tdesc.c (tdesc_start_field): Pass "field_name" to
gdb_xml_error call.

7 years agoPR21303, objdump doesn't show e200z4 insns
Alan Modra [Sun, 26 Mar 2017 21:49:48 +0000 (08:19 +1030)]
PR21303, objdump doesn't show e200z4 insns

PR 21303
opcodes/
* ppc-dis.c (struct ppc_mopt): Comment.
(ppc_opts <e200z4>): Move PPC_OPCODE_VLE from .sticky to .cpu.
gas/
* testsuite/gas/ppc/pr21303.d,
* testsuite/gas/ppc/pr21303.s: New test
* testsuite/gas/ppc/ppc.exp: Run it.

7 years agogdb: Make ldirname return a std::string
Pedro Alves [Mon, 27 Mar 2017 10:56:28 +0000 (11:56 +0100)]
gdb: Make ldirname return a std::string

Eliminates several uses of cleanups.

Tested on x86_64 Fedora 23 with Python 2 and 3.

gdb/ChangeLog
2017-03-27  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (struct file_and_directory): New.
(dwarf2_get_dwz_file): Adjust to use std::string.
(dw2_get_file_names_reader): Adjust to use file_and_directory.
(find_file_and_directory): Adjust to return a file_and_directory
object.
(read_file_scope): Adjust to use file_and_directory.  Remove
make_cleanup/do_cleanups calls.
(open_and_init_dwp_file): Adjust to use std::string.  Remove
make_cleanup/do_cleanups calls.
* python/python.c (do_start_initialization): Adjust to ldirname
returning a std::string.
* utils.c (ldirname): Now returns a std::string.
* utils.h (ldirname): Change return type to std::string.
* xml-syscall.c (xml_init_syscalls_info): Adjust to ldirname
returning a std::string.
* xml-tdesc.c (file_read_description_xml): Likewise.

7 years agooops - forgot to add the bfd/ChangeLog entry...
Pip Cet [Mon, 27 Mar 2017 10:45:24 +0000 (11:45 +0100)]
oops - forgot to add the bfd/ChangeLog entry...

7 years agoAdd minimal support for WebAssembly backend to the BFD library.
Pip Cet [Mon, 27 Mar 2017 10:39:50 +0000 (11:39 +0100)]
Add minimal support for WebAssembly backend to the BFD library.

include * elf/wasm32.h: New file to support wasm32 architecture.

bfd * cpu-wasm32.c: New file to support wasm32 architecture.
    * elf32-wasm32.c: New file to support wasm32 architecture.
    * Makefile.am: Add wasm32 architecture.
    * archures.c: Likewise.
    * config.bfd: Likewise.
    * configure.ac: Likewise.
    * targets.c: Likewise.

7 years agoImplement ARC NPS-400 Ultra Ip and Miscellaneous instructions.
Rinat Zelig [Mon, 27 Mar 2017 10:14:30 +0000 (11:14 +0100)]
Implement ARC NPS-400 Ultra Ip and Miscellaneous instructions.

opcodes * arc-nps400-tbl.h: Add Ultra Ip and Miscellaneous instructions format.
* arc-opc.c: Add defines. e.g. F_NJ, F_NM , F_NO_T, F_NPS_SR, F_NPS_M, F_NPS_CORE, F_NPS_ALL.
(insert_nps_misc_imm_offset): New function.
(extract_nps_misc imm_offset): New function.
(arc_num_flag_operands): Add F_NJ, F_NM, F_NO_T.
(arc_flag_special_cases): Add F_NJ, F_NM, F_NO_T.

include * opcode/arc.h (insn_class_t): Add ULTRAIP and MISC class.

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

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Mar 2017 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoFix bug with cmn/adds where C flag was incorrectly set.
Jim Wilson [Sun, 26 Mar 2017 03:32:02 +0000 (20:32 -0700)]
Fix bug with cmn/adds where C flag was incorrectly set.

sim/aarch64/
* simulator.c (set_flags_for_add32): Cast result to uint32_t in carry
flag check.

sim/testsuite/sim/aarch64/
* adds.s: Add checks for values -2 and 1, where C is not set.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 26 Mar 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Mar 2017 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoRemove MAX_REGISTER_SIZE from target.c
Alan Hayward [Fri, 24 Mar 2017 16:53:05 +0000 (16:53 +0000)]
Remove MAX_REGISTER_SIZE from target.c

gdb/
* regcache.c (regcache_debug_print_register): New function.
* regcache.h (regcache_debug_print_register): New declaration.
* target.c (debug_print_register): Remove.
(target_fetch_registers): Call regcache_debug_print_register.
(target_store_registers): Likewise.

7 years agoAvoid segfault on invalid directory table
Pádraig Brady [Fri, 24 Mar 2017 15:12:53 +0000 (15:12 +0000)]
Avoid segfault on invalid directory table

gdb was segfaulting during backtrace on a binary here, where
fe->dir_index parsed from the DWARF info was seen to access beyond the
provided include_dirs array.

This commit bounds the access to entries actually written to the
array, and was verified to output the backtrace correctly.

gdb/ChangeLog:

* dwarf2read.c (setup_type_unit_groups): Ensure dir_index doesn't
reference beyond the 'lh->include_dirs' array before accessing to
it.
(psymtab_include_file_name): Likewise.
(dwarf_decode_lines_1): Likewise.
(dwarf_decode_lines): Likewise.
(file_file_name): Likewise.

7 years ago[GAS/ARM] Fix selected_cpu with default CPU and -mcpu
Thomas Preud'homme [Fri, 24 Mar 2017 13:22:16 +0000 (13:22 +0000)]
[GAS/ARM] Fix selected_cpu with default CPU and -mcpu

When GAS is compiled with DEFAULT_CPU set and then run with a -mcpu or
-march option, selected_cpu will be set to the default CPU. This means
the -mcpu is ignored which is surprising behavior. This commit instead
sets selected_cpu from the value passed to -mcpu/-march.

2017-03-24  Thomas preud'homme  <thomas.preudhomme@arm.com>

gas/
* config/tc-arm.: (md_begin): Set selected_cpu from *mcpu_cpu_opt when
CPU_DEFAULT is defined.

7 years agoreadelf: Fix incorrect "Version definition past end of section" message (ChangeLog)
Maciej W. Rozycki [Fri, 24 Mar 2017 12:25:49 +0000 (12:25 +0000)]
readelf: Fix incorrect "Version definition past end of section" message (ChangeLog)

Correct ChangeLog entry for commit c9f02c3e2949 ("readelf: Fix incorrect
"Version definition past end of section" message").

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 24 Mar 2017 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoRemove some unnecessary inferior_ptid setting/restoring when fetching/storing registers
Simon Marchi [Thu, 23 Mar 2017 17:37:06 +0000 (13:37 -0400)]
Remove some unnecessary inferior_ptid setting/restoring when fetching/storing registers

Now that the to_fetch_registers, to_store_registers and
to_prepare_to_store target methods don't rely on the value of
inferior_ptid anymore, we can remove a bunch of now unnecessary setting
and restoring of inferior_ptid.

The asserts added recently in target_fetch_registers and
target_store_registers, which validate that inferior_ptid matches the
regcache's ptid, must go away.  It's the whole point of this effort, to
not require inferior_ptid to have a particular value when calling these
functions.

One thing that I noticed is how sol-thread.c's ps_lgetregs and friends
use the current value of inferior_ptid instead of what's passed as
argument (ph->ptid), unlike proc-service.c's versions of the same
functions.  Is it expected?  I left it like this in the current patch,
but unless there's a good reason for it to be that way, I guess we
should make it use the parameter.

gdb/ChangeLog:

* fbsd-tdep.c (fbsd_corefile_thread): Don't set/restore
inferior_ptid.
* proc-service.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs,
ps_lsetfpregs): Likewise.
* regcache.c (regcache_raw_update, regcache_raw_write): Likewise.
* sol-thread.c (ps_lgetregs, ps_lsetregs, ps_lgetfpregs,
ps_lsetfpregs): Likewise.
* target.c (target_fetch_registers, target_store_registers):
Remove asserts.

7 years agoRemove MAX_REGISTER_SIZE from sol-thread.c
Alan Hayward [Thu, 23 Mar 2017 14:40:58 +0000 (14:40 +0000)]
Remove MAX_REGISTER_SIZE from sol-thread.c

gdb/
* sol-thread.c (sol_thread_store_registers): Remove regcache calls.

7 years agoHandle PRFM in AArch64 process record
Yao Qi [Thu, 23 Mar 2017 14:11:04 +0000 (14:11 +0000)]
Handle PRFM in AArch64 process record

This patch fixes the bug of handling PRFM instruction.  PRFM is documented
in a table with other load and store instructions, but it doesn't do any
load or store.  This patch also adds a unit test to PRFM instruction.

gdb:

2017-03-23  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (aarch64_process_record_test): Declare.
(_initialize_aarch64_tdep): Register it.
(aarch64_record_load_store): Handle PRFM instruction.
(aarch64_process_record_test): New function.

7 years agoFix code indentation
Yao Qi [Thu, 23 Mar 2017 14:11:04 +0000 (14:11 +0000)]
Fix code indentation

gdb:

2017-03-23  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c (aarch64_record_load_store): Fix code
indentation.

7 years agoRemove AARCH64_RECORD_FAILURE
Yao Qi [Thu, 23 Mar 2017 14:11:04 +0000 (14:11 +0000)]
Remove AARCH64_RECORD_FAILURE

It is not used at all.

gdb:

2017-03-23  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c: Remove AARCH64_RECORD_FAILURE.

7 years agoRemove constness of libdir in do_start_initialization
Andreas Arnez [Thu, 23 Mar 2017 11:51:14 +0000 (12:51 +0100)]
Remove constness of libdir in do_start_initialization

The patch "Fix memory leak in python.c:do_start_initialization"
(https://sourceware.org/ml/gdb-patches/2017-03/msg00407.html) introduced a
compilation error on some platforms:

  ../../binutils-gdb/gdb/python/python.c: In function bool do_start_initialization():
  ../../binutils-gdb/gdb/python/python.c:1556:16: error: invalid conversion from const void* to void* [-fpermissive]
   xfree (libdir);
                ^

This is fixed by removing the constness of libdir's data type.

gdb/ChangeLog:

* python/python.c (do_start_initialization): Remove 'const' from
data type of libdir.

7 years agoFix memory leak in python.c:do_start_initialization
Philipp Rudo [Thu, 23 Mar 2017 11:22:11 +0000 (12:22 +0100)]
Fix memory leak in python.c:do_start_initialization

When intializing Python the path to the python binary is build the
following way

progname = concat (ldirname (python_libdir), SLASH_STRING, "bin",
   SLASH_STRING, "python", (char *) NULL);

This is problematic as both concat and ldirname allocate memory for the
string they return.  Thus the memory allocated by ldirname cannot be
accessed afterwards causing a memory leak.  Fix it by temporarily storing
libdir in a variable and xfree it after concat.

gdb/ChangeLog:
python/python.c (do_start_initialization): Fix memory leak.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 23 Mar 2017 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoSanitize RISC-V GAS help text, documentation
Palmer Dabbelt [Tue, 21 Mar 2017 15:36:44 +0000 (08:36 -0700)]
Sanitize RISC-V GAS help text, documentation

It looks like I missed the GAS help text when going through all the
documentation last time, so it printed some of the old-format (never
upstream) arguments.  I fixed this, and when I went to check doc/ I
noticed it was missing the '-fpic'/'-fno-pic' options.

7 years agogas: xtensa: make trampolines relaxation work with jumps in slots other than 0
Max Filippov [Wed, 22 Mar 2017 17:19:14 +0000 (10:19 -0700)]
gas: xtensa: make trampolines relaxation work with jumps in slots other than 0

add_jump_to_trampoline assumes that jump instruction is in slot 0,
when it's in other slot that results in fixup that references NULL symbol,
which results in segfault later in xtensa_make_cached_fixup.
Search for the non-NULL symbol in the tc_frag_data.slot_symbols and check
that there's exactly one such slot.

xtensa_relax_frag for RELAX_TRAMPOLINE reassigns fixup from the original
instruction with jump to generated jump in the trampoline frag, but does not
fix its fx_r_type or fx_size. That results in "undecodable fix" or
"fixup not contained within frag" error messages during relaxation.
Fix both these fields.

gas/
2017-03-22  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (xtensa_relax_frag): Change fx_size of the
reassigned fixup to size of jump instruction (3) and fx_r_type
to BFD_RELOC_XTENSA_SLOT0_OP, as there's only one slot.
(add_jump_to_trampoline): Search
origfrag->tc_frag_data.slot_symbols for the slot with non-NULL
symbol and use that slot instead of slot 0.

7 years agoRemove lwp -> pid conversion in linux_nat_xfer_partial
Simon Marchi [Wed, 22 Mar 2017 14:35:07 +0000 (10:35 -0400)]
Remove lwp -> pid conversion in linux_nat_xfer_partial

The linux_nat_xfer_partial does a conversion of inferior_ptid: if it's
an LWP (ptid::lwp != 0), it builds a new ptid with the lwp as
the pid and assigns that temporarily to inferior_ptid.  For example, if
inferior_ptid is:

  { .pid = 1234, .lwp = 1235 }

it will assign this to inferior_ptid for the duration of the call:

  { .pid = 1235, .lwp = 0 }

Instead of doing this, this patch teaches the inf-ptrace implementation
of xfer_partial to deal with ptids representing lwps by using
get_ptrace_pid.

Also, in linux_proc_xfer_spu and linux_proc_xfer_partial, we use ptid_get_lwp
instead of ptid_get_pid.  While not strictly necessary, since the content of
/proc/<pid> and /proc/<lwp> should be the same, it's a bit safer, because:

- some files under /proc/<pid>/ may not work if the <pid> thread is
  running, just like ptrace requires a stopped thread.  The current
  thread's lwp id is more likely to be in the necessary state (stopped).

- if the leader (<pid>) had exited and is thus now zombie, then several
  files under "/proc/<pid>" won't work, while they will if you use
  "/proc/<lwp>".

The testsuite found no regression on native amd64 linux.

gdb/ChangeLog:

* inf-ptrace.c (inf_ptrace_xfer_partial): Get pid from ptid
using get_ptrace_pid.
* linux-nat.c (linux_nat_xfer_partial): Don't set/restore
inferior_ptid.
(linux_proc_xfer_partial, linux_proc_xfer_spu): Use lwp of
inferior_ptid instead of pid.

7 years agoSync top level config files with master versions in the FSF config project.
Nick Clifton [Wed, 22 Mar 2017 14:01:03 +0000 (14:01 +0000)]
Sync top level config files with master versions in the FSF config project.

* config.sub: Sync with master version in config project.
* config.guess: Likewise.

7 years agoRemove @code for python
Yao Qi [Wed, 22 Mar 2017 12:40:24 +0000 (12:40 +0000)]
Remove @code for python

There's no reason to use @code for Python the name of a programming
language.

gdb/doc:

2017-03-22  Yao Qi  <yao.qi@linaro.org>

* python.texi (Inferiors In Python): Remove @code from Python.

7 years agoWrap locally used classes in anonymous namespace
Yao Qi [Wed, 22 Mar 2017 12:35:31 +0000 (12:35 +0000)]
Wrap locally used classes in anonymous namespace

Both aarch64-tdep.c and arm-tdep.c defines a class instruction_reader, which
violates ODR, but linker doesn't an emit error.  I fix this issue by wrapping
them by anonymous namespace, but I think it is better to apply this for all
locally used classes.

If it is a good idea to put locally used class into anonymous namespace, we
should document this rule into GDB coding convention, or even GCC coding
convention.  Note that anonymous namespace has been used in GCC but GCC
coding convention doesn't mention the it.

gdb:

2017-03-22  Yao Qi  <yao.qi@linaro.org>

* aarch64-tdep.c: Wrap locally used classes in anonymous
namespace.
* arm-tdep.c: Likewise.
* linespec.c: Likewise.
* ui-out.c: Likewise.

7 years agoImport sys in gdb/python/lib/gdb/printer/bound_registers.py
Jonah Graham [Wed, 22 Mar 2017 11:19:44 +0000 (11:19 +0000)]
Import sys in gdb/python/lib/gdb/printer/bound_registers.py

Pick up missing bits from the patch merged in.

2017-03-22  Jonah Graham  <jonah@kichwacoders.com>

PR gdb/19637
* python/lib/gdb/printer/bound_registers.py: Import sys.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 22 Mar 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoDisable shared library tests for nios2-*-elf.
Sandra Loosemore [Tue, 21 Mar 2017 20:25:09 +0000 (13:25 -0700)]
Disable shared library tests for nios2-*-elf.

The Nios II processor documentation defines relocations for PIC and
shared libraries as part of the GNU/Linux ABI only; GCC rejects -fpic
on bare-metal.

2017-03-21  Sandra Loosemore  <sandra@codesourcery.com>

ld/
* testsuite/lib/ld-lib.exp (check_shared_lib_support): Return
false for nios2-*-elf.

7 years agowindows: Use ptid from regcache in register fetch/store
Simon Marchi [Tue, 21 Mar 2017 15:35:54 +0000 (11:35 -0400)]
windows: Use ptid from regcache in register fetch/store

Use the ptid from the regcache so we don't depend on the current value
of the inferior_ptid global.

Also, change how the current thread is passed to sub-functions.  The
windows_fetch_inferior_registers function sets current_thread then calls
do_windows_fetch_inferior_registers, which reads current_thread.  This
very much looks like passing a parameter through a global variable.  I
think it would be more straightforward to pass the thread as a
parameter.

gdb/ChangeLog:

* windows-nat.c (do_windows_fetch_inferior_registers): Add
windows_thread_info parameter and use it instead of
current_thread.
(windows_fetch_inferior_registers): Don't set current_thread,
pass the thread to do_windows_fetch_inferior_registers.  Use
ptid from regcache instead of inferior_ptid.
(do_windows_store_inferior_registers): Add windows_thread_info
parameter and use it instead of current_thread.
(windows_store_inferior_registers): Don't set current_thread,
pass the thread to do_windows_store_inferior_registers.  Use
ptid from regcache instead of inferior_ptid.

7 years agoRemove remaining reference to struct serial::current_timeout
Simon Marchi [Tue, 21 Mar 2017 15:35:42 +0000 (11:35 -0400)]
Remove remaining reference to struct serial::current_timeout

I get this when trying to build for --host=x68_64-w64-mingw32:

/home/emaisin/src/binutils-gdb/gdb/ser-mingw.c: In function 'void ser_windows_raw(serial*)':
/home/emaisin/src/binutils-gdb/gdb/ser-mingw.c:166:8: error: 'struct serial' has no member named 'current_timeout'
   scb->current_timeout = 0;
        ^~~~~~~~~~~~~~~

It is just a leftover from

  9bcbdca808b5f9fec6217d20bd4b48a56008c460
  PR remote/21188: Fix remote serial timeout

gdb/ChangeLog:

* ser-mingw.c (ser_windows_raw): Remove reference to
struct serial::current_timeout.

7 years agoS/390: Remove vx2 facility flag
Andreas Krebbel [Tue, 21 Mar 2017 13:21:02 +0000 (14:21 +0100)]
S/390: Remove vx2 facility flag

This patch removes the vx2 facility flag.  It will not be used by GCC
and was a misnomer anyway.

Committed to mainline and 2.28 branch.

include/ChangeLog:

2017-03-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* opcode/s390.h (S390_INSTR_FLAG_VX2): Remove.
(S390_INSTR_FLAG_FACILITY_MASK): Adjust value.

gas/ChangeLog:

2017-03-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/tc-s390.c (s390_parse_cpu): Remove S390_INSTR_FLAG_VX2
from cpu_table.  Remove vx2, and novx2 from cpu_flags.

opcodes/ChangeLog:

2017-03-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-mkopc.c (main): Remove vx2 check.
* s390-opc.txt: Remove vx2 instruction flags.

7 years agoAdd --inlines option to objdump to include scope backtrace of inlined functions when...
Andi Kleen [Tue, 21 Mar 2017 13:05:19 +0000 (13:05 +0000)]
Add --inlines option to objdump to include scope backtrace of inlined functions when generating source line number information.

* objdump.c (unwind_inlines): Add.
(option_values): Add OPTION_INLINES.
(show_line): Unwind inlines if requested.
(main): Parse OPTION_INLINES.
(usage): Document --inlines.
* doc/binutils.texi: Document --inlines.
* NEWS: Likewise.

7 years agoarc/nps400: Add cp16/cp32 instructions to opcodes library
Rinat Zelig [Tue, 21 Mar 2017 11:37:33 +0000 (11:37 +0000)]
arc/nps400: Add cp16/cp32 instructions to opcodes library

Instructions for loading or storing 16/32B data from one address type to
another.

gas/ChangeLog

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

include/ChangeLog

* opcode/arc.h (insn_class_t): Add DMA class.

opcodes/ChangeLog

* arc-nps400-tbl.h: Add cp32/cp16 instructions format.
* arc-opc.c: Add F_NPS_NA, NPS_DMA_IMM_ENTRY, NPS_DMA_IMM_OFFSET.
(insert_nps_imm_offset): New function.
(extract_nps_imm_offset): New function.
(insert_nps_imm_entry): New function.
(extract_nps_imm_entry): New function.

7 years agoUpdate support for GNU BUILD notes so that version notes can contain extra informatio...
Nick Clifton [Tue, 21 Mar 2017 11:48:57 +0000 (11:48 +0000)]
Update support for GNU BUILD notes so that version notes can contain extra information, and stack protection notes can contain numeric values.

* readelf.c (print_gnu_build_attribute_name): Allow stack
protection notes to contain numeric values.  Use a colon rather
than a space to separate a string name from its values.  Decode
the numeric value of a stack protection note.
* objcopy.c (merge_gnu_build_notes): Allow version notes to
contain extra text after the protocol version number.

7 years agoDecode properly flags of %ccr register on sparc64.
Ivo Raisr [Tue, 21 Mar 2017 11:39:33 +0000 (04:39 -0700)]
Decode properly flags of %ccr register on sparc64.

While at it, decode also properly one-bit flags for %fsr (accrued and
current exception flags were mixed up).

ChangeLog entry:
2017-03-21  Ivo Raisr  <ivo.raisr@oracle.com>

     PR tdep/20928
     * gdb/sparc-tdep.h (gdbarch_tdep) <sparc64_ccr_type>: New field.
     * gdb/sparc64-tdep.c (sparc64_ccr_type): New function.
     (sparc64_fsr_type): Fix %fsr decoding.

ChangeLog entry for testsuite:
2017-03-21  Ivo Raisr  <ivo.raisr@oracle.com>

     PR tdep/20928
     * gdb.arch/sparc64-regs.exp: New file.
     * gdb.arch/sparc64-regs.S: Likewise.

7 years agold: check overflow only for allocated sections.
Tristan Gingold [Fri, 17 Mar 2017 10:12:05 +0000 (11:12 +0100)]
ld: check overflow only for allocated sections.

* ldlang.c (lang_check_section_addresses): Check only for
allocated sections.

7 years agoFix break on Python 2
Tim Wiederhake [Tue, 21 Mar 2017 07:19:59 +0000 (08:19 +0100)]
Fix break on Python 2

This changes the return type of "gdb.BtraceInstruction.data ()" from
"memoryview" to "buffer" on Python 2.7 and below, similar to what
"gdb.Inferior.read_memory ()" does.

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

7 years agospu: Use ptid from regcache instead of inferior_ptid
Simon Marchi [Mon, 20 Mar 2017 22:23:47 +0000 (18:23 -0400)]
spu: Use ptid from regcache instead of inferior_ptid

The implementations of to_fetch_registers/to_store_registers in the spu
code use some functions that rely on inferior_ptid.  It's simpler for
now to set/restore inferior_ptid.

gdb/ChangeLog:

* spu-linux-nat.c (spu_fetch_inferior_registers,
spu_store_inferior_registers): Use ptid from regcache, set and
restore inferior_ptid.
* spu-multiarch.c (spu_fetch_registers, spu_store_registers):
Likewise.

7 years agoUse ptid from regcache in almost all remaining nat files
Simon Marchi [Mon, 20 Mar 2017 21:37:36 +0000 (17:37 -0400)]
Use ptid from regcache in almost all remaining nat files

This patch contains almost all of the remaining changes needed to make
to_fetch_registers/to_store_registers/to_prepare_to_store independent of
inferior_ptid.  It contains only some "trivial" changes, the more
complicated ones are in separate patches.

gdb/ChangeLog:

* i386-linux-nat.c (fetch_register, store_register,
i386_linux_fetch_inferior_registers,
i386_linux_store_inferior_registers): Use ptid from regcache.
* ia64-linux-nat.c (ia64_linux_fetch_register,
ia64_linux_store_register): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_register,
inf_ptrace_store_register): Likewise.
* m32r-linux-nat.c (m32r_linux_fetch_inferior_registers,
m32r_linux_store_inferior_registers): Likewise.
* m68k-bsd-nat.c (m68kbsd_fetch_inferior_registers,
m68kbsd_store_inferior_registers): Likewise.
* m68k-linux-nat.c (fetch_register, store_register,
m68k_linux_fetch_inferior_registers,
m68k_linux_store_inferior_registers): Likewise.
* m88k-bsd-nat.c (m88kbsd_fetch_inferior_registers,
m88kbsd_store_inferior_registers): Likewise.
* mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers,
mips_fbsd_store_inferior_registers): Likewise.
* mips-linux-nat.c (mips64_linux_regsets_fetch_registers,
mips64_linux_regsets_store_registers): Likewise.
* mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers,
mipsnbsd_store_inferior_registers): Likewise.
* mips-obsd-nat.c (mips64obsd_fetch_inferior_registers,
mips64obsd_store_inferior_registers): Likewise.
* nto-procfs.c (procfs_fetch_registers, procfs_store_registers):
Likewise.
* ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers,
ppcfbsd_store_inferior_registers): Likewise.
* ppc-linux-nat.c (ppc_linux_fetch_inferior_registers,
ppc_linux_store_inferior_registers): Likewise.
* ppc-nbsd-nat.c (ppcnbsd_fetch_inferior_registers,
ppcnbsd_store_inferior_registers): Likewise.
* ppc-obsd-nat.c (ppcobsd_fetch_registers,
ppcobsd_store_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers):
Likewise.
* ravenscar-thread.c (ravenscar_fetch_registers,
ravenscar_store_registers, ravenscar_prepare_to_store):
Likewise.
* record-btrace.c (record_btrace_fetch_registers,
record_btrace_store_registers, record_btrace_prepare_to_store):
Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register):
Lookup inferior using ptid from regcache, instead of
current_inferior.
* remote.c (remote_fetch_registers, remote_store_registers): Use
ptid from regcache.
* rs6000-nat.c (fetch_register, store_register): Likewise.
* s390-linux-nat.c (s390_linux_fetch_inferior_registers,
s390_linux_store_inferior_registers): Likewise.
* sh-nbsd-nat.c (shnbsd_fetch_inferior_registers,
shnbsd_store_inferior_registers): Likewise.
* sol-thread.c (sol_thread_fetch_registers,
sol_thread_store_registers): Likewise.
* sparc-nat.c (sparc_fetch_inferior_registers,
sparc_store_inferior_registers): Likewise.
* tilegx-linux-nat.c (fetch_inferior_registers,
store_inferior_registers): Likewise.
* vax-bsd-nat.c (vaxbsd_fetch_inferior_registers,
vaxbsd_store_inferior_registers): Likewise.
* xtensa-linux-nat.c (fetch_gregs, store_gregs, fetch_xtregs,
store_xtregs): Likewise.

7 years agoAdd rvalue reference tests and docs
Artemiy Volkov [Mon, 20 Mar 2017 20:47:59 +0000 (13:47 -0700)]
Add rvalue reference tests and docs

This patch adds tests for the initial rvalue reference support patchset.  All
of the new tests are practically mirrored regular references tests and, except
for the demangler ones, are introduced in new files, which are set to be
compiled with -std=gnu++11.  Tested are printing of rvalue reference types and
values, rvalue reference parameters in function overloading, demangling of
function names containing rvalue reference parameters, casts to rvalue
reference types, application of the sizeof operator to rvalue reference types
and values, and support for rvalue references within the gdb python module.

gdb/ChnageLog

PR gdb/14441
* NEWS: Mention support for rvalue references in GDB and python.
* doc/gdb.texinfo (C Plus Plus Expressions): Mention that GDB
supports both lvalue and rvalue references.

gdb/testsuite/ChangeLog

PR gdb/14441
* gdb.cp/demangle.exp: Add rvalue reference tests.
* gdb.cp/rvalue-ref-casts.cc: New file.
* gdb.cp/rvalue-ref-casts.exp: New file.
* gdb.cp/rvalue-ref-overload.cc: New file.
* gdb.cp/rvalue-ref-overload.exp: New file.
* gdb.cp/rvalue-ref-params.cc: New file.
* gdb.cp/rvalue-ref-params.exp: New file.
* gdb.cp/rvalue-ref-sizeof.cc: New file.
* gdb.cp/rvalue-ref-sizeof.exp: New file.
* gdb.cp/rvalue-ref-types.cc: New file.
* gdb.cp/rvalue-ref-types.exp: New file.
* gdb.python/py-rvalue-ref-value-cc.cc: New file.
* gdb.python/py-rvalue-ref-value-cc.exp: New file.

7 years agoAdd rvalue references to overloading resolution
Artemiy Volkov [Mon, 20 Mar 2017 20:47:57 +0000 (13:47 -0700)]
Add rvalue references to overloading resolution

This patch introduces changes to rank_one_type() dealing with ranking an rvalue
reference type when selecting a best viable function from a set of candidate
functions. The 4 new added rules for rvalue references are:

1) An rvalue argument cannot be bound to a non-const lvalue reference parameter
and an lvalue argument cannot be bound to an rvalue reference parameter.
[C++11 13.3.3.1.4p3]

2) If a conversion to one type of reference is an identity conversion, and a
conversion to the second type of reference is a non-identity conversion, choose
the first type. [C++11 13.3.3.2p3]

3) An rvalue should be first tried to bind to an rvalue reference, and then to
an lvalue reference. [C++11 13.3.3.2p3]

4) An lvalue reference to a function gets higher priority than an rvalue
reference to a function. [C++11 13.3.3.2p3]

This patch is not exactly correct.  See c++/15372 for tracking overload
resolution bugs.

gdb/ChangeLog

PR gdb/14441
* gdbtypes.c (rank_one_type): Implement overloading
resolution rules regarding rvalue references.

7 years agoConvert lvalue reference type check to general reference type check
Artemiy Volkov [Mon, 20 Mar 2017 20:47:54 +0000 (13:47 -0700)]
Convert lvalue reference type check to general reference type check

In almost all contexts (except for overload resolution rules and expression
semantics), lvalue and rvalue references are equivalent. That means that in all
but these cases we can replace a TYPE_CODE_REF check to a TYPE_IS_REFERENCE
check and, for switch statements, add a case label for a rvalue reference type
next to a case label for an lvalue reference type. This patch does exactly
that.

gdb/ChangeLog

PR gdb/14441
* aarch64-tdep.c (aarch64_type_align)
(aarch64_extract_return_value, aarch64_store_return_value): Change
lvalue reference type checks to general reference type checks.
* amd64-tdep.c (amd64_classify): Likewise.
* amd64-windows-tdep.c (amd64_windows_passed_by_integer_register):
Likewise.
* arm-tdep.c (arm_type_align, arm_extract_return_value)
(arm_store_return_value): Likewise.
* ax-gdb.c (gen_fetch, gen_cast): Likewise.
* c-typeprint.c (c_print_type): Likewise.
* c-varobj.c (adjust_value_for_child_access, c_value_of_variable)
(cplus_number_of_children, cplus_describe_child): Likewise.
* compile/compile-c-symbols.c (generate_vla_size): Likewise.
* completer.c (expression_completer): Likewise.
* cp-support.c (make_symbol_overload_list_adl_namespace):
Likewise.
* darwin-nat-info.c (info_mach_region_command): Likewise.
* dwarf2loc.c (entry_data_value_coerce_ref)
(value_of_dwarf_reg_entry): Likewise.
* eval.c (ptrmath_type_p, evaluate_subexp_standard)
(evaluate_subexp_for_address, evaluate_subexp_for_sizeof):
Likewise.
* findvar.c (extract_typed_address, store_typed_address):
Likewise.
* gdbtypes.c (rank_one_type): Likewise.
* hppa-tdep.c (hppa64_integral_or_pointer_p): Likewise.
* infcall.c (value_arg_coerce): Likewise.
* language.c (pointer_type): Likewise.
* m32c-tdep.c (m32c_reg_arg_type, m32c_m16c_address_to_pointer):
Likewise.
* m88k-tdep.c (m88k_integral_or_pointer_p): Likewise.
* mn10300-tdep.c (mn10300_type_align): Likewise.
* msp430-tdep.c (msp430_push_dummy_call): Likewise.
* ppc-sysv-tdep.c (do_ppc_sysv_return_value)
(ppc64_sysv_abi_push_param, ppc64_sysv_abi_return_value):
Likewise.
* printcmd.c (print_formatted, x_command): Likewise.
* python/py-type.c (typy_get_composite, typy_template_argument):
Likewise.
* python/py-value.c (valpy_referenced_value)
(valpy_get_dynamic_type, value_has_field): Likewise.
* s390-linux-tdep.c (s390_function_arg_integer): Likewise.
* sparc-tdep.c (sparc_integral_or_pointer_p): Likewise.
* sparc64-tdep.c (sparc64_integral_or_pointer_p): Likewise.
* spu-tdep.c (spu_scalar_value_p): Likewise.
* symtab.c (lookup_symbol_aux): Likewise.
* typeprint.c (whatis_exp, print_type_scalar): Likewise.
* valarith.c (binop_types_user_defined_p, unop_user_defined_p):
Likewise.
* valops.c (value_cast_pointers, value_cast)
(value_reinterpret_cast, value_dynamic_cast, value_addr, typecmp)
(value_struct_elt, value_struct_elt_bitpos)
(value_find_oload_method_list, find_overload_match)
(value_rtti_indirect_type): Likewise.
* valprint.c (val_print_scalar_type_p, generic_val_print):
Likewise.
* value.c (value_actual_type, value_as_address, unpack_long)
(pack_long, pack_unsigned_long, coerce_ref_if_computed)
(coerce_ref): Likewise.
* varobj.c (varobj_get_value_type): Likewise.

7 years agoSupport rvalue references in the gdb python module (includes doc/)
Artemiy Volkov [Mon, 20 Mar 2017 20:47:52 +0000 (13:47 -0700)]
Support rvalue references in the gdb python module (includes doc/)

This patch adds the ability to inspect rvalue reference types and values using
the gdb python module. This is achieved by creating two wrappers for
valpy_reference_value(), using the ReferenceExplorer class to handle the
objects of rvalue reference types and placing necessary checks for a
TYPE_CODE_RVALUE_REF type code next to the checks for a TYPE_CODE_REF type
code.

gdb/ChangeLog

PR gdb/14441
* doc/python.texi (Types in Python): Add TYPE_CODE_RVALUE_REF to
table of constants.
* python/lib/gdb/command/explore.py: Support exploring values
of rvalue reference types.
* python/lib/gdb/types.py: Implement get_basic_type() for
rvalue reference types.
* python/py-type.c (pyty_codes) <TYPE_CODE_RVALUE_REF>: New
constant.
* python/py-value.c (valpy_getitem): Add an rvalue reference
check.
(valpy_reference_value): Add new parameter "refcode".
(valpy_lvalue_reference_value, valpy_rvalue_reference_value):
New wrappers for valpy_reference_value().
* python/py-xmethods.c (gdbpy_get_xmethod_result_type)
(gdbpy_invoke_xmethod): Likewise.

7 years agoSupport DW_TAG_rvalue_reference type
Artemiy Volkov [Mon, 20 Mar 2017 20:47:50 +0000 (13:47 -0700)]
Support DW_TAG_rvalue_reference type

Make gdb DWARF reader understand the DW_TAG_rvalue_reference type tag. Handling
of this tag is done in the existing read_tag_reference_type() function, to
which we add a new parameter representing the kind of reference type
(lvalue vs rvalue).

gdb/ChangeLog

PR gdb/14441
* dwarf2read.c (process_die, read_type_die_1): Handle the
DW_TAG_rvalue_reference_type DIE.
(read_tag_reference_type): Add new parameter "refcode".

7 years agoImplement printing of rvalue reference types and values
Artemiy Volkov [Mon, 20 Mar 2017 20:47:48 +0000 (13:47 -0700)]
Implement printing of rvalue reference types and values

This patch provides the ability to print out names of rvalue reference types
and values of those types. This is done in full similarity to regular
references, and as with them, we don't print out "const" suffix because all
rvalue references are const.

gdb/ChangeLog

PR gdb/14441
* c-typeprint.c (c_print_type, c_type_print_varspec_prefix)
(c_type_print_modifier, c_type_print_varspec_suffix)
(c_type_print_base): Support printing rvalue reference types.
* c-valprint.c (c_val_print, c_value_print): Support printing
rvalue reference values.

7 years agoImplement demangling for rvalue reference type names
Artemiy Volkov [Mon, 20 Mar 2017 20:47:46 +0000 (13:47 -0700)]
Implement demangling for rvalue reference type names

This patch fixes demangling of names containing rvalue reference typenames by
handling DEMANGLE_COMPONENT_RVALUE_REFERENCE demangle component.

gdb/ChangeLog

PR gdb/14441
* cp-name-parser.y (ptr_operator): Handle the '&&' token in
typename.
* cp-support.c (replace_typedefs): Handle
DEMANGLE_COMPONENT_RVALUE_REFERENCE.
* python/py-type.c (typy_lookup_type): Likewise.

7 years agoSupport rvalue reference type in parser
Artemiy Volkov [Mon, 20 Mar 2017 20:47:43 +0000 (13:47 -0700)]
Support rvalue reference type in parser

This patch implements correct parsing of C++11 rvalue reference typenames.
This is done in full similarity to the handling of regular references by adding
a '&&' token handling in c-exp.y, defining an rvalue reference type piece, and
implementing a follow type derivation in follow_types().

gdb/ChangeLog

PR gdb/14441
* c-exp.y (ptr_operator): Handle the '&&' token in the typename.
* parse.c (insert_type): Change assert statement.
(follow_types): Handle rvalue reference types.
* parser-defs.h (enum type_pieces) <tp_rvalue_reference>: New
constant.

7 years agoAdd ability to return rvalue reference values from value_ref
Artemiy Volkov [Mon, 20 Mar 2017 20:47:41 +0000 (13:47 -0700)]
Add ability to return rvalue reference values from value_ref

Parameterize value_ref() by the kind of reference type the value of which
is requested. Change all callers to use the new API.

gdb/ChangeLog

PR gdb/14441
* ada-lang.c (ada_evaluate_subexp): Adhere to the new
value_ref() interface.
* c-valprint.c (c_value_print): Likewise.
* infcall.c (value_arg_coerce): Likewise.
* python/py-value.c (valpy_reference_value): Likewise.
* valops.c (value_cast, value_reinterpret_cast)
(value_dynamic_cast, typecmp): Likewise.
(value_ref): Parameterize by kind of return value reference type.
* value.h (value_ref): Add new parameter "refcode".

7 years agoChange {lookup,make}_reference_type API
Artemiy Volkov [Mon, 20 Mar 2017 20:47:39 +0000 (13:47 -0700)]
Change {lookup,make}_reference_type API

Parameterize lookup_reference_type() and make_reference_type() by the kind of
reference type we want to look up. Create two wrapper functions
lookup_{lvalue,rvalue}_reference_type() for lookup_reference_type() to simplify
the API. Change all callers to use the new API.

gdb/Changelog

PR gdb/14441
* dwarf2read.c (read_tag_reference_type): Use
lookup_lvalue_reference_type() instead of lookup_reference_type().
* eval.c (evaluate_subexp_standard): Likewise.
* f-exp.y: Likewise.
* gdbtypes.c (make_reference_type, lookup_reference_type):
Generalize with rvalue reference types.
(lookup_lvalue_reference_type, lookup_rvalue_reference_type): New
convenience wrappers for lookup_reference_type().
* gdbtypes.h (make_reference_type, lookup_reference_type): Add a
reference kind parameter.
(lookup_lvalue_reference_type, lookup_rvalue_reference_type): Add
wrappers for lookup_reference_type().
* guile/scm-type.c (gdbscm_type_reference): Use
lookup_lvalue_reference_type() instead of lookup_reference_type().
* guile/scm-value.c (gdbscm_value_dynamic_type): Likewise.
* parse.c (follow_types): Likewise.
* python/py-type.c (typy_reference, typy_lookup_type): Likewise.
* python/py-value.c (valpy_get_dynamic_type, valpy_getitem):
Likewise.
* python/py-xmethods.c (gdbpy_get_xmethod_result_type)
(gdbpy_invoke_xmethod): Likewise.
* stabsread.c: Provide extra argument to make_reference_type()
call.
* valops.c (value_ref, value_rtti_indirect_type): Use
lookup_lvalue_reference_type() instead of lookup_reference_type().

7 years agoAdd definitions for rvalue reference types
Artemiy Volkov [Mon, 20 Mar 2017 20:47:30 +0000 (13:47 -0700)]
Add definitions for rvalue reference types

This patch introduces preliminal definitions regarding C++11 rvalue references
to the gdb type system. In addition to an enum type_code entry, a field in
struct type and an accessor macro for that which are created similarly to the
lvalue references counterparts, we also introduce a TYPE_REFERENCE convenience
macro used to check for both kinds of references simultaneously as they are
equivalent in many contexts.

gdb/Changelog

    PR gdb/14441
    * gdbtypes.h (enum type_code) <TYPE_CODE_RVALUE_REF>: New constant.
    (TYPE_IS_REFERENCE): New macro.
    (struct type): Add rvalue_reference_type field.
    (TYPE_RVALUE_REFERENCE_TYPE): New macro.

7 years agoAdd -file-list-shared-libraries MI command
Marc-Andre Laperle [Mon, 20 Mar 2017 18:57:51 +0000 (14:57 -0400)]
Add -file-list-shared-libraries MI command

This change adds the MI equivalent for the "info sharedlibrary"
command. The command was already partially documented but ignored as
it was not implemented. The new MI command works similarly to the CLI
command, taking an optional regular expression as an argument and
outputting the library information.

I included a test for the new command in mi-solib.exp.

gdb/doc/ChangeLog:

* gdb.texinfo (gdb/mi Symbol Query Commands): Document new MI
command file-list-shared-libraries
(GDB/MI Async Records): Update documentation of library-loaded with new
field.

gdb/ChangeLog:

* NEWS: Add an entry about new '-file-list-shared-libraries' command.
* mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries):
New function definition.
* mi/mi-cmds.c (mi_cmds): Add -file-list-shared-libraries command.
* mi/mi-cmds.h (mi_cmd_file_list_shared_libraries):
New function declaration.
* mi/mi-interp.c (mi_output_solib_attribs): New Function.
* mi/mi-interp.h: New file.
* solib.c (info_sharedlibrary_command): Replace for loop with
ALL_SO_LIBS macro
* solib.h (update_solib_list): New function declaration.
(so_list_head): Move macro.
* solist.h (ALL_SO_LIBS): New macro.

gdb/testsuite/ChangeLog:

* gdb.mi/mi-solib.exp (test_file_list_shared_libraries):
New procedure.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
7 years agoAdd a better diagnostic message in mi_gdb_test
Marc-Andre Laperle [Mon, 20 Mar 2017 18:57:45 +0000 (14:57 -0400)]
Add a better diagnostic message in mi_gdb_test

When using mi_gdb_test, if it fails because of the presence of
unexpected output, the error message is only the message passed as
the argument with no indication that there was an unexpected output.
This change adds an additional text to the failure message to
indicate that there was an unexpected output.

gdb/testsuite/ChangeLog:

* lib/mi-support.exp (mi_gdb_test): Add additional message
for unexpected output.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
7 years agoRemove unused parameter in solib_add and update_solib_list
Marc-Andre Laperle [Mon, 20 Mar 2017 18:57:32 +0000 (14:57 -0400)]
Remove unused parameter in solib_add and update_solib_list

The target parameter in both solib_add and update_solib_list
functions is not used anymore and as not been used for a while. This
change removes the parameter to clean up the code a little bit.

gdb/ChangeLog:

* infcmd.c (post_create_inferior): Remove unused argument in
call to solib_add.
* remote.c (remote_start_remote): Likewise.
* solib-frv.c (frv_fetch_objfile_link_map): Likewise.
* solib-svr4.c: (svr4_fetch_objfile_link_map): Likewise.
(enable_break): Likewise.
* solib.c (update_solib_list): Remove unused target argument
and its documentation.
(solib_add): Remove unused target argument.  Remove unused
argument in call to update_solib_list.
(info_sharedlibrary_command): Remove unused argument in call
to update_solib_list.
(sharedlibrary_command): Remove unused argument in call to
solib_add.
(handle_solib_event): Likewise.
(reload_shared_libraries): Likewise.
* solib.h (solib_add): Remove unused target argument.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
7 years agoFix spurious FAILs with examine-backward.exp
Andreas Arnez [Mon, 20 Mar 2017 17:55:39 +0000 (18:55 +0100)]
Fix spurious FAILs with examine-backward.exp

The test case examine-backward.exp issues the command "x/-s" after the end
of the first string in TestStrings, but without making sure that this
string is preceded by a string terminator.  Thus GDB may spuriously print
some random characters from before that string, and then the test fails.

This patch assures that TestStrings is preceded by a string terminator.

gdb/testsuite/ChangeLog:

* gdb.base/examine-backward.c (Barrier): New character array
constant, to ensure that TestStrings is preceded by a string
terminator.

7 years agoreadelf: Don't error on .debug files with NOBITS .dynamic section.
Mark Wielaard [Mon, 20 Mar 2017 14:32:34 +0000 (15:32 +0100)]
readelf: Don't error on .debug files with NOBITS .dynamic section.

The fix for PR binutils/17512 added a check for the dynamic segment being
inside the actual ELF file. If not an error message would be produced:

readelf: Error: the dynamic segment offset + size exceeds the size of the file

Unfortunately for separate debuginfo files it is common for the dynamic
segment not being inside the file because the .dynamic section is NOBITS.

Since the check is done unconditionally in process_program_headers and
process_program_headers is always called (to setup dynamic_addr in case
it is needed). The error is produced on any operations done on any .debug
file (even if no program headers or the dynamic segment is used).

If there are section headers then a cross check is done to see if the
.dynamic section is NOBITS in which case dynamic_addr is set to zero
without a warning or error (which is then checked first before any
operation on the dynamic segement is done).

Move the check for the dynamic segment being inside the actual ELF file
after the cross check with the section headers to suppress the error for
.debug files.

binutils/ChangeLog:

* readelf.c (process_program_headers): Move dynamic_addr check
after .dynamic section cross check.

7 years agoUpdate descriptions of the .2byte, .4byte and .8byte directives.
Nick Clifton [Mon, 20 Mar 2017 16:57:07 +0000 (16:57 +0000)]
Update descriptions of the .2byte, .4byte and .8byte directives.

* doc/as.texinfo (2byte): Note that if no expressions are present
the directive does nothing.  Emphasize that the output is
unaligned, and that this can have an effect on the relocations
generated.
(4byte): Simplify description.  Refer back to the 2byte
description.
(8byte): Likewise.

7 years agos390: Fix displaced-stepping certain relative branch insns
Andreas Arnez [Mon, 20 Mar 2017 16:30:01 +0000 (17:30 +0100)]
s390: Fix displaced-stepping certain relative branch insns

On s390x targets GDB can not handle displaced stepping correctly for some
relative branch instructions, such as cij (compare immediate and branch
relative).  When setting a breakpoint on such an instruction and
single-stepping over it, the branch is never taken.  This is because the
check in s390_displaced_step_fixup for relative branch instructions is
incomplete.

Instead of completing the list of relative branch instructions to check
against, this patch just treats relative branches and non-branching
instructions in the same way and adjusts the PC with the negated
displacement in both cases.

gdb/ChangeLog:

* s390-linux-tdep.c (is_rsi, is_rie): Remove functions.
(s390_displaced_step_fixup): Cover relative branches with the
default fixup handling.  This fixes lack of support for some
relative branch instructions.

7 years agoUpdate the openrisc previous program counter (ppc) when running code in the cgen...
Stafford Horne [Mon, 20 Mar 2017 15:33:51 +0000 (15:33 +0000)]
Update the openrisc previous program counter (ppc) when running code in the cgen based simulator.

* or1kcommon.cpu: Add pc set semantics to also update ppc.

7 years ago[arm] Document missing -mfpu entries.
Richard Earnshaw [Mon, 20 Mar 2017 14:56:22 +0000 (14:56 +0000)]
[arm] Document missing -mfpu entries.

Nick pointed out that I hadn't documented the new -mfpu option
neon-vfpv3 and mentioned that some others were missing.

Having looked through the list only one (neon-fp16) really should be
documented; the other two entries in the real table should not be
documented as they are aliases kept for legacy compatibility reasons.
This patch adds the missing entries and notes in the main table that
the other two entries should not be documented.

I've also fixed a small spelling error in the accompanying text.

* config/tc-arm.c (arm_fpus): Note entires that should not be
documented.
* doc/c-arm.texi (-mfpu): Add missing FPU entries for neon-vfpv3 and
neon-fp16.  Fix spelling error.

7 years ago[arm] Add neon-vfp3 as an alias for neon to -mfpu.
Richard Earnshaw [Mon, 20 Mar 2017 10:03:15 +0000 (10:03 +0000)]
[arm] Add neon-vfp3 as an alias for neon to -mfpu.

GCC recently added neon-vfpv3 as an alias for neon in -mfpu.  This patch adds a similar alias in GAS.

* config/tc-arm.c (arm_fpus): Add neon-vfpv3 as an alias for neon.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 20 Mar 2017 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in

7 years agoPR 21266, unstable qsort in bfd/elf64-ppc.c
Alan Modra [Sun, 19 Mar 2017 21:55:50 +0000 (08:25 +1030)]
PR 21266, unstable qsort in bfd/elf64-ppc.c

PR 21266
* elf64-ppc.c (compare_symbols): Stabilize sort.