Commit Graph

94136 Commits

Author SHA1 Message Date
Alan Modra c2bf1eecf9 Remove m88k support
include/
	* coff/internal.h: Remove m88k support.
	* coff/m88k.h: Delete.
	* opcode/m88k.h: Delete.
bfd/
	* Makefile.am: Remove m88k support.
	* aoutx.h: Likewise.
	* archures.c: Likewise.
	* coffcode.h: Likewise.
	* coffswap.h: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* cpu-ns32k.c: Likewise.
	* elf32-nds32.c: Likewise.
	* mach-o.c: Likewise.
	* netbsd-core.c: Likewise.
	* reloc.c: Likewise.
	* targets.c: Likewise.
	* coff-m88k.c: Delete.
	* cpu-m88k.c: Delete.
	* elf32-m88k.c: Delete.
	* hosts/m88kmach3.h: Delete.
	* m88kmach3.c: Delete.
	* m88kopenbsd.c: Delete.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
opcodes/
	* Makefile.am: Remove m88k support.
	* configure.ac: Likewise.
	* disassemble.c: Likewise.
	* disassemble.h: Likewise.
	* m88k-dis.c: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
binutils/
	* MAINTAINERS (Mark Kettenis): Move to past maintainers.
	* testsuite/binutils-all/objdump.exp: Remove m88k support.
gas/
	* configure.ac: Remove m88k support.
	* config.in: Regenerate.
	* configure: Regenerate.
ld/
	* Makefile.am: Remove m88k support.
	* configure.host: Likewise.
	* configure.tgt: Likewise.
	* testsuite/ld-elf/sec-to-seg.exp: Likewise.
	* emulparams/m88kbcs.sh: Delete.
	* scripttempl/m88kbcs.sc: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:23:38 +09:30
Alan Modra 6793974daa Remove i370 support
include/
	* elf/i370.h: Delete.
	* opcode/i370.h: Delete.
bfd/
	* Makefile.am: Remove i370 support.
	* archures.c: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* targets.c: Likewise.
	* cpu-i370.c: Delete.
	* elf32-i370.c: Delete.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
opcodes/
	* Makefile.am: Remove i370 support.
	* configure.ac: Likewise.
	* disassemble.c: Likewise.
	* disassemble.h: Likewise.
	* i370-dis.c: Delete.
	* i370-opc.c: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
binutils/
	* readelf.c: Remove i370 support.
	* testsuite/binutils-all/objdump.exp: Likewise.
gas/
	* Makefile.am: Remove i370 support.
	* app.c: Likewise.
	* config/obj-elf.c: Likewise.
	* configure.tgt: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/as.texinfo: Likewise.
	* testsuite/gas/all/gas.exp: Likewise.
	* testsuite/gas/elf/warn-2.s: Likewise.
	* testsuite/gas/lns/lns.exp: Likewise.
	* config/tc-i370.c: Delete.
	* config/tc-i370.h: Delete.
	* doc/c-i370.texi: Delete.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
ld/
	* Makefile.am: Remove i370 support.
	* configure.tgt: Likewise.
	* testsuite/ld-elf/compressed1d.d: Likewise.
	* testsuite/ld-elf/group8a.d: Likewise.
	* testsuite/ld-elf/group8b.d: Likewise.
	* testsuite/ld-elf/group9a.d: Likewise.
	* testsuite/ld-elf/group9b.d: Likewise.
	* testsuite/ld-elf/merge.d: Likewise.
	* testsuite/ld-elf/pr12851.d: Likewise.
	* testsuite/ld-elf/pr12975.d: Likewise.
	* testsuite/ld-elf/pr13177.d: Likewise.
	* testsuite/ld-elf/pr13195.d: Likewise.
	* testsuite/ld-elf/pr17615.d: Likewise.
	* testsuite/ld-elf/pr21562a.d: Likewise.
	* testsuite/ld-elf/pr21562b.d: Likewise.
	* testsuite/ld-elf/pr21562c.d: Likewise.
	* testsuite/ld-elf/pr21562d.d: Likewise.
	* testsuite/ld-elf/pr21562i.d: Likewise.
	* testsuite/ld-elf/pr21562j.d: Likewise.
	* testsuite/ld-elf/pr21562k.d: Likewise.
	* testsuite/ld-elf/pr21562l.d: Likewise.
	* testsuite/ld-elf/pr21562m.d: Likewise.
	* testsuite/ld-elf/pr21562n.d: Likewise.
	* testsuite/ld-elf/pr22677.d: Likewise.
	* testsuite/lib/ld-lib.exp: Likewise.
	* emulparams/elf32i370.sh: Delete.
	* scripttempl/elfi370.sc: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:21:56 +09:30
Alan Modra e82aa7944d Remove h8500 support
include/
	* coff/h8500.h: Delete.
	* coff/internal.h: Remove h8500 support.
bfd/
	* Makefile.am: Remove h8500 support.
	* archures.c: Likewise.
	* coffcode.h: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* targets.c: Likewise.
	* coff-h8500.c: Delete.
	* cpu-h8500.c: Delete.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
opcodes/
	* Makefile.am: Remove h8500 support.
	* configure.ac: Likewise.
	* disassemble.c: Likewise.
	* disassemble.h: Likewise.
	* h8500-dis.c: Delete.
	* h8500-opc.h: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
binutils/
	* testsuite/binutils-all/objcopy.exp: Remove h8500 support.
	* testsuite/lib/binutils-common.exp: Likewise.
gas/
	* config/obj-coff.h: Remove h8500 support.
ld/
	* Makefile.am: Remove h8500 support.
	* configure.tgt: Likewise.
	* emulparams/h8500.sh: Delete.
	* emulparams/h8500b.sh: Delete.
	* emulparams/h8500c.sh: Delete.
	* emulparams/h8500m.sh: Delete.
	* emulparams/h8500s.sh: Delete.
	* scripttempl/h8500.sc: Delete.
	* scripttempl/h8500b.sc: Delete.
	* scripttempl/h8500c.sc: Delete.
	* scripttempl/h8500m.sc: Delete.
	* scripttempl/h8500s.sc: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:19:52 +09:30
Alan Modra fe0bf0fd57 Remove h8300-coff support
include/
	* coff/h8300.h: Delete.
bfd/
	* Makefile.am: Remove h8300-coff support.
	* coffcode.h: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* reloc16.c: Likewise.
	* targets.c: Likewise.
	* coff-h8300.c: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* testsuite/binutils-all/objcopy.exp: Remove h8300-coff support.
gas/
	* config/obj-coff.h: Remove h8300-coff support.
	* config/tc-h8300.c: Likewise.
	* config/tc-h8300.h: Likewise.
	* testsuite/gas/h8300/h8300.exp: Likewise.
	* testsuite/gas/h8300/branch-coff.s: Delete.
	* testsuite/gas/h8300/branchh-coff.s: Delete.
	* testsuite/gas/h8300/branchs-coff.s: Delete.
	* testsuite/gas/h8300/ffxx1-coff.d: Delete.
	* testsuite/gas/h8300/ffxx1-coff.s: Delete.
	* testsuite/gas/h8300/h8300-coff.exp: Delete.
ld/
	* Makefile.am: Remove h8300-coff support.
	* configure.tgt: Likewise.
	* testsuite/ld-h8300/h8300.exp: Likewise.
	* emulparams/h8300.sh: Delete.
	* emulparams/h8300h.sh: Delete.
	* emulparams/h8300hn.sh: Delete.
	* emulparams/h8300s.sh: Delete.
	* emulparams/h8300sn.sh: Delete.
	* emulparams/h8300sx.sh: Delete.
	* emulparams/h8300sxn.sh: Delete.
	* scripttempl/h8300.sc: Delete.
	* scripttempl/h8300h.sc: Delete.
	* scripttempl/h8300hn.sc: Delete.
	* scripttempl/h8300s.sc: Delete.
	* scripttempl/h8300sn.sc: Delete.
	* scripttempl/h8300sx.sc: Delete.
	* scripttempl/h8300sxn.sc: Delete.
	* testsuite/ld-h8300/relax-3-coff.d: Delete.
	* testsuite/ld-h8300/relax-4-coff.d: Delete.
	* testsuite/ld-h8300/relax-5-coff.d: Delete.
	* testsuite/ld-h8300/relax-6-coff.d: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:17:57 +09:30
Alan Modra fdef394344 Remove IEEE 695 object support
include/
	* ieee.h: Delete.
bfd/
	* Makefile.am: Remove IEEE 695 support.
	* archures.c: Likewise.
	* bfd.c: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* doc/bfd.texinfo: Likewise.
	* doc/bfdint.texi: Likewise.
	* doc/bfdsumm.texi: Likewise.
	* section.c: Likewise.
	* targets.c: Likewise.
	* ieee.c: Delete.
	* libieee.h: Delete.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* Makefile.am: Remove IEEE 695 support.
	* budbg.h: Likewise.
	* doc/binutils.texi: Likewise.
	* makefile.vms: Likewise.
	* objcopy.c: Likewise.
	* objdump.c: Likewise.
	* rddbg.c: Likewise.
	* ieee.c: Delete.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
gas/
	* app.c: Remove IEEE 695 support.
	* symbols.c: Likewise.
ld/
	* ld.texinfo: Remove IEEE 695 support.
	* mri.c: Likewise.
2018-04-16 15:16:00 +09:30
Alan Modra de96689e03 Remove tandem support
bfd/
	* config.bfd: Remove tandem support.
ld/
	* Makefile.am: Remove tandem support.
	* configure.tgt: Likewise.
	* emulparams/st2000.sh: Delete.
	* scripttempl/st2000.sc: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:14:19 +09:30
Alan Modra 5972ac7375 Remove sony newsos3 support
include/
	* aout/host.h: Remove newsos3 support.
bfd/
	* Makefile.am: Remove newsos3 support.
	* aoutx.h: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* targets.c: Likewise.
	* newsos3.c: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* testsuite/binutils-all/copy-2.d: Remove newsos3 support.
	* testsuite/binutils-all/nm.exp: Likewise.
ld/
	* Makefile.am: Remove newsos3 support.
	* configure.tgt: Likewise.
	* emulparams/news.sh: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:13:07 +09:30
Alan Modra b4b594e304 Remove netware support
include/
	* nlm/ChangeLog-9315: Delete.
	* nlm/alpha-ext.h: Delete.
	* nlm/common.h: Delete.
	* nlm/external.h: Delete.
	* nlm/i386-ext.h: Delete.
	* nlm/internal.h: Delete.
	* nlm/ppc-ext.h: Delete.
	* nlm/sparc32-ext.h: Delete.
bfd/
	* Makefile.am: Remove netware support.
	* bfd-in.h: Likewise.
	* bfd.c: Likewise.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* doc/bfdint.texi: Likewise.
	* ecoff.c: Likewise.
	* targets.c: Likewise.
	* libnlm.h: Delete.
	* nlm-target.h: Delete.
	* nlm.c: Delete.
	* nlm32-alpha.c: Delete.
	* nlm32-i386.c: Delete.
	* nlm32-ppc.c: Delete.
	* nlm32-sparc.c: Delete.
	* nlm32.c: Delete.
	* nlm64.c: Delete.
	* nlmcode.h: Delete.
	* nlmswap.h: Delete.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* .gitignore: Remove netware support.
	* Makefile.am: Likewise.
	* configure.ac: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/binutils.texi: Likewise.
	* testsuite/binutils-all/nm.exp: Likewise.
	* nlmconv.c: Delete.
	* nlmconv.h: Delete.
	* nlmheader.y: Delete.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
gas/
	* Makefile.am: Remove netware support.
	* config/tc-i386.c: Likewise.
	* configure.tgt: Likewise.
	* config/te-netware.h: Delete.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
gprof/
	* corefile.c: Remove netware support.
ld/
	* Makefile.am: Remove netware support.
	* configure.tgt: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
	* emulparams/i386nw.sh: Delete.
	* emulparams/ppcnw.sh: Delete.
	* scripttempl/nw.sc: Delete.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-16 15:11:22 +09:30
Alan Modra fceadf0951 Remove tahoe support
include/
	* opcode/tahoe.h: Delete.
bfd/
	* archures.c: Remove tahoe support.
	* config.bfd: Likewise.
	* configure.ac: Likewise.
	* hosts/tahoe.h: Delete.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
opcodes/
	* configure.ac: Remove tahoe support.
	* configure: Regenerate.
binutils/
	* testsuite/binutils-all/objdump.exp: Remove tahoe support.
gprof/
	* Makefile.am: Remove tahoe support.
	* corefile.c: Likewise.
	* tahoe.c: Delete.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
2018-04-16 15:08:40 +09:30
GDB Administrator 5a48b83f3f Automatic date update in version.in 2018-04-16 00:00:29 +00:00
Simon Marchi eda4efb127 Add x86-tdep.o to i386/amd64 target build
We get this error when doing a build with a single amd64 target (the
default when doing just ./configure on x86-64 GNU/Linux):

/home/simark/src/binutils-gdb/gdb/i386-tdep.c:4431: error: undefined reference to 'x86_in_indirect_branch_thunk(unsigned long, char const**, int, int)'
/home/simark/src/binutils-gdb/gdb/amd64-tdep.c:3045: error: undefined reference to 'x86_in_indirect_branch_thunk(unsigned long, char const**, int, int)'

The problem is that commit

  1d509aa625 ("infrun: step through indirect branch thunks")

missed adding x86-tdep.o to the list of object file included in an amd64
or i386 build.  The problem is not seen with --enable-targets=all
because that file is included in ALL_TARGET_OBS.

Built-tested using:

  * --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
  * --host=armv7-rpi2-linux-gnueabihf --target=x86_64-pc-linux-gnu

gdb/ChangeLog:

	* configure.tgt (x86_tobjs): New variable.
	(amd64_tobjs, i386_tobjs): Use it.
2018-04-15 15:43:47 -04:00
H.J. Lu ae1d384372 x86: Allow 32-bit registers for tpause and umwait
Since only the first 32 bits of input operand are used for tpause and
umwait, the REX.W bit is skipped.  Both 32-bit registers and 64-bit
registers are allowed.

gas/

	* testsuite/gas/i386/x86-64-waitpkg.s: Add 32-bit registers
	tests for tpause and umwait.
	* testsuite/gas/i386/x86-64-waitpkg-intel.d: Updated.
	* testsuite/gas/i386/x86-64-waitpkg.d: Likewise.

opcodes/

	* i386-dis.c (prefix_table): Replace Em with Edq on tpause and
	umwait.
	* i386-opc.tbl: Allow 32-bit registers for tpause and umwait in
	64-bit mode.
	* i386-tbl.h: Regenerated.
2018-04-15 08:38:36 -07:00
GDB Administrator 7c31c22f1a Automatic date update in version.in 2018-04-15 00:00:48 +00:00
Cary Coutant aae8280935 Fix bug where --icf=safe triggers segfault when linking ARM.
When checking a R_ARM_TARGET[12] relocation, we need a valid target
pointer, but the garbage collection code was passing a NULL instead.

gold/
	PR gold/23046
	* gc.h (gc_process_relocs): Pass target to
	scan.global_reloc_may_be_function_pointer.
2018-04-14 15:58:07 -07:00
Alan Modra 702d167134 powerpc common-page-size
max-page-size only matters for demand paged executables or shared
libraries, and the ideal size is the largest value used by your
operating system.  Values larger than necessary just waste file space
and memory.  common-page-size also affects file and memory size,
trading a possible small increase in file size for a decrease in
memory size when the operating system is using a common-page-size
page.  With a powerpc max-page-size of 64k and common-page-size of 4k
many executables will use no more memory pages when the system page
size is 4k than an executable linked with -z max-page-size=0x1000,
yet will still run on a system using 64k pages.  However, when running
on a system using 64k pages relro protection will not be completely
effective.

Due to the relro problem, powerpc binutils has been using a default
common-page-size of 64k since 2014-12-18 (git commit 04c6a44c7),
leading to complaints about increased file and memory sizes.  People
not using relro do have a valid reason to complain..

So this patch introduces an extra back-end value to use as the default
for common-page-size when generating relro executables, and enables
the support for powerpc.  Non relro executables will now be generated
with a default common-page-size of 4k.

bfd/
	* elf-bfd.h (struct elf_backend_data): Add relropagesize.
	* elfxx-target.h (ELF_RELROPAGESIZE): Provide default and
	sanity test.
	(elfNN_bed): Init relropagesize.
	* bfd.c (bfd_emul_get_commonpagesize): Add boolean param to
	select relropagesize.
	* elf32-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
	(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
	(ELF_MINPAGESIZE): Don't define.
	* elf64-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
	(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
	* bfd-in2.h: Regenerate.
ld/
	* ldmain.c (main): Move config.maxpagesize and
	config.commonpagesize initialization to..
	* ldemul.c (after_parse_default): ..here.
	* testsuite/ld-powerpc/ppc476-shared.d: Pass -z common-page-size.
	* testsuite/ld-powerpc/ppc476-shared2.d: Likewise.
2018-04-14 17:56:40 +09:30
Alan Modra 03aa968462 powerpc max-page-size vs __QNXTARGET__
The default max-page-size on ppc32 has been 64k since 1995-02-15 (git
commit bcbe2c71).  There was a change committed 2003-07-12 to chose a
4k page if __QNXTARGET__ is defined, but that particular commit was
from an earlier posted patch
https://sourceware.org/ml/binutils/2003-07/msg00211.html that only
made the change effective for arm, rather than the later one
https://sourceware.org/ml/binutils/2003-07/msg00220.html that also
changed powerpc and sh..

Since the __QNXTARGET__ #ifdef in elf32-ppc.c is ineffective unless
the user defines it in his or her CFLAGS, I'm removing that code.

	* elf32-ppc.c (ELF_MAXPAGESIZE, ELF_COMMONPAGESIZE): Don't depend
	on __QNXTARGET__ define.
2018-04-14 17:54:08 +09:30
Alan Modra 24acfe5e2b powerpc-lynxos and powerpc-windiss fixes
Enabling shared lib tests showed the powerpc-lynxos target is broken,
and has been for a long time.  The breakage happened in a 2005-05-07
patch of mine, git commit 3b36f7e62, I think.  There have been no bug
reports I recall so it seems the target is dead.  powerpc-windiss is
similarly broken.

This patch fixes the breakage, and puts the targets on the obsolete
list.

bfd/
	* config.bfd: Add powerpc-*-lynxos* and powerpc-*-windiss*
	to obsolete list.
ld/
	* emulparams/elf32ppcwindiss.sh: Rewrite to use elf32ppc.sh.
	* emulparams/ppclynx.sh: Likewise.
2018-04-14 17:53:22 +09:30
Alan Modra fb70ec1714 Reinstate readelf decoding of i860 and i960 machine names
Decoding of EM_* ought to continue.

	* readelf.c (get_machine_name): Revert 2018-04-11 change.
2018-04-14 10:50:16 +09:30
GDB Administrator 68e91e4249 Automatic date update in version.in 2018-04-14 00:00:33 +00:00
Andreas Arnez b744723f57 Show line numbers in output for "info var/func/type"
The GDB commands "info variables", "info functions", and "info types" show
the appropriate list of definitions matching the given pattern.  They also
group them by source files.  But no line numbers within these source files
are shown.

The line number information is particularly useful to the user when a
simple "grep" doesn't readily point to a definition.  This is often the
case when the definition involves a macro, occurs within a namespace, or
when the identifier appears very frequently in the source file.

This patch enriches the printout of these commands by the line numbers and
adjusts affected test cases to the changed output where necessary.  The
new output looks like this:

  (gdb) i variables
  All defined variables:

  File foo.c:
  3:	const char * const foo;
  1:	int x;

The line number is followed by a colon and a tab character, which is then
followed by the symbol definition.  If no line number is available, the
tab is printed out anyhow, so definitions line up.

gdb/ChangeLog:

	* symtab.c (print_symbol_info): Precede the symbol definition by
	the line number when available.
	* NEWS: Advertise this enhancement.

gdb/doc/ChangeLog:

	* gdb.texinfo (Symbols): Mention the fact that "info
	variables/functions/types" show source files and line numbers.

gdb/testsuite/ChangeLog:

	* gdb.ada/info_types.exp: Adjust expected output to the line
	numbers now printed by "info var/func/type".
	* gdb.base/completion.exp: Likewise.
	* gdb.base/included.exp: Likewise.
	* gdb.cp/cp-relocate.exp: Likewise.
	* gdb.cp/cplusfuncs.exp: Likewise.
	* gdb.cp/namespace.exp: Likewise.
	* gdb.dwarf2/dw2-case-insensitive.exp: Likewise.
2018-04-13 19:26:05 +02:00
Markus Metzger 4a4495d62d btrace: set/show record btrace cpu
Add new set/show commands to set the processor that is used for enabling
errata workarounds when decoding branch trace.

The general format is "<vendor>:<identifier>" but we also allow two
special values "auto" and "none".

The default is "auto", which is the current behaviour of having GDB
determine the processor on which the trace was recorded.

If that cpu is not known to the trace decoder, e.g. when using an old
decoder on a new system, decode may fail with "unknown cpu".  In most
cases it should suffice to 'downgrade' decode to assume an older cpu.
Unfortunately, we can't do this automatically.

The other special value, "none", disables errata workarounds.

gdb/
	* NEWS (New options): announce set/show record btrace cpu.
	* btrace.c: Include record-btrace.h.
	(btrace_compute_ftrace_pt): Skip enabling errata workarounds if
	the vendor is unknown.
	(btrace_compute_ftrace_1): Add cpu parameter.  Update callers.
	Maybe overwrite the btrace configuration's cpu.
	(btrace_compute_ftrace): Add cpu parameter.  Update callers.
	(btrace_fetch): Add cpu parameter.  Update callers.
	(btrace_maint_update_pt_packets): Call record_btrace_get_cpu.
	Maybe overwrite the btrace configuration's cpu.  Skip enabling
	errata workarounds if the vendor is unknown.
	* python/py-record-btrace.c: Include record-btrace.h.
	(recpy_bt_begin, recpy_bt_end, recpy_bt_instruction_history)
	(recpy_bt_function_call_history): Call record_btrace_get_cpu.
	* record-btrace.c (record_btrace_cpu_state_kind): New.
	(record_btrace_cpu): New.
	(set_record_btrace_cpu_cmdlist): New.
	(record_btrace_get_cpu): New.
	(require_btrace_thread, record_btrace_info)
	(record_btrace_resume_thread): Call record_btrace_get_cpu.
	(cmd_set_record_btrace_cpu_none): New.
	(cmd_set_record_btrace_cpu_auto): New.
	(cmd_set_record_btrace_cpu): New.
	(cmd_show_record_btrace_cpu): New.
	(_initialize_record_btrace): Initialize set/show record btrace cpu
	commands.
	* record-btrace.h (record_btrace_get_cpu): New.

testsuite/
	* gdb.btrace/cpu.exp: New.

doc/
	* gdb.texinfo: Document set/show record btrace cpu.
2018-04-13 11:35:55 +02:00
Markus Metzger 69f90c75b3 record: fix typo in "set record" output
Alan Hayward pointed out a typo in the output of "set record btrace" that
I took from "set record".  Fix the original.

gdb/
	* record.c (set_record_command): Fix typo in message.
2018-04-13 11:31:35 +02:00
Markus Metzger b85310e1ec btrace: fix output of "set record btrace"
Instead of giving a message that "set record btrace" needs a sub-command,
GDB crashed.  Fix it.  A regression test comes with the next patch.

gdb/
	* record-btrace.c (cmd_set_record_btrace): Print sub-commands.
2018-04-13 11:30:15 +02:00
Markus Metzger 1d509aa625 infrun: step through indirect branch thunks
With version 7.3 GCC supports new options

   -mindirect-branch=<choice>
   -mfunction-return=<choice>

The choices are:

    keep                behaves as before
    thunk               jumps through a thunk
    thunk-external      jumps through an external thunk
    thunk-inline        jumps through an inlined thunk

For thunk and thunk-external, GDB would, on a call to the thunk, step into
the thunk and then resume to its caller assuming that this is an
undebuggable function.  On a return thunk, GDB would stop inside the
thunk.

Make GDB step through such thunks instead.

Before:
    Temporary breakpoint 1, main ()
        at gdb.base/step-indirect-call-thunk.c:37
    37        x = apply (inc, 41);
    (gdb) s
    apply (op=0x80483e6 <inc>, x=41)
        at gdb.base/step-indirect-call-thunk.c:29
    29        return op (x);
    (gdb)
    30      }

After:
    Temporary breakpoint 1, main ()
        at gdb.base/step-indirect-call-thunk.c:37
    37        x = apply (inc, 41);
    (gdb) s
    apply (op=0x80483e6 <inc>, x=41)
        at gdb.base/step-indirect-call-thunk.c:29
    29        return op (x);
    (gdb)
    inc (x=41) at gdb.base/step-indirect-call-thunk.c:23
    23        return x + 1;

This is independent of the step-mode.  In order to step into the thunk,
you would need to use stepi.

When stepping over an indirect call thunk, GDB would first step through
the thunk, then recognize that it stepped into a sub-routine and resume to
the caller (of the thunk).  Not sure whether this is worth optimizing.

Thunk detection is implemented via gdbarch.  I implemented the methods for
IA.  Other architectures may run into unexpected fails.

The tests assume a fixed number of instruction steps to reach a thunk.
This depends on the compiler as well as the architecture.  They may need
adjustments when we add support for more architectures.  Or we can simply
drop those tests that cover being able to step into thunks using
instruction stepping.

When using an older GCC, the tests will fail to build and will be reported
as untested:

    Running .../gdb.base/step-indirect-call-thunk.exp ...
    gdb compile failed, \
    gcc: error: unrecognized command line option '-mindirect-branch=thunk'
    gcc: error: unrecognized command line option '-mfunction-return=thunk'

                    === gdb Summary ===

    # of untested testcases         1

gdb/
	* infrun.c (process_event_stop_test): Call
	gdbarch_in_indirect_branch_thunk.
	* gdbarch.sh (in_indirect_branch_thunk): New.
	* gdbarch.c: Regenerated.
	* gdbarch.h: Regenerated.
	* x86-tdep.h: New.
	* x86-tdep.c: New.
	* Makefile.in (ALL_TARGET_OBS): Add x86-tdep.o.
	(HFILES_NO_SRCDIR): Add x86-tdep.h.
	(ALLDEPFILES): Add x86-tdep.c.
	* arch-utils.h (default_in_indirect_branch_thunk): New.
	* arch-utils.c (default_in_indirect_branch_thunk): New.
	* i386-tdep: Include x86-tdep.h.
	(i386_in_indirect_branch_thunk): New.
	(i386_elf_init_abi): Set in_indirect_branch_thunk gdbarch
	function.
	* amd64-tdep: Include x86-tdep.h.
	(amd64_in_indirect_branch_thunk): New.
	(amd64_init_abi): Set in_indirect_branch_thunk gdbarch function.

testsuite/
	* gdb.base/step-indirect-call-thunk.exp: New.
	* gdb.base/step-indirect-call-thunk.c: New.
	* gdb.reverse/step-indirect-call-thunk.exp: New.
	* gdb.reverse/step-indirect-call-thunk.c: New.
2018-04-13 10:44:47 +02:00
GDB Administrator 7a2711e437 Automatic date update in version.in 2018-04-13 00:00:33 +00:00
Jan Kratochvil b4be9bfdab Fix -D_GLIBCXX_DEBUG gdb-add-index regression
Fedora Rawhide started to use -D_GLIBCXX_DEBUG which made gdb-add-index
failing:
	gdb: Out-of-bounds vector access while running gdb-add-index
	https://bugzilla.redhat.com/show_bug.cgi?id=1540559

/usr/include/c++/7/debug/safe_iterator.h:270:
Error: attempt to dereference a past-the-end iterator.
Objects involved in the operation:
    iterator "this" @ 0x0x7fffffffcb90 {
      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<unsigned char*, std::__cxx1998::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > >, std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > > > (mutable iterator);
      state = past-the-end;
      references sequence with type 'std::__debug::vector<unsigned char, gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> > >' @ 0x0x7fffffffcc50
    }

/usr/include/c++/7/debug/vector:417:
Error: attempt to subscript container with out-of-bounds index 556, but
container only holds 556 elements.
Objects involved in the operation:
    sequence "this" @ 0x0x2e87af8 {
      type = std::__debug::vector<partial_symbol*, std::allocator<partial_symbol*> >;
    }

The two -D_GLIBCXX_DEBUG regressions were made by:

commit bc8f2430e0
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Jun 12 16:29:53 2017 +0100
    Code cleanup: C++ify .gdb_index producer

commit af5bf4ada4
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Sat Oct 14 08:06:29 2017 -0400
    Replace psymbol_allocation_list with std::vector

gdb/ChangeLog
2018-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/23053
	* dwarf-index-write.c (data_buf::grow) (write_one_signatured_type)
	(recursively_write_psymbols) (debug_names::recursively_write_psymbols)
	(debug_names::write_one_signatured_type): Fix -D_GLIBCXX_DEBUG
	regression.
2018-04-12 22:31:39 +02:00
Tom Tromey 53d7df28bc Remove old univariant code from rust-lang.c
Since moving Rust enum handling into dwarf2read.c, some old code for
handling univariant enums in rust-lang.c has been obsolete.  This
patch removes this code.

Tested on x86-64 Fedora 26, using rustc 1.23 (1.24 emits incorrect
DWARF for enums and so can't be used for this test).

2018-04-12  Tom Tromey  <tom@tromey.com>

	* rust-lang.c (rust_print_struct_def): Remove univariant code.
	(rust_evaluate_subexp): Likewise.
2018-04-12 11:03:59 -06:00
Pedro Alves 70b33f195b Fix Solaris build
This commit fixes a bit of rot in procfs.c caused by recent changes.

Specifically, the target_ops::to_detach change to pass down 'inferior
*' missed updating a forward declation, and the change to use
scoped_fd in more places missed removing one do_cleanups call.

  src/gdb/procfs.c: In function ‘target_ops* procfs_target()’:
  src/gdb/procfs.c:167:16: error: invalid conversion from ‘void (*)(target_ops*, const char*, int)’ to ‘void (*)(target_ops*, inferior*, int)’ [-fpermissive]
     t->to_detach = procfs_detach;
		  ^
  src/gdb/procfs.c: In function ‘ssd* proc_get_LDT_entry(procinfo*, int)’:
  src/gdb/procfs.c:1624:17: error: ‘old_chain’ was not declared in this scope
      do_cleanups (old_chain);
		   ^
  src/gdb/procfs.c: At global scope:
  src/gdb/procfs.c:90:13: error: ‘void procfs_detach(target_ops*, const char*, int)’ declared ‘static’ but never defined [-Werror=unused-function]
   static void procfs_detach (struct target_ops *, const char *, int);
	       ^
  src/gdb/procfs.c:1923:1: error: ‘void procfs_detach(target_ops*, inferior*, int)’ defined but not used [-Werror=unused-function]
   procfs_detach (struct target_ops *ops, inferior *inf, int from_tty)
   ^

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

	* procfs.c (procfs_detach): Make forward declaration's prototype
	match definition's protototype.
	(proc_get_LDT_entry): Remove stale do_cleanups call.
2018-04-12 17:47:59 +01:00
Pedro Alves 436411b1c6 Eliminate target_has_exited
Nothing uses this.

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

	* target.h (target_ops::to_has_exited): Delete.
	(target_has_exited): Delete.
	* target-delegates.c: Regenerate.
2018-04-12 17:36:01 +01:00
Nick Clifton 86c6c6df00 Fix the loading of the dynamic string table in a file without sections.
PR 23050
	* readelf.c (process_dynamic_section): Correct dynamic string
	table size calculation.
2018-04-12 15:41:07 +01:00
John Darrington 67f846b59b Stop the assembler from overwriting its output file.
* as.c (main): Fail if the output is the same as one of the input
	files.
	* testsuite/gas/all/gas.exp: Test the new feature.
2018-04-12 15:08:59 +01:00
Nick Clifton 73a05be215 Updated Spanish and Russian translations for the gas sub-directory 2018-04-12 12:01:50 +01:00
GDB Administrator f7ebc2b18a Automatic date update in version.in 2018-04-12 00:00:29 +00:00
Igor Tsimbalist de89d0a34d Enable Intel WAITPKG instructions.
Intel has disclosed a set of new instructions for Tremont processor.
The spec is
https://software.intel.com/en-us/intel-architecture-instruction-set-extensions-programming-reference
This patch enables Intel WAITPKG instructions.

gas/
	* config/tc-i386.c (cpu_arch): Add WAITPKG.
	(cpu_noarch): Likewise.
	* doc/c-i386.texi: Document WAITPKG.
	* i386/i386.exp: Run WAITPKG tests.
	* testsuite/gas/i386/waitpkg-intel.d: New test.
	* testsuite/gas/i386/waitpkg.d: Likewise.
	* testsuite/gas/i386/waitpkg.s: Likewise.
	* testsuite/gas/i386/x86-64-waitpkg-intel.d: Likewise.
	* testsuite/gas/i386/x86-64-waitpkg.d: Likewise.
	* testsuite/gas/i386/x86-64-waitpkg.s: Likewise.

opcodes/
	* i386-dis.c (enum): Add PREFIX_MOD_0_0FAE_REG_6,
	PREFIX_MOD_1_0FAE_REG_6.
	(va_mode): New.
	(OP_E_register): Use va_mode.
	* i386-dis-evex.h (prefix_table):
	New instructions (see prefixes above).
	* i386-gen.c (cpu_flag_init): Add WAITPKG.
	(cpu_flags): Likewise.
	* i386-opc.h (enum): Likewise.
	(i386_cpu_flags): Likewise.
	* i386-opc.tbl: Add umonitor, umwait, tpause.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Likewise.
2018-04-11 21:37:12 +02:00
Simon Marchi 6295b6da16 Add test for following fork on position-independent executables
Commit

  b2e586e ("Defer breakpoint reset when cloning progspace for fork
  child")

fixed following fork childs when the executable is position-independent.
This patch adds a little test for it.

gdb/testsuite/ChangeLog:

	* gdb.base/pie-fork.c: New file.
	* gdb.base/pie-fork.exp: New file.
2018-04-11 14:55:40 -04:00
Tom Tromey 50146e7022 Add Rust test case for ".." struct initializer
Building with --coverage pointed out that there was no Rust test for
initializing a structure using the ".." initializer.  This patch adds
such a test.

Regression tested on x86-64 Fedora 26.

2018-04-11  Tom Tromey  <tom@tromey.com>

	* gdb.rust/simple.exp: Add test for ".." struct initializer.
2018-04-11 08:25:34 -06:00
Alan Modra a8eb42a8b7 Remove i860, i960, bout and aout-adobe targets
Plus remove a few leftovers from the 29k support.

include/
	* aout/adobe.h: Delete.
	* aout/reloc.h: Delete.
	* coff/i860.h: Delete.
	* coff/i960.h: Delete.
	* elf/i860.h: Delete.
	* elf/i960.h: Delete.
	* opcode/i860.h: Delete.
	* opcode/i960.h: Delete.
	* aout/aout64.h (enum reloc_type): Trim off 29k and other unused values.
	* aout/ar.h (ARMAGB): Remove.
	* coff/internal.h (struct internal_aouthdr, struct internal_scnhdr,
	union internal_auxent): Remove i960 support.
bfd/
	* aout-adobe.c: Delete.
	* bout.c: Delete.
	* coff-i860.c: Delete.
	* coff-i960.c: Delete.
	* cpu-i860.c: Delete.
	* cpu-i960.c: Delete.
	* elf32-i860.c: Delete.
	* elf32-i960.c: Delete.
	* hosts/i860mach3.h: Delete.
	* Makefile.am: Remove i860, i960, bout, and adobe support.
	* archures.c: Remove i860 and i960 support.
	* coffcode.h: Likewise.
	* reloc.c: Likewise.
	* aoutx.h: Comment updates.
	* archive.c: Remove BOUT and i960 support.
	* bfd.c: Remove BOUT support.
	* coffswap.h: Remove i960 support.
	* config.bfd: Remove i860, i960 and adobe targets.
	* configure.ac: Remove adode, bout, i860, i960, icoff targets.
	* targets.c: Likewise.
	* ieee.c: Remove i960 support.
	* mach-o.c: Remove i860 support.
	* Makefile.in: Regenerate.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* libbfd.h: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
opcodes/
	* opcodes/i860-dis.c: Delete.
	* opcodes/i960-dis.c: Delete.
	* Makefile.am: Remove i860 and i960 support.
	* configure.ac: Likewise.
	* disassemble.c: Likewise.
	* disassemble.h: Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
binutils/
	* ieee.c: Remove i960 support.
	* od-macho.c: Remove i860 support.
	* readelf.c: Remove i860 and i960 support.
	* testsuite/binutils-all/objcopy.exp: Likewise.
	* testsuite/binutils-all/objdump.exp: Likewise.
	* testsuite/lib/binutils-common.exp: Likewise.
gas/
	* config/aout_gnu.h: Delete.
	* config/tc-i860.c: Delete.
	* config/tc-i860.h: Delete.
	* config/tc-i960.c: Delete.
	* config/tc-i960.h: Delete.
	* doc/c-i860.texi: Delete.
	* doc/c-i960.texi: Delete.
	* testsuite/gas/i860/README.i860: Delete.
	* testsuite/gas/i860/bitwise.d: Delete.
	* testsuite/gas/i860/bitwise.s: Delete.
	* testsuite/gas/i860/branch.d: Delete.
	* testsuite/gas/i860/branch.s: Delete.
	* testsuite/gas/i860/bte.d: Delete.
	* testsuite/gas/i860/bte.s: Delete.
	* testsuite/gas/i860/dir-align01.d: Delete.
	* testsuite/gas/i860/dir-align01.s: Delete.
	* testsuite/gas/i860/dir-intel01.d: Delete.
	* testsuite/gas/i860/dir-intel01.s: Delete.
	* testsuite/gas/i860/dir-intel02.d: Delete.
	* testsuite/gas/i860/dir-intel02.s: Delete.
	* testsuite/gas/i860/dir-intel03-err.l: Delete.
	* testsuite/gas/i860/dir-intel03-err.s: Delete.
	* testsuite/gas/i860/dual01.d: Delete.
	* testsuite/gas/i860/dual01.s: Delete.
	* testsuite/gas/i860/dual02-err.l: Delete.
	* testsuite/gas/i860/dual02-err.s: Delete.
	* testsuite/gas/i860/dual03.d: Delete.
	* testsuite/gas/i860/dual03.s: Delete.
	* testsuite/gas/i860/fldst01.d: Delete.
	* testsuite/gas/i860/fldst01.s: Delete.
	* testsuite/gas/i860/fldst02.d: Delete.
	* testsuite/gas/i860/fldst02.s: Delete.
	* testsuite/gas/i860/fldst03.d: Delete.
	* testsuite/gas/i860/fldst03.s: Delete.
	* testsuite/gas/i860/fldst04.d: Delete.
	* testsuite/gas/i860/fldst04.s: Delete.
	* testsuite/gas/i860/fldst05.d: Delete.
	* testsuite/gas/i860/fldst05.s: Delete.
	* testsuite/gas/i860/fldst06.d: Delete.
	* testsuite/gas/i860/fldst06.s: Delete.
	* testsuite/gas/i860/fldst07.d: Delete.
	* testsuite/gas/i860/fldst07.s: Delete.
	* testsuite/gas/i860/fldst08.d: Delete.
	* testsuite/gas/i860/fldst08.s: Delete.
	* testsuite/gas/i860/float01.d: Delete.
	* testsuite/gas/i860/float01.s: Delete.
	* testsuite/gas/i860/float02.d: Delete.
	* testsuite/gas/i860/float02.s: Delete.
	* testsuite/gas/i860/float03.d: Delete.
	* testsuite/gas/i860/float03.s: Delete.
	* testsuite/gas/i860/float04.d: Delete.
	* testsuite/gas/i860/float04.s: Delete.
	* testsuite/gas/i860/form.d: Delete.
	* testsuite/gas/i860/form.s: Delete.
	* testsuite/gas/i860/i860.exp: Delete.
	* testsuite/gas/i860/iarith.d: Delete.
	* testsuite/gas/i860/iarith.s: Delete.
	* testsuite/gas/i860/ldst01.d: Delete.
	* testsuite/gas/i860/ldst01.s: Delete.
	* testsuite/gas/i860/ldst02.d: Delete.
	* testsuite/gas/i860/ldst02.s: Delete.
	* testsuite/gas/i860/ldst03.d: Delete.
	* testsuite/gas/i860/ldst03.s: Delete.
	* testsuite/gas/i860/ldst04.d: Delete.
	* testsuite/gas/i860/ldst04.s: Delete.
	* testsuite/gas/i860/ldst05.d: Delete.
	* testsuite/gas/i860/ldst05.s: Delete.
	* testsuite/gas/i860/ldst06.d: Delete.
	* testsuite/gas/i860/ldst06.s: Delete.
	* testsuite/gas/i860/pfam.d: Delete.
	* testsuite/gas/i860/pfam.s: Delete.
	* testsuite/gas/i860/pfmam.d: Delete.
	* testsuite/gas/i860/pfmam.s: Delete.
	* testsuite/gas/i860/pfmsm.d: Delete.
	* testsuite/gas/i860/pfmsm.s: Delete.
	* testsuite/gas/i860/pfsm.d: Delete.
	* testsuite/gas/i860/pfsm.s: Delete.
	* testsuite/gas/i860/pseudo-ops01.d: Delete.
	* testsuite/gas/i860/pseudo-ops01.s: Delete.
	* testsuite/gas/i860/regress01.d: Delete.
	* testsuite/gas/i860/regress01.s: Delete.
	* testsuite/gas/i860/shift.d: Delete.
	* testsuite/gas/i860/shift.s: Delete.
	* testsuite/gas/i860/simd.d: Delete.
	* testsuite/gas/i860/simd.s: Delete.
	* testsuite/gas/i860/system.d: Delete.
	* testsuite/gas/i860/system.s: Delete.
	* testsuite/gas/i860/xp.d: Delete.
	* testsuite/gas/i860/xp.s: Delete.
	* Makefile.am: Remove i860 and i960 support.
	* configure.tgt: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/all.texi: Likewise.
	* testsuite/gas/all/gas.exp
	* config/obj-coff.h: Remove i960 support.
	* doc/internals.texi: Likewise.
	* expr.c: Likewise.
	* read.c: Likewise.
	* write.c: Likewise.
	* write.h: Likewise.
	* testsuite/gas/lns/lns.exp: Likewise.
	* testsuite/gas/symver/symver.exp: Likewise.
	* config/tc-m68k.c: Remove BOUT support.
	* config/tc-score.c: Likewise.
	* config/tc-score7.c: Likewise.
	* config/tc-sparc.c: Likewise.
	* symbols.c: Likewise.
	* doc/h8.texi: Likewise.
	* configure.ac: Remove BOUT and i860 support.
	* doc/as.texinfo: Remove BOUT, i860 and i960 support
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
ld/
	* emulparams/coff_i860.sh: Delete.
	* emulparams/elf32_i860.sh: Delete.
	* emulparams/elf32_i960.sh: Delete.
	* emulparams/gld960.sh: Delete.
	* emulparams/gld960coff.sh: Delete.
	* emulparams/lnk960.sh: Delete.
	* emultempl/gld960.em: Delete.
	* emultempl/gld960c.em: Delete.
	* emultempl/lnk960.em: Delete.
	* scripttempl/i860coff.sc: Delete.
	* scripttempl/i960.sc: Delete.
	* ld.texinfo: Remove i960 support.
	* Makefile.am: Remove i860 and i960 support.
	* configure.tgt: Likewise.
	* testsuite/ld-discard/extern.d: Likewise.
	* testsuite/ld-discard/start.d: Likewise.
	* testsuite/ld-discard/static.d: Likewise.
	* testsuite/ld-elf/compressed1d.d: Likewise.
	* testsuite/ld-elf/group1.d: Likewise.
	* testsuite/ld-elf/group3b.d: Likewise.
	* testsuite/ld-elf/group8a.d: Likewise.
	* testsuite/ld-elf/group8b.d: Likewise.
	* testsuite/ld-elf/group9a.d: Likewise.
	* testsuite/ld-elf/group9b.d: Likewise.
	* testsuite/ld-elf/linkonce2.d: Likewise.
	* testsuite/ld-elf/merge.d: Likewise.
	* testsuite/ld-elf/merge2.d: Likewise.
	* testsuite/ld-elf/merge3.d: Likewise.
	* testsuite/ld-elf/orphan-10.d: Likewise.
	* testsuite/ld-elf/orphan-11.d: Likewise.
	* testsuite/ld-elf/orphan-12.d: Likewise.
	* testsuite/ld-elf/orphan-9.d: Likewise.
	* testsuite/ld-elf/orphan-region.d: Likewise.
	* testsuite/ld-elf/orphan.d: Likewise.
	* testsuite/ld-elf/orphan3.d: Likewise.
	* testsuite/ld-elf/pr12851.d: Likewise.
	* testsuite/ld-elf/pr12975.d: Likewise.
	* testsuite/ld-elf/pr13177.d: Likewise.
	* testsuite/ld-elf/pr13195.d: Likewise.
	* testsuite/ld-elf/pr17550a.d: Likewise.
	* testsuite/ld-elf/pr17550b.d: Likewise.
	* testsuite/ld-elf/pr17550c.d: Likewise.
	* testsuite/ld-elf/pr17550d.d: Likewise.
	* testsuite/ld-elf/pr17615.d: Likewise.
	* testsuite/ld-elf/pr20528a.d: Likewise.
	* testsuite/ld-elf/pr20528b.d: Likewise.
	* testsuite/ld-elf/pr21562a.d: Likewise.
	* testsuite/ld-elf/pr21562b.d: Likewise.
	* testsuite/ld-elf/pr21562c.d: Likewise.
	* testsuite/ld-elf/pr21562d.d: Likewise.
	* testsuite/ld-elf/pr21562i.d: Likewise.
	* testsuite/ld-elf/pr21562j.d: Likewise.
	* testsuite/ld-elf/pr21562k.d: Likewise.
	* testsuite/ld-elf/pr21562l.d: Likewise.
	* testsuite/ld-elf/pr21562m.d: Likewise.
	* testsuite/ld-elf/pr21562n.d: Likewise.
	* testsuite/ld-elf/pr22677.d: Likewise.
	* testsuite/ld-elf/pr22836-1a.d: Likewise.
	* testsuite/ld-elf/pr22836-1b.d: Likewise.
	* testsuite/ld-elf/pr349.d: Likewise.
	* testsuite/ld-elf/sec-to-seg.exp: Likewise.
	* testsuite/ld-elf/sec64k.exp: Likewise.
	* testsuite/ld-elf/warn1.d: Likewise.
	* testsuite/ld-elf/warn2.d: Likewise.
	* testsuite/ld-elf/warn3.d: Likewise.
	* testsuite/lib/ld-lib.exp: Likewise.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2018-04-11 21:49:30 +09:30
Maciej W. Rozycki c43b2c546b binutils/testsuite: Also consider `*-*-lynxos*' and `*-*-symbianelf*' ELF
These targets use the ELF format according to `bfd/config.bfd'.

	binutils/
	* testsuite/lib/binutils-common.exp (is_elf_format): Also return
	1 for `*-*-lynxos*' and `*-*-symbianelf*' targets.
2018-04-11 12:03:49 +01:00
Pedro Alves 20db9c52a2 File I/O file handles after target closes
A future patch will propose making the remote target's target_ops be
heap-allocated (to make it possible to have multiple instances of
remote targets, for multiple simultaneous connections), and will
delete/destroy the remote target at target_close time.

That change trips on a latent problem, though.  File I/O handles
remain open even after the target is gone, with a dangling pointer to
a target that no longer exists.  This results in GDB crashing when it
calls the target_ops backend associated with the file handle:

 (gdb) Disconnect
 Ending remote debugging.
 * GDB crashes deferencing a dangling pointer

Backtrace:

   #0  0x00007f79338570a0 in main_arena () at /lib64/libc.so.6
   #1  0x0000000000858bfe in target_fileio_close(int, int*) (fd=1, target_errno=0x7ffe0499a4c8)
       at src/gdb/target.c:2980
   #2  0x00000000007088bd in gdb_bfd_iovec_fileio_close(bfd*, void*) (abfd=0x1a631b0, stream=0x223c9d0)
       at src/gdb/gdb_bfd.c:353
   #3  0x0000000000930906 in opncls_bclose (abfd=0x1a631b0) at src/bfd/opncls.c:528
   #4  0x0000000000930cf9 in bfd_close_all_done (abfd=0x1a631b0) at src/bfd/opncls.c:768
   #5  0x0000000000930cb3 in bfd_close (abfd=0x1a631b0) at src/bfd/opncls.c:735
   #6  0x0000000000708dc5 in gdb_bfd_close_or_warn(bfd*) (abfd=0x1a631b0) at src/gdb/gdb_bfd.c:511
   #7  0x00000000007091a2 in gdb_bfd_unref(bfd*) (abfd=0x1a631b0) at src/gdb/gdb_bfd.c:615
   #8  0x000000000079ed8e in objfile::~objfile() (this=0x2154730, __in_chrg=<optimized out>)
       at src/gdb/objfiles.c:682
   #9  0x000000000079fd1a in objfile_purge_solibs() () at src/gdb/objfiles.c:1065
   #10 0x00000000008162ca in no_shared_libraries(char const*, int) (ignored=0x0, from_tty=1)
       at src/gdb/solib.c:1251
   #11 0x000000000073b89b in disconnect_command(char const*, int) (args=0x0, from_tty=1)
       at src/gdb/infcmd.c:3035

This goes unnoticed in current master, because the current remote
target's target_ops is never destroyed nowadays, so we end up calling:

  remote_hostio_close -> remote_hostio_send_command

which gracefully fails with FILEIO_ENOSYS if remote_desc is NULL
(because the target is closed).

Fix this by invalidating a target's file I/O handles when the target
is closed.

With this change, remote_hostio_send_command no longer needs to handle the
case of being called with a closed remote target, originally added here:
<https://sourceware.org/ml/gdb-patches/2008-08/msg00359.html>.

gdb/ChangeLog:
2018-04-11  Pedro Alves  <palves@redhat.com>

	* target.c (fileio_fh_t::t): Add comment.
	(target_fileio_pwrite, target_fileio_pread, target_fileio_fstat)
	(target_fileio_close): Handle a NULL target.
	(invalidate_fileio_fh): New.
	(target_close): Call it.
	* remote.c (remote_hostio_send_command): No longer check whether
	remote_desc is open.
2018-04-11 11:40:05 +01:00
Pedro Alves 5ff79300ae C++ify fileio_fh_t, replace VEC with std::vector
Preparation for the next patch.

- Replace VEC with std::vector.
- Rewrite a couple macros as methods/functions.
- While at it, rename fileio_fh_t::fd as fileio_fh_t::target_fd to
  avoid confusion between target and host file descriptors.

gdb/ChangeLog:
2018-04-11  Pedro Alves  <palves@redhat.com>

	* target.c (fileio_fh_t): Make it a named struct instead of a
	typedef.
	(fileio_fh_t::is_closed): New method.
	(DEF_VEC_O (fileio_fh_t)): Remove.
	(fileio_fhandles): Now a std::vector.
	(is_closed_fileio_fh): Delete.
	(acquire_fileio_fd): Adjust.  Rename parameters.
	(release_fileio_fd): Adjust.
	(fileio_fd_to_fh): Reimplement as a function instead of a macro.
	(target_fileio_pwrite, target_fileio_pread, target_fileio_fstat)
	(target_fileio_close): Adjust.
2018-04-11 11:29:39 +01:00
Alan Modra 18e404c4e2 Silence nds32 pic warnings
Fixes:
FAIL: Build pr22471a.so
FAIL: Build pr22471b.so
FAIL: Build pr22649-1.so
FAIL: Build pr22649-2c.so
FAIL: Build pr22649-2d.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: PR ld/21233 dynamic symbols with section GC (auxiliary shared library)
FAIL: Build pr22150.so
FAIL: Build shared library for pr14170
FAIL: PR ld/21703 shared
FAIL: Build shared library for broken linker script test
FAIL: Build pr17068.so
FAIL: -Bsymbolic-functions
FAIL: Build pr20995.so
FAIL: Build pr20995-2.so
FAIL: Build pr22374 shared library

	* testsuite/ld-elf/shared.exp (AFLAGS_PIC): Add -mpic for nds32.
2018-04-11 11:13:49 +09:30
GDB Administrator b6572eb070 Automatic date update in version.in 2018-04-11 00:00:15 +00:00
Simon Marchi 6e22e10d63 Iterate by index in auto_load_safe_path_vec_update
As reported by Jan, we get this error when building with -D_GLIBCXX_DEBUG:

/usr/include/c++/7/debug/safe_iterator.h:297:
Error: attempt to increment a singular iterator.
Objects involved in the operation:
    iterator "this" @ 0x0x7fffffffd140 {
      type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<std::unique_ptr<char, gdb::xfree_deleter<char> >*, std::__cxx1998::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > > >, std::__debug::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > > > (mutable iterator);
      state = singular;
      references sequence with type 'std::__debug::vector<std::unique_ptr<char, gdb::xfree_deleter<char> >, std::allocator<std::unique_ptr<char, gdb::xfree_deleter<char> > > >' @ 0x0x265db40
    }

The bug was introduced by commit

commit e80aaf6183
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Mar 2 23:22:06 2018 -0500
Make delim_string_to_char_ptr_vec return an std::vector

The problem is that we iterate using a range-based for on a vector to
which we push in the loop.  Pushing to the vector invalidates the
iterator used in the loop.  Instead, change the code to iterate by index
as was done in the previous code.

gdb/ChangeLog:

	* auto-load.c (auto_load_safe_path_vec_update): Iterate by
	index.
2018-04-10 16:50:59 -04:00
Pedro Alves f50d8a2eae Fix gdb.base/fork-running-state.exp race
On my multi-target branch I was occasionaly seeing a FAIL like this:

  (gdb) PASS: gdb.base/fork-running-state.exp: detach-on-fork=off: follow-fork=parent: non-stop: kill parent
  [Inferior 2 (process 32672) exited normally]
  kill inferior 2
  warning: Inferior ID 2 is not running.
  (gdb) FAIL: gdb.base/fork-running-state.exp: detach-on-fork=off: follow-fork=parent: non-stop: kill child (the program exited)
  ... other similar fails ...

Turns out to be a testcase bug/race.  A tweak like this increases the
changes of hitting the race substancially:

  --- a/gdb/testsuite/gdb.base/fork-running-state.c
  +++ b/gdb/testsuite/gdb.base/fork-running-state.c
  @@ -29,7 +29,7 @@ fork_child (void)
   {
     while (1)
       {
  -      sleep (1);
  +      usleep (100);


The testcase has two processes, parent and child fork.  The problem is
that the child exits itself if it notices the parent is gone, but the
testcase .exp does not expect that.

I first wrote a patch that handled the different combinations of
non-stop/detach-on-fork/follow-fork/schedule-multiple, making the .exp
file know when to expect the child to exit itself vs when to kill it
explicitly, but the result was that the code to kill the parent and
child was getting about as large as the test code that is the actual
point of the testcase, above the kills.

So I scratched that approach and came up with a simpler patch --
simply make the child not exit itself when the parent exits.

The .exp file is going to kill both parent and child explicitly, and,
main() already calls alarm() as a safeguard.  I don't think we lose
anything.

gdb/testsuite/ChangeLog:
2018-04-10  Pedro Alves  <palves@redhat.com>

	* gdb.base/fork-running-state.c (fork_child): Don't exit if parent
	exits.  Instead loop running forever.
	(fork_parent): Run forever too.
2018-04-10 15:00:39 +01:00
Pedro Alves 731f534f91 Replace finish_thread_state_cleanup with a RAII class
gdb/ChangeLog:
2018-04-10  Pedro Alves  <palves@redhat.com>

	* gdbthread.h (finish_thread_state_cleanup): Delete declaration.
	(scoped_finish_thread_state): New class.
	* infcmd.c (run_command_1): Use it instead of finish_thread_state
	cleanup.
	* infrun.c (proceed, prepare_for_detach, wait_for_inferior)
	(fetch_inferior_event, normal_stop): Likewise.
	* thread.c (finish_thread_state_cleanup): Delete.
2018-04-10 14:49:30 +01:00
Alan Modra d4ae193277 Fix some strip test fails on nds32 and pru
Fixes these fails:
nds32le-linux  +FAIL: binutils-all/strip-14
nds32le-linux  +FAIL: binutils-all/strip-15
pru-elf  +FAIL: binutils-all/strip-14
pru-elf  +FAIL: binutils-all/strip-15

strip-13 fails on nds32 due to an assertion failure and out of bounds
access to nds32_elf_howto_table.

	* testsuite/binutils-all/objcopy.exp (strip-14, strip-15): Choose
	reloc=11 for pru and reloc=50 for nds32.
	* testsuite/binutils-all/strip-15.d: Accept 0xb reloc number.
2018-04-10 09:41:25 +09:30
GDB Administrator 6c7c5081f0 Automatic date update in version.in 2018-04-10 00:00:28 +00:00
Simon Marchi d5f4488f09 Add selftests for range_contains and insert_into_bit_range_vector
Add some selftests for these two functions.  To to make it easier to
compare sequences of ranges, add operator== and operator!= to compare
two gdb::array_view, and add operator== in struct range.

gdb/ChangeLog:

	* value.c: Include "selftest.h" and "common/array-view.h".
	(struct range) <operator ==>: New.
	(test_ranges_contain): New.
	(check_ranges_vector): New.
	(test_insert_into_bit_range_vector): New.
	(_initialize_values): Register selftests.
	* common/array-view.h (operator==, operator!=): New.
2018-04-09 15:47:12 -04:00
Simon Marchi b24531ed17 Use an std::vector for inline_states
This patch replaces VEC(inline_state) with std::vector<inline_state> and
adjusts the code that uses it.

gdb/ChangeLog:

	* common/gdb_vecs.h (unordered_remove): Add overload that takes
	an iterator.
	* inline-frame.c: Include <algorithm>.
	(struct inline_state): Add constructor.
	(inline_state_s): Remove.
	(DEF_VEC_O(inline_state_s)): Remove.
	(inline_states): Change type to std::vector.
	(find_inline_frame_state): Adjust to std::vector.
	(allocate_inline_frame_state): Remove.
	(clear_inline_frame_state): Adjust to std::vector.
	(skip_inline_frames): Adjust to std::vector.
2018-04-09 15:40:45 -04:00
Simon Marchi c252925ccc Remove VEC(tsv_s), use std::vector instead
This patch removes VEC(tsv_s), using an std::vector instead.  I C++ified
trace_state_variable a bit in the process, using std::string for the
name.  I also thought it would be nicer to pass a const reference to
target_download_trace_state_variable, since we know it will never be
NULL.  This highlighted that the make-target-delegates script didn't
handle references well, so I adjusted this as well.  It will surely be
useful in the future.

gdb/ChangeLog:

	* tracepoint.h (struct trace_state_variable): Add constructor.
	<name>: Change type to std::string.
	* tracepoint.c (tsv_s): Remove.
	(DEF_VEC_O(tsv_s)): Remove.
	(tvariables): Change to std::vector.
	(create_trace_state_variable): Adjust to std::vector.
	(find_trace_state_variable): Likewise.
	(find_trace_state_variable_by_number): Likewise.
	(delete_trace_state_variable): Likewise.
	(trace_variable_command): Adjust to std::string.
	(delete_trace_variable_command): Likewise.
	(tvariables_info_1): Adjust to std::vector.
	(save_trace_state_variables): Likewise.
	(start_tracing): Likewise.
	(merge_uploaded_trace_state_variables): Adjust to std::vector
	and std::string.
	* target.h (struct target_ops)
	<to_download_trace_state_variable>: Pass reference to
	trace_state_variable.
	* target-debug.h (target_debug_print_const_trace_state_variable_r): New.
	* target-delegates.c: Re-generate.
	* mi/mi-interp.c (mi_tsv_created): Adjust to std::string.
	(mi_tsv_deleted): Likewise.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
	* remote.c (remote_download_trace_state_variable): Change
	pointer to reference and adjust.
	* make-target-delegates (parse_argtypes): Handle references.
	(write_function_header): Likewise.
	(munge_type): Likewise.
2018-04-09 15:16:19 -04:00