deliverable/binutils-gdb.git
5 years agoPowerPC64 higher REL16 relocations
Alan Modra [Wed, 29 Aug 2018 03:58:21 +0000 (13:28 +0930)] 
PowerPC64 higher REL16 relocations

There are occasions where someone might want to build a 64-bit
pc-relative offset from 16-bit pieces.  This adds the necessary REL16
relocs corresponding to existing ADDR16 relocs that can be used to
build 64-bit absolute values.

include/
* elf/ppc64.h (R_PPC64_REL16_HIGH, R_PPC64_REL16_HIGHA),
(R_PPC64_REL16_HIGHER, R_PPC64_REL16_HIGHERA),
(R_PPC64_REL16_HIGHEST, R_PPC64_REL16_HIGHESTA): Define.
(R_PPC64_LO_DS_OPT, R_PPC64_16DX_HA): Bump value.
bfd/
* reloc.c (BFD_RELOC_PPC64_REL16_HIGH, BFD_RELOC_PPC64_REL16_HIGHA),
(BFD_RELOC_PPC64_REL16_HIGHER, BFD_RELOC_PPC64_REL16_HIGHERA),
(BFD_RELOC_PPC64_REL16_HIGHEST, BFD_RELOC_PPC64_REL16_HIGHESTA):
Define.
* elf64-ppc.c (ppc64_elf_howto_raw): Add new REL16 howtos.
(ppc64_elf_reloc_type_lookup): Translate new REL16 relocs.
(ppc64_elf_check_relocs, ppc64_elf_relocate_section): Handle them.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
gas/
* config/tc-ppc.h (TC_FORCE_RELOCATION_SUB_LOCAL): Allow ADDR16
HIGH, HIGHA, HIGHER, HIGHERA, HIGHEST, and HIGHESTA relocs.
Group 16-bit relocs.
* config/tc-ppc.c (md_apply_fix): Translate those ADDR16 relocs
to REL16 when pcrel.  Sort relocs.

5 years agoRearrange ppc_size_one_stub and correct _notoc stub examples
Alan Modra [Wed, 29 Aug 2018 04:41:25 +0000 (14:11 +0930)] 
Rearrange ppc_size_one_stub and correct _notoc stub examples

This patch rearranges ppc_size_one_stub to make it a little easier to
compare against ppc_build_one_stub, and makes a few other random
changes that might help for future maintenance.  There should be no
functional changes here.

The patch also fixes code examples in comments.  A couple of "ori"
instructions lacked the source register operand, and "@high" is the
correct reloc modifier to use in a sequence building a 64-bit value.
(@hi reports overflow of a 32-bit signed value.)

* elf64-ppc.c: Correct _notoc stub comments.
(ppc_build_one_stub): Simplify output of branch for notoc
long branch stub.  Don't include label offset of 8 bytes in
"off" calculation for notoc plt stub.  Don't emit insns to get pc.
(build_offset): Emit insns to get pc here instead.
(size_offset): Add 4 extra insns.
(plt_stub_size): Adjust for "off" and size_offset changes.
(ppc_size_one_stub): Rearrange code into a switch, duplicating
some to better match ppc_build_one_stub.

5 years agold: Pass -z separate-code to ld for property-x86-4a tests
H.J. Lu [Fri, 31 Aug 2018 12:11:03 +0000 (05:11 -0700)] 
ld: Pass -z separate-code to ld for property-x86-4a tests

Pass -z separate-code to ld for property-x86-4a tests to generate
the expected .note.gnu.property section.  Also run i386 tests for
x86_64-*-elf* targets.

* testsuite/ld-i386/i386.exp: Also run for x86_64-*-elf* targets.
* testsuite/ld-i386/property-x86-4a.d: Pass -z separate-code to
ld.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.

5 years agold: Append -mx86-used-note=no to ASFLAGS
H.J. Lu [Fri, 31 Aug 2018 11:47:41 +0000 (04:47 -0700)] 
ld: Append -mx86-used-note=no to ASFLAGS

Since x86 assembler may generate .note.gnu.property section, append
-mx86-used-note=no to tests which don't expect .note.gnu.property
section on ELF/x86 targets.

* testsuite/ld-elf/elf.exp (ASFLAGS): Save, append
-mx86-used-note=no and restore.
* testsuite/ld-ifunc/ifunc.exp (ASFLAGS): Likewise.
* testsuite/ld-scripts/defined.exp (ASFLAGS): Likewise.
* testsuite/ld-scripts/overlay-size.exp (ASFLAGS): Likewise

5 years agold: Append -Wa,-mx86-used-note=no for S-records tests
H.J. Lu [Fri, 31 Aug 2018 11:44:45 +0000 (04:44 -0700)] 
ld: Append -Wa,-mx86-used-note=no for S-records tests

Since x86 assembler may generate .note.gnu.property section and S-records
can't handle .note.gnu.property sections, add -mx86-used-note=no to
S-records tests on ELF/x86 targets to avoid .note.gnu.property section.

* testsuite/ld-srec/srec.exp: Append -Wa,-mx86-used-note=no to
CC and CXX on ELF/x86 targets.

5 years agogas: Pass -mx86-used-note=no to assembler
H.J. Lu [Fri, 31 Aug 2018 11:42:51 +0000 (04:42 -0700)] 
gas: Pass -mx86-used-note=no to assembler

Since x86 assembler may generate .note.gnu.property section, pass
-mx86-used-note=no to assembler for section2 test on ELF/x86 targets
to avoid .note.gnu.property section.

* testsuite/gas/elf/elf.exp: Pass -mx86-used-note=no to
assembler for section2 test on ELF/x86 targets.

5 years agox86: pass -mx86-used-note=no to assembler
H.J. Lu [Fri, 31 Aug 2018 11:39:21 +0000 (04:39 -0700)] 
x86: pass -mx86-used-note=no to assembler

Since cfi/cfi-label.d is ELF/x86 specific, we can pass -mx86-used-note=no
to assembler.

* testsuite/gas/cfi/cfi-label.d: Pass -mx86-used-note=no to
assembler.

5 years agobinutils: Adjusted tests for .note.gnu.property section
H.J. Lu [Fri, 31 Aug 2018 11:38:12 +0000 (04:38 -0700)] 
binutils: Adjusted tests for .note.gnu.property section

Since x86 assembler may generate .note.gnu.property section, adjust
binutils tests to handle it.

* testsuite/binutils-all/readelf.s-64: Adjusted for
.note.gnu.property section.
* testsuite/binutils-all/strip-3.d: Also strip
.note.gnu.property section.

5 years agox86: Add explicit -mx86-used-note=[yes|no] to tests
H.J. Lu [Fri, 31 Aug 2018 11:35:46 +0000 (04:35 -0700)] 
x86: Add explicit -mx86-used-note=[yes|no] to tests

Pass explicit -mx86-used-note=[yes|no] to x86 assembler and update
expected outputs from "readelf -n" if needed.

binutils/

* testsuite/binutils-all/i386/compressed-1b.d: Pass
-mx86-used-note=no to assembler.
* testsuite/binutils-all/i386/compressed-1c.d: Likewise.
* testsuite/binutils-all/x86-64/compressed-1b.d: Likewise.
* testsuite/binutils-all/x86-64/compressed-1c.d: Likewise.
* testsuite/binutils-all/i386/empty.d: Pass -mx86-used-note=yes
to assembler and update expected output from "readelf -n".
* testsuite/binutils-all/i386/ibt.d: Likewise.
* testsuite/binutils-all/i386/pr21231a.d: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Likewise.
* testsuite/binutils-all/i386/shstk.d: Likewise.
* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
* testsuite/binutils-all/x86-64/empty.d: Likewise.
* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
* testsuite/binutils-all/x86-64/ibt.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
* testsuite/binutils-all/x86-64/shstk.d: Likewise.

gas/

* testsuite/gas/i386/bss.d: Pass -mx86-used-note=no to assembler.
* testsuite/gas/i386/ilp32/quad.d: Likewise.
* testsuite/gas/i386/ilp32/reloc64.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Likewise.
* testsuite/gas/i386/property-1.d: Likewise.
* testsuite/gas/i386/relax.d: Likewise.
* testsuite/gas/i386/reloc64.d: Likewise.
* testsuite/gas/i386/size-1.d: Likewise.
* testsuite/gas/i386/size-3.d: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
* testsuite/gas/i386/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.
* testsuite/gas/i386/divide.d: Append "#pass".

ld/

* testsuite/ld-i386/i386.exp: (ASFLAGS): Save, append
-mx86-used-note=no and restore.  Pass -mx86-used-note=yes and
-mx86-used-note=no to assembler.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/no-plt.exp: Pass -mx86-used-note=yes to
assembler.
* testsuite/ld-i386/tls.exp: Likewise.
* testsuite/ld-x86-64/no-plt.exp: Likewise.
* testsuite/ld-x86-64/tls.exp: Likewise.
* testsuite/ld-i386/pr23486a.d: Pass -mx86-used-note=no to
assembler.
* testsuite/ld-i386/pr23486b.d: Likewise.
* testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486a.d: Likewise.
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486b.d: Likewise.
* testsuite/ld-i386/property-x86-3.d: Pass -mx86-used-note=yes
to assembler and update expected output from "readelf -n".
* testsuite/ld-i386/property-x86-4a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt2.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt4.d: Likewise.
* testsuite/ld-i386/property-x86-ibt5.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk2.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk4.d: Likewise.
* testsuite/ld-i386/property-x86-shstk5.d: Likewise.
* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-3.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.
* testsuite/ld-i386/property-1a.r: New file.
* testsuite/ld-i386/property-2a.r: Likewise.
* testsuite/ld-i386/property-3a.r: Likewise.
* testsuite/ld-i386/property-4a.r: Likewise.
* testsuite/ld-i386/property-5a.r: Likewise.
* testsuite/ld-i386/property-7a.r: Likewise.
* testsuite/ld-x86-64/property-1a.r: Likewise.
* testsuite/ld-x86-64/property-2a.r: Likewise.
* testsuite/ld-x86-64/property-3a.r: Likewise.
* testsuite/ld-x86-64/property-4a.r: Likewise.
* testsuite/ld-x86-64/property-5a.r: Likewise.
* testsuite/ld-x86-64/property-7a.r: Likewise.
* testsuite/ld-x86-64/mpx.exp: Pass -mx86-used-note=no to
assembler.

5 years agox86: Extend assembler to generate GNU property notes
H.J. Lu [Fri, 31 Aug 2018 11:31:08 +0000 (04:31 -0700)] 
x86: Extend assembler to generate GNU property notes

Add -mx86-used-note=[yes|no] option to generate (or not) GNU property
notes with GNU_PROPERTY_X86_FEATURE_2_USED and GNU_PROPERTY_X86_ISA_1_USED
properties.  If the assembly input contains no instructions, set the
GNU_PROPERTY_X86_UINT32_VALID bit in GNU_PROPERTY_X86_FEATURE_2_USED
property.  Add a --enable-x86-used-note configure time option to set the
default behavior.  Set the default if the configure option is not used
to "no".

* NEWS: Mention -mx86-used-note=[no|yes].
* configure.ac: Add --enable-x86-used-note.  Define
DEFAULT_X86_USED_NOTE.
* config.in: Regenerated.
* configure: Likewise.
* config/tc-i386.c (x86_isa_1_used): New.
(x86_feature_2_used): Likewise.
(x86_used_note): Likewise.
(_i386_insn): Add has_regmmx, has_regxmm, has_regymm and
has_regzmm.
(build_modrm_byte): Set i.has_regmmx, i.has_regzmm.
i.has_regymm and i.has_regxmm.
(x86_cleanup): New function.
(output_insn): Update x86_isa_1_used and x86_feature_2_used.
(OPTION_X86_USED_NOTE): New.
(md_longopts): Add -mx86-used-note=.
(md_parse_option): Handle OPTION_X86_USED_NOTE.
(md_show_usage): Display -mx86-used-note=.
* config/tc-i386.h (x86_cleanup): New prototype.
(md_cleanup): New.
* doc/c-i386.texi: Document -mx86-used-note=.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 31 Aug 2018 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agosparc: gas: leon.d: disassemble assuming v8 also in sparc64 targets.
Jose E. Marchesi [Thu, 30 Aug 2018 21:37:45 +0000 (23:37 +0200)] 
sparc: gas: leon.d: disassemble assuming v8 also in sparc64 targets.

gas/ChangeLog:

2018-08-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

* testsuite/gas/sparc/leon.d: Disassemble v8 code also in sparc64
targets.

5 years agoRISC-V: Allow instruction require more than one extension
Jim Wilson [Thu, 30 Aug 2018 20:23:12 +0000 (13:23 -0700)] 
RISC-V: Allow instruction require more than one extension

2018-08-29  Kito Cheng  <kito@andestech.com>

gas/
* config/tc-riscv.c (riscv_subset_supports): New argument:
xlen_required.
(riscv_multi_subset_supports): New function, able to check more
than one extension.
(riscv_ip): Use riscv_multi_subset_supports instead of
riscv_subset_supports.
(riscv_set_arch): Update call-site for riscv_subset_supports.
(riscv_after_parse_args): Likewise.

include/
*opcode/riscv.h (MAX_SUBSET_NUM): New.
(riscv_opcode): Add xlen_requirement field and change type of
subset.

opcodes/
* riscv-dis.c (riscv_disassemble_insn): Check XLEN by
riscv_opcode.xlen_requirement.
* riscv-opc.c (riscv_opcodes): Update for struct change.

5 years agoSkip elf/section14 test for h8300 targets
H.J. Lu [Thu, 30 Aug 2018 18:06:16 +0000 (11:06 -0700)] 
Skip elf/section14 test for h8300 targets

Skip elf/section14 test for h8300 targets since the h8300 port issues a
warning message for new sections created without atrributes.

* testsuite/gas/elf/section14.d: Skip h8300 targets.

5 years agogdb/riscv: Extend instruction decode to cover more instructions
Andrew Burgess [Thu, 16 Aug 2018 13:56:19 +0000 (14:56 +0100)] 
gdb/riscv: Extend instruction decode to cover more instructions

Extends the instruction decoder used during prologue scan and software
single step to cover more instructions.  These instructions are
encountered when running the current GDB testsuite with the DWARF
stack unwinders turned off.

gdb/ChangeLog:

* riscv-tdep.c (riscv_insn::decode): Decode c.addi4spn, c.sd,
c.sw, c.swsp, and c.sdsp.

5 years agogdb/riscv: remove extra caching of misa register
Andrew Burgess [Mon, 9 Apr 2018 21:38:07 +0000 (22:38 +0100)] 
gdb/riscv: remove extra caching of misa register

The RISC-V had a mechanism in place to cache the contents of the misa
register per-inferior, the original intention behind this was to
reduce the number of times the misa register had to be read (as the
contents should be constant), but it was pointed out on the mailing
list[1] that the register cache will mean the register is only
accessed once each time GDB stops, and any additional caching is
probably just unneeded extra complexity.

As such, until it can be shown that there's a real need for additional
caching, this commit removes all of the additional caching of the misa
register, and just accesses the misa register like a normal register.

[1] https://sourceware.org/ml/gdb-patches/2018-03/msg00136.html

gdb/ChangeLog:

* riscv-tdep.c (struct riscv_inferior_data): Delete.
(riscv_read_misa_reg): Don't cache value read into inferior data.
(riscv_new_inferior_data): Delete.
(riscv_inferior_data_cleanup): Delete.
(riscv_inferior_data): Delete.
(riscv_invalidate_inferior_data): Delete.
(_initialize_riscv_tdep): Remove initialisation of inferior data.

5 years agogdb: Ensure compiler doesn't optimise variable out in test
Andrew Burgess [Wed, 29 Aug 2018 17:49:51 +0000 (18:49 +0100)] 
gdb: Ensure compiler doesn't optimise variable out in test

In the test gdb.base/funcargs.exp, there's this function:

    void recurse (SVAL a, int depth)
    {
      a.s = a.i = a.l = --depth;
      if (depth == 0)
        hitbottom ();
      else
        recurse (a, depth);
    }

The test script places a breakpoint in hitbottom, and runs the
executable which calls recurse with an initial depth of 4.

When GDB hits the breakpoint in hitbottom the testscript performs a
backtrace, and examines 'a' at each level.

The problem is that 'a' is not live after either the call to
'hitbottom' or the call to 'recurse', and as a result the test fails.

In the particular case I was looking at GCC for RISC-V 32-bit, the
variable 'a' is on the stack and GCC selects the register $ra (the
return address register) to hold the pointer to 'a'.  This is fine,
because, by the time the $ra register is needed to hold a return
address (calling hitbottom or recurse) then 'a' is dead.

In this patch I propose that a use of 'a' is added after the calls to
hitbottom and recurse, this should cause the compiler to keep 'a'
around, which should ensure GDB can find it.

gdb/testsuite/ChangeLog:

* gdb.base/funcargs.c (use_a): New function.
(recurse): Call use_a.

5 years agoFix compile-cplus-types.c build errors
Simon Marchi [Thu, 30 Aug 2018 15:09:48 +0000 (11:09 -0400)] 
Fix compile-cplus-types.c build errors

I see these errors when building with clang:

  CXX    compile/compile-cplus-types.o
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:306:56: error: cannot pass non-trivial object of type 'compile_scope' to variadic function; expected type from format string was 'void *' [-Wnon-pod-varargs]
        fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current);
                                                       ~~     ^~~~~~~
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:1058:13: error: comparison of two values with different enumeration types ('enum_flags<gcc_cp_qualifiers>::enum_type' (aka 'gcc_cp_qualifiers') and 'gcc_cp_ref_qualifiers') [-Werror,-Wenum-compare]
  if (quals != GCC_CP_REF_QUAL_NONE)
      ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~

Fix the first one by using host_address_to_string.

Fix the second one by comparing to 0 instead.  I think the current
comparison simply uses the wrong enum type.  Comparing to 0 seems like
the right thing to do, because we want to check whether any flags are
specified.

gdb/ChangeLog:

* compile/compile-cplus-types.c
(compile_cplus_instance::leave_scope): Take the address of scope
object.
(compile_cplus_instance::convert_qualified_base): Compare quals
to 0.

5 years agoTreat SHT_FINI_ARRAY and SHT_PREINIT_ARRAY as relocatable sections
H.J. Lu [Thu, 30 Aug 2018 15:01:36 +0000 (08:01 -0700)] 
Treat SHT_FINI_ARRAY and SHT_PREINIT_ARRAY as relocatable sections

Since SHT_FINI_ARRAY and SHT_PREINIT_ARRAY sections are relocatable,
this patch fixes readelf and adds a testcase.

binutils/

* readelf.c (process_section_headers): Treat SHT_FINI_ARRAY and
SHT_PREINIT_ARRAY as relocatable sections.

gas/

* testsuite/gas/elf/elf.exp: Run section14.
* testsuite/gas/elf/section14.d: New file.
* testsuite/gas/elf/section14.s: Likewise.

5 years agoUse host_address_to_string in compile_cplus_instance::enter_scope
Keith Seitz [Thu, 30 Aug 2018 14:47:03 +0000 (07:47 -0700)] 
Use host_address_to_string in compile_cplus_instance::enter_scope

This patch fixes a problem being reported by the buildbot with an
invalid argument to a "%p" printf format. Instead of "%p", the
debug output is changed to use "%s" and host_address_to_string.

gdb/ChangeLog

* compile/compile-cplus-types.c (compile_cplus_instance::enter_scope):
Use "%s" and host_address_to_string instead of "%p" in printf.

5 years ago[MIPS] Add myself as a MIPS port maintainer.
Chenghua Xu [Thu, 30 Aug 2018 00:30:36 +0000 (08:30 +0800)] 
[MIPS] Add myself as a MIPS port maintainer.

binutils/
* MAINTAINERS: Add myself as a MIPS port maintainer.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 30 Aug 2018 00:01:03 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoC++ compile support
Keith Seitz [Wed, 29 Aug 2018 22:12:24 +0000 (15:12 -0700)] 
C++ compile support

This patch adds *basic* support for C++ to the compile feature.  It does
most simple type conversions, including everything that C compile does and
your basic "with-classes" type of C++.

I've written a new compile-support.exp support file which adds a new test
facility for automating and simplifying "compile print" vs "compile code"
testing.  See testsuite/lib/compile-support.exp and CompileExpression
for more on that.  The tests use this facility extensively.

This initial support has several glaring omissions:
- No template support at all
  I have follow-on patches for this, but they add much complexity
  to this "basic" support.  Consequently, they will be submitted separately.
- Cannot print functions
  The code template needs tweaking, and I simply haven't gotten to it yet.
- So-called "special function" support is not included
  Using constructors, destructors, operators, etc will not work. I have
  follow-on patches for that, but they require some work because of the
  recent churn in symbol searching.
- There are several test suite references to "compile/1234" bugs.
  I will file bugs and update the test suite's bug references before pushing
  these patches.

The test suite started as a copy of the original C-language support, but
I have written tests to exercise the basic functionality of the plug-in.

I've added a new option for outputting debug messages for C++ type-conversion
("debug compile-cplus-types").

gdb/ChangeLog:

* Makefile.in (SUBDIR_GCC_COMPILE_SRCS): Add compile-cplus-symbols.c
and compile-cplus-types.c.
(HFILES_NO_SRCDIR): Add gcc-cp-plugin.h.
* c-lang.c (cplus_language_defn): Set C++ compile functions.
* c-lang.h (cplus_get_compile_context, cplus_compute_program):
Declare.
* compile/compile-c-support.c: Include compile-cplus.h.
(load_libcompile): Templatize.
(get_compile_context): "New" function.
(c_get_compile_context): Use get_compile_context.
(cplus_get_compile_context): New function.
(cplus_push_user_expression, cplus_pop_user_expression)
(cplus_add_code_header, cplus_add_input, cplus_compile_program)
(cplus_compute_program): Define new structs/functions.
* compile/compile-cplus-symmbols.c: New file.
* compile/compile-cplus-types.c: New file.
* compile/compile-cplus.h: New file.
* compile/compile-internal.h (debug_compile_oracle, GCC_TYPE_NONE):
Declare.
* compile/compile-object-load.c (get_out_value_type): Use
strncmp_iw when comparing symbol names.
(compile_object_load): Add mst_bss and mst_data.
* compile/compile.c (_initialize_compile): Remove
-Wno-implicit-function-declaration from `compile_args'.
* compile/gcc-cp-plugin.h: New file.
* NEWS: Mention C++ compile support and new debug options.

gdb/testsuite/ChangeLog:

* gdb.compile/compile-cplus-anonymous.cc: New file.
* gdb.compile/compile-cplus-anonymous.exp: New file.
* gdb.compile/compile-cplus-array-decay.cc: New file.
* gdb.compile/compile-cplus-array-decay.exp: New file.
* gdb.compile/compile-cplus-inherit.cc: New file.
* gdb.compile/compile-cplus-inherit.exp: New file.
* gdb.compile/compile-cplus-member.cc: New file.
* gdb.compile/compile-cplus-member.exp: New file.
* gdb.compile/compile-cplus-method.cc: New file.
* gdb.compile/compile-cplus-method.exp: New file.
* gdb.compile/compile-cplus-mod.c: "New" file.
* gdb.compile/compile-cplus-namespace.cc: New file.
* gdb.compile/compile-cplus-namespace.exp: New file.
* gdb.compile/compile-cplus-nested.cc: New file.
* gdb.compile/compile-cplus-nested.exp: New file.
* gdb.compile/compile-cplus-print.c: "New" file.
* gdb.compile/compile-cplus-print.exp: "New" file.
* gdb.compile/compile-cplus-virtual.cc: New file.
* gdb.compile/compile-cplus-virtual.exp: New file.
* gdb.compile/compile-cplus.c: "New" file.
* gdb.compile/compile-cplus.exp: "New" file.
* lib/compile-support.exp: New file.

doc/ChangeLog:

* gdb.texinfo (Compiling and injecting code in GDB): Document
set/show "compile-oracle" and "compile-cplus-types" commands.

5 years agoAdd new search_symbols_multiple API
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Add new search_symbols_multiple API

This patch adds a new symbol searching API based on linespec.c's parser
implementation.  This allows users to find "all* matching symbols instead
of the first found match (a la lookup_symbol).

gdb/ChangeLog:

* linespec.c (collect_info::add_symbol): Make virtual.
(struct symbol_searcher_collect_info): New struct.
(symbol_searcher::find_all_symbols): New method.
* symtab.h (class symbol_searcher): New class.

5 years agoUse block_symbol in linespec APIs
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Use block_symbol in linespec APIs

This patch changes the linespec.c APIs to use block_symbol instead of just
a symbol.  lookup_symbol et al already return block_symbol's.

gdb/ChangeLog:

* linespec.c (struct linespec) <function_symbols, label_symbols>:
Change to vector of block_symbol.  Update all users.
(struct collect_info) <symbols>: Likewise.
(collect_info::add_symbol): Take block_symbol as argument.
Update all callers.
(decode_compound_collector) <m_symbols>: Change type to vector
of block_symbol.  Update all users.
(decode_compound_collector::operator ()): Change parameter type
to block_symbol.
(find_method, find_function_symbols, find_linespec_symbols)
(find_label_symbols_in_block, find_label_symbols): Change symbol
vectors to block_symbol vectors.
* symtab.h (symbol_found_callback_ftype): Change parameter type to
block_symbol.

5 years agoRemove VEC definitions from linespec.c
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Remove VEC definitions from linespec.c

Since they are now no longer necessary, this patch removes the typedefs
and VEC definitions for bound_minimal_symbol_d and symbolp.

gdb/ChangeLog:

* linespec.c (symbolp): Remove typedef and VEC definitions.
(bound_minimal_symbol_d): Likewise.

5 years agoChange decode_compound_collector to use std::vector
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Change decode_compound_collector to use std::vector

This patch changes decode_compound_collector to use std::vector instead of
VEC, eliminating a cleanup in the process.

gdb/ChangeLog:

* linespec.c (decode_compound_collector::decode_compound_collector):
Remove initialization for `m_symtabs'.
(decode_compound_collector::release_symbols): Change return type
to std::vector.  Update all callers.
(class decode_compound_collector) <m_symbols>: Change type to
std::vector.
(lookup_prefix_sym): Change return type to std::vector.  Update all
callers.
(compare_symbols): Remove.
(std_compare_symbols): Rename to `compare_symbols'.
(find_method): Change `sym_classes' parameter to std::vector.
Update all callers.  Use std::sort to sort sym_classes.
(find_linespec_symbols): Remove cleanup.

5 years agoChange `minimal_symbols' to std::vector in linespec.c structures
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Change `minimal_symbols' to std::vector in linespec.c structures

This patch converts linespec.c's linespec.label_symbols member from a
VEC to a std::vector.

gdb/ChangeLog:

* linespec.c (struct linespec) <minimal_symbols>: Change type to
std::vector.  Update all users.
(convert_linespec_to_sals): Use std::sort to sort minimal symbols.
(struct collect_info) <minimal_symbols>: Likewise.
(compare_msymbols): Return bool.  Change parameters to const
bound_minimal_symbol references.
(find_method, find_function_symbols, find_linespec_symbols): Change
`minsyms' parameter to std::vector.  Update all callers.

5 years agoChange `label_symbols' to std::vector in linespec.c structures
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Change `label_symbols' to std::vector in linespec.c structures

This patch converts linespec.c's linespec.label_symbols member from a
VEC to a std::vector.

gdb/ChangeLog:

* linespec.c (struct linespec) <label_symbols>: Change type to
std::vector.  Update all users.
(find_label_symbols_in_block): Change `result' parameter to
std::vector.  Update all callers.
(find_label_symbols): Return std::vector.  Update all callers.

5 years agoChange `function_symbols' to std::vector
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Change `function_symbols' to std::vector

This patch changes the `function_symbols'  members in linespec.c structures
from a VEC to a std::vector.

gdb/ChangeLog:

* linespec.c (struct linespec) <function_symbols>: Change type to
std::vector.  Update all users.
(struct collect_info) <function_symbols>: Likewise.
(convert_linespec_to_sals): Use std::sort to sort function_symbols.
(std_compare_symbols): New function.
(find_method, find_function_symbols, find_linespec_symbols)
(find_label_symbols_in_block): Change `symbols' parameter to
std::vector.  Update all callers.
(find_label_symbols): Likewise for `function_symbols' and
`label_funcs_ret'.

5 years agoChange `file_symtabs' to std::vector
Keith Seitz [Wed, 29 Aug 2018 22:12:23 +0000 (15:12 -0700)] 
Change `file_symtabs' to std::vector

This patch changes the `file_symtabs' members in linespec.c structures
from a VEC to a std::vector (or unique_ptr thereof), eliminating a cleanup
in the process.

gdb/ChangeLog:

* linespec.c (symtab_vector_up): Define.
(struct linespec) <file_symtabs>: Change type to std::vector *.
Update all uses.
(struct collect_info) <file_symtabs>: Likewise.
(collect_symtabs_from_filename): Return symtab_vector_up.
Update all callers.
(decode_objc): Remove cleanup.
(symtab_collector::symtab_collector): Initialize `m_symtabs'.
(symtab_collector::release_symtabs): Return symtab_vector_up.
Update all callers.
(class symtab_collector) <m_symtabs>: Change type to symtab_vector_up.
Update all users.
(collect_symtabs_from_filename, symtabs_from_filename): Return
symtab_vector_up.  Update all callers.

5 years agoUse core_addr_to_string_nz in csky_analyze_prologue
Tom Tromey [Wed, 29 Aug 2018 21:33:23 +0000 (15:33 -0600)] 
Use core_addr_to_string_nz in csky_analyze_prologue

One of the buildbot builders had a failure on a recent try run:

../../binutils-gdb/gdb/csky-tdep.c: In function CORE_ADDR csky_analyze_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, CORE_ADDR, frame_info*, csky_unwind_cache*, lr_type_t):
../../binutils-gdb/gdb/csky-tdep.c:1107:23: error: format %lx expects argument of type long unsigned int, but argument 3 has type CORE_ADDR {aka long long unsigned int} [-Werror=format=]
        "0x%lx\n", addr);
                       ^
../../binutils-gdb/gdb/csky-tdep.c:1419:12: error: format %lx expects argument of type long unsigned int, but argument 3 has type CORE_ADDR {aka long long unsigned int} [-Werror=format=]
        addr);
            ^

The fix is to use core_addr_to_string_nz rather than %lx in
csky-tdep.c.

Tested by rebuilding.  I'm checking this in.

gdb/ChangeLog
2018-08-29  Tom Tromey  <tom@tromey.com>

* csky-tdep.c (csky_analyze_prologue): Use
core_addr_to_string_nz.

5 years agoFix windows-nat.c for -Wnarrowing
Tom Tromey [Wed, 29 Aug 2018 17:37:42 +0000 (11:37 -0600)] 
Fix windows-nat.c for -Wnarrowing

Sergio pointed out that the Windows builder was failing due to the
-Wnarrowing patch, with:

../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225477' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
   {-1, GDB_SIGNAL_UNKNOWN}};
                           ^
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225725' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483651' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '2147483652' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]
../../binutils-gdb/gdb/windows-nat.c:301:27: error: narrowing conversion of '3221225614' from 'DWORD {aka long unsigned int}' to 'int' inside { } [-Wnarrowing]

Looking into this, I found two things.

First, in struct xlate_exception, it is better to have "them" be of
type DWORD, as that's the type actually in use.

Second, struct xlate_exception and xlate are not used in this file,
because the code in windows_nat_target::resume is #if'd out.

This patch changes the type of "them", but also similarly #if's out
this object.

In order to avoid a narrowing warning from the -1 entry, at Pedro's
suggestion I have removed this and changed windows_nat_target::resume
to use ranged for.

Tested by rebuilding using the mingw toolchain on x86-64 Fedora 28.  I
also tested it by temporarily removing the "#if 0"s and rebuilding.

gdb/ChangeLog
2018-08-29  Tom Tromey  <tom@tromey.com>

* windows-nat.c (struct xlate_exception) <them>: Change type to
DWORD.
(xlate): Fix formatting.  Remove last entry.
(struct xlate_exception, xlate): Comment out.
(windows_nat_target::resume): Use ranged for.

5 years agosparc/leon: add support for partial write psr instruction
Martin Aberg [Wed, 29 Aug 2018 18:52:28 +0000 (20:52 +0200)] 
sparc/leon: add support for partial write psr instruction

Partial write %PSR (PWRPSR) is a SPARC V8e option that allows the WRPSR
instruction to only affect the %PSR.ET field. When available it is enabled
by setting the rd field of the WRPSR instruction to a value other than 0.
For Leon processors with support for partial write %PSR (currently GR740
and GR716) the rd value must be 1.

opcodes/ChangeLog:

2018-08-29  Martin Aberg  <maberg@gaisler.com>

        * sparc-opc.c (sparc_opcodes): Add Leon specific partial write
        psr (PWRPSR) instruction.

gas/ChangeLog:

2018-08-29  Daniel Cederman  <cederman@gaisler.com>

        * testsuite/gas/sparc/leon.d: New test.
        * testsuite/gas/sparc/leon.s: New test.
        * testsuite/gas/sparc/sparc.exp: Execute the pwrpsr test.

5 years agoFix riscv-linux native gdb build failure.
Jim Wilson [Wed, 29 Aug 2018 17:52:42 +0000 (10:52 -0700)] 
Fix riscv-linux native gdb build failure.

The linux kernel uses NT_PRFPREG.  Glibc before BZ 14890 defines NT_FPREGSET.
After it defines both.  Avoid glibc version dependency by using the gdb header
file instead of the glibc header file, and the macro name that gdb defines
which is NT_FPREGSET.

gdb/
* riscv-linux-nat.c: Include elf/common.h instead of elf.h.
(riscv_linux_nat_target::fetch_registers): Use NT_FPREGSET instead
of NT_PRFPREG.
(riscv_linux_nat_target::store_registers): Likewise.

5 years agoUpdate gnulib to current upstream master
Sergio Durigan Junior [Mon, 27 Aug 2018 22:56:03 +0000 (18:56 -0400)] 
Update gnulib to current upstream master

It has been a while since we don't update our gnulib copy against
their upstream master branch, so I thought I'd propose this patch.  It
also fixes (at least) one bug reported against GDB:

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

The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB.  With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.

This has been reported against upstream gnulib and the fix has been
pushed here:

  https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=a96d2e67052c879b1bcc5bc461722beac75fc372

I regtested this patch on Fedora 28 x86-64, and there were no
regressions.

OK?

gdb/ChangeLog:

2018-08-29  Sergio Durigan Junior  <sergiodj@redhat.com>

PR gdb/23555
PR gdb/23558
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/extra/snippet/_Noreturn.h: Rename to...
* gnulib/import/_Noreturn.h: ... this.
* gnulib/import/alloca.in.h: Update.
* gnulib/import/extra/snippet/arg-nonnull.h: Rename to...
* gnulib/import/arg-nonnull.h: ... this.
* gnulib/import/assure.h: Update.
* gnulib/import/at-func.c: Update.
* gnulib/import/basename-lgpl.c: Update.
* gnulib/import/extra/snippet/c++defs.h: Rename to...
* gnulib/import/c++defs.h: ... this.
* gnulib/import/canonicalize-lgpl.c: Update.
* gnulib/import/cdefs.h: Update.
* gnulib/import/chdir-long.c: Update.
* gnulib/import/chdir-long.h: Update.
* gnulib/import/cloexec.c: Update.
* gnulib/import/cloexec.h: Update.
* gnulib/import/close.c: Update.
* gnulib/import/closedir.c: Update.
* gnulib/import/config.charset: Update.
* gnulib/import/dirent-private.h: Update.
* gnulib/import/dirent.in.h: Update.
* gnulib/import/dirfd.c: Update.
* gnulib/import/dirname-lgpl.c: Update.
* gnulib/import/dirname.h: Update.
* gnulib/import/dosname.h: Update.
* gnulib/import/dup-safer-flag.c: Update.
* gnulib/import/dup-safer.c: Update.
* gnulib/import/dup.c: Update.
* gnulib/import/dup2.c: Update.
* gnulib/import/errno.in.h: Update.
* gnulib/import/error.c: Update.
* gnulib/import/error.h: Update.
* gnulib/import/exitfail.c: Update.
* gnulib/import/exitfail.h: Update.
* gnulib/import/extra/update-copyright: Update.
* gnulib/import/fchdir.c: Update.
* gnulib/import/fcntl.c: Update.
* gnulib/import/fcntl.in.h: Update.
* gnulib/import/fd-hook.c: Update.
* gnulib/import/fd-hook.h: Update.
* gnulib/import/fd-safer-flag.c: Update.
* gnulib/import/fd-safer.c: Update.
* gnulib/import/fdopendir.c: Update.
* gnulib/import/filename.h: Update.
* gnulib/import/filenamecat-lgpl.c: Update.
* gnulib/import/filenamecat.h: Update.
* gnulib/import/flexmember.h: Update.
* gnulib/import/float+.h: Update.
* gnulib/import/float.c: Update.
* gnulib/import/float.in.h: Update.
* gnulib/import/fnmatch.c: Update.
* gnulib/import/fnmatch.in.h: Update.
* gnulib/import/fnmatch_loop.c: Update.
* gnulib/import/fpucw.h: Update.
* gnulib/import/frexp.c: Update.
* gnulib/import/frexpl.c: Update.
* gnulib/import/fstat.c: Update.
* gnulib/import/fstatat.c: Update.
* gnulib/import/getcwd-lgpl.c: Update.
* gnulib/import/getcwd.c: Update.
* gnulib/import/getdtablesize.c: Update.
* gnulib/import/getlogin_r.c: Update.
* gnulib/import/getprogname.c: Update.
* gnulib/import/getprogname.h: Update.
* gnulib/import/gettext.h: Update.
* gnulib/import/gettimeofday.c: Update.
* gnulib/import/glob-libc.h: Update.
* gnulib/import/glob.c: Update.
* gnulib/import/glob.in.h: Update.
* gnulib/import/glob_internal.h: Update.
* gnulib/import/glob_pattern_p.c: Update.
* gnulib/import/globfree.c: Update.
* gnulib/import/hard-locale.c: Update.
* gnulib/import/hard-locale.h: Update.
* gnulib/import/intprops.h: Update.
* gnulib/import/inttypes.in.h: Update.
* gnulib/import/isnan.c: Update.
* gnulib/import/isnand-nolibm.h: Update.
* gnulib/import/isnand.c: Update.
* gnulib/import/isnanl-nolibm.h: Update.
* gnulib/import/isnanl.c: Update.
* gnulib/import/itold.c: Update.
* gnulib/import/libc-config.h: Update.
* gnulib/import/limits.in.h: Update.
* gnulib/import/localcharset.c: Update.
* gnulib/import/localcharset.h: Update.
* gnulib/import/localtime-buffer.c: Update.
* gnulib/import/localtime-buffer.h: Update.
* gnulib/import/lstat.c: Update.
* gnulib/import/m4/00gnulib.m4: Update.
* gnulib/import/m4/__inline.m4: Update.
* gnulib/import/m4/absolute-header.m4: Update.
* gnulib/import/m4/alloca.m4: Update.
* gnulib/import/m4/builtin-expect.m4: Update.
* gnulib/import/m4/canonicalize.m4: Update.
* gnulib/import/m4/chdir-long.m4: Update.
* gnulib/import/m4/close.m4: Update.
* gnulib/import/m4/closedir.m4: Update.
* gnulib/import/m4/configmake.m4: Update.
* gnulib/import/m4/d-ino.m4: Update.
* gnulib/import/m4/d-type.m4: Update.
* gnulib/import/m4/dirent_h.m4: Update.
* gnulib/import/m4/dirfd.m4: Update.
* gnulib/import/m4/dirname.m4: Update.
* gnulib/import/m4/double-slash-root.m4: Update.
* gnulib/import/m4/dup.m4: Update.
* gnulib/import/m4/dup2.m4: Update.
* gnulib/import/m4/eealloc.m4: Update.
* gnulib/import/m4/environ.m4: Update.
* gnulib/import/m4/errno_h.m4: Update.
* gnulib/import/m4/error.m4: Update.
* gnulib/import/m4/exponentd.m4: Update.
* gnulib/import/m4/exponentl.m4: Update.
* gnulib/import/m4/extensions.m4: Update.
* gnulib/import/m4/extern-inline.m4: Update.
* gnulib/import/m4/fchdir.m4: Update.
* gnulib/import/m4/fcntl-o.m4: Update.
* gnulib/import/m4/fcntl.m4: Update.
* gnulib/import/m4/fcntl_h.m4: Update.
* gnulib/import/m4/fdopendir.m4: Update.
* gnulib/import/m4/filenamecat.m4: Update.
* gnulib/import/m4/flexmember.m4: Update.
* gnulib/import/m4/float_h.m4: Update.
* gnulib/import/m4/fnmatch.m4: Update.
* gnulib/import/m4/fnmatch_h.m4: Update.
* gnulib/import/m4/fpieee.m4: Update.
* gnulib/import/m4/frexp.m4: Update.
* gnulib/import/m4/frexpl.m4: Update.
* gnulib/import/m4/fstat.m4: Update.
* gnulib/import/m4/fstatat.m4: Update.
* gnulib/import/m4/getcwd-abort-bug.m4: Update.
* gnulib/import/m4/getcwd-path-max.m4: Update.
* gnulib/import/m4/getcwd.m4: Update.
* gnulib/import/m4/getdtablesize.m4: Update.
* gnulib/import/m4/getlogin.m4: Update.
* gnulib/import/m4/getlogin_r.m4: Update.
* gnulib/import/m4/getpagesize.m4: Update.
* gnulib/import/m4/getprogname.m4: Update.
* gnulib/import/m4/gettimeofday.m4: Update.
* gnulib/import/m4/glibc21.m4: Update.
* gnulib/import/m4/glob.m4: Update.
* gnulib/import/m4/glob_h.m4: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-common.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/gnulib-tool.m4: Update.
* gnulib/import/m4/hard-locale.m4: Update.
* gnulib/import/m4/include_next.m4: Update.
* gnulib/import/m4/inttypes-pri.m4: Update.
* gnulib/import/m4/inttypes.m4: Update.
* gnulib/import/m4/isnand.m4: Update.
* gnulib/import/m4/isnanl.m4: Update.
* gnulib/import/m4/largefile.m4: Update.
* gnulib/import/m4/limits-h.m4: Update.
* gnulib/import/m4/localcharset.m4: Update.
* gnulib/import/m4/locale-fr.m4: Update.
* gnulib/import/m4/locale-ja.m4: Update.
* gnulib/import/m4/locale-zh.m4: Update.
* gnulib/import/m4/localtime-buffer.m4: Update.
* gnulib/import/m4/longlong.m4: Update.
* gnulib/import/m4/lstat.m4: Update.
* gnulib/import/m4/malloc.m4: Update.
* gnulib/import/m4/malloca.m4: Update.
* gnulib/import/m4/math_h.m4: Update.
* gnulib/import/m4/mbrtowc.m4: Update.
* gnulib/import/m4/mbsinit.m4: Update.
* gnulib/import/m4/mbsrtowcs.m4: Update.
* gnulib/import/m4/mbstate_t.m4: Update.
* gnulib/import/m4/memchr.m4: Update.
* gnulib/import/m4/memmem.m4: Update.
* gnulib/import/m4/mempcpy.m4: Update.
* gnulib/import/m4/memrchr.m4: Update.
* gnulib/import/m4/mkdir.m4: Update.
* gnulib/import/m4/mkstemp.m4: Update.
* gnulib/import/m4/mmap-anon.m4: Update.
* gnulib/import/m4/mode_t.m4: Update.
* gnulib/import/m4/msvc-inval.m4: Update.
* gnulib/import/m4/msvc-nothrow.m4: Update.
* gnulib/import/m4/multiarch.m4: Update.
* gnulib/import/m4/nocrash.m4: Update.
* gnulib/import/m4/off_t.m4: Update.
* gnulib/import/m4/onceonly.m4: Update.
* gnulib/import/m4/open-cloexec.m4: Update.
* gnulib/import/m4/open.m4: Update.
* gnulib/import/m4/openat.m4: Update.
* gnulib/import/m4/opendir.m4: Update.
* gnulib/import/m4/pathmax.m4: Update.
* gnulib/import/m4/rawmemchr.m4: Update.
* gnulib/import/m4/readdir.m4: Update.
* gnulib/import/m4/readlink.m4: Update.
* gnulib/import/m4/realloc.m4: Update.
* gnulib/import/m4/rename.m4: Update.
* gnulib/import/m4/rewinddir.m4: Update.
* gnulib/import/m4/rmdir.m4: Update.
* gnulib/import/m4/save-cwd.m4: Update.
* gnulib/import/m4/secure_getenv.m4: Update.
* gnulib/import/m4/setenv.m4: Update.
* gnulib/import/m4/signal_h.m4: Update.
* gnulib/import/m4/ssize_t.m4: Update.
* gnulib/import/m4/stat-time.m4: Update.
* gnulib/import/m4/stat.m4: Update.
* gnulib/import/m4/std-gnu11.m4: Update.
* gnulib/import/m4/stdbool.m4: Update.
* gnulib/import/m4/stddef_h.m4: Update.
* gnulib/import/m4/stdint.m4: Update.
* gnulib/import/m4/stdio_h.m4: Update.
* gnulib/import/m4/stdlib_h.m4: Update.
* gnulib/import/m4/strchrnul.m4: Update.
* gnulib/import/m4/strdup.m4: Update.
* gnulib/import/m4/strerror.m4: Update.
* gnulib/import/m4/string_h.m4: Update.
* gnulib/import/m4/strstr.m4: Update.
* gnulib/import/m4/strtok_r.m4: Update.
* gnulib/import/m4/sys_socket_h.m4: Update.
* gnulib/import/m4/sys_stat_h.m4: Update.
* gnulib/import/m4/sys_time_h.m4: Update.
* gnulib/import/m4/sys_types_h.m4: Update.
* gnulib/import/m4/tempname.m4: Update.
* gnulib/import/m4/time_h.m4: Update.
* gnulib/import/m4/unistd-safer.m4: Update.
* gnulib/import/m4/unistd_h.m4: Update.
* gnulib/import/m4/warn-on-use.m4: Update.
* gnulib/import/m4/wchar_h.m4: Update.
* gnulib/import/m4/wchar_t.m4: Update.
* gnulib/import/m4/wctype_h.m4: Update.
* gnulib/import/m4/wint_t.m4: Update.
* gnulib/import/malloc.c: Update.
* gnulib/import/malloc/scratch_buffer.h: Update.
* gnulib/import/malloc/scratch_buffer_grow.c: Update.
* gnulib/import/malloc/scratch_buffer_grow_preserve.c: Update.
* gnulib/import/malloc/scratch_buffer_set_array_size.c: Update.
* gnulib/import/malloca.c: Update.
* gnulib/import/malloca.h: Update.
* gnulib/import/malloca.valgrind: Update.
* gnulib/import/math.in.h: Update.
* gnulib/import/mbrtowc.c: Update.
* gnulib/import/mbsinit.c: Update.
* gnulib/import/mbsrtowcs-impl.h: Update.
* gnulib/import/mbsrtowcs-state.c: Update.
* gnulib/import/mbsrtowcs.c: Update.
* gnulib/import/memchr.c: Update.
* gnulib/import/memmem.c: Update.
* gnulib/import/mempcpy.c: Update.
* gnulib/import/memrchr.c: Update.
* gnulib/import/mkdir.c: Update.
* gnulib/import/mkstemp.c: Update.
* gnulib/import/msvc-inval.c: Update.
* gnulib/import/msvc-inval.h: Update.
* gnulib/import/msvc-nothrow.c: Update.
* gnulib/import/msvc-nothrow.h: Update.
* gnulib/import/open.c: Update.
* gnulib/import/openat-die.c: Update.
* gnulib/import/openat-priv.h: Update.
* gnulib/import/openat-proc.c: Update.
* gnulib/import/openat.c: Update.
* gnulib/import/openat.h: Update.
* gnulib/import/opendir.c: Update.
* gnulib/import/pathmax.h: Update.
* gnulib/import/pipe-safer.c: Update.
* gnulib/import/rawmemchr.c: Update.
* gnulib/import/readdir.c: Update.
* gnulib/import/readlink.c: Update.
* gnulib/import/realloc.c: Update.
* gnulib/import/ref-add.sin: Update.
* gnulib/import/ref-del.sin: Update.
* gnulib/import/rename.c: Update.
* gnulib/import/rewinddir.c: Update.
* gnulib/import/rmdir.c: Update.
* gnulib/import/same-inode.h: Update.
* gnulib/import/save-cwd.c: Update.
* gnulib/import/save-cwd.h: Update.
* gnulib/import/scratch_buffer.h: Update.
* gnulib/import/secure_getenv.c: Update.
* gnulib/import/setenv.c: Update.
* gnulib/import/signal.in.h: Update.
* gnulib/import/stat-time.c: Update.
* gnulib/import/stat-time.h: Update.
* gnulib/import/stat-w32.c: Update.
* gnulib/import/stat-w32.h: Update.
* gnulib/import/stat.c: Update.
* gnulib/import/stdbool.in.h: Update.
* gnulib/import/stddef.in.h: Update.
* gnulib/import/stdint.in.h: Update.
* gnulib/import/stdio.in.h: Update.
* gnulib/import/stdlib.in.h: Update.
* gnulib/import/str-two-way.h: Update.
* gnulib/import/strchrnul.c: Update.
* gnulib/import/strdup.c: Update.
* gnulib/import/streq.h: Update.
* gnulib/import/strerror-override.c: Update.
* gnulib/import/strerror-override.h: Update.
* gnulib/import/strerror.c: Update.
* gnulib/import/string.in.h: Update.
* gnulib/import/stripslash.c: Update.
* gnulib/import/strnlen1.c: Update.
* gnulib/import/strnlen1.h: Update.
* gnulib/import/strstr.c: Update.
* gnulib/import/strtok_r.c: Update.
* gnulib/import/sys_stat.in.h: Update.
* gnulib/import/sys_time.in.h: Update.
* gnulib/import/sys_types.in.h: Update.
* gnulib/import/tempname.c: Update.
* gnulib/import/tempname.h: Update.
* gnulib/import/time.in.h: Update.
* gnulib/import/unistd--.h: Update.
* gnulib/import/unistd-safer.h: Update.
* gnulib/import/unistd.in.h: Update.
* gnulib/import/unsetenv.c: Update.
* gnulib/import/verify.h: Update.
* gnulib/import/extra/snippet/warn-on-use.h: Update.
* gnulib/import/wchar.in.h: Update.
* gnulib/import/wctype.in.h: Update.
* gnulib/import/xalloc-oversized.h: Update.
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
"53e2c179f26a890fa6685af4b6c1397ee370433b".

5 years agoIndicate batch mode failures by exiting with nonzero status
Gary Benson [Wed, 29 Aug 2018 15:11:50 +0000 (16:11 +0100)] 
Indicate batch mode failures by exiting with nonzero status

This commit causes GDB in batch mode to exit with nonzero status
if the last command to be executed fails.

gdb/ChangeLog:

PR gdb/13000:
* gdb/main.c (captured_main_1): Exit with nonzero status
in batch mode if the last command to be executed failed.
* NEWS: Mention the above.

gdb/testsuite/ChangeLog:

PR gdb/13000:
* gdb.base/batch-exit-status.exp: New file.
* gdb.base/batch-exit-status.good-commands: Likewise.
* gdb.base/batch-exit-status.bad-commands: Likewise.

5 years agoRemove newline at end of warning message
Simon Marchi [Wed, 29 Aug 2018 14:26:11 +0000 (10:26 -0400)] 
Remove newline at end of warning message

... to fix this ARI warning:

  gdb/csky-tdep.c:1612: gettext: trailing new line: A message should not have a trailing new line
  gdb/csky-tdep.c:1612:    warning (_("Invalid breakpoint address 0x%x is an odd number.\n"),

gdb/ChangeLog:

* csky-tdep.c (csky_memory_insert_breakpoint): Remove newline at
end of warning message.

5 years ago[MIPS] Add Loongson 2K1000 proccessor support.
Chenghua Xu [Wed, 29 Aug 2018 12:55:25 +0000 (20:55 +0800)] 
[MIPS] Add Loongson 2K1000 proccessor support.

bfd/
* archures.c (bfd_architecture): New machine
bfd_mach_mips_gs264e.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (enum I_xxx): Likewise.
(arch_info_struct): Likewise.
* elfxx-mips.c (_bfd_elf_mips_mach): Handle
E_MIPS_MACH_GS264E.
(mips_set_isa_flags): Likewise.
(mips_mach_extensions): Map bfd_mach_mips_gs264e to
bfd_mach_mips_gs464e extension.

binutils/
* NEWS: Mention Loongson 2K1000 proccessor support.
* readelf.c (get_machine_flags): Handle gs264e.

elfcpp/
* mips.c (EF_MIPS_MACH): New E_MIPS_MACH_GS264E.

gas/
* config/tc-mips.c (ISA_HAS_ODD_SINGLE_FPR): Exclude CPU_GS264E.
(mips_cpu_info_table): Add gs264e descriptors.
* doc/as.texi (march table): Add gs264e.

include/
* elf/mips.h (E_MIPS_MACH_XXX): New E_MIPS_MACH_GS264E.
* opcode/mips.h (CPU_XXX): New CPU_GS264E.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Run good_combination
gs264e and gs464e.

opcodes/
* mips-dis.c (mips_arch_choices): Add gs264e descriptors.

5 years ago[MIPS] Add Loongson 3A2000/3A3000 proccessor support.
Chenghua Xu [Wed, 29 Aug 2018 12:36:23 +0000 (20:36 +0800)] 
[MIPS] Add Loongson 3A2000/3A3000 proccessor support.

bfd/
* archures.c (bfd_architecture): New machine
bfd_mach_mips_gs464e.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (enum I_xxx): Likewise.
(arch_info_struct): Likewise.
* elfxx-mips.c (_bfd_elf_mips_mach): Handle
E_MIPS_MACH_GS464E.
(mips_set_isa_flags): Likewise.
(mips_mach_extensions): Map bfd_mach_mips_gs464e to
bfd_mach_mips_gs464 extension.

binutils/
* NEWS: Mention Loongson 3A2000/3A3000 proccessor support.
* readelf.c (get_machine_flags): Handle gs464e.

elfcpp/
* mips.c (EF_MIPS_MACH): New E_MIPS_MACH_GS464E.

gas/
* config/tc-mips.c (ISA_HAS_ODD_SINGLE_FPR): Exclude CPU_GS464E.
(mips_cpu_info_table): Add gs464e descriptors.
* doc/as.texi (march table): Add gs464e.

include/
* elf/mips.h (E_MIPS_MACH_XXX): New E_MIPS_MACH_GS464E.
* opcode/mips.h (CPU_XXX): New CPU_GS464E.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Run good_combination
gs464e and gs464.

opcodes/
* mips-dis.c (mips_arch_choices): Add gs464e descriptors.

5 years ago[MIPS] Add Loongson 3A1000 proccessor support.
Chenghua Xu [Wed, 29 Aug 2018 12:13:00 +0000 (20:13 +0800)] 
[MIPS] Add Loongson 3A1000 proccessor support.

bfd/
* archures.c (bfd_architecture): Rename
bfd_mach_mips_loongson_3a to bfd_mach_mips_gs464.
* bfd-in2.h (bfd_architecture): Likewise.
* cpu-mips.c (enum I_xxx): Likewise.
(arch_info_struct): Likewise.
* elfxx-mips.c (_bfd_elf_mips_mach): Likewise.
(mips_set_isa_flags): Likewise.
(mips_mach_extensions): Likewise.
(bfd_mips_isa_ext_mach): Likewise.
(bfd_mips_isa_ext): Likewise.
(print_mips_isa_ext): Delete AFL_EXT_LOONGSON_3A.

binutils/
* NEWS: Mention Loongson 3A1000 proccessor support.
* readelf.c (get_machine_flags): Rename loongson-3a to gs464.
(print_mips_isa_ext): Delete AFL_EXT_LOONGSON_3A.

elfcpp/
* mips.c (EF_MIPS_MACH): Rename E_MIPS_MACH_LS3A to
E_MIPS_MACH_GS464.

gas/
* config/tc-mips.c (ISA_HAS_ODD_SINGLE_FPR): Rename
CPU_LOONGSON_3A to CPU_GS464.
(mips_cpu_info_table): Add gs464 descriptors, Keep
loongson3a as an alias of gs464 for compatibility.
* doc/as.texi (march table): Rename loongson3a to gs464.
* testsuite/gas/mips/loongson-3a-mmi.d: Set "ISA Extension"
flag to None.

gold/
* mips.cc (Mips_mach, add_machine_extensions, elf_mips_mach):
Rename loongson3a to gs464.
(mips_isa_ext_mach, mips_isa_ext): Delete loongson3a.
(infer_abiflags): Use ases instead of isa_ext for infer ABI
flags.
(elf_mips_mach_name): Rename loongson3a to gs464.

include/
* elf/mips.h (E_MIPS_MACH_XXX): Rename E_MIPS_MACH_LS3A to
E_MIPS_MACH_GS464.
(AFL_EXT_XXX): Delete AFL_EXT_LOONGSON_3A.
* opcode/mips.h (INSN_XXX): Delete INSN_LOONGSON_3A.
(CPU_XXX): Rename CPU_LOONGSON_3A to CPU_GS464.
* opcode/mips.h (mips_isa_table): Delete CPU_LOONGSON_3A case.

ld/
* testsuite/ld-mips-elf/mips-elf-flags.exp: Rename loongson3a
to gs464.

opcodes/
* mips-dis.c (mips_arch_choices): Add gs464 descriptors, Keep
loongson3a as an alias of gs464 for compatibility.
* mips-opc.c (mips_opcodes): Change Comments.

5 years ago[MIPS/GAS] Add Loongson EXT2 Instructions support.
Chenghua Xu [Wed, 29 Aug 2018 12:08:58 +0000 (20:08 +0800)] 
[MIPS/GAS] Add Loongson EXT2 Instructions support.

bfd/
* elfxx-mips.c (print_mips_ases): Add Loongson EXT2 extension.

binutils/
* readelf.c (print_mips_ases): Add Loongson EXT2 extension.

gas/
* NEWS: Mention Loongson EXTensions R2 (EXT2) support.
* config/tc-mips.c (options): Add OPTION_LOONGSON_EXT2 and
OPTION_NO_LOONGSON_EXT2.
(md_longopts): Likewise.
(mips_ases): Define availability for EXT.
(mips_convert_ase_flags): Map ASE_LOONGSON_EXT2 to
AFL_ASE_LOONGSON_EXT2.
(md_show_usage): Add help for -mloongson-ext2 and
-mno-loongson-ext2.
* doc/as.texi: Document -mloongson-ext2, -mno-loongson-ext2.
* doc/c-mips.texi: Document -mloongson-ext2, -mno-loongson-ext2,
.set loongson-ext2 and .set noloongson-ext2.
* testsuite/gas/mips/loongson-ext2.d: New test.
* testsuite/gas/mips/loongson-ext2.s: New test.
* testsuite/gas/mips/mips.exp: Run loongson-ext2 test.

include/
* elf/mips.h (AFL_ASE_LOONGSON_EXT2): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_EXT2.
* opcode/mips.h (ASE_LOONGSON_EXT2): New macro.

opcodes/
* mips-dis.c (parse_mips_ase_option): Handle -M loongson-ext
option.
(print_mips_disassembler_options): Document -M loongson-ext.
* mips-opc.c (LEXT2): New macro.
(mips_opcodes): Add cto, ctz, dcto, dctz instructions.

5 years ago[MIPS/GAS] Split Loongson EXT Instructions from loongson3a.
Chenghua Xu [Wed, 29 Aug 2018 11:57:39 +0000 (19:57 +0800)] 
[MIPS/GAS] Split Loongson EXT Instructions from loongson3a.

bfd/
 * elfxx-mips.c (infer_mips_abiflags): Use ases instead of
 isa_ext for infer ABI flags.
 (print_mips_ases): Add Loongson EXT extension.

binutils/
 * readelf.c (print_mips_ases): Add Loongson EXT extension.

elfcpp/
 * mips.h (AFL_ASE_LOONGSON_EXT): New enum.

gas/
 * NEWS: Mention Loongson EXTensions (EXT) support.
 * config/tc-mips.c (options): Add OPTION_LOONGSON_EXT and
 OPTION_NO_LOONGSON_EXT.
 (md_longopts): Likewise.
 (mips_ases): Define availability for EXT.
 (mips_convert_ase_flags): Map ASE_LOONGSON_EXT to
 AFL_ASE_LOONGSON_EXT.
 (mips_cpu_info_table): Add ASE_LOONGSON_EXT for loongson3a.
 (md_show_usage): Add help for -mloongson-ext and
 -mno-loongson-ext.
 * doc/as.texi: Document -mloongson-ext, -mno-loongson-ext.
 * doc/c-mips.texi: Document -mloongson-ext, -mno-loongson-ext,
 .set loongson-ext and .set noloongson-ext.
 * testsuite/gas/mips/loongson-mmi.d: Add ASE flag.

include/
 * elf/mips.h (AFL_ASE_LOONGSON_EXT): New macro.
 (AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_EXT.
 * opcode/mips.h (ASE_LOONGSON_EXT): New macro.

opcodes/
 * mips-dis.c (mips_arch_choices): Add EXT to loongson3a
 descriptors.
 (parse_mips_ase_option): Handle -M loongson-ext option.
 (print_mips_disassembler_options): Document -M loongson-ext.
 * mips-opc.c (IL3A): Delete.
 * mips-opc.c (LEXT): New macro.
 (mips_opcodes): Replace IL2F|IL3A marking with LEXT for EXT
 instructions.

5 years ago[MIPS/GAS] Split Loongson CAM Instructions from loongson3a
Chenghua Xu [Wed, 29 Aug 2018 09:39:33 +0000 (17:39 +0800)] 
[MIPS/GAS] Split Loongson CAM Instructions from loongson3a

bfd/
* elfxx-mips.c (print_mips_ases): Add CAM extension.

binutils/
* readelf.c (print_mips_ases): Add CAM extension.

gas/
* NEWS: Mention Loongson Content Address Memory (CAM)
support.
* config/tc-mips.c (options): Add OPTION_LOONGSON_CAM and
OPTION_NO_LOONGSON_CAM.
(md_longopts): Likewise.
(mips_ases): Define availability for CAM.
(mips_convert_ase_flags): Map ASE_LOONGSON_CAM to
AFL_ASE_LOONGSON_CAM.
(mips_cpu_info_table): Add ASE_LOONGSON_CAM for loongson3a.
(md_show_usage): Add help for -mloongson-cam and
-mno-loongson-cam.
* doc/as.texi: Document -mloongson-cam, -mno-loongson-cam.
* doc/c-mips.texi: Document -mloongson-cam, -mno-loongson-cam,
.set loongson-cam and .set noloongson-cam.
* testsuite/gas/mips/loongson-3a-2.d: Move cam test to ...
* testsuite/gas/mips/loongson-cam.d: Here.  Add ISA/ASE
flag verification.
* testsuite/gas/mips/loongson-3a-2.s: Move cam test to ...
* testsuite/gas/mips/loongson-cam.s: Here.
* testsuite/gas/mips/loongson-3a-mmi.d: Add ASE flag.
* testsuite/gas/mips/mips.exp: Run loongson-cam test.

include/
* elf/mips.h (AFL_ASE_LOONGSON_CAM): New macro.
(AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_CAM.
* opcode/mips.h (ASE_LOONGSON_CAM): New macro.

opcodes/
* mips-dis.c (mips_arch_choices): Add CAM to loongson3a
descriptors.
(parse_mips_ase_option): Handle -M loongson-cam option.
(print_mips_disassembler_options): Document -M loongson-cam.
* mips-opc.c (LCAM): New macro.
(mips_opcodes): Replace IL2F|IL3A marking with LCAM for CAM
instructions.

5 years agoinfcall-nested-structs: Test up to five fields
Alan Hayward [Wed, 29 Aug 2018 10:43:53 +0000 (11:43 +0100)] 
infcall-nested-structs: Test up to five fields

Aarch64 can pass structures of up to four members of identical
types in float registers (See AAPCS 5.3 and 5.4). Expand test to
cover this.

Remove the need to specify an additional sets of structures if tB
is not defined.

gdb/testsuite/
* gdb.base/infcall-nested-structs.c (struct struct01): Remove.
(struct struct02): Likewise.
(struct struct03): Likewise.
(struct struct04): Likewise.
(struct struct_01_01): New struct.
(struct struct_01_02): Likewise.
(struct struct_01_03): Likewise.
(struct struct_01_04): Likewise.
(struct struct_02_01): Likewise.
(struct struct_02_02): Likewise.
(struct struct_02_03): Likewise.
(struct struct_02_04): Likewise.
(struct struct_04_01): Likewise.
(struct struct_04_02): Likewise.
(struct struct_04_03): Likewise.
(struct struct_04_04): Likewise.
(struct struct_05_01): Likewise.
(struct struct_05_02): Likewise.
(struct struct_05_03): Likewise.
(struct struct_05_04): Likewise.
(cmp_struct01): Remove function.
(cmp_struct02): Likewise.
(cmp_struct03): Likewise.
(cmp_struct04): Likewise.
(cmp_struct_01_01): Add Function.
(cmp_struct_01_02): Likewise.
(cmp_struct_01_03): Likewise.
(cmp_struct_01_04): Likewise.
(cmp_struct_02_01): Likewise.
(cmp_struct_02_02): Likewise.
(cmp_struct_02_03): Likewise.
(cmp_struct_02_04): Likewise.
(cmp_struct_04_01): Likewise.
(cmp_struct_04_02): Likewise.
(cmp_struct_04_03): Likewise.
(cmp_struct_04_04): Likewise.
(cmp_struct_05_01): Likewise.
(cmp_struct_05_02): Likewise.
(cmp_struct_05_03): Likewise.
(cmp_struct_05_04): Likewise.
(call_all): Add new structs.
* gdb.base/infcall-nested-structs.exp: Likewise.

5 years agoAarch64: Float register detection for return values
Alan Hayward [Wed, 29 Aug 2018 10:41:45 +0000 (11:41 +0100)] 
Aarch64: Float register detection for return values

Use aapcs_is_vfp_call_or_return_candidate to detect float register
args.

gdb/
PR gdb/22943:
* aarch64-tdep.c (is_hfa_or_hva): Remove function.
(aarch64_extract_return_value): Use
aapcs_is_vfp_call_or_return_candidate.
(aarch64_return_in_memory): Likewise.
(aarch64_store_return_value): Likewise.

5 years agoAarch64: Float register detection for _push_dummy_call
Alan Hayward [Wed, 29 Aug 2018 10:40:05 +0000 (11:40 +0100)] 
Aarch64: Float register detection for _push_dummy_call

Use aapcs_is_vfp_call_or_return_candidate to detect float register
args, then pass in registers if there is room.

gdb/
* aarch64-tdep.c
(aapcs_is_vfp_call_or_return_candidate): Make static
(pass_in_v_or_stack): Remove function.
(pass_in_v_vfp_candidate): New function.
(aarch64_push_dummy_call): Check for float register candidates.

5 years agoAarch64: Func to detect args passed in float regs
Alan Hayward [Wed, 29 Aug 2018 10:28:10 +0000 (11:28 +0100)] 
Aarch64: Func to detect args passed in float regs

aapcs_is_vfp_call_or_return_candidate is as an eventual replacement
for is_hfa_or_hva.

This function is based on the GCC code
gcc/config/aarch64/aarch64.c:aarch64_vfp_is_call_or_return_candidate ()

gdb/
* aarch64-tdep.c (HA_MAX_NUM_FLDS): New macro.
(aapcs_is_vfp_call_or_return_candidate_1): New function.
(aapcs_is_vfp_call_or_return_candidate): Likewise.

5 years ago[MIPS/LD/testsuite] Skip o32 flags check on mips*-*-irix*
Chenghua Xu [Wed, 29 Aug 2018 09:12:44 +0000 (17:12 +0800)] 
[MIPS/LD/testsuite] Skip o32 flags check on mips*-*-irix*

ld/ChangeLog:

* testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination):
Skip o32 flags checking if target is mips*-*-irix*.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 29 Aug 2018 00:00:38 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoGet rid of -Wodr warning (PR build/23399)
Simon Marchi [Tue, 28 Aug 2018 17:29:32 +0000 (13:29 -0400)] 
Get rid of -Wodr warning (PR build/23399)

The PR reports that building with -Wodr -flto complains about different
versions of struct ipa_sym_addresses, in common/agent.c and
gdbserver/tracepoint.c.  This patch renames the version in common to
ipa_sym_addresses_common to avoid the name clash.  Because the IPA_SYM
assumed the name ipa_sym_addresses, it now requires the includer to
define the IPA_SYM_STRUCT_NAME macro to define the name of the structure
holding the IPA symbol addresses.

gdb/ChangeLog:

PR build/23399
* common/agent.c (IPA_SYM_STRUCT_NAME): Define.
(struct ipa_sym_addresses): Rename to...
(struct ipa_sym_addresses_common): ... this.
* common/agent.h (IPA_SYM): Use IPA_SYM_STRUCT_NAME.

gdb/gdbserver/ChangeLog:

PR build/23399
* tracepoint.c (IPA_SYM_STRUCT_NAME): Define.

5 years agoModify gdb.base/commands.exp to test multi breakpoints command clearing.
Philippe Waroquiers [Thu, 2 Aug 2018 21:15:23 +0000 (23:15 +0200)] 
Modify gdb.base/commands.exp to test multi breakpoints command clearing.

gdb/testsuite/ChangeLog
2018-08-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/commands.exp: Test multi breakpoints command clearing.

5 years agoFix regression for multi breakpoints command line clearing.
Philippe Waroquiers [Thu, 2 Aug 2018 21:13:22 +0000 (23:13 +0200)] 
Fix regression for multi breakpoints command line clearing.

breakpoint.c is modified to fix the regression introduced
when clearing the commands of several breakpoints by giving an empty
list of commands, by just typing "end".
GDB should read an empty list of command once, but it reads
it for each breakpoint, as an empty list of command is NULL,
and NULL is interpreted as 'not having read the command list yet'.

The fix consists in having a boolean set to true once the
command list has been read.

gdb/ChangeLog

2018-08-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* breakpoint.c (commands_command_1): New boolean cmd_read
to detect cmd was already read.

5 years agoRemove some uses of VEC from parsers
Tom Tromey [Sun, 22 Jul 2018 16:05:14 +0000 (10:05 -0600)] 
Remove some uses of VEC from parsers

This changes some uses of VEC in a few parsers to std::vector instead.

Tested by the buildbot.

gdb/ChangeLog
2018-08-28  Tom Tromey  <tom@tromey.com>

* c-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, c_parse): Update.
* d-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, d_parse): Update.
* go-exp.y (struct token_and_value): Remove typedef and DEF_VEC.
(token_fifo): Now a std::vector.
(yylex, go_parse): Update.

5 years agoImplement struct type_stack with a vector
Simon Marchi [Tue, 28 Aug 2018 15:13:26 +0000 (11:13 -0400)] 
Implement struct type_stack with a vector

This patch changes the home-made stack implementation with a vector,
which makes it a bit more concise and readable.

Regtested on the buildbot.

gdb/ChangeLog:

* parser-defs.h (struct type_stack) <elements>: Change type to
std::vector<union type_stack_elt>.
<depth, size>: Remove.
* parse.c (parse_exp_in_context_1): Adjust.
(type_stack_reserve): Remove.
(check_type_stack_depth): Remove.
(insert_into_type_stack): Adjust to std::vector.
(insert_type): Likewise.
(push_type): Likewise.
(push_type_int): Likewise.
(insert_type_address_space): Likewise.
(pop_type): Likewise.
(pop_type_int): Likewise.
(pop_typelist): Likewise.
(pop_type_stack): Likewise.
(append_type_stack): Likewise.
(push_type_stack): Likewise.
(get_type_stack): Likewise.
(type_stack_cleanup): Likewise.
(push_typelist): Likewise.
(follow_types): Likewise.
(_initialize_parse): Likewise.

5 years agoMention csky target in the NEWS.
Hafiz Abid Qadeer [Wed, 25 Jul 2018 09:45:26 +0000 (10:45 +0100)] 
Mention csky target in the NEWS.

2018-08-28  Hafiz Abid Qadeer  <abidh@codesourcery.com>

* NEWS: Mention csky target.

5 years agoAdd support for new target 'csky'.
Hafiz Abid Qadeer [Wed, 25 Jul 2018 09:43:22 +0000 (10:43 +0100)] 
Add support for new target 'csky'.

2018-08-28  Jiangshuai Li  <jiangshuai_li@c-sky.com>
    Hafiz Abid Qadeer  <abidh@codesourcery.com>
    Don Breazeal  <donb@codesourcery.com>

* csky-linux-tdep.c: New file.
* csky-tdep.c: Likewise.
* csky-tdep.h: Likewise.
* Makefile.in (ALL_TARGET_OBS): Add csky-linux-tdep.o and
csky-tdep.o.
(HFILES_NO_SRCDIR): Add csky-tdep.h.
(ALLDEPFILES): Add csky-linux-tdep.c and csky-tdep.c
* configure.tgt: Add csky support.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 28 Aug 2018 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agox86: Don't mask out the GNU_PROPERTY_X86_UINT32_VALID bit
H.J. Lu [Mon, 27 Aug 2018 22:41:09 +0000 (15:41 -0700)] 
x86: Don't mask out the GNU_PROPERTY_X86_UINT32_VALID bit

Since only the GNU_PROPERTY_X86_UINT32_VALID bit may be set in data-only
relocatable objects which don't contain any instructions, linker
shouldn't mask out the GNU_PROPERTY_X86_UINT32_VALID bit when merging
GNU_PROPERTY_X86_XXX bits.  Otherwise, linker output doesn't contain
GNU_PROPERTY_X86_XXX property with any data-only relocatable inputs.
This patch keeps the GNU_PROPERTY_X86_UINT32_VALID bit and updates
readelf to print "<None>" if GNU_PROPERTY_X86_XXX property only has
the GNU_PROPERTY_X86_UINT32_VALID bit.

bfd/

* elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Don't mask
out the GNU_PROPERTY_X86_UINT32_VALID bit.

binutils/

* readelf.c (decode_x86_isa): Print <None> if bitmask only
contains the GNU_PROPERTY_X86_UINT32_VALID bit.
(decode_x86_feature_1): Likewise.
(decode_x86_feature_2): Likewise.
(print_gnu_property_note): Don't mask out the
GNU_PROPERTY_X86_UINT32_VALID bit.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.

gas/

* testsuite/gas/i386/i386.exp: Run property-1 and
x86-64-property-1.
* testsuite/gas/i386/property-1.d: New file.
* testsuite/gas/i386/property-1.s: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.

ld/

* testsuite/ld-i386/i386.exp: Run property-x86-5.
* testsuite/ld-i386/property-x86-5.d: New file.
* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-5a.s: Likewise.
* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run property-x86-5 and
property-x86-5-x32.

5 years agoMI: Fix printing of frame architecture with Python frame filters enabled
Jan Vrany [Mon, 27 Aug 2018 20:52:44 +0000 (21:52 +0100)] 
MI: Fix printing of frame architecture with Python frame filters enabled

Commit 6d52907e226a (MI: Print frame architecture when printing frames
on an MI channel) added frame's architecture to MI frame output. However
the frame architecture was not correctly printed in the output of
"-stack-list-frames" with frame filters enabled (via "-enable-frame-filters").
This was because with frame filters enabled, the actual frame printing is
done in "py_print_frame" rather than "print_frame". This issue is now fixed.

gdb/Changelog:
2018-08-27  Jan Vrany  <jan.vrany@fit.cvut.cz>

* python/py-framefilter.c (py_print_frame): Print frame architecture
when printing on an MI output.

gdb/testsuite/Changelog:
2018-08-27  Jan Vrany  <jan.vrany@fit.cvut.cz>

* gdb.python/py-framefilter-mi.exp: Update regexp to
check for "arch" field in frame output.

5 years agoreadelf.c: Break multi-statement line
H.J. Lu [Mon, 27 Aug 2018 20:01:08 +0000 (13:01 -0700)] 
readelf.c: Break multi-statement line

* readelf.c (decode_x86_compat_isa): Break multi-statement line.
(decode_x86_isa): Likewise.
(decode_x86_feature_2): Likewise.

5 years agoRemove -Wno-narrowing from warnings.m4
Tom Tromey [Tue, 7 Aug 2018 19:14:09 +0000 (13:14 -0600)] 
Remove -Wno-narrowing from warnings.m4

This removes -Wno-narrowing from warnings.m4.
This is PR build/23087.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

PR build/23087:
* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS): Remove -Wno-narrowing.

gdb/gdbserver/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

PR build/23087:
* configure: Rebuild.

5 years agoAvoid -Wnarrowing warnings in aarch64-linux-tdep.c
Tom Tromey [Mon, 27 Aug 2018 17:55:39 +0000 (11:55 -0600)] 
Avoid -Wnarrowing warnings in aarch64-linux-tdep.c

This avoids -Wnarrowing warnings in
aarch64_linux_iterate_over_regset_sections, by adding some casts to
int.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* aarch64-linux-tdep.c
(aarch64_linux_iterate_over_regset_sections) <sve_regmap>: Add
casts to int.

5 years agoAvoid -Wnarrowing warnings in gdbserver
Tom Tromey [Tue, 7 Aug 2018 22:33:46 +0000 (16:33 -0600)] 
Avoid -Wnarrowing warnings in gdbserver

This avoids -Wnarrowing warnings in gdbserver, by introducing some
casts to unsigned char.

gdb/gdbserver/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* linux-s390-low.c (s390_emit_ext, s390_emit_litpool)
(s390_emit_const, s390_emit_reg, s390_emit_zero_ext)
(s390_emit_stack_adjust, s390_emit_set_r2, s390x_emit_ext)
(s390x_emit_const, s390x_emit_reg, s390x_emit_zero_ext)
(s390x_emit_stack_adjust): Add casts to unsigned char.

5 years agoAvoid -Wnarrowing warnings in ppc64-tdep.c
Tom Tromey [Tue, 7 Aug 2018 19:13:58 +0000 (13:13 -0600)] 
Avoid -Wnarrowing warnings in ppc64-tdep.c

This avoids -Wnarrowing warnings in ppc64-tdep.c, by adding a few
casts to unsigned.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* ppc64-tdep.c (insn_d, insn_ds, insn_xfx): Add casts to
unsigned.
(ppc64_standard_linkage1, ppc64_standard_linkage2)
(ppc64_standard_linkage3, ppc64_standard_linkage4)
(ppc64_standard_linkage5, ppc64_standard_linkage6)
(ppc64_standard_linkage7, ppc64_standard_linkage8): Add casts to
unsigned.

5 years agoFix two -Wnarrowing warnings in xtensa-tdep.h
Tom Tromey [Tue, 7 Aug 2018 19:07:21 +0000 (13:07 -0600)] 
Fix two -Wnarrowing warnings in xtensa-tdep.h

This fixes a couple of -Wnarrowing warnings in xtensa-tdep.h, by
introducing some casts to unsigned.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* xtensa-tdep.h (XTREG_END): Add cast to unsigned.
(XTENSA_GDBARCH_TDEP_INSTANTIATE): Likewise.

5 years agoAvoid -Wnarrowing warnings in struct tramp_frame instances
Tom Tromey [Tue, 7 Aug 2018 19:04:05 +0000 (13:04 -0600)] 
Avoid -Wnarrowing warnings in struct tramp_frame instances

This avoids -Wnarrowing warnings in struct tramp_frame instances,
replacing uses of -1 with a new ULONGEST_MAX.  It also redefined
TRAMP_SENTINEL_INSN to avoid the same warning.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* tramp-frame.h (TRAMP_SENTINEL_INSN): Redefine.
* tilegx-linux-tdep.c (tilegx_linux_rt_sigframe): Use
ULONGEST_MAX.
* tic6x-linux-tdep.c (tic6x_linux_rt_sigreturn_tramp_frame): Use
ULONGEST_MAX.
* sparc64-linux-tdep.c (sparc64_linux_rt_sigframe): Use
ULONGEST_MAX.
* sparc-linux-tdep.c (sparc32_linux_sigframe)
(sparc32_linux_rt_sigframe): Use ULONGEST_MAX.
* ppc-nbsd-tdep.c (ppcnbsd_sigtramp, ppcnbsd2_sigtramp): Use
ULONGEST_MAX.
* ppc-linux-tdep.c (ppc32_linux_sigaction_tramp_frame)
(ppc64_linux_sigaction_tramp_frame)
(ppc32_linux_sighandler_tramp_frame)
(ppc64_linux_sighandler_tramp_frame): Use ULONGEST_MAX.
* nios2-linux-tdep.c (nios2_r1_linux_rt_sigreturn_tramp_frame)
(nios2_r2_linux_rt_sigreturn_tramp_frame): Use ULONGEST_MAX.
* mn10300-linux-tdep.c (am33_linux_sigframe)
(am33_linux_rt_sigframe): Use ULONGEST_MAX.
* mips64-obsd-tdep.c (mips64obsd_sigframe): Use ULONGEST_MAX.
* mips-linux-tdep.c (mips_linux_o32_sigframe)
(mips_linux_o32_rt_sigframe, mips_linux_n32_rt_sigframe)
(mips_linux_n64_rt_sigframe, micromips_linux_o32_sigframe)
(micromips_linux_o32_rt_sigframe, micromips_linux_n32_rt_sigframe)
(micromips_linux_n64_rt_sigframe): Use ULONGEST_MAX.
* mips-fbsd-tdep.c (mips_fbsd_sigframe, mipsn32_fbsd_sigframe)
(mips64_fbsd_sigframe): Use ULONGEST_MAX.
* microblaze-linux-tdep.c
(microblaze_linux_sighandler_tramp_frame): Use ULONGEST_MAX.
* i386-nbsd-tdep.c (i386nbsd_sigtramp_sc16, i386nbsd_sigtramp_sc2)
(i386nbsd_sigtramp_si2, i386nbsd_sigtramp_si31)
(i386nbsd_sigtramp_si4): Use ULONGEST_MAX.
* hppa-nbsd-tdep.c (hppanbsd_sigtramp_si4): Use ULONGEST_MAX.
* common/common-types.h (ULONGEST_MAX): New define.
(CORE_ADDR_MAX): Fix formatting.
* bfin-linux-tdep.c (bfin_linux_sigframe): Use ULONGEST_MAX.
* arm-obsd-tdep.c (armobsd_sigframe): Use ULONGEST_MAX.
* arm-linux-tdep.c (arm_linux_sigreturn_tramp_frame)
(arm_linux_rt_sigreturn_tramp_frame)
(arm_eabi_linux_sigreturn_tramp_frame)
(arm_eabi_linux_rt_sigreturn_tramp_frame)
(thumb2_eabi_linux_sigreturn_tramp_frame)
(thumb2_eabi_linux_rt_sigreturn_tramp_frame)
(arm_linux_restart_syscall_tramp_frame)
(arm_kernel_linux_restart_syscall_tramp_frame): Use ULONGEST_MAX.
* arm-fbsd-tdep.c (arm_fbsd_sigframe): Use ULONGEST_MAX.
* aarch64-linux-tdep.c (aarch64_linux_rt_sigframe): Use
ULONGEST_MAX.
* aarch64-fbsd-tdep.c (aarch64_fbsd_sigframe): Use ULONGEST_MAX.

5 years agoUse CORE_ADDR_MAX in various "breaks" arrays
Tom Tromey [Tue, 7 Aug 2018 18:48:47 +0000 (12:48 -0600)] 
Use CORE_ADDR_MAX in various "breaks" arrays

Code like this:

  CORE_ADDR breaks[2] = {-1, -1};

... gives a warning with -Wnarrowing.  This patch changes all
instances of this to use CORE_ADDR_MAX instead.

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Use
CORE_ADDR_MAX.
* mips-tdep.c (mips_deal_with_atomic_sequence)
(micromips_deal_with_atomic_sequence): Use CORE_ADDR_MAX.
* arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw)
(arm_deal_with_atomic_sequence_raw): Use CORE_ADDR_MAX.
* alpha-tdep.c (alpha_deal_with_atomic_sequence): Use
CORE_ADDR_MAX.
* aarch64-tdep.c (aarch64_software_single_step): Use
CORE_ADDR_MAX.

5 years agoAvoid -Wnarrowing warnings from quote_char()
Tom Tromey [Thu, 9 Aug 2018 18:38:39 +0000 (12:38 -0600)] 
Avoid -Wnarrowing warnings from quote_char()

This adds a couple of casts to avoid -Wnarrowing warnings coming from
the use of quote_char().

gdb/ChangeLog
2018-08-27  Tom Tromey  <tom@tromey.com>

* linespec.c (complete_linespec_component): Add cast to "char".
* completer.c (completion_tracker::build_completion_result): Add
cast to "char".

5 years agoFix indentation in solist.h
Simon Marchi [Mon, 27 Aug 2018 00:05:48 +0000 (20:05 -0400)] 
Fix indentation in solist.h

gdb/ChangeLog:

* solist.h (struct solist, struct target_so_ops): Fix
indentation.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 27 Aug 2018 00:01:39 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoMake ada_tasks_inferior_data::task_list an std::vector
Simon Marchi [Sun, 26 Aug 2018 15:56:41 +0000 (11:56 -0400)] 
Make ada_tasks_inferior_data::task_list an std::vector

This removes a VEC type.  It requires converting ada_tasks_inferior_data
to C++ (initializing fields, allocating with new).  It seems, however,
that the allocated ada_tasks_inferior_data structures are never freed
(that should be fixed separately).

gdb/ChangeLog:

* ada-tasks.c (ada_task_info_s): Remove typedef.
(DEF_VEC_O(ada_task_info_s)): Remove.
(struct ada_tasks_inferior_data): Initialize fields.
<task_list>: Make an std::vector.
(get_ada_tasks_inferior_data): Allocate with new.
(ada_get_task_number): Adjust.
(get_task_number_from_id): Likewise.
(valid_task_id): Likewise.
(ada_get_task_info_from_ptid): Likewise.
(iterate_over_live_ada_tasks): Likewise.
(add_ada_task): Likewise.
(read_known_tasks): Likewise.
(ada_build_task_list): Likewise.
(print_ada_task_info): Likewise.
(info_task): Likewise.
(task_command_1): Likewise.

5 years agoMake ada-lang.c::add_angle_brackets return an std::string
Simon Marchi [Sun, 26 Aug 2018 15:53:47 +0000 (11:53 -0400)] 
Make ada-lang.c::add_angle_brackets return an std::string

This removes the need for manual memory management.  It may also be a
bit more efficient, since the returned string can be moved all the way
into the destination, in ada_lookup_name_info::matches.

gdb/ChangeLog:

* ada-lang.c (add_angle_brackets): Return std::string.

5 years agoDelay evaluation of alignment expressions in output sections
Alan Modra [Sun, 26 Aug 2018 04:53:38 +0000 (14:23 +0930)] 
Delay evaluation of alignment expressions in output sections

git commit 702d16713 broke expressions using CONSTANT(COMMONPAGESIZE)
in ALIGN or SUBALIGN of output section statements, because these
optional fields were evaluated at script parse time and the patch in
question delayed setting of config.commonpagesize.  The right thing to
do is keep the tree representation of those fields for later
evaluation.

PR 23571
* ldlang.h (section_alignment): Make it an expression tree.
(subsection_alignment): Likewise.
* ldlang.c (topower): Delete.
(output_section_statement_newfunc): Adjust initialization.
(init_os): Evaluate section_alignment.
(lang_size_sections_1): Likewise.
(size_input_section): Evaluate subsection_alignment.
(lang_enter_output_section_statement): Don't evaluate here.
(lang_new_phdr): Use exp_get_vma rather than exp_get_value_int.
* ldexp.h (exp_get_value_int): Delete.
(exp_get_power): Declare.
* ldexp.c (exp_get_value_int): Delete.
(exp_get_power): New function.
* emultempl/pe.em (place_orphan): Build expression for section
alignment.
* emultempl/pep.em (place_orphan): Likewise.
* testsuite/ld-scripts/pr23571.d,
* testsuite/ld-scripts/pr23571.t: New test.
* testsuite/ld-scripts/align.exp: Run it.

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 26 Aug 2018 00:01:07 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoInitialize variable in py_get_event_thread
Simon Marchi [Sat, 25 Aug 2018 15:52:24 +0000 (11:52 -0400)] 
Initialize variable in py_get_event_thread

The pythread variable could be used without being initialized, fix it by
initializing it to nullptr.

gdb/ChangeLog:

* python/py-threadevent.c (py_get_event_thread): Initialize
pythread.

5 years agoelf: Check for corrupt symbol version info
H.J. Lu [Sat, 25 Aug 2018 13:17:52 +0000 (06:17 -0700)] 
elf: Check for corrupt symbol version info

The BFD linker with PR ld/23499 may generate shared libraries with
corrupt symbol version info which leads to linker error when the
corrupt shared library is used:

/usr/bin/ld: bin/libKF5Service.so.5.49.0: _edata: invalid version 21 (max 0)
/usr/bin/ld: bin/libKF5Service.so.5.49.0: error adding symbols: bad value

Add check for corrupt symbol version info to objdump:

00000000000af005 g    D  .data 0000000000000000  <corrupt>   _edata

and readelf:

   728: 00000000000af005     0 NOTYPE  GLOBAL DEFAULT   25 _edata@<corrupt> (5)

bfd/

PR ld/23499
* elf.c (_bfd_elf_get_symbol_version_string): Return
_("<corrupt>") for corrupt symbol version info.

binutils/

PR ld/23499
* readelf.c (get_symbol_version_string): Return _("<corrupt>")
for corrupt symbol version info.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 25 Aug 2018 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agogdb/python: Use copy-initialization more when possible
Pedro Alves [Fri, 24 Aug 2018 19:09:19 +0000 (20:09 +0100)] 
gdb/python: Use copy-initialization more when possible

gdb/ChangeLog:
2018-08-24  Pedro Alves  <palves@redhat.com>

* python/py-bpevent.c (create_breakpoint_event_object): Use
copy-initialization.
* python/py-continueevent.c (emit_continue_event): Use
copy-initialization.
* python/py-exitedevent.c (create_exited_event_object): Return a
gdbpy_ref<>.
(emit_exited_event): Use copy-initialization.
* python/py-inferior.c (python_new_inferior)
(python_inferior_deleted, add_thread_object): Use
copy-initialization.
* python/py-infevents.c (create_inferior_call_event_object)
(create_register_changed_event_object)
(create_memory_changed_event_object): Return a gdbpy_ref<>.
(emit_inferior_call_event, emit_memory_changed_event)
(emit_register_changed_event): Use copy-initialization.
* python/py-newobjfileevent.c (create_new_objfile_event_object):
Return a gdbpy_ref<>.
(emit_new_objfile_event): Use copy-initialization.
(create_clear_objfiles_event_object): Return a gdbpy_ref<>.
(emit_clear_objfiles_event): Use copy-initialization.
* python/py-signalevent.c (create_signal_event_object): Use
copy-initialization.
* python/py-threadevent.c (create_thread_event_object): Use
copy-initialization.

5 years agoFix 8.2 regression in gdb.python/py-evthreads.exp w/ gdbserver (PR gdb/23379)
Pedro Alves [Fri, 24 Aug 2018 21:13:30 +0000 (22:13 +0100)] 
Fix 8.2 regression in gdb.python/py-evthreads.exp w/ gdbserver (PR gdb/23379)

This commit fixes a 8.1->8.2 regression exposed by
gdb.python/py-evthreads.exp when testing with
--target_board=native-gdbserver.

gdb.log shows:

  src/gdb/thread.c:93: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) FAIL: gdb.python/py-evthreads.exp: run to breakpoint 1 (GDB internal error)

A backtrace shows (frames #2 and #10 highlighted) that the assertion
fails when GDB is setting up the connection to the remote target, in
non-stop mode:

  #0  0x0000000000622ff0 in internal_error(char const*, int, char const*, ...) (file=0xc1ad98 "src/gdb/thread.c", line=93, fmt=0xc1ad20 "%s: Assertion `%s' failed.") at src/gdb/common/errors.c:54
  #1  0x000000000089567e in inferior_thread() () at src/gdb/thread.c:93
= #2  0x00000000004da91d in get_event_thread() () at src/gdb/python/py-threadevent.c:38
  #3  0x00000000004da9b7 in create_thread_event_object(_typeobject*, _object*) (py_type=0x11574c0 <continue_event_object_type>, thread=0x0)
      at src/gdb/python/py-threadevent.c:60
  #4  0x00000000004bf6fe in create_continue_event_object() () at src/gdb/python/py-continueevent.c:27
  #5  0x00000000004bf738 in emit_continue_event(ptid_t) (ptid=...) at src/gdb/python/py-continueevent.c:40
  #6  0x00000000004c7d47 in python_on_resume(ptid_t) (ptid=...) at src/gdb/python/py-inferior.c:108
  #7  0x0000000000485bfb in std::_Function_handler<void (ptid_t), void (*)(ptid_t)>::_M_invoke(std::_Any_data const&, ptid_t&&) (__functor=..., __args#0=...) at /usr/include/c++/7/bits/std_function.h:316
  #8  0x000000000089b416 in std::function<void (ptid_t)>::operator()(ptid_t) const (this=0x12aa600, __args#0=...)
      at /usr/include/c++/7/bits/std_function.h:706
  #9  0x000000000089aa0e in gdb::observers::observable<ptid_t>::notify(ptid_t) const (this=0x118a7a0 <gdb::observers::target_resumed>, args#0=...)
      at src/gdb/common/observable.h:106
= #10 0x0000000000896fbe in set_running(ptid_t, int) (ptid=..., running=1) at src/gdb/thread.c:880
  #11 0x00000000007f750f in remote_target::remote_add_thread(ptid_t, bool, bool) (this=0x12c5440, ptid=..., running=true, executing=true) at src/gdb/remote.c:2434
  #12 0x00000000007f779d in remote_target::remote_notice_new_inferior(ptid_t, int) (this=0x12c5440, currthread=..., executing=1)
      at src/gdb/remote.c:2515
  #13 0x00000000007f9c44 in remote_target::update_thread_list() (this=0x12c5440) at src/gdb/remote.c:3831
  #14 0x00000000007fb922 in remote_target::start_remote(int, int) (this=0x12c5440, from_tty=0, extended_p=0)
      at src/gdb/remote.c:4655
  #15 0x00000000007fd102 in remote_target::open_1(char const*, int, int) (name=0x1a4f45e "localhost:2346", from_tty=0, extended_p=0)
      at src/gdb/remote.c:5638
  #16 0x00000000007fbec1 in remote_target::open(char const*, int) (name=0x1a4f45e "localhost:2346", from_tty=0)
      at src/gdb/remote.c:4862

So on frame #10, we're marking a newly-discovered thread as running,
and that causes the Python API to emit a gdb.ContinueEvent.
gdb.ContinueEvent is a gdb.ThreadEvent, and as such includes the event
thread as the "inferior_thread" attribute.  The problem is that when
we get to frame #3/#4, we lost all references to the thread that is
being marked as running.  create_continue_event_object assumes that it
is the current thread, which is not true in this case.

Fix this by passing down the right thread in
create_continue_event_object.  Also remove
create_thread_event_object's default argument and have the only other
caller left pass down the right thread explicitly too.

gdb/ChangeLog:
2018-08-24  Pedro Alves  <palves@redhat.com>
    Simon Marchi  <simon.marchi@ericsson.com>

PR gdb/23379
* python/py-continueevent.c: Include "gdbthread.h".
(create_continue_event_object): Add intro comment.  Add 'ptid'
parameter.  Use it to find thread to pass to
create_thread_event_object.
(emit_continue_event): Pass PTID down to
create_continue_event_object.
* python/py-event.h (py_get_event_thread): Declare.
(create_thread_event_object): Remove default from 'thread'
parameter.
* python/py-stopevent.c (create_stop_event_object): Use
py_get_event_thread.
* python/py-threadevent.c (get_event_thread): Rename to ...
(py_get_event_thread): ... this, make extern, add 'ptid' parameter
and use it to find the thread.
(create_thread_event_object): Assert that THREAD isn't null.
Don't find the event thread here.

5 years ago[PATCH] [MIPS] LD/testsuite: Skip 32bit test if ld not support.
Chenghua Xu [Fri, 24 Aug 2018 13:25:15 +0000 (21:25 +0800)] 
[PATCH] [MIPS] LD/testsuite: Skip 32bit test if ld not support.

ld/ChangeLog:

    * testsuite/ld-mips-elf/mips-elf-flags.exp
    (check_ld_support_32bit, check_is_32bit_args): New procedures.
    (good_combination, bad_combination): Skip 32bit test if ld
    not support 32bit emulations.

5 years agox86: Update GNU_PROPERTY_X86_XXX macros
H.J. Lu [Fri, 24 Aug 2018 11:41:50 +0000 (04:41 -0700)] 
x86: Update GNU_PROPERTY_X86_XXX macros

This patch updates GNU_PROPERTY_X86_XXX macros:

1. GNU_PROPERTY_X86_UINT32_AND_XXX: A 4-byte unsigned integer property.
A bit is set if it is set in all relocatable inputs:

 #define GNU_PROPERTY_X86_UINT32_AND_LO      0xc0000002
 #define GNU_PROPERTY_X86_UINT32_AND_HI      0xc0007fff

2. GNU_PROPERTY_X86_UINT32_OR_XXX: A 4-byte unsigned integer property.
A bit is set if it is set in any relocatable inputs:

 #define GNU_PROPERTY_X86_UINT32_OR_LO    0xc0008000
 #define GNU_PROPERTY_X86_UINT32_OR_HI    0xc000ffff

3. GNU_PROPERTY_X86_UINT32_OR_AND_XXX: A 4-byte unsigned integer property.
A bit is set if it is set in any relocatable inputs and the property is
present in all relocatable inputs:

 #define GNU_PROPERTY_X86_UINT32_OR_AND_LO   0xc0010000
 #define GNU_PROPERTY_X86_UINT32_OR_AND_HI   0xc0017fff

4. GNU_PROPERTY_X86_FEATURE_2_NEEDED, GNU_PROPERTY_X86_FEATURE_2_USED
and GNU_PROPERTY_X86_FEATURE_2_XXX bits.

GNU_PROPERTY_X86_FEATURE_1_AND is unchanged.  GNU_PROPERTY_X86_ISA_1_USED
and GNU_PROPERTY_X86_ISA_1_NEEDED are updated to better support targeted
processors since GNU_PROPERTY_X86_ISA_1_?86 aren't isn't very useful.
A new set of GNU_PROPERTY_X86_ISA_1_XXX bits are defined.  The previous
GNU_PROPERTY_X86_ISA_1_XXX macros are deprecated and renamed to
GNU_PROPERTY_X86_COMPAT_ISA_1_XXX.

bfd/

* elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Handle
X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED,
X86_UINT32_AND_LO, X86_UINT32_AND_HI, X86_UINT32_OR_LO,
X86_UINT32_OR_HI, X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI
instead of X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND.
(_bfd_x86_elf_merge_gnu_properties): Likewise.
(_bfd_x86_elf_link_setup_gnu_properties): Add X86_FEATURE_2_NEEDED
instead of X86_ISA_1_NEEDED.
(_bfd_x86_elf_link_fixup_gnu_properties): Handle
X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED, X86_UINT32_AND_LO,
X86_UINT32_AND_HI, X86_UINT32_OR_LO, X86_UINT32_OR_HI,
X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI instead of
X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND.

binutils/

* readelf.c (decode_x86_compat_isa): New function.
(decode_x86_feature_2): Likewise.
(decode_x86_isa): Updated for new X86_ISA_1_XXX bits.
(decode_x86_feature): Renamed to ...
(decode_x86_feature_1): This.  Remove the type argument.
(print_gnu_property_note): Handle X86_COMPAT_ISA_1_USED,
X86_COMPAT_ISA_1_NEEDED, X86_UINT32_AND_LO, X86_UINT32_AND_HI,
X86_UINT32_OR_LO, X86_UINT32_OR_HI, X86_UINT32_OR_AND_LO and
X86_UINT32_OR_AND_HI instead of X86_ISA_1_USED, X86_ISA_1_NEEDED
and X86_FEATURE_1_AND.
* testsuite/binutils-all/i386/pr21231b.s: Updated to the current
GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
values.
* testsuite/binutils-all/x86-64/pr21231b.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.s: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Updated.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.

include/

* elf/common.h (GNU_PROPERTY_X86_ISA_1_USED): Renamed to ...
(GNU_PROPERTY_X86_COMPAT_ISA_1_USED): This.
(GNU_PROPERTY_X86_ISA_1_NEEDED): Renamed to ...
(GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED): This.
(GNU_PROPERTY_X86_ISA_1_XXX): Renamed to ...
(GNU_PROPERTY_X86_COMPAT_ISA_1_XXX): This.
(GNU_PROPERTY_X86_UINT32_AND_LO): New.
(GNU_PROPERTY_X86_UINT32_AND_HI): Likewise.
(GNU_PROPERTY_X86_UINT32_OR_LO): Likewise.
(GNU_PROPERTY_X86_UINT32_OR_HI): Likewise.
(GNU_PROPERTY_X86_UINT32_OR_AND_LO): Likewise.
(GNU_PROPERTY_X86_UINT32_OR_AND_HI): Likewise.
(GNU_PROPERTY_X86_ISA_1_CMOV): Likewise.
(GNU_PROPERTY_X86_ISA_1_SSE): Likewise.
(GNU_PROPERTY_X86_ISA_1_SSE2): Likewise.
(GNU_PROPERTY_X86_ISA_1_SSE3): Likewise.
(GNU_PROPERTY_X86_ISA_1_SSSE3): Likewise.
(GNU_PROPERTY_X86_ISA_1_SSE4_1): Likewise.
(GNU_PROPERTY_X86_ISA_1_SSE4_2): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX2): Likewise.
(GNU_PROPERTY_X86_ISA_1_FMA): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512F): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512CD): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512ER): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512PF): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512VL): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512DQ): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512BW): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_4FMAPS): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_4VNNIW): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_BITALG): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_IFMA): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_VBMI): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_VBMI2): Likewise.
(GNU_PROPERTY_X86_ISA_1_AVX512_VNNI): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_X86): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_X87): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_MMX): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_XMM): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_YMM): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_ZMM): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_FXSR): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_XSAVE): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT): Likewise.
(GNU_PROPERTY_X86_FEATURE_2_XSAVEC): Likewise.
(GNU_PROPERTY_X86_FEATURE_1_AND): Updated to
(GNU_PROPERTY_X86_UINT32_AND_LO + 0).
(GNU_PROPERTY_X86_ISA_1_NEEDED): Defined to
(GNU_PROPERTY_X86_UINT32_OR_LO + 0).
(GNU_PROPERTY_X86_FEATURE_2_NEEDED): New.  Defined to
(GNU_PROPERTY_X86_UINT32_OR_LO + 1).
(GNU_PROPERTY_X86_ISA_1_USED): Defined to
(GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0).
(GNU_PROPERTY_X86_FEATURE_2_USED): New.  Defined to
(GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1).

ld/

* testsuite/ld-i386/i386.exp: Run pr23372c, pr23372d, pr23486c
and pr23486d.
* testsuite/ld-i386/pr23372a.s: Update comments.
* testsuite/ld-i386/pr23372b.s: Likewise.
* testsuite/ld-i386/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23372a.s: Likewise.
* testsuite/ld-x86-64/pr23372b.s: Likewise.
* testsuite/ld-x86-64/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23486a.s: Likewise.
* testsuite/ld-x86-64/pr23486b.s: Likewise.
* testsuite/ld-i386/pr23372c.d: New file.
* testsuite/ld-i386/pr23372d.d: Likewise.
* testsuite/ld-i386/pr23486c.d: Likewise.
* testsuite/ld-i386/pr23486d.d: Likewise.
* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372c.d: Likewise.
* testsuite/ld-x86-64/pr23372d-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372d.d: Likewise.
* testsuite/ld-x86-64/pr23372d.s: Likewise.
* testsuite/ld-x86-64/pr23372e.s: Likewise.
* testsuite/ld-x86-64/pr23372f.s: Likewise.
* testsuite/ld-x86-64/pr23486c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486c.d: Likewise.
* testsuite/ld-x86-64/pr23486c.s: Likewise.
* testsuite/ld-x86-64/pr23486d-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486d.d: Likewise.
* testsuite/ld-x86-64/pr23486d.s: Likewise.
* testsuite/ld-i386/property-3.r: Updated.
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-x86-3.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-5.r: Likewise.
* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-3.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
* testsuite/ld-i386/property-x86-1.S: Updated to the current
GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
values.
* testsuite/ld-i386/property-x86-2.S: Likewise.
* testsuite/ld-i386/property-x86-3.s: Likewise.
* testsuite/ld-x86-64/property-x86-1.S: Likewise.
* testsuite/ld-x86-64/property-x86-2.S: Likewise.
* testsuite/ld-x86-64/property-x86-3.s: Likewise.
* ld/testsuite/ld-x86-64/x86-64.exp: Run pr23372c, pr23372c-x32,
pr23372d, pr23372d-x32, pr23486c, pr23486c-x32, pr23486d and
pr23486d-x32.

5 years agox86: Add GNU_PROPERTY_X86_UINT32_VALID
H.J. Lu [Fri, 24 Aug 2018 11:37:45 +0000 (04:37 -0700)] 
x86: Add GNU_PROPERTY_X86_UINT32_VALID

The older linker treats .note.gnu.property section as a generic note
and just concatenates all .note.gnu.property sections from the input
to the output.  On CET-enabled OS, the output of the older linker is
marked as CET enabled, but in fact, it is not CET enabled and it crashes
on CET-enabled machines.

This patch defines GNU_PROPERTY_X86_UINT32_VALID.  Linker is updated to
set the GNU_PROPERTY_X86_UINT32_VALID bit in GNU property note for
non-relocatable output to differentiate outputs from the older linker.

bfd/

* elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Mask out the
GNU_PROPERTY_X86_UINT32_VALID bit.
(_bfd_x86_elf_link_fixup_gnu_properties): Set the
GNU_PROPERTY_X86_UINT32_VALID bit for non-relocatable output.

binutils/

* readelf.c (print_gnu_property_note): Check the
GNU_PROPERTY_X86_UINT32_VALID bit for invalid GNU property note.

include/

* elf/common.h (GNU_PROPERTY_X86_UINT32_VALID): New.

5 years agoehdr_start twiddles
Alan Modra [Fri, 24 Aug 2018 08:07:53 +0000 (17:37 +0930)] 
ehdr_start twiddles

We force __ehdr_start to defined in before_allocation, then restore
the type and a union after dynamic symbols have been allocated.
The union contains a number of structs, all starting with a "next"
pointer, and various fields depending on the symbol type.  The old
code restored the entire union, but it isn't necessary to restore the
"next" pointer, and in fact it could be wrong if __ehdr_start happened
to be last on the list and some symbols were added before restoring.

* emultempl/elf32.em (before_allocation): Don't restore
__ehdr_start u.*.next pointer.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 24 Aug 2018 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoTest case for functions with non-contiguous ranges
Kevin Buettner [Thu, 23 Aug 2018 23:00:50 +0000 (16:00 -0700)] 
Test case for functions with non-contiguous ranges

See comments in the new files for what this is about - I tried to
explain it all there.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/dw2-ranges-func.c: New file.
* gdb.dwarf2/dw2-ranges-func.exp: New file.

5 years agoRelocate block range start and end addresses
Kevin Buettner [Thu, 23 Aug 2018 23:00:50 +0000 (16:00 -0700)] 
Relocate block range start and end addresses

gdb/ChangeLog:

* objfiles.c (objfile_relocate1): Relocate start and end addresses
for each range in a block.

5 years agoIntroduce find_function_entry_range_from_pc and use it in infrun.c
Kevin Buettner [Thu, 23 Aug 2018 23:00:49 +0000 (16:00 -0700)] 
Introduce find_function_entry_range_from_pc and use it in infrun.c

An earlier version of this patch used the returned block in conjunction
with BLOCK_ENTRY_PC to set stop_func_start in fill_in_stop_func() in
infrun.c.  While I think this was the correct thing to do, changes
to find_inferior_partial_function could potentially end up with
stop_func_end < stop_func_start, which is definitely wrong.  For
this case, we want to set both stop_func_start and stop_func_end
to the start and end of the range containing the function's entry
pc.

I think that this functionality will be useful in many other places
too - it probably ought to be used in all of the various prologue
analyzers in GDB.

The change to infrun.c was simple: the call to
find_pc_partial_function was replaced with a call to
find_function_entry_range_from_pc.  The difference between these two
functions is that find_pc_partial_entry_function will (potentially)
return the start and end address corresponding to the range in which
PC is found, but find_function_entry_range_from_pc will (again,
potentially) return the start and end address of the range containing
the entry pc.  find_pc_partial_function has the property that
*ADDRESS <= PC < *ENDADDR.  This condition does not necessarily hold
for the outputs of find_function_entry_range_from_pc.

It should be noted that for functions which contain only a single
range, the outputs of find_pc_partial_function and
find_function_entry_range_from_pc are identical.

I think it might happen that find_function_entry_range_from_pc will come
to be used in place of many of the calls to find_pc_partial_function
within GDB.  Care must be taken in making this change, however, since
some of this code depends on the *ADDRESS <= PC < *ENDADDR property.

Finally, a note regarding the name: I had initially chosen a different
name with a find_pc_partial_ prefix, but Simon suggested the current
name citing the goal of eventually making naming consistent using
the form find_X_from_Y.  In this case X is "function_entry_range" and
Y is "pc".  Both the name and rationale made sense to me, so that's
how it came to be.

gdb/ChangeLog:

* infrun.c (fill_in_stop_func): Use find_function_entry_range_from_pc
in place of find_pc_partial_function.
* blockframe.c (find_function_entry_range_from_pc): New function.
* symtab.h (find_function_entry_range_from_pc): Declare and document.

5 years agoUse BLOCK_ENTRY_PC in place of most uses of BLOCK_START
Kevin Buettner [Thu, 23 Aug 2018 23:00:49 +0000 (16:00 -0700)] 
Use BLOCK_ENTRY_PC in place of most uses of BLOCK_START

This change/patch substitues BLOCK_ENTRY_PC for BLOCK_START in
places where BLOCK_START is used to obtain the address at which
execution should enter the block.  Since blocks can now contain
non-contiguous ranges, the BLOCK_START - which is still be the
very lowest address in the block - might not be the same as
BLOCK_ENTRY_PC.

There is a change to infrun.c which is less obvious and less mechanical.
I'm posting it as a separate patch.

gdb/ChangeLog:

* ax-gdb.c (gen_var_ref): Use BLOCK_ENTRY_PC in place of
BLOCK_START.
* blockframe.c (get_pc_function_start): Likewise.
* compile/compile-c-symbols.c (convert_one_symbol): Likewise.
(gcc_symbol_address): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* compile/compile.c (get_expr_block_and_pc): Likewise.
* dwarf2loc.c (dwarf2_find_location_expression): Likewise.
(func_addr_to_tail_call_list): Likewise.
* findvar.c (default_read_var_value): Likewise.
* inline-frame.c (inline_frame_this_id): Likewise.
(skip-inline_frames): Likewise.
* infcmd.c (until_next_command): Likewise.
* linespec.c (convert_linespec_to_sals): Likewise.
* parse.c (parse_exp_in_context_1): Likewise.
* printcmd.c (build_address_symbolic): likewise.
(info_address_command): Likewise.
symtab.c (find_function_start_sal): Likewise.
(skip_prologue_sal): Likewise.
(find_function_alias_target): Likewise.
(find_gnu_ifunc): Likewise.
* stack.c (find_frame_funname): Likewise.
* symtab.c (fixup_symbol_section): Likewise.
(find_function_start_sal): Likewise.
(skip_prologue_sal): Likewsie.
(find_function_alias_target): Likewise.
(find_gnu_ifunc): Likewise.
* tracepoint.c (info_scope_command): Likewise.
* value.c (value_fn_field): Likewise.

5 years agoDisassemble blocks with non-contiguous ranges
Kevin Buettner [Thu, 23 Aug 2018 23:00:49 +0000 (16:00 -0700)] 
Disassemble blocks with non-contiguous ranges

This patch adds support for disassembly of blocks with non-contiguous
ranges.  These blocks are printed as follows:

(gdb) disassemble foo
Dump of assembler code for function foo:
Address range 0x401136 to 0x401151:
   0x0000000000401136 <+0>:     push   %rbp
   0x0000000000401137 <+1>:     mov    %rsp,%rbp
   0x000000000040113a <+4>:     callq  0x401134 <bar>
   0x000000000040113f <+9>:     mov    0x2eef(%rip),%eax        # 0x404034 <e>
   0x0000000000401145 <+15>:    test   %eax,%eax
   0x0000000000401147 <+17>:    je     0x40114e <foo+24>
   0x0000000000401149 <+19>:    callq  0x401128 <foo+4294967282>
   0x000000000040114e <+24>:    nop
   0x000000000040114f <+25>:    pop    %rbp
   0x0000000000401150 <+26>:    retq
Address range 0x401128 to 0x401134:
   0x0000000000401128 <+-14>:   push   %rbp
   0x0000000000401129 <+-13>:   mov    %rsp,%rbp
   0x000000000040112c <+-10>:   callq  0x401126 <baz>
   0x0000000000401131 <+-5>:    nop
   0x0000000000401132 <+-4>:    pop    %rbp
   0x0000000000401133 <+-3>:    retq
End of assembler dump.

This is an actual dump from the test case that I constructed for
this work.  The ranges are printed in the order encountered in the
debug info. For the above example, note that the second range occupies
lower addresses than the first range.

Functions with contiguous ranges are still printed as follows:

(gdb) disassemble main
Dump of assembler code for function main:
   0x0000000000401151 <+0>:     push   %rbp
   0x0000000000401152 <+1>:     mov    %rsp,%rbp
   0x0000000000401155 <+4>:     callq  0x401136 <foo>
   0x000000000040115a <+9>:     mov    $0x0,%eax
   0x000000000040115f <+14>:    pop    %rbp
   0x0000000000401160 <+15>:    retq
End of assembler dump.

gdb/ChangeLog:

* cli/cli-cmds.c (block.h): Include.
(print_disassembly): Handle printing of non-contiguous blocks.
(disassemble_current_function): Likewise.
(disassemble_command): Likewise.

5 years agoAdd support for non-contiguous blocks to find_pc_partial_function
Kevin Buettner [Thu, 23 Aug 2018 23:00:49 +0000 (16:00 -0700)] 
Add support for non-contiguous blocks to find_pc_partial_function

This change adds an optional output parameter BLOCK to
find_pc_partial_function.  If BLOCK is non-null, then *BLOCK will be
set to the address of the block corresponding to the function symbol
if such a symbol was found during lookup.  Otherwise it's set to the
NULL value.  Callers may wish to use the block information to
determine whether the block contains any non-contiguous ranges.  The
caller may also iterate over or examine those ranges.

When I first started looking at the broken stepping behavior associated
with functions w/ non-contiguous ranges, I found that I could "fix"
the problem by disabling the find_pc_partial_function cache.  It would
sometimes happen that the PC passed in would be between the low and
high cache values, but would be in some other function that happens to
be placed in between the ranges for the cached function.  This caused
incorrect values to be returned.

So dealing with this cache turns out to be very important for fixing
this problem.  I explored three different ways of dealing with the
cache.

My first approach was to clear the cache when a block was encountered
with more than one range.  This would cause the non-cache pathway to
be executed on the next call to find_pc_partial_function.

Another approach, which I suspect is slightly faster, checks to see
whether the PC is within one of the ranges associated with the cached
block.  If so, then the cached values can be used.  It falls back to
the original behavior if there is no cached block.

The current approach, suggested by Simon Marchi, is to restrict the
low/high pc values recorded for the cache to the beginning and end of
the range containing the PC value under consideration.  This allows us
to retain the simple (and fast) test for determining whether the
memoized (cached) values apply to the PC passed to
find_pc_partial_function.

Another choice that had to be made regards setting *ADDRESS and
*ENDADDR.  There are three possibilities which might make sense:

1) *ADDRESS and *ENDADDR represent the lowest and highest address
   of the function.
2) *ADDRESS and *ENDADDR are set to the start and end address of
   the range containing the entry pc.
3) *ADDRESS and *ENDADDR are set to the start and end address of
   the range in which PC is found.

An earlier version of this patch implemented option #1.  I found out
that it's not very useful though and, in fact, returns results that
are incorrect when used in the context of determining the start and
end of the function for doing prologue analysis.  While debugging a
function in which the entry pc was in the second range (of a function
containing two non-contiguous ranges), I noticed that
amd64_skip_prologue called find_pc_partial_function - the returned
start address was set to the beginning of the first range.  This is
incorrect for this function.  What was also interesting was that this
first invocation of find_pc_partial_function correctly set the cache
for the PC on which it had been invoked, but a slightly later call
from skip_prologue_using_sal could not use this cached value because
it was now being used to lookup the very lowest address of the
function - which is in a range not containing the entry pc.

Option #2 is attractive as it would provide a desirable result
when used in the context of prologue analysis.  However, many callers,
including some which do prologue analysis want the condition
*ADDRESS <= PC < *ENDADDR to hold.  This will not be the case when
find_pc_partial_function is called on a PC that's in a non-entry-pc
range.  A later patch to this series adds
find_function_entry_range_from_pc as a wrapper of
find_pc_partial_function.

Option #3 causes the *ADDRESS <= PC < *ENDADDR property to hold.  If
find_pc_partial_function is called with a PC that's within entry pc's
range, then it will correctly return the limits of that range.  So, if
the result of a minsym search is passed to find_pc_partial_function
to find the limits, then correct results will be achieved.  Returned
limits (for prologue analysis) won't be correct when PC is within some
other (non-entry-pc) range.  I don't yet know how big of a problem
this might be; I'm guessing that it won't be a serious problem - if a
compiler generates functions which have non-contiguous ranges, then it
also probably generates DWARF2 CFI which makes a lot of the old
prologue analysis moot.

I've implemented option #3 for this version of the patch.  I don't see
any regressions for x86-64.  Moreover, I don't expect to see
regressions for other targets either simply because
find_pc_partial_function behaves the same as it did before for the
contiguous address range case.  That said, there may be some
adjustments needed if GDB encounters a function requiring prologue
analysis which occupies non-contiguous ranges.

gdb/ChangeLog:

* symtab.h (find_pc_partial_function): Add new parameter `block'.
* blockframe.c (cache_pc_function_block): New static global.
(clear_pc_function_cache): Clear cache_pc_function_block.
(find_pc_partial_function): Move comment to symtab.h.  Add
support for non-contiguous blocks.

5 years agoRecord explicit block ranges from dwarf2read.c
Kevin Buettner [Thu, 23 Aug 2018 23:00:49 +0000 (16:00 -0700)] 
Record explicit block ranges from dwarf2read.c

This change sets BLOCK_RANGES for the block under consideration by
calling make_blockranges().  This action is performed in
dwarf2_record_block_ranges().

It should be noted that dwarf2_record_block_ranges() already does some
recording of the range via a call to record_block_range().  The ranges
recorded in that fashion end up in the address map associated with the
blockvector for the compilation unit's symtab.  Given an address, the
addrmap provides a fast way of finding the block containing that
address.  The address map does not, however, provide a convenient way
of determining which address ranges make up a particular block.

While reading a set of ranges, a vector of pairs is used to collect
the starting and ending addresses for each range in the block.  Once
all of the ranges for a block have been collected, make_blockranges()
is called to fill in BLOCK_RANGES for the block.

The ranges are stored for the block in the order that they're read
from the debug info.  For DWARF, the starting address of the first
range of the block will be the entry pc in cases where DW_AT_entry_pc
is not present.  (Well, that would ideally be the case.  At the moment
DW_AT_entry_pc is not being handled.)

gdb/ChangeLog:

* dwarf2read.c (dwarf2_record_block_ranges): Fill in BLOCK_RANGES
for block.

5 years agoAdd block range data structure for blocks with non-contiguous address ranges
Kevin Buettner [Thu, 23 Aug 2018 23:00:48 +0000 (16:00 -0700)] 
Add block range data structure for blocks with non-contiguous address ranges

This patch does the following:

- Introduces a block range data structure which is accessed via
  a new field in struct block.
- Defines several macros for accessing block ranges.
- Defines a new function, make_blockrange, which is responsible for
  creating the new data structure.

It should be noted that some support for non-contiguous ranges already
existed in GDB in the form of blockvector addrmaps.  This support
allowed GDB to quickly find a block containing a particular address
even when the block consists of non-contiguous addresses.  See
find_block_in_blockvector() in block.c, dwarf2_record_block_ranges()
in dwarf2read.c, and record_block_range() in buildsym.c.

Addrmaps do not provide a convenient way to examine address ranges
associated with a particular block.  This data structure (and its
interface) is set up for quickly finding the value (which in this case
is a block) associated with a particular address.  The interface
does not include a method for doing a reverse mapping from blocks to
addresses.  A linear time mapping might be attempted via use of the
addrmap's foreach method, but this is not as straightforward as it
might first appear due to the fact that blocks corresponding to inline
function instances and lexical blocks w/ variables end up getting
interspersed in in the set of transitions.

Note:  If this approach is deemed to be too expensive in terms of
space, an alternate approach might be to attempt the linear time
mapping noted above.  find_pc_partial_function() needs to be able to
quickly know whether there are discontiguous ranges, so a flag for
this property would have to be added to struct block.  Also integral
to this set of changes is the concept of an "entry pc" which might be
different from the block's start address.  An entry_pc field would
also need to be added to struct block.  This does not result in any
space savings in struct block though since the space for the flag and
entry_pc use more space than the blockranges struct pointer that I've
added.  There would, however, be some space savings due to the fact
that the new data structures that I've added for this patch would not
need to be allocated.  (I happen to like the approach I've come up
with, but I wanted to mention another possibility just in case someone
does not.)

gdb/ChangeLog:

* block.h (blockrange, blockranges): New struct declarations.
(struct block): Add new field named `ranges'.
(BLOCK_RANGES, BLOCK_NRANGES, BLOCK_RANGE, BLOCK_CONTIGUOUS_P)
(BLOCK_RANGE_START, BLOCK_RANGE_END, BLOCK_ENTRY_PC): New
macros for accessing ranges in struct block.
(make_blockranges): New declaration.
block.c (make_blockranges): New function.

5 years agoRISC-V: Reject empty rouding mode and fence operand.
Jim Wilson [Thu, 23 Aug 2018 20:26:48 +0000 (13:26 -0700)] 
RISC-V: Reject empty rouding mode and fence operand.

gas/
2018-08-23  Kito Cheng  <kito@andestech.com>
* config/tc-riscv.c (arg_lookup): Checking
length before look up.
* testsuite/gas/riscv/fence-fail.d: New file.
* testsuite/gas/riscv/fence-fail.l: Likewise.
* testsuite/gas/riscv/fence-fail.s: Likewise.
* testsuite/gas/riscv/rouding-fail.d: Likewise.
* testsuite/gas/riscv/rouding-fail.l: Likewise.
* testsuite/gas/riscv/rouding-fail.s: Likewise.

5 years agoAvoid problems with plugins being loaded multiple times.
Zenith423 [Thu, 23 Aug 2018 15:22:56 +0000 (16:22 +0100)] 
Avoid problems with plugins being loaded multiple times.

PR 23460
* plugin.c (struct plugin_list_entry): New structure.
(plugin_list): New variable.
(try_load_plugin): Place opened plugins on a list.  Ensure that
the refcount in the dynamic loader is kept at 1.

5 years agoDarwin: fix bad loop incrementation
Xavier Roirand [Thu, 23 Aug 2018 15:17:03 +0000 (11:17 -0400)] 
Darwin: fix bad loop incrementation

When reading symbols from the vector of oso files on Mac OS X
Darwin, a previous commit introduce a change in the loop and add
an increment at each loop iteration whereas this incrementation is
not needed since the increment or set of the loop control variable
is already done in the loop.

gdb/ChangeLog:

* machoread.c (macho_symfile_read_all_oso): Remove uneeded
incrementation.

Change-Id: I3a5a6deb4e9d834ee7d4217a62d90c2ffb7241bc

5 years agoPR23566, false uninitialized warning
Alan Modra [Thu, 23 Aug 2018 14:50:05 +0000 (00:20 +0930)] 
PR23566, false uninitialized warning

PR 23566
* emultempl/elf32.em (before_allocation): Warning fix.

5 years agoPowerPC64 "call lacks nop"
Alan Modra [Thu, 23 Aug 2018 14:45:35 +0000 (00:15 +0930)] 
PowerPC64 "call lacks nop"

The "-fPIC" and "-mcmodel=small" parts of these messages isn't always
true, so lets dispense with that and just report the type of stub
causing trouble.

* elf64-ppc.c (ppc64_elf_relocate_section): Revise "call lacks
nop" error message.

5 years agoPowerPC64 st_other decoding in readelf
Alan Modra [Thu, 23 Aug 2018 08:04:13 +0000 (17:34 +0930)] 
PowerPC64 st_other decoding in readelf

localentry:1 is a valid encoding, so display it.  The patch also bails
out of get_ppc64_symbol_other when st_other bits besides the three
used for localentry offsets are set, to avoid hiding any such values.

* readelf.c (get_ppc64_symbol_other): Return NULL if st_other
field contains unrecognised or reserved values.  Handle
localentry:1 value.

5 years agoPrune BFD warnings for unknown GNU properties
H.J. Lu [Thu, 23 Aug 2018 13:12:37 +0000 (06:12 -0700)] 
Prune BFD warnings for unknown GNU properties

When glibc is enabled with the new GNU_PROPERTY_X86_XXX bits:

https://groups.google.com/forum/#!topic/x86-64-abi/-D05GQ3kWrA

BFD will issue an unknown GNU property warning like

warning: tmpdir/ld1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001

and ignore such GNU properties.  This patch adds prune_warnings_extra to
prune such warnings on release branches and updates prune_warnings to
call prune_warnings_extra.

binutils/

PR ld/23536
* Makefile.am (development.exp): New target.
(EXTRA_DEJAGNU_SITE_CONFIG): New.
(DISTCLEANFILES): Add development.exp.
* Makefile.in: Regenerated.
* testsuite/binutils-all/objcopy.exp (strip_test): Call
prune_warnings to prune BFD output.
(strip_test_with_saving_a_symbol): Likewise.
(objcopy_test_without_global_symbol): Likewise.
* testsuite/lib/binutils-common.exp (prune_warnings_extra):
New proc.
(prune_warnings): Likewise.

gas/

PR ld/23536
* Makefile.am (development.exp): New target.
(EXTRA_DEJAGNU_SITE_CONFIG): New.
(DISTCLEANFILES): Add development.exp.
* Makefile.in: Regenerated.

ld/

PR ld/23536
* Makefile.am (development.exp): New target.
(EXTRA_DEJAGNU_SITE_CONFIG): New.
(DISTCLEANFILES): Add development.exp.
* Makefile.in: Regenerated.
* testsuite/ld-bootstrap/bootstrap.exp: Call prune_warnings to
prune BFD output.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/lib/ld-lib.exp (prune_warnings): Removed.
* testsuite/ld-elf/shared.exp: Allow "\n" in linker warnings.

This page took 0.063528 seconds and 4 git commands to generate.