Commit Graph

93624 Commits

Author SHA1 Message Date
Andreas Arnez 194ed4130d Testsuite: Fix ambiguous "break" due to libinproctrace
Some of GDB's trace test cases define a function end() and place a
breakpoint there with "break end".  However, when libinproctrace is linked
to the binary, there are multiple methods named "end", such as
std::string::end() from the C++ library or format_pieces::end() from
common/format.h.  GDB then creates multiple breakpoints instead of just a
single one, and some FAILs result, such as these:

  FAIL: gdb.trace/trace-mt.exp: ftrace on: break end
  FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

Fix this by adding the "-qualified" option to the break commands.  For
consistency, change all occurrences of "break end" (and similar) in all
trace test cases, even if the current behavior does not cause problems.
Also, consequently use the gdb_breakpoint convenience proc.

gdb/testsuite/ChangeLog:

	* gdb.trace/actions-changed.exp: Call gdb_breakpoint with the
	"qualified" option when setting breakpoints.
	* gdb.trace/backtrace.exp: Likewise.
	* gdb.trace/circ.exp: Likewise.
	* gdb.trace/collection.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/ftrace-lock.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/packetlen.exp: Likewise.
	* gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/qtro.exp: Likewise.
	* gdb.trace/read-memory.exp: Likewise.
	* gdb.trace/report.exp: Likewise.
	* gdb.trace/signal.exp: Likewise.
	* gdb.trace/status-stop.exp: Likewise.
	* gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfind.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/trace-condition.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.
	* gdb.trace/tstatus.exp: Likewise.
	* gdb.trace/tsv.exp: Likewise.
	* gdb.trace/unavailable-dwarf-piece.exp: Likewise.
	* gdb.trace/unavailable.exp: Likewise.
	* gdb.trace/while-dyn.exp: Likewise.
2018-03-19 13:13:09 +01:00
Nick Clifton 315aa1cf83 Updated Spanish translation for the bfd/ sub-directory, and updated Ukranian translation for the gas/ sub-directory.
bfd	* po/es.po: Updated Spanish translation.
gas	* po/uk.po: Updated Ukranian translation.
2018-03-19 10:49:13 +00:00
Tom Tromey 1cb1f3dae7 Remove some cleanups from solib.c
This removes some cleanups from solib.c, replacing them with
gdb::def_vector.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-18  Tom Tromey  <tom@tromey.com>

	* solib.c (gdb_bfd_lookup_symbol_from_symtab): Use
	gdb::def_vector.
	(bfd_lookup_symbol_from_dyn_symtab): Likewise.
2018-03-18 21:50:00 -06:00
GDB Administrator c820f6a44d Automatic date update in version.in 2018-03-19 00:00:24 +00:00
GDB Administrator 2e1d1be528 Automatic date update in version.in 2018-03-18 00:01:24 +00:00
Tom Tromey a06ab151cb Change auto_load_objfile_script_1 to use std::string
This replaces some manual string manipulation in
auto_load_objfile_script_1 with std::string, simplifying the code and
allowing the removal of some cleanups.

Tested by the buildbot.

2018-03-17  Tom Tromey  <tom@tromey.com>

	* auto-load.c (auto_load_objfile_script_1): Use std::string.
2018-03-17 13:28:56 -06:00
Tom Tromey 770623f79f Remove target_fileio_close_cleanup
This removes target_fileio_close_cleanup in favor of a new RAII class.
The new class is similar to scoped_fd but calls
target_fileio_close_cleanup rather than close.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-17  Tom Tromey  <tom@tromey.com>

	* target.c (class scoped_target_fd): New.
	(target_fileio_close_cleanup): Remove.
	(target_fileio_read_alloc_1): Use scoped_target_fd.
2018-03-17 09:22:15 -06:00
GDB Administrator 04153a3e04 Automatic date update in version.in 2018-03-17 00:00:16 +00:00
Simon Marchi 39be3c7e98 Add silent Makefile rules
Many projects (e.g. the Linux kernel) and build systems use "silent"
rules, which means that they'll only print a summary of what's being
done instead of printing all the detailed command lines.  While chatting
on the #gdb IRC channel, I realized a few people (including me) thought
it would be nice to have it in GDB too.

The idea is that too much text is not useful, the important information
gets lost.  If there's only the essential information, it's more likely
to be useful.  Most of the time, when I look at the build output, it's
to see how it's progressing.  By just printing a brief summary of each
operation, I can easily spot what's currently being compiled and
therefore how the build progresses (with time you know the order in
which files are compiled almost by heart).

As with other projects (Linux, automake-based things, probably others),
it's possible to print the complete command lines by passing V=1 to make
(or any other non-zero value).

I had one hesitation about this: when people report build failures, we
are more likely to miss the full compile command line.  We'll probably
sometimes need to ask people to include the build log with "make V=1".
I don't think it's a big downside, if other projects the size of the
Linux kernel can live with it, I'm sure we can too.

gdb/ChangeLog:

	* silent-rules.mk: New.
	* Makefile.in: Include silent-rules.mk
	(srcdir, VPATH, top_srcdir): Move up.
	(COMPILE): Add ECHO_CXX.
	(test-cp-name-parser$(EXEEXT)): Add ECHO_CXXLD.
	(init.c): Add ECHO_INIT_C.
	(gdb$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
	(version.c): Add ECHO_GEN.
	(printcmd.o): Add ECHO_CXX.
	(target-float.o): Add ECHO_CXX.
	(ada-exp.o): Add ECHO_CXX.
	(stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN.
	(insight$(EXEEXT)): Add ECHO_CXXLD.
	* gnulib/configure.ac: Add AM_SILENT_RULES.
	* gnulib/aclocal.m4: Re-generate.
	* gnulib/configure: Re-generate.
	* gnulib/import/Makefile.in: Re-generate.

gdb/gdbserver/ChangeLog:

	* Makefile.in: Include silent-rules.mk.
	(srcdir, abs_top_srcdir, abs_srcdir, VPATH): Move up.
	(COMPILE): Add ECHO_CXX.
	(gdbserver$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
	(gdbreplay$(EXEEXT)): Add SILENCE and ECHO_CXXLD.
	($(IPA_LIB)): Add SILENCE and ECHO_CXXLD.
	(version-generated.c): Add ECHO_GEN.
	(stamp-xml): Add SILENCE and ECHO_GEN_XML_BUILTIN_GENERATED.
	(IPAGENT_COMPILE): Add ECHO_CXX.
	(%-generated.c): Add ECHO_REGDAT.
2018-03-16 16:30:25 -04:00
Tom Tromey 37e136b168 Remove make_cleanup_free_section_addr_info
This removes make_cleanup_free_section_addr_info.  Instead -- per
Simon's suggestion -- this changes section_addr_info to be a
std::vector.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-16  Tom Tromey  <tom@tromey.com>

	* xcoffread.c (xcoff_symfile_offsets): Change type of "addrs".
	* utils.h (make_cleanup_free_section_addr_info): Don't declare.
	* utils.c (do_free_section_addr_info)
	(make_cleanup_free_section_addr_info): Remove.
	* symfile.h (struct other_sections): Add constructor.
	(struct section_addr_info): Remove.
	(section_addr_info): New typedef.
	(struct sym_fns) <sym_offsets>: Change type of parameter.
	(build_section_addr_info_from_objfile)
	(relative_addr_info_to_section_offsets, addr_info_make_relative)
	(default_symfile_offsets, symbol_file_add)
	(symbol_file_add_from_bfd)
	(build_section_addr_info_from_section_table): Update.
	(alloc_section_addr_info, free_section_addr_info): Don't declare.
	* symfile.c (alloc_section_addr_info): Remove.
	(build_section_addr_info_from_section_table): Change return type.
	Update.
	(build_section_addr_info_from_bfd)
	(build_section_addr_info_from_objfile): Likewise.
	(free_section_addr_info): Remove.
	(relative_addr_info_to_section_offsets): Change type of "addrs".
	(addrs_section_compar): Now a std::sort comparator.
	(addrs_section_sort): Change return type.
	(addr_info_make_relative): Change type of "addrs".  Update.
	(default_symfile_offsets, syms_from_objfile_1)
	(syms_from_objfile, symbol_file_add_with_addrs): Likewise.
	(symbol_file_add_separate): Update.
	(symbol_file_add): Change type of "addrs".  Update.
	(add_symbol_file_command): Update.  Remove cleanups.
	* symfile-mem.c (symbol_file_add_from_memory): Update.  Remove
	cleanups.
	* symfile-debug.c (debug_sym_offsets): Change type of "info".
	* solib.c (solib_read_symbols): Update.
	* objfiles.c (objfile_relocate): Update.  Remove cleanups.
	* machoread.c (macho_symfile_offsets): Update.
	* jit.c (jit_bfd_try_read_symtab): Update.
2018-03-16 14:22:13 -06:00
Andreas Arnez 8b067d2cf5 Fix tspeed test case: copy libinproctrace to target
The tspeed test case does not execute correctly because libinproctrace.so
is not copied to the target.  This is fixed.

gdb/testsuite/ChangeLog:

	* gdb.trace/tspeed.exp: Add invocation of gdb_load_shlib to ensure
	that libinproctrace is copied to the target.
2018-03-16 20:40:38 +01:00
Jim Wilson ca2fd32c55 RISC-V: Emit better warning for unknown CSR.
gas/
	* config/tc-riscv.c (check_absolute_expr): Expand comment.  New
	parameter maybe_csr.  If maybe_csr and O_symbol, print CSR name.
	(riscv_ip): Add new argument to check_absolute_expr calls.
	* testsuite/gas/riscv/bad-csr.d: New.
	* testsuite/gas/riscv/bad-csr.l: New.
	* testsuite/gas/riscv/bad-csr.s: New.
2018-03-16 10:03:57 -07:00
Simon Marchi 03afa6ef8a Add selftest for substitute_path_component
This patch add some unit tests for the substitute_path_component
function.

gdb/ChangeLog:

	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
	unittests/utils-selftests.c.
	* unittests/utils-selftests.c: New file.
2018-03-15 22:04:42 -04:00
GDB Administrator acc834c7ab Automatic date update in version.in 2018-03-16 00:00:29 +00:00
Max Filippov 0854d50445 xtensa: bfd: fix assertion in xlate_offset_with_removed_text
Linking objects containing jumps targeting the end of a section triggers
assertion in the xlate_offset_with_removed_text. Such jumps may be
generated by a compiler as a dead code and not removed at -O0. Allow
such jumps.
While at it make bsearch argument match comparison function expectations
and use bfd_vma for address fields in the struct xlate_map_entry.

bfd/
2018-03-15  Max Filippov  <jcmvbkbc@gmail.com>

	* elf32-xtensa.c (xlate_map_entry): Change types of address
	fields from 'unsigned' to 'bfd_vma'.
	(xlate_offset_with_removed_text): Use struct xlate_map_entry as
	the key argument to bsearch. Allow offsets past the end of a
	section, use the last map entry for translation of such offsets.
2018-03-15 13:53:33 -07:00
Andreas Schwab 202d116e57 RISC-V: Don't enable relaxation in relocatable link
PR ld/22949
	* emultempl/riscvelf.em (riscv_elf_before_allocation): Don't
	enable relaxation in relocatable link.
2018-03-15 09:54:51 +01:00
Kuan-Lin Chen f967164095 nds32: Remove the unsupported target feature. 2018-03-15 14:50:51 +08:00
GDB Administrator 8bb251a84a Automatic date update in version.in 2018-03-15 00:00:38 +00:00
Jim Wilson 399912428d Missing testcase files for last commit. 2018-03-14 16:05:44 -07:00
Jim Wilson 0e35537d75 RISC-V: Add .insn support.
gas/ChangeLog
	2018-03-07  Kito Cheng  <kito.cheng@gmail.com>
	* config/tc-riscv.c (opcode_name_list): New.
	(opcode_names_hash): Likewise.
	(init_opcode_names_hash): Likewise.
	(opcode_name_lookup): Likewise.
	(validate_riscv_insn): New argument length, and add new format
	which used in .insn directive.
	(md_begin): Refine hash table initialization logic into
	init_opcode_hash.
	(init_opcode_hash): New.
	(my_getOpcodeExpression): Parse opcode name for .insn.
	(riscv_ip): New argument hash, able to handle .insn directive.
	(s_riscv_insn): Handler for .insn directive.
	(riscv_pseudo_table): New entry for .insn.
	* doc/c-riscv.texi: Add documentation for .insn directive.
	* testsuite/gas/riscv/insn.d: Add testcase for .insn directive.
	* testsuite/gas/riscv/insn.s: Likewise.

	include/ChangeLog
	2018-03-07  Kito Cheng  <kito.cheng@gmail.com>
	* opcode/riscv.h (OP_MASK_FUNCT3): New.
	(OP_SH_FUNCT3): Likewise.
	(OP_MASK_FUNCT7): Likewise.
	(OP_SH_FUNCT7): Likewise.
	(OP_MASK_OP2): Likewise.
	(OP_SH_OP2): Likewise.
	(OP_MASK_CFUNCT4): Likewise.
	(OP_SH_CFUNCT4): Likewise.
	(OP_MASK_CFUNCT3): Likewise.
	(OP_SH_CFUNCT3): Likewise.
	(riscv_insn_types): Likewise.

	opcodes/ChangeLog
	2018-03-07  Kito Cheng  <kito.cheng@gmail.com>
	* riscv-opc.c (riscv_insn_types): New.
2018-03-14 16:04:03 -07:00
Tom Tromey 3ae9ce5dd7 Special case NULL when using printf's %s format
This changes the printf command's %s and %ls formats to special-case
NULL, and print "(null)" for these.  This is PR cli/14977.  This
behavior seems a bit friendlier; I was undecided on whether other
invalid pointers should be handled specially somehow, so for the time
being I've left those out.

gdb/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

	PR cli/14977:
	* printcmd.c (printf_c_string, printf_wide_c_string): Special case
	for NULL.

gdb/gdbserver/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

	PR cli/14977:
	* ax.c (ax_printf): Special case for NULL.

gdb/testsuite/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

	PR cli/14977:
	* gdb.base/printcmds.exp (test_printf): Add printf test of %s with
	a null pointer.
	* gdb.base/wchar.exp: Likewise.
2018-03-14 09:44:34 -06:00
Tom Tromey b8c2339b2f Allow - in %p for printf
PR cli/19918 points out that a printf format like "%-5p" will cause a
gdb crash.  The bug is problem is that printf_pointer doesn't take the
"-" flag into account.

gdb/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

	PR cli/19918:
	* printcmd.c (printf_pointer): Allow "-" in format.

gdb/testsuite/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

	PR cli/19918:
	* gdb.base/printcmds.exp (test_printf): Add printf test using '-'
	flag.
2018-03-14 09:44:33 -06:00
Tom Tromey 80ae639d3c Add usage to printf command
This patch adds the "Usage:" text to the printf command's help text,
and tries to improve the text a tiny bit.

gdb/ChangeLog
2018-03-14  Tom Tromey  <tom@tromey.com>

	* printcmd.c (_initialize_printcmd): Add usage to printf.
2018-03-14 09:44:32 -06:00
Yao Qi 0d671d99a6 Update my email address
gdb:

2018-03-14  Yao Qi  <qiyao@sourceware.org>

	* MAINTAINERS: Update my email address.
2018-03-14 13:43:00 +00:00
Alan Modra 7dda8d3cf3 PowerPC64 debian bug 886264, out-of-line save/restore functions
This calculation in relocate_section

	      if (stub_entry->stub_type == ppc_stub_save_res)
		relocation += (stub_sec->output_offset
			       + stub_sec->output_section->vma
			       + stub_sec->size - htab->sfpr->size
			       - htab->sfpr->output_offset
			       - htab->sfpr->output_section->vma);

to adjust from the original out-of-line save/restore function address
in sfpr to a copy at the end of stub_sec goes wrong when stub_sec is
padded, because the copy is no longer at the end of stub_sec.  The
solution is to pad before copying sfpr, so the copy is always at the
end of stub_sec.

	* elf64-ppc.c (sfpr_define): Adjust for stub_sec size having
	sfpr size added before defining alias symbols.
	(ppc64_elf_build_stubs): Add stub section padding before
	copying sfpr contents and defining save/restore alias symbols.
2018-03-14 22:20:11 +10:30
H.J. Lu 9e223787a4 GC: Also check the local debug definition section
Extend

commit b7c871edcd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed May 17 07:57:15 2017 -0700

    Mark debug sections referenced by kept debug sections

to handle the local debug definition section.

bfd/

	PR ld/20882
	* elflink.c (elf_gc_mark_debug_section): Also check the local
	debug definition section.

ld/

	PR ld/20882
	* testsuite/ld-gc/pr20882.d: Also dump and check .debug_abbrev
	section.
	* testsuite/ld-gc/pr20882b.s: Add .debug_abbrev section.
2018-03-14 04:23:40 -07:00
H.J. Lu bf48520113 gc.exp: Fix a typo: $LFLAGS -> $LDFLAGS
* testsuite/ld-gc/gc.exp: Fix a typo: $LFLAGS -> $LDFLAGS.
2018-03-14 04:21:32 -07:00
GDB Administrator f8ed12daa1 Automatic date update in version.in 2018-03-14 00:00:42 +00:00
Tom Tromey b577b6af8e Remove two cleanups using std::string
This patches removes cleanups from a couple of spots by using
std::string rather than manual memory management.

Regression tested by the buildbot, though note that I don't believe
the buildbot actually exercises the machoread code.

gdb/ChangeLog
2018-03-13  Tom Tromey  <tom@tromey.com>

	* machoread.c (macho_check_dsym): Change filenamep to a
	std::string*.
	(macho_symfile_read): Update.
	* symfile.c (load_command): Use std::string.
2018-03-13 17:41:12 -06:00
Nick Clifton e45ad1239d Prevent a buffer overrun when parsing corrupt STABS debug information.
PR 22957
	* stabs.c (pop_binincl): Fail if the file index is off the end of
	the stack.
2018-03-13 17:03:04 +00:00
Nick Clifton b4a3689a68 Updated Russian and Brazilian Portuguese translations.
ld	* po/pt_BR.po: Updated Brazilian Portuguese translation.
opcodes	* po/pt_BR.po: Updated Brazilian Portuguese translation.
gas	* po/ru.po: Updated Russian translation.
2018-03-13 16:57:29 +00:00
Nick Clifton 81db3241f2 Add range changing to STABS parsing functions, in order to prevent buffer overruns.
PR 22955
	* stabs.c (parse_number): Add p_end parameter and use it to check
	the validity of the pp parameter.  Add checks to prevent walking
	off the end of the string buffer.
	(parse_stab_string): Likewise.
	(parse_stab_type): Likewise.
	(parse_stab_type_number): Likewise.
	(parse_stab_range_type): Likewise.
	(parse_stab_sun_builtin_type): Likewise.
	(parse_stab_sun_floating_type): Likewise.
	(parse_stab_enum_type): Likewise.
	(parse_stab_struct_type): Likewise.
	(parse_stab_baseclasses): Likewise.
	(parse_stab_struct_fields): Likewise.
	(parse_stab_cpp_abbrev): Likewise.
	(parse_stab_one_struct_field): Likewise.
	(parse_stab_members): Likewise.
	(parse_stab_tilde_field): Likewise.
	(parse_stab_array_type): Likewise.
	* parse_stab: Compute the end of the string and then pass it on to
	individual parser functions.
2018-03-13 16:10:45 +00:00
Nick Clifton 3e33b23945 Prevent memory access violations when attempting to parse an x86_64 PE binary containing corrupt unwind information.
PR 22113
incldue	* coff/pe.h (struct pex64_unwind_info): Add a rawUnwindCodesEnd
	field.

bfd	* pei-x86_64.c (pex64_get_unwind_info): Change to a boolean
	function.  Add an end address parameter.  Check access of the data
	pointer to make sure that they do not extend beyond the end
	address.  Return FALSE if any check fails.  Add the end address
	pointer to the ui structure.
	(pex64_xdata_print_uwd_codes): Check accesses of the raw unwind
	codes to make sure that they do not extend beyond the end address
	pointer.  Print an error message and return immediately if any
	check fails.
2018-03-13 14:02:52 +00:00
GDB Administrator b0d186effc Automatic date update in version.in 2018-03-13 00:00:24 +00:00
Andrew Burgess 89a3b63e52 gdb/riscv: Fix some ARI issues
Fix some ARI issues in recently added riscv code, the ARI email is:

  https://sourceware.org/ml/gdb-patches/2018-03/msg00156.html

gdb/ChangeLog:

	* riscv-tdep.c (riscv_sw_breakpoint_from_kind): Add localization
	to error message string.
	(riscv_register_name): Use xsnprintf instead of sprintf.
	(riscv_insn::fetch_instruction): Use gdb_assert instead of
	internal_error.
	(riscv_print_arg_location): Use gdb_assert_not_reached instead of
	error.
	(riscv_push_dummy_call): Likewise.
2018-03-12 21:41:42 +00:00
Tom Tromey 984c72381c Use gdb::byte_vector when reading section data
This changes a couple of spots that read section data to use
gdb::byte_vector rather than a cleanup.

Regression tested by the buildbot.  I am not certain that the buildbot
actually tests the code in question, so I recommend careful review.

gdb/ChangeLog
2018-03-12  Tom Tromey  <tom@tromey.com>

	* rs6000-aix-tdep.c (rs6000_aix_core_xfer_shared_libraries_aix):
	Use gdb::byte_vector.
	* arm-tdep.c (arm_exidx_new_objfile): Use gdb::byte_vector.
2018-03-12 08:24:17 -06:00
Yao Qi 933522d1db Fix ia64 GDB build
Commit 849d0ba8 breaks GDB build for ia64 with --with-libunwind-ia64=yes.
This patch fixes it.

gdb:

2018-03-12  Yao Qi  <yao.qi@linaro.org>

	* ia64-libunwind-tdep.c (libunwind_get_reg_special): Change
	parameter type to readable_regcache.
	* ia64-libunwind-tdep.h (libunwind_get_reg_special): Update
	the declaration.
2018-03-12 09:15:39 +00:00
Tom Tromey be2daae6b8 Use std::vector for field lists in dwarf2read.c
This changes dwarf2read.c to use std::vector rather than a linked list
when managing the fields and base classes to be added to a type.  This
removes some bookkeeping types and also allows the removal of some
cleanups.

gdb/ChangeLog
2018-03-11  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (struct nextfield): Add initializers.
	(struct nextfnfield): Remove.
	(struct fnfieldlist): Add initializers.  Remove "length" and
	"head", use std::vector.
	(struct decl_field_list): Remove.
	(struct field_info): Add initializers.
	<fields, baseclasses>: Now std::vector.
	<nbaseclasses, nfnfields, typedef_field_list_count,
	nested_types_list_count>: Remove.
	(dwarf2_add_field, dwarf2_add_type_defn)
	(dwarf2_attach_fields_to_type, dwarf2_add_member_fn)
	(dwarf2_attach_fn_fields_to_type, handle_struct_member_die)
	(process_structure_scope): Update.
2018-03-11 21:06:41 -06:00
Tom Tromey 484cf504af Remove cleanup from build_type_psymtabs_1
This removes a cleanup from build_type_psymtabs_1, by using
std::vector rather than manual memory management.

gdb/ChangeLog
2018-03-11  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (sort_tu_by_abbrev_offset): Change to be suitable
	for use by std::sort.
	(build_type_psymtabs_1): Use std::vector.
2018-03-11 21:06:41 -06:00
GDB Administrator c20bca94fa Automatic date update in version.in 2018-03-12 00:00:40 +00:00
GDB Administrator 69a52a7b7a Automatic date update in version.in 2018-03-11 00:01:12 +00:00
GDB Administrator 7d4f13635f Automatic date update in version.in 2018-03-10 00:00:30 +00:00
H.J. Lu 80c34c3812 x86: Encode EVEX instructions with VEX128 if possible
If EVEX encoding isn't required, we can encode EVEX instructions with
VEX128.

	* config/tc-i386.c (optimize_encoding): Encode EVEX instructions
	with VEX128 if EVEX encoding isn't required.
	* testsuite/gas/i386/optimize-1.d: Updated.
	* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
2018-03-09 08:10:40 -08:00
Nick Clifton f657f8c4a1 Fix Sparc, s390 and AArch64 targets so that they can handle relocs against ifunc symbols found in note sections.
Following on from PR 22929, I have found the same problem exists with
  other ifunc supporting targets too.  Plus see this link for the bug
  being reported against the s390x binutils for Fedora rawhide:

     https://bugzilla.redhat.com/show_bug.cgi?id=1553705

  So I am going to check in the patch below which applies the same
  change that H.J. made for the x86_64 target to the other affected
  targets.  (Specifically: S390, AArch64 and Sparc).  Plus it adds a new
  test to the linker testsuite to make sure that this problem stays
  fixed.

bfd	* elf64-s390.c (elf_s390_relocate_section): Move check for
	relocations against non-allocated sections to before the code that
	handles ifunc relocations.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Treat
	relocs against IFUNC symbols in non-allocated sections as relocs
	against FUNC symbols.
	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.

ld	* testsuite/ld-ifunc/ifuncmod5.s: New test.  Checks that targets
	that support IFUNC symbols can handle relocations against those
	symbols in NOTE sections.
	* testsuite/ld-ifunc/ifuncmod5.d: New file:  Driver for the new
	test.
	* testsuite/ld-ifunc/ifunc.exp: Run the new test.
2018-03-09 14:37:36 +00:00
Eli Zaretskii 9bd8e0b072 Update "gdb --configuration" with recently added features
This adds display of a few recently added optional features.

gdb/ChangeLog:
2018-03-09  Eli Zaretskii  <eliz@gnu.org>

	* top.c (print_gdb_configuration): Reflect LIBIPT, LIBMEMCHECK,
	and LIBMPFR in the printed configuration.
2018-03-09 15:59:11 +02:00
H.J. Lu 0ba3a73180 x86: Strip whitespace in check_VecOperations
Since the addition of pseudo prefixes changed how the scrubber treats
'{', we need to explicitly strip whitespace in check_VecOperations ().

	* config/tc-i386.c (check_VecOperations): Strip whitespace.
	* testsuite/gas/i386/optimize-1.s: Add whitespaces before
	{%k7} and {z},
	* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
2018-03-09 03:51:31 -08:00
Tom Tromey 5dc1a7047a Use scoped_fd in more places
This changes a few more places to use scoped_fd.  This allows the
removal of some cleanups.

Regression tested by the buildbot, though note that I'm not sure
whether the buildbot actually builds anything using all of these
files.

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

	* source.c (get_filename_and_charpos): Use scoped_fd.
	* nto-procfs.c (procfs_open_1): Use scoped_fd.
	(procfs_pidlist): Likewise.
	* procfs.c (proc_get_LDT_entry): Use scoped_fd.
	(iterate_over_mappings): Likewise.
2018-03-08 22:00:08 -07:00
Tom Tromey fdf07f3aeb Change enable_thread_stack_temporaries to an RAII class
This started as a patch to change enable_thread_stack_temporaries to
be an RAII class, but then I noticed that this code used a VEC, so I
went ahead and did a bit more C++-ification, changing
stack_temporaries_enabled to a bool and changing stack_temporaries to
a std::vector.

Regression tested by the buildbot.

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

	* infcall.c (struct call_return_meta_info)
	<stack_temporaries_enabled>: Remove.
	(get_call_return_value, call_function_by_hand_dummy): Update.
	* thread.c (disable_thread_stack_temporaries): Remove.
	(enable_thread_stack_temporaries): Remove.
	(thread_stack_temporaries_enabled_p): Return bool.
	(push_thread_stack_temporary, value_in_thread_stack_temporaries)
	(get_last_thread_stack_temporary): Update.
	* eval.c (evaluate_subexp): Update.
	* gdbthread.h (class enable_thread_stack_temporaries): Now a
	class, not a function.
	(value_ptr, value_vec): Remove typedefs.
	(class thread_info) <stack_temporaries_enabled>: Now bool.
	<stack_temporaries>: Now a std::vector.
	(thread_stack_temporaries_enabled_p)
	(value_in_thread_stack_temporaries): Return bool.
2018-03-08 21:57:14 -07:00
H.J. Lu 0089daceab x86: Optimize with EVEX128 encoding for AVX512VL
We can optimize AVX512 instructions with EVEX128 only if AVX512VL is
enabled:

1. Instruction is an AVX512VL instruction. Or
2. AVX512VL is enabled explicitly by -march=+avx512vl/".arch .avx512vl".

We should optimize EVEX instructions with EVEX128 encoding when pseudo
{evex} prefix is used.

	* config/tc-i386.c (set_cpu_arch): Set cpu_arch_isa_flags.
	(md_parse_option): Likewise.
	(optimize_encoding): Check i.tm.cpu_flags and cpu_arch_isa_flags
	for cpuavx512vl instead of cpu_arch_flags.  Optimize EVEX with
	EVEX128 when EVEX encoding is required.
	* testsuite/gas/i386/i386.exp: Run optimize-4, optimize-5,
	x86-64-optimize-5 and x86-64-optimize-6.
	* testsuite/gas/i386/optimize-1.d: Updated.
	* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
	* testsuite/gas/i386/optimize-4.d: New file.
	* testsuite/gas/i386/optimize-4.s: Likewise.
	* testsuite/gas/i386/optimize-5.d: Likewise.
	* testsuite/gas/i386/optimize-5.s: Likewise.
	* testsuite/gas/i386/x86-64-optimize-5.d: Likewise.
	* testsuite/gas/i386/x86-64-optimize-5.s: Likewise.
	* testsuite/gas/i386/x86-64-optimize-6.d: Likewise.
	* testsuite/gas/i386/x86-64-optimize-6.s: Likewise.
2018-03-08 19:57:48 -08:00
Simon Marchi 567a3e54d2 Fix misreporting of omitted bytes for large remote packets
In remote.c, when the output of "set debug remote" is truncated, the
number of characters reported is incorrect.  What is reported is the
number of characters added by the quoting, not the number of characters
that were truncated.

gdb/ChangeLog:

	* remote.c (putpkt_binary): Fix omitted bytes reporting.
	(getpkt_or_notif_sane_1): Likewise.
2018-03-08 19:00:59 -05:00