Commit Graph

89614 Commits

Author SHA1 Message Date
Joel Brobecker 2132fe8503 fix gdbserver build in nat/linux-ptrace.c on arm-android
The following change replaced an include of gregset.h by
an include of <sys/procfs.h>:

    commit 39b2247157
    Date:   Thu Aug 11 12:01:22 2016 +0100
    Subject: Fix fallout from gdb/20413's fix
             (x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER)

Unfortunately, this broke gdbserver on Android, because that file
does not exist on this platform.  This patch fixes the issue by
conditionalizing its include with HAVE_SYS_PROCFS_H (which we check
both in gdb/configure and gdbserver/configure).

gdb/ChangeLog:

        * nat/linux-ptrace.c: Only include <sys/procfs.h> if
        HAVE_SYS_PROCFS_H is defined.

Tested by rebuilding gdbserver on arm-android and GNU/Linux.
2017-01-20 03:47:16 -05:00
GDB Administrator 8b5a555d09 Automatic date update in version.in 2017-01-20 00:00:39 +00:00
GDB Administrator 530d10ca18 Automatic date update in version.in 2017-01-19 00:00:31 +00:00
Maciej W. Rozycki 6984613a53 PR ld/20995: MIPS: Set GAS flags correctly for tests
Complement commit 9acc85a62e ("Use dynrelro for symbols in relro
sections too").

	ld/
	PR ld/20995
	* testsuite/ld-elf/elf.exp: Set GAS flags correctly for the
	`mips*-*-*' target and `pr20995' and `pr20995-2' tests.
2017-01-18 23:19:07 +00:00
Maciej W. Rozycki 81ff47b3a5 PR ld/20828: Fix linker script symbols wrongly forced local with section GC
Fix a generic ELF linker regression introduced with a chain of changes
made to unused input section garbage collection:

- commit 1a766c6843 ("Also hide symbols without PLT nor GOT
  references."),
  <https://sourceware.org/ml/binutils/2011-09/msg00076.html>,

- commit 1d5316ab67 ("PR ld/13177: garbage collector retains zombie
  references to external libraries"),
  <https://sourceware.org/ml/binutils/2011-10/msg00161.html>,

- commit 6673f753c0 ("Fix PR 12772, garbage collection of dynamic
  syms"), <https://sourceware.org/ml/binutils/2011-12/msg00077.html>,

causing the garbage collection of unused symbols present in a DSO
involved in a link to make identically named symbols ordinarily defined
(i.e. not hidden or PROVIDEd) by a linker script local, even though the
latter symbols are supposed to be global as if no DSO defined them as
well.

This is because linker script assignments are processed very late as
`lang_process' proceeds, down in the call to `ldemul_before_allocation',
which is made after the call to `lang_gc_sections' to do input section
garbage collecting.  Consequently if unused, then any such DSO-defined
symbol has already been garbage-collected and internally marked local.
It would ordinarily be removed from dynamic symbol table output, however
a linker script assignment correctly replaces its original definition
with the new one and enters it into the dynamic symbol table produced as
it is supposed to be exported.  The original local marking is however
retained making the symbol local in the dynamic symbol table and
therefore not available externally.  This also causes a sorting problem
with the MIPS target, which does not expect non-section local dynamic
symbols to be output and produces an invalid binary.

Fix the problem then, by removing the `forced_local' marking for the
offending case and add suitable test cases.  First to verify that unused
symbols ordinarily defined with linker script assignments remain
exported in the context of input section garbage collection whether or
not a DSO defining identically named symbols is present in the link.
Second that a linker version script still correctly retains or removes
such symbols as requested.

	bfd/
	PR ld/20828
	* elflink.c (bfd_elf_record_link_assignment): Clear any
	`forced_local' marking for DSO symbols that are not being
	provided.

	ld/
	PR ld/20828
	* testsuite/ld-elf/pr20828-1.sd: New test.
	* testsuite/ld-elf/pr20828-2a.sd: New test.
	* testsuite/ld-elf/pr20828-2b.sd: New test.
	* testsuite/ld-elf/pr20828.ld: New test linker script.
	* testsuite/ld-elf/pr20828.ver: New test version script.
	* testsuite/ld-elf/pr20828.s: New test source.
	* testsuite/ld-elf/shared.exp: Run the new test.
2017-01-18 18:30:34 +00:00
Maciej W. Rozycki 9e009953a5 PR gas/20649: MIPS: Fix GOT16/LO16 reloc pairing with comdat sections
Correct a regression from commit 8614eeee67 ("Traditional MIPS
patches"), <https://sourceware.org/ml/binutils/2000-07/msg00018.html>,
which caused symbols in linkonce or what is these days known as comdat
sections to be treated as external for the purpose of PIC relocation
generation even if their binding remains STB_LOCAL.  This in turn
disabled GOT16/LO16 relocation pairing with references to such symbols,
as no complementing LO16 relocation is expected for external GOT16
references in the o32 ABI, which ultimately leads to link errors, e.g.:

ld: comdat-reloc.o: Can't find matching LO16 reloc against `foo' for R_MIPS_GOT16 at 0x24 in section `.text.bar[bar]'

as with the LD test case included with this change.

Revert the special case for symbols in comdat sections then, making code
actually match `adjust_reloc_syms' as indicated in its explanatory
comment, and adjust calling code accordingly.  Also bring back the
corresponding description of what now is `s_is_linkonce', lost with
commit 5f0fe04bc5 ("Improved MIPS16/MIPS32 code intermixing for
gas."), <https://www.sourceware.org/ml/binutils/2006-07/msg00039.html>.

	gas/
	PR gas/20649
	* config/tc-mips.c (pic_need_relax): Don't check for linkonce
	symbols, remove the `segtype' parameter.
	(mips_frob_file, md_estimate_size_before_relax): Adjust
	accordingly.
	(s_is_linkonce): Add an explanatory comment.
	* testsuite/gas/mips/comdat-reloc.d: New test.
	* testsuite/gas/mips/comdat-reloc.s: New test source.
	* testsuite/gas/mips/mips.exp: Run the new test.

	ld/
	PR gas/20649
	* testsuite/ld-mips-elf/mips-elf.exp: Add PIC comdat GOT16/LO16
	relocation pairing link test.
2017-01-18 18:24:08 +00:00
Szabolcs Nagy c13a63b046 [ARM] Fix the decoding of indexed element VCMLA instruction
Bit 24 of the indexed element vcmla decode mask was incorrectly
left unset.  This could cause incorrect disassembly of some
currently undefined instructions as vcmla.

Rotatation immediates were not printed correctly in the disassembly
(could print 170 and 280 instead of 180 and 270).

opcodes/
	* arm-dis.c (coprocessor_opcodes): Fix vcmla mask and disassembly.

gas/
	* testsuite/gas/arm/armv8_3-a-simd.s: Add vcmla tests.
	* testsuite/gas/arm/armv8_3-a-simd.d: Update.
2017-01-18 17:08:34 +00:00
Alan Hayward d1dff2266d Allocate data in cached_reg_t
2017-01-18  Alan Hayward  <alan.hayward@arm.com>

	* remote.c (struct cached_reg): Change data into a pointer.
	* (stop_reply_dtr): Free data pointers before deleting vector.
	(process_stop_reply): Likewise.
	(remote_parse_stop_reply): Allocate space for data
2017-01-18 15:17:55 +00:00
Alan Hayward 9890e4338d Use register_size () instead of MAX_REGISTER_SIZE
2017-01-18  Alan Hayward  <alan.hayward@arm.com>

	* amd64-tdep.c (amd64_pseudo_register_read_value): remove
	MAX_REGISTER_SIZE.
	(amd64_pseudo_register_read_value): Likewise.
	* remote.c (fetch_register_using_p): Remove MAX_REGISTER_SIZE.
	(store_register_using_P): Likewise.
	* regcache.c (regcache_xfer_part): Likewise.
2017-01-18 15:17:55 +00:00
Bernhard Rosenkranzer 2cedb9ebf8 Add support for processing lex source files with flex v 2.6.3
PR 21059
binutils* arlex.l: Support processing with flex 2.6.3.
	* deflex.l: Likewise.

gas	* config/bfin-lex.l: Support processing with flex 2.6.3.
	* itbl-lex.l: Likewise.
2017-01-18 13:38:27 +00:00
Nathan Sidwell 1ec4b9f28b Catch gas exit-via-signal
gas/
	* as.h (gas_assert): Use abort.
	(as_assert): Remove.
	(signal_init): Declare.
	* as.c (main): Call signal_init.
	* messages.c: #include <signal.h>
	(as_assert): Delete.
	(as_abort): Allow NULL FILE.
	(signal_crash): New.
	(signal_init): Register fatal signal handlers.
	* configure.ac: Check for strsignal.
	* config.in: Rebuilt.
	* configure: Rebuilt.
2017-01-18 08:23:10 -05:00
Dimitar Dimitrov 319b82e47d Skip linker tests for unique symbols in shared libraries if the target does not support building shared libraries.
ld	* testsuite/ld-unique/unique.exp: Filter shared lib cases in
	uniqeue.exp, as not all targets have such support.
2017-01-18 12:23:19 +00:00
Dmitry Timoshkov 6bb21700ab Stop the (optional) dialong control data from being aligned when parsing/writing windows resource files.
binutils* resbin.c: Optional dialog control data immediately follow
	the control description without alignment.
	* testsuite/binutils-all/windres/controldata.rc: New test.
	source.
	* testsuite/binutils-all/windres/controldata.rsd: New test.
2017-01-18 11:40:06 +00:00
Nick Clifton 01fabda4d4 Updated Swedish translation for GAS. 2017-01-18 11:35:29 +00:00
Jim Wilson 05b3d79d26 Fixes for addv and xtn2 instructions.
sim/aarch64/
	* simulator.c (do_vec_ADDV): Call aarch64_set_vec_u64 instead of
	aarch64_set_reg_u64.  In case 2, call HALT_UNALLOC if not full.  In
	case 3, call HALT_UNALLOC unconditionally.
	(do_vec_XTN): Delete shifts.  In case 2, change index from i + 4 to
	i + 2.  Delete if on bias, change index to i + bias * X.

	sim/testsuite/sim/aarch64/
	* addv.s: New.
	* xtn.s: New.
2017-01-17 16:11:09 -08:00
GDB Administrator 11741d50ef Automatic date update in version.in 2017-01-18 00:00:27 +00:00
Kuan-Lin Chen 640d6bfddb RISC-V/bfd: Hook elf_backend_object_p to set the mach type. 2017-01-17 16:43:31 +08:00
GDB Administrator f964e51d90 Automatic date update in version.in 2017-01-17 00:00:21 +00:00
Ivo Raisr 7a36499abc gdb: sparc: split real and pseudo registers.
gdb/ChangeLog:

2017-01-16  Ivo Raisr  <ivo.raisr@oracle.com>

	Split real and pseudo registers.
	* sparc-tdep.h (SPARC_CORE_REGISTERS): New macro.
	(sparc32_pseudo_regnum): New enum.
	* sparc64-tdep.h (sparc64_pseudo_regnum): New enum.
	* sparc-tdep.c (SPARC32_FPU_REGISTERS): New macro.
	(SPARC32_CP0_REGISTERS): New macro.
	(sparc32_pseudo_register_name): New function.
	(sparc32_register_name): Use sparc32_pseudo_register_name.
	(sparc32_pseudo_register_type): New function.
	(sparc32_register_type): Use sparc32_pseudo_register_type.
	(sparc32_pseudo_register_read, sparc32_pseudo_register_write): Handle
	pseudo register numbers.
	* sparc64-tdep.c SPARC64_FPU_REGISTERS): New macro.
	(SPARC64_CP0_REGISTERS): New macro.
	(sparc64_pseudo_register_name): New function.
	(sparc64_register_name): Use sparc64_pseudo_register_name.
	(sparc64_pseudo_register_type): New function.
	(sparc64_register_type): Use sparc64_pseudo_register_type.
	(sparc64_pseudo_register_read, sparc64_pseudo_register_write): Handle
	pseudo register numbers.
	(sparc64_store_floating_fields, sparc64_extract_floating_fields,
	sparc64_store_arguments): Handle pseudo register numbers.
2017-01-16 08:45:48 -08:00
Nick Clifton 6aa1df2d44 Updated Swedish translations for GAS and LD subdirectories.
gas	* po/sv.po: Updated Swedish translation.
ld	* po/sv.po: Updated Swedish translation.
2017-01-16 10:59:23 +00:00
GDB Administrator 17a3046bfd Automatic date update in version.in 2017-01-16 00:00:21 +00:00
GDB Administrator e707b49e73 Automatic date update in version.in 2017-01-15 00:00:21 +00:00
GDB Administrator 545e07dffd Automatic date update in version.in 2017-01-14 00:00:23 +00:00
H.J. Lu 857e829e3a Gold: Fix build with GCC 4.2
PR gold/21040
	* powerpc.cc (Powerpc_relobj<size, big_endian>::make_toc_relative):
	Cast 0x80008000 to uint64_t.
2017-01-13 07:47:52 -08:00
Yao Qi 6f8976bfd6 Don't print too much if remote_debug is on
If we turn "remote debug" on and GDB does some vFile operations,
a lot of things will be printed in the screen, which makes
"remote debug" useless.

This patch changes the code that we only print 512 chars in max in
debugging messages, like this,

Sending packet: $qXfer:features:read:target.xml:0,fff#7d...Packet received: l<?xml version="1.0"?>\n<!-- Copyright (C) 2010-2016 Free Software Foundation, Inc.\n\n     Copying and distribution of this file, with or without modification,\n     are permitted in any medium without royalty provided the copyright\n     notice and this notice are preserved.  -->\n\n<!-- AMD64 with AVX - Includes Linux-only special "register".  -->\n\n<!DOCTYPE target SYSTEM "gdb-target.dtd">\n<target>\n  <architecture>i386:x86-64</architecture>\n  <osabi>GNU/Linux</osabi>\n  <xi:include href="64bit-core.xml"/>\n  <xi:[14 bytes omitted]

Sending packet: $qXfer:auxv:read::0,1000#6b...Packet received: l!\000\000\000\000\000\000\000\000d\000\000\000\000\000\000\000\003\000\000\000\000\000\000\000@\000@\000\000\000\000\000\004\000\000\000\000\000\000\0008\000\000\000\000\000\000\000\005\000\000\000\000\000\000\000\t\000\000\000\000\000\000\000\a\000\000\000\000\000\000\000\177\000\000\b\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\t\000\000\000\000\000\000\000\000\004@\000\000\000\000\000\013\000\000\000\000\000\000\003\000\000\000\000\000\000\f\000\000\000\000\000\000\003\000\000\000\000\000\000\r\000\000\000\000\000\000\003\000\000\000\000\000\000\016\000\000\000\000\000\000\003\000\000\000\000\000\000\027\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\031\000\000\000\000\000\000\177\000\000\037\000\000\000\000\000\000\000\000\017\000\000\000\000\000\000\00\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000[582 bytes omitted]

gdb:

2017-01-13  Yao Qi  <yao.qi@linaro.org>

	* remote.c (REMOTE_DEBUG_MAX_CHAR): New macro.
	(putpkt_binary): Print only REMOTE_DEBUG_MAX_CHAR chars in debug
	output.
	(getpkt_or_notif_sane_1): Likewise.
2017-01-13 15:45:33 +00:00
Yao Qi e4241ace68 'make check-headers' for c++ header
If I run 'make check-headers', I get these errors,
....
In file included from ../../binutils-gdb/gdb/common/common-defs.h:78:0,
                 from ../../binutils-gdb/gdb/defs.h:28,
                 from <command-line>:0:
../../binutils-gdb/gdb/common/common-utils.h:23:18: fatal error: string: No such file or directory
 #include <string>
                  ^

because we still parse headers as c file with a c compiler, which is no
longer true after we moved to C++.  This patch changes it to use C++
compiler and parse headers as c++ headers.

gdb:

2017-01-13  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (checker-headers): Use CXX and CXX_DIALET instead
	of CC.  Pass "-x c++-header" instead of "-x c".
2017-01-13 14:40:11 +00:00
Yao Qi 9608051a0e Return -1 on memory error in print_insn_m68k
m68k-dis.c:print_insn_m68k doesn't return -1 on memory error, but GDB
expects it returning -1 on memory error.

opcodes:

2017-01-13  Yao Qi  <yao.qi@linaro.org>

	* m68k-dis.c (match_insn_m68k): Extend comments.  Return -1
	if FETCH_DATA returns 0.
	(m68k_scan_mask): Likewise.
	(print_insn_m68k): Update code to handle -1 return value.
2017-01-13 12:27:39 +00:00
Yao Qi f622ea96de Remove magic numbers in m68k-dis.c:print_insn_arg
When I inspect the return values of disassmblers, I happen to see
various -1/-2/-3 magic numbers are used in m68k-dis.c.  This patch
is to replace them with enum.

-1 and -2 is "clearly documented" in print_ins_arg's comments, but
-3 isn't.  In fact, -3 is returned when FETCH_DATA returns false,
which means memory error (because fetch_data return 0 on memory
error).  So I name enum PRINT_INSN_ARG_MEMORY_ERROR for -3.

This patch is a refactor patch, doesn't affect any functionality.

opcodes:

2017-01-13  Yao Qi  <yao.qi@linaro.org>

	* m68k-dis.c (enum print_insn_arg_error): New.
	(NEXTBYTE): Replace -3 with
	PRINT_INSN_ARG_MEMORY_ERROR.
	(NEXTULONG): Likewise.
	(NEXTSINGLE): Likewise.
	(NEXTDOUBLE): Likewise.
	(NEXTDOUBLE): Likewise.
	(NEXTPACKED): Likewise.
	(FETCH_ARG): Likewise.
	(FETCH_DATA): Update comments.
	(print_insn_arg): Update comments. Replace magic numbers with
	enum.
	(match_insn_m68k): Likewise.
2017-01-13 12:21:22 +00:00
GDB Administrator 404c843430 Automatic date update in version.in 2017-01-13 00:00:22 +00:00
Cary Coutant aca5eec611 Fix incorrect byte counts.
gold/
	* object.cc (Sized_relobj_file): Fix byte counts for calls to memmem.
2017-01-12 11:51:40 -08:00
H.J. Lu 8361ed4d6b x86-64: Also generate unwind info for .plt.bnd
Also generate unwind info for the .plt.bnd section.  Sine it is the same
as unwind info for the .plt.got section, we use unwind info for the
.plt.got section to cover the the .plt.bnd section.

bfd/

	PR ld/21038
	* elf64-x86-64.c (elf_x86_64_link_hash_table): Add
	plt_bnd_eh_frame.
	(elf_x86_64_check_relocs): Create .eh_frame section for the
	.plt.bnd section.
	(elf_x86_64_size_dynamic_sections): Allocate and initialize
	.eh_frame section for the .plt.bnd section.
	(elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
	for the .plt.bnd section.

ld/

	PR ld/21038
	* testsuite/ld-x86-64/pr21038b.d: Updated.
	* testsuite/ld-x86-64/pr21038c.d: New file.
	* testsuite/ld-x86-64/pr21038c.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr21038c.
2017-01-12 10:32:17 -08:00
Nick Clifton 2425a30e40 Add support for locating separate debug info files via the build-id method.
PR binutils/20876
bfd	* opncls.c (find_separate_debug_file): Add include_dirs
	parameter.  Only include the directory part of the bfd's filename
	in search paths if include_dirs is true.  Add a couple of extra
	locations for looking for debug files.
	( bfd_follow_gnu_debuglink): Update invocation of
	find_separate_debug_file.
	(bfd_follow_gnu_debugaltlink): Likewise.
	(get_build_id): New function: Finds the build-id of the given bfd.
	(get_build_id_name): New function: Computes the name of the
	separate debug info file for a bfd, based upon its build-id.
	(check_build_id_file): New function: Checks to see if a separate
	debug info file exists at the given location, and that its
	build-id matches that of the original bfd.
	(bfd_follow_build_id_debuglink): New function: Finds a separate
	debug info file for a given bfd by using the build-id method.
	* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
	method of locating a separate debug info file before using the
	debuglink method.
	* bfd-in2.h: Regenerate.

binutils * NEWS: Mention the new feature.
	* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
	New proc to test the location of separate debug info files using
	the build-id method.
2017-01-12 16:56:54 +00:00
Igor Tsimbalist 620214f742 Enable Intel AVX512_VPOPCNTDQ instructions
gas/

2017-01-12  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>

	* config/tc-i386.c (cpu_arch): Add .avx512_vpopcntdq.
	(cpu_noarch): Add noavx512_vpopcntdq.
	* doc/c-i386.texi: Document avx512_vpopcntdq, noavx512_vpopcntdq.
	* testsuite/gas/i386/i386.exp: Run AVX512_VPOPCNTDQ tests.
	* testsuite/gas/i386/avx512_vpopcntdqd-intel.d: New file.
	* testsuite/gas/i386/avx512_vpopcntdqd.d: Ditto.
	* testsuite/gas/i386/avx512_vpopcntdqd.s: Ditto.
	* testsuite/gas/i386/x86-64-avx512_vpopcntdqd-intel.d: Ditto.
	* testsuite/gas/i386/x86-64-avx512_vpopcntdqd.d: Ditto.
	* testsuite/gas/i386/x86-64-avx512_vpopcntdqd.s: Ditto.

opcodes/

2017-01-12  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>

	* i386-dis.c (enum): Add PREFIX_EVEX_0F3855, EVEX_W_0F3855_P_2.
	* i386-dis-evex.h (evex_table): Updated.
	* i386-gen.c (cpu_flag_init): Add CPU_AVX512_VPOPCNTDQ_FLAGS,
	CPU_ANY_AVX512_VPOPCNTDQ_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
	(cpu_flags): Add CpuAVX512_VPOPCNTDQ.
	* i386-opc.h (enum): (AVX512_VPOPCNTDQ): New.
	(i386_cpu_flags): Add cpuavx512_vpopcntdq.
	* i386-opc.tbl: Add Intel AVX512_VPOPCNTDQ instructions.
	* i386-init.h: Regenerate.
	* i386-tbl.h: Ditto.
2017-01-12 08:44:24 -08:00
Simon Marchi 3015c06465 Update comment in remote_can_async_p
I find this comment counter intuitive, and it probably predates the
always-target-async change.  AFAIK, remote will always be async, unless
the user explicitly prevents it with "maint set target-async off".

gdb/ChangeLog:

	* remote.c (remote_can_async_p): Update comment.
2017-01-12 11:15:02 -05:00
Simon Marchi fde1b17d37 Update comment in linux_nat_can_async_p
I think this comment is outdated.  Nowadays, linux-nat is always async,
unless the user has explictly turned it off with
"maint set target-async off".

gdb/ChangeLog:

	* linux-nat.c (linux_nat_can_async_p): Update comment.
2017-01-12 11:04:53 -05:00
Simon Marchi ca1ca08b08 Remove dead serial_interface_lookup calls
By inspecting the serial_add_interface calls, I found that the serial
interface names that we have today are:

 - hardwire
 - terminal
 - pipe
 - tcp
 - event

 The calls to serial_interface_lookup with any other names are most
 likely leftovers which can be removed since these serial interfaces
 don't exist anymore.  The commits that removed the "pc" and "parallel"
 interfaces are respectively:

  cb2a4ac5da

and

  e386d4d2fb

gdb/ChangeLog:

	* serial.c (serial_open): Forget about "pc" and "lpt" serial interface.
2017-01-12 10:41:50 -05:00
Nick Clifton 1181551ef0 Prevent internal assembler errors if a stabs creation function builds an badly formatted input string.
* read.c (temp_ilp): New function.  Installs a temporary input
	line pointer.
	(restore_ilp): New function.  Restores the original input line
	pointer.
	* read.h (temp_ilp): Prototype.
	(restore_ilp): Prototype.
	* stabs.c (dot_func_p): Use bfd_boolean type.
	(generate_asm_file): Use temp_ilp and restore_ilp.
	(stabs_generate_asm_lineno): Likewise.
	(stabs_generate_asm_endfunc): Likewise.
2017-01-12 14:56:13 +00:00
Yao Qi d95014a2ef Return -1 on memory error in print_insn_msp430
Disassemblers in opcodes return -1 on memory error, but msp430 doesn't
follow this convention.  If I change GDB not to throw exception in
disassemble_info.memory_error_func and rely on the return value of
disassembler, I'll get the following output.

(gdb) disassemble 0x0,+8
Dump of assembler code from 0x0 to 0x8:
   0x00000000:  .word   0xffff; ????
   0x00000002:  .word   0xffff; ????
   0x00000004:  .word   0xffff; ????
   0x00000006:  .word   0xffff; ????
End of assembler dump.

This patch teaches print_insn_msp430 and its callees to return -1
on memory error.

opcodes:

2017-01-12  Yao Qi  <yao.qi@linaro.org>

	* msp430-dis.c (msp430_singleoperand): Return -1 if
	msp430dis_opcode_signed returns false.
	(msp430_doubleoperand): Likewise.
	(msp430_branchinstr): Return -1 if
	msp430dis_opcode_unsigned returns false.
	(msp430x_calla_instr): Likewise.
	(print_insn_msp430): Likewise.
2017-01-12 09:40:41 +00:00
GDB Administrator eed0b5b263 Automatic date update in version.in 2017-01-12 00:00:25 +00:00
Cary Coutant 6624f3a142 Fix more compile errors with GCC 4.2.
gold/
	PR gold/21040
	* x86_64.cc (Output_data_plt_x86_64_bnd::do_fill_first_plt_entry):
	Remove unnecessary 'typename' keyword.
	(Output_data_plt_x86_64_bnd::do_fill_plt_entry): Likewise.
	(Output_data_plt_x86_64_bnd::fill_aplt_entry): Likewise.
	(Output_data_plt_x86_64_bnd::do_fill_tlsdesc_entry): Likewise.
	(Output_data_plt_x86_64_bnd::do_write): Likewise.
2017-01-11 13:42:24 -08:00
Cary Coutant 976e204b36 Fix compile errors with GCC 4.2.
gold/
	PR gold/21040
	* x86_64.cc (Output_data_plt_x86_64_bnd::do_fill_first_plt_entry):
	Remove unnecessary 'typename' keyword.
	(Output_data_plt_x86_64_bnd::do_fill_plt_entry): Likewise.
	(Output_data_plt_x86_64_bnd::do_fill_tlsdesc_entry): Likewise.
	(Output_data_plt_x86_64_bnd::fill_aplt_entry): Likewise.
	* testsuite/copy_test_relro_1.cc (p, b, c, q): Add separate extern
	declarations.
2017-01-11 11:47:27 -08:00
Cary Coutant 1fa5f68bf3 Fix test cases to work for i386.
gold/
	PR gold/21039
	* testsuite/script_test_13.sh: Adjust patterns to work for i386.
	* testsuite/script_test_15a.sh: Likewise.
	* testsuite/script_test_15b.sh: Likewise.
	* testsuite/script_test_15c.sh: Likewise.
2017-01-11 11:26:26 -08:00
H.J. Lu 9e65917652 x86-64: Correct unwind info for the BND PLT
Since the BND PLT has

 230:	68 00 00 00 00       	pushq  $0x0
 235:	f2 e9 e5 ff ff ff    	bnd jmpq 220 <.plt>
 23b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

instead of

 230:	ff 25 e2 0d 20 00    	jmpq   *0x200de2(%rip)        # 201018
<func>
 236:	68 00 00 00 00       	pushq  $0x0
 23b:	e9 e0 ff ff ff       	jmpq   220 <.plt>

its unwind info should be

DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0;
DW_OP_lit15; DW_OP_and; DW_OP_lit5; DW_OP_ge; DW_OP_lit3; DW_OP_shl;
DW_OP_plus)

bfd/

	PR ld/21038
	* elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
	(elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
	elf_x86_64_eh_frame_plt_got.
	(elf_x86_64_size_dynamic_sections): Get unwind info from
	elf_x86_64_bnd_arch_bed for the BND PLT.

ld/

	PR ld/21038
	* testsuite/ld-x86-64/pr21038a.d: New file.
	* testsuite/ld-x86-64/pr21038a.s: Likewise.
	* testsuite/ld-x86-64/pr21038b.d: Likewise.
	* testsuite/ld-x86-64/pr21038b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr21038a and pr21038b.
2017-01-11 09:17:05 -08:00
Simon Marchi 4ad2da7317 Fix typo in lookup_cmd_1 comment
gdb/ChangeLog:

	* cli/cli-decode.c (lookup_cmd_1): Fix typo in comment.
2017-01-11 11:15:26 -05:00
Jeremy Soller f2e2d2f54b Add support for x86/64 redox target.
bfd	* config.bfd: Add entries for i686-redox and x86_64-redox.

gas	* configure.tgt: Add entry for i386-redox.

ld	* configure.tgt: Add entries for x86-redox and x86_64-redox.
2017-01-11 15:05:53 +00:00
Tom Tromey c8b23b3f89 Add constructor and destructor to demangle_parse_info
This adds a constructor and destructor to demangle_parse_info, and
then changes all the users to use them.  This removes
make_cleanup_cp_demangled_name_parse_free and its single use.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* python/py-type.c (typy_legacy_template_argument): Update.
	* cp-support.h (struct demangle_parse_info) (demangle_parse_info,
	~demangle_parse_info): Declare new members.
	(cp_demangled_name_to_comp): Return unique_ptr.
	(cp_demangled_name_parse_free)
	(make_cleanup_cp_demangled_name_parse_free)
	(cp_new_demangle_parse_info): Remove.
	* cp-support.c (do_demangled_name_parse_free_cleanup)
	(make_cleanup_cp_demangled_name_parse_free): Remove.
	(inspect_type, cp_canonicalize_string_full)
	(cp_canonicalize_string): Update.
	(mangled_name_to_comp): Change return type.
	(cp_class_name_from_physname, method_name_from_physname)
	(cp_func_name, cp_remove_params): Update.
	* cp-name-parser.y (demangle_parse_info): New constructor, from
	cp_new_demangle_parse_info.
	(~demangle_parse_info): New destructor, from
	cp_demangled_name_parse_free.
	(cp_merge_demangle_parse_infos): Update.
	(cp_demangled_name_to_comp): Change return type.
2017-01-10 19:14:15 -07:00
Tom Tromey 1ac32117f7 Remove cleanups from execute_gdb_command
This replaces a cleanup in execute_gdb_command with an instance of
std::string.

Testing showed that this originally missed a cleanup that was returned
by prevent_dont_repeat.  This version of the patch changes
prevent_dont_repeat to return a scoped_restore rather than a cleanup.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* top.c (prevent_dont_repeat): Change return type.
	* python/python.c (execute_gdb_command): Use std::string.
	Update.
	* guile/guile.c (gdbscm_execute_gdb_command): Update.
	* command.h (prevent_dont_repeat): Change return type.
	* breakpoint.c (bpstat_do_actions_1): Update.
2017-01-10 19:14:14 -07:00
Tom Tromey 0cf0822778 Use scoped_value_mark in dwarf2_evaluate_loc_desc_full
This changes dwarf2_evaluate_loc_desc_full to use scoped_value_mark.

Note that this function previously called do_cleanup using the same
cleanup multiple times.  I had thought this was buggy, but re-reading
make_my_cleanup2 indicates that it is not.  Nevertheless it is
surprising, and at least one of the calls (the one that is completely
removed in this patch) seems to have been done under the assumption
that it would still have some effect.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* value.h (scoped_value_mark::~scoped_value_mark): Call
	free_to_mark.
	(scoped_value_mark::free_to_mark): New method.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use
	scoped_value_mark.
2017-01-10 19:14:13 -07:00
Tom Tromey eb11506932 Add scoped_value_mark
This adds a scoped_value_mark class, that records the value mark in
the constructor and then calls value_free_to_mark in the destructor.
It then updates various spots in gdb to use this class, rather than a
cleanup.

It would be better overall to replace "struct value *" with a
shared_ptr, maybe eliminating the need for this class (watchpoints
would perhaps need some new mechanism as well).  However, that's
difficult to do.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* python/py-value.c (valpy_dereference, valpy_referenced_value)
	(valpy_reference_value, valpy_const_value, valpy_get_address)
	(valpy_get_dynamic_type, valpy_lazy_string, valpy_do_cast)
	(valpy_getitem, valpy_call, valpy_binop_throw, valpy_negative)
	(valpy_absolute, valpy_richcompare_throw): Use scoped_value_mark.
	* dwarf2loc.c (dwarf2_loc_desc_get_symbol_read_needs): Use
	scoped_value_mark.
	* dwarf2-frame.c (execute_stack_op): Use scoped_value_mark.
	* value.h (scoped_value_mark): New class.
2017-01-10 19:14:12 -07:00
Tom Tromey 906768f970 Remove make_cleanup_discard_psymtabs
This removes make_cleanup_discard_psymtabs in favor of a new class.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (dwarf2_build_psymtabs): Use psymtab_discarder.
	* psympriv.h (make_cleanup_discard_psymtabs): Don't declare.
	* psymtab.c (discard_psymtabs_upto): Remove.
	(make_cleanup_discard_psymtabs): Remove.
	(struct psymtab_state): Remove.
2017-01-10 19:14:12 -07:00