Commit Graph

102104 Commits

Author SHA1 Message Date
Andrew Burgess f16a9f57b5 gdb: Convert language la_watch_location_expression field to a method
This commit changes the language_data::la_watch_location_expression
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_watch_location_expression): Rename to
	ada_language::watch_location_expression.
	(ada_language_data): Delete la_watch_location_expression
	initializer.
	(ada_language::watch_location_expression): New member function,
	implementation from ada_watch_location_expression.
	* breakpoint.c (watch_command_1): Update call to
	watch_location_expression.
	* c-lang.c (c_watch_location_expression): Rename to
	language_defn::watch_location_expression.
	(c_language_data): Delete la_watch_location_expression
	initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* c-lang.h (c_watch_location_expression): Delete declaration.
	* d-lang.c (d_language_data): Delete la_watch_location_expression
	initializer.
	* f-lang.c (f_language_data): Likewise.
	* go-lang.c (go_language_data): Likewise.
	* language.c (language_defn::watch_location_expression): Member
	function implementation from c_watch_location_expression.
	(unknown_language_data): Delete la_watch_location_expression
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_watch_location_expression
	field.
	(language_defn::watch_location_expression): Declare new member
	function.
	* m2-lang.c (m2_language_data): Delete
	la_watch_location_expression initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_watch_location_expression): Rename to
	rust_language::watch_location_expression.
	(rust_language_data): Delete la_watch_location_expression
	initializer.
	(rust_language::watch_location_expression): New member function,
	implementation from rust_watch_location_expression.
2020-06-17 09:25:11 +01:00
Andrew Burgess 7e56227dff gdb: Convert language la_collect_symbol_completion_matches field to a method
This commit changes the
language_data::la_collect_symbol_completion_matches function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_collect_symbol_completion_matches): Rename to
	ada_language::collect_symbol_completion_matches.
	(ada_language_data): Delete la_collect_symbol_completion_matches
	initializer.
	(ada_language::collect_symbol_completion_matches): New member
	function, implementation from
	ada_collect_symbol_completion_matches.
	* c-lang.c (c_language_data): Delete
	la_collect_symbol_completion_matches initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* f-lang.c (f_collect_symbol_completion_matches): Rename to
	f_language::collect_symbol_completion_matches.
	(f_language_data): Delete la_collect_symbol_completion_matches
	initializer.
	(f_language::collect_symbol_completion_matches) New member
	function, implementation from f_collect_symbol_completion_matches.
	* go-lang.c (go_language_data): Delete
	la_collect_symbol_completion_matches initializer.
	* language.c (unknown_language_data): Likewise.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete
	la_collect_symbol_completion_matches field.
	(language_defn::collect_symbol_completion_matches): New member
	function.
	* m2-lang.c (m2_language_data): Delete
	la_collect_symbol_completion_matches initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
	* symtab.c (default_collect_symbol_completion_matches): Delete.
	(collect_symbol_completion_matches): Update call to
	collect_symbol_completion_matches.
	(collect_symbol_completion_matches_type): Likewise.
	* symtab.h (default_collect_symbol_completion_matches): Delete
	declaration.
2020-06-17 09:25:10 +01:00
Andrew Burgess 53fc67f8b2 gdb: Convert language la_word_break_characters field to a method
This commit changes the language_data::la_word_break_characters
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_get_gdb_completer_word_break_characters): Delete.
	(ada_language_data): Delete la_word_break_characters initializer.
	(ada_language::word_break_characters): New member function.
	* c-lang.c (c_language_data): Delete la_word_break_characters
	initializer.
	(cplus_language_data): Likewise.
	(asm_language_data): Likewise.
	(minimal_language_data): Likewise.
	* completer.c: Update global comment.
	(advance_to_expression_complete_word_point): Update call to
	word_break_characters.
	(complete_files_symbols): Likewise.
	(complete_line_internal_1): Likewise.
	(default_completer_handle_brkchars): Likewise.
	(skip_quoted_chars): Likewise.
	* d-lang.c (d_language_data): Delete la_word_break_characters
	initializer.
	* f-lang.c (f_word_break_characters): Delete.
	(f_language_data): Delete la_word_break_characters initializer.
	(f_language::word_break_characters): New member function.
	* go-lang.c (go_language_data): Delete la_word_break_characters
	initializer.
	* language.c (unknown_language_data): Likewise.
	(auto_language_data): Likewise.
	* language.h (default_word_break_characters): Move declaration to
	earlier in the file.
	(language_data): Delete la_word_break_characters field.
	(language_defn::word_break_characters): New member function.
	* m2-lang.c (m2_language_data): Delete la_word_break_characters
	initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
2020-06-17 09:25:10 +01:00
Andrew Burgess c9debfb97e gdb: Convert language la_get_symbol_name_matcher field to a method
This commit changes the language_data::la_get_symbol_name_matcher
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

Before this commit access to the la_get_symbol_name_matcher function
pointer was through the get_symbol_name_matcher function, which looked
something like this (is pseudo-code):

  <return-type>
  get_symbol_name_matcher (language_defn *lang, <other args>)
  {
    if (current_language == ada)
      current_language->la_get_symbol_name_matcher (<other args>);
    else
      lang->la_get_symbol_name_matcher (<other args>);
  }

In this commit I moved the get_symbol_name_matcher as a non-virtual
function in the language_defn base class, I then add a new virtual
method that is only used from within get_symbol_name_matcher, this can
then be overridden by specific languages as needed.  So we now have:

  class language_defn
  {
    <return-type> get_symbol_name_matcher (<args>)
    {
      if (current_language == ada)
        return current_language->get_symbol_name_matcher_inner (<args>);
      else
        return this->get_symbol_name_matcher_inner (<args>);
    }

    virtual <return-type> get_symbol_name_matcher_inner (<args>)
    {
        ....
    }
  }

gdb/ChangeLog:

	* ada-lang.c (ada_get_symbol_name_matcher): Update header comment.
	(ada_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(language_defn::get_symbol_name_matcher_inner): New member
	function.
	* c-lang.c (c_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(cplus_language_data): Likewise.
	(cplus_language::get_symbol_name_matcher_inner): New member
	function.
	(asm_language_data): Delete la_get_symbol_name_matcher initializer.
	(minimal_language_data): Likewise.
	* cp-support.h (cp_get_symbol_name_matcher): Update header comment.
	* d-lang.c (d_language_data): Delete la_get_symbol_name_matcher
	initializer.
	* dictionary.c (iter_match_first_hashed): Update call to
	get_symbol_name_matcher.
	(iter_match_next_hashed): Likewise.
	(iter_match_next_linear): Likewise.
	* dwarf2/read.c (dw2_expand_symtabs_matching_symbol): Likewise.
	* f-lang.c (f_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(f_language::get_symbol_name_matcher_inner): New member function.
	* go-lang.c (go_language_data): Delete la_get_symbol_name_matcher
	initializer.
	* language.c (default_symbol_name_matcher): Update header comment,
	make static.
	(language_defn::get_symbol_name_matcher): New definition.
	(language_defn::get_symbol_name_matcher_inner): Likewise.
	(get_symbol_name_matcher): Delete.
	(unknown_language_data): Delete la_get_symbol_name_matcher
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_get_symbol_name_matcher
	field.
	(language_defn::get_symbol_name_matcher): New member function.
	(language_defn::get_symbol_name_matcher_inner): Likewise.
	(default_symbol_name_matcher): Delete declaration.
	* linespec.c (find_methods): Update call to
	get_symbol_name_matcher.
	* m2-lang.c (m2_language_data): Delete la_get_symbol_name_matcher
	initializer.
	* minsyms.c (lookup_minimal_symbol): Update call to
	get_symbol_name_matcher.
	(iterate_over_minimal_symbols): Likewise.
	* objc-lang.c (objc_language_data): Delete
	la_get_symbol_name_matcher initializer.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* psymtab.c (psymbol_name_matches): Update call to
	get_symbol_name_matcher.
	* rust-lang.c (rust_language_data): Delete
	la_get_symbol_name_matcher initializer.
	* symtab.c (symbol_matches_search_name): Update call to
	get_symbol_name_matcher.
	(compare_symbol_name): Likewise.
2020-06-17 09:25:09 +01:00
Andrew Burgess 9a49ad8c52 gdb: Convert language la_compute_program field to a method
This commit changes the language_data::la_compute_program function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data): Delete la_compute_program
	initializer.
	* c-lang.c (c_language_data): Likewise.
	(c_language::compute_program): New member function.
	(cplus_language_data): Delete la_compute_program initializer.
	(cplus_language::compute_program): New member function.
	(asm_language_data): Delete la_compute_program initializer.
	(minimal_language_data): Likewise.
	* c-lang.h (c_compute_program): Update comment.
	(cplus_compute_program): Likewise.
	* compile/compile-c-support.c (c_compute_program): Likewise.
	(cplus_compute_program): Likewise.
	* compile/compile.c (compile_to_object): Update call to
	la_compute_program.
	* d-lang.c (d_language_data): Delete la_compute_program
	initializer.
	* f-lang.c (f_language_data): Likewise.
	* go-lang.c (go_language_data): Likewise.
	* language.c (unknown_language_data): Likewise.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_compute_program field.
	(language_defn::compute_program): New member function.
	* m2-lang.c (m2_language_data): Delete la_compute_program
	initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
2020-06-17 09:25:09 +01:00
Andrew Burgess eff93b4d48 gdb: Convert language la_class_name_from_physname field to a method
This commit changes the language_data::la_class_name_from_physname function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* ada-lang.c (ada_language_data) Delete
	la_class_name_from_physname initializer.
	* c-lang.c (c_language_data): Likewise.
	(cplus_language_data): Likewise.
	(cplus_language::class_name_from_physname): New member function.
	(asm_language_data): Delete la_class_name_from_physname
	initializer.
	(minimal_language_data): Likewise.
	* d-lang.c (d_language_data): Likewise.
	* dwarf2/read.c (guess_partial_die_structure_name): Update to call
	method on language_defn class.
	(guess_full_die_structure_name): Likewise.
	* f-lang.c (f_language_data): Delete la_class_name_from_physname
	initializer.
	* go-lang.c (go_language_data): Likewise.
	* language.c (language_class_name_from_physname): Delete.
	(unk_lang_class_name): Delete.
	(unknown_language_data): Delete la_class_name_from_physname
	initializer.
	(auto_language_data): Likewise.
	* language.h (language_data): Delete la_class_name_from_physname
	field.
	(language_defn::class_name_from_physname): New function.
	(language_class_name_from_physname): Delete declaration.
	* m2-lang.c (m2_language_data): Delete la_class_name_from_physname
	initializer.
	* objc-lang.c (objc_language_data): Likewise.
	* opencl-lang.c (opencl_language_data): Likewise.
	* p-lang.c (pascal_language_data): Likewise.
	* rust-lang.c (rust_language_data): Likewise.
2020-06-17 09:25:09 +01:00
Tom Tromey de54374205 Use macros for TUI window names
Christian pointed out that tui-layout.c hard-codes various window
names.  This patch changes the code to use the macros from tui-data.h
instead.  For each window, I searched for uses of the name; but I only
found any in tui-layout.c.  This also adds a new macro to account for
the "status" window.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (STATUS_NAME): New macro.
	* tui/tui-layout.c (tui_remove_some_windows)
	(initialize_known_windows, tui_register_window)
	(tui_layout_split::remove_windows, initialize_layouts)
	(tui_new_layout_command): Don't use hard-coded window names.
2020-06-16 18:02:20 -06:00
Tom Tromey a350efd4fb Fix crash when exiting TUI with gdb -tui
PR tui/25348 points out that, when "gdb -tui" is used, then exiting
the TUI will cause a crash.

This happens because tui_setup_io stashes some readline variables --
but because this happens before readline is initialized, some of these
are NULL.  Then, when exiting the TUI, the NULL values are "restored",
causing a crash in readline.

This patch fixes the problem by ensuring that readline is initialized
first.  Back in commit 11061048d ("Give a name to the TUI SingleKey
keymap"), a call to rl_initialize was removed from
tui_initialize_readline; this patch resurrects the call, but moves it
to the end of the function, so as not to remove the ability to modify
the SingleKey map from .inputrc.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

	PR tui/25348:
	* tui/tui.c (tui_ensure_readline_initialized): Rename from
	tui_initialize_readline.  Only run once.  Call rl_initialize.
	* tui/tui.h (tui_ensure_readline_initialized): Rename from
	tui_initialize_readline.
	* tui/tui-io.c (tui_setup_io): Call
	tui_ensure_readline_initialized.
	* tui/tui-interp.c (tui_interp::init): Update.
2020-06-16 18:02:20 -06:00
Tom Tromey 39ec04904f Fix C-x 1 from gdb prompt
Pedro pointed out on irc that C-x 1 from the gdb prompt will cause a
crash.  This happened because of a bug in remove_windows -- it would
always remove all the windows from the layout.  This patch fixes this
bug, and also arranges to have C-x 1 preserve the status window.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (tui_layout_split::remove_windows): Fix logic.
	Also preserve the status window.
2020-06-16 18:02:20 -06:00
GDB Administrator 1ce22eebea Automatic date update in version.in 2020-06-17 00:00:15 +00:00
Tom Tromey d2d1ea20ae Fix crash when TUI window creation fails
If a TUI window is written in Python, and if the window construction
function fails, then gdb will crash.  This patch fixes the crash.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

	* python/py-tui.c (tui_py_window::~tui_py_window): Handle case
	where m_window==nullptr.

gdb/testsuite/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

	* gdb.python/tui-window.py (failwin): New function.  Register it
	as a TUI window type.
	* gdb.python/tui-window.exp: Create new "fail" layout.  Test it.
2020-06-16 17:48:38 -06:00
Cui,Lili 708a2ffff5 x86: Correct noavx512_vp2intersect
* config/tc-i386.c (cpu_arch): Correct noavx512_vp2intersect
	cpu_arch to CPU_ANY_VP2INTERSECT_FLAGS.
	* doc/c-i386.texi: Add avx512_vp2intersect.
2020-06-16 10:07:15 -07:00
Alan Modra 5f89899448 Re: Use __asm__ rather than asm in ld testsuite
* testsuite/ld-elf/pr19553c.c: Replace asm with __asm__.
	* testsuite/ld-elfvers/vers27b.c: Likewise.
2020-06-16 22:44:13 +09:30
Alan Modra 07e7fdfd42 Use __asm__ rather than asm in ld testsuite
* testsuite/ld-elf/pr23428.c: Define _DEFAULT_SOURCE.
	* testsuite/ld-elf/indirect1b.c: Replace asm with __asm__.
	* testsuite/ld-elf/indirect2.c: Likewise.
	* testsuite/ld-elf/indirect3b.c: Likewise.
	* testsuite/ld-elf/indirect4b.c: Likewise.
	* testsuite/ld-elf/pr14323-2.c: Likewise.
	* testsuite/ld-elf/pr18720b.c: Likewise.
	* testsuite/ld-elf/pr23428.c: Likewise.
	* testsuite/ld-elfvsb/common.c: Likewise.
	* testsuite/ld-elfvsb/main.c: Likewise.
	* testsuite/ld-elfvsb/sh1.c: Likewise.
	* testsuite/ld-elfvsb/test.c: Likewise.
	* testsuite/ld-pe/aligncomm-1.c: Likewise.
	* testsuite/ld-pe/aligncomm-2.c: Likewise.
	* testsuite/ld-pe/aligncomm-3.c: Likewise.
	* testsuite/ld-pe/aligncomm-4.c: Likewise.
	* testsuite/ld-plugin/pr23958.c: Likewise.
	* testsuite/ld-size/size-1b.c: Likewise.
	* testsuite/ld-size/size-2b.c: Likewise.
	* testsuite/ld-size/size-3a.c: Likewise.
	* testsuite/ld-size/size-3b.c: Likewise.
	* testsuite/ld-size/size-3c.c: Likewise.
	* testsuite/ld-size/size-4b.c: Likewise.
	* testsuite/ld-size/size-5b.c: Likewise.
	* testsuite/ld-size/size-6a.c: Likewise.
	* testsuite/ld-size/size-7a.c: Likewise.
	* testsuite/ld-size/size-8a.c: Likewise.
	* testsuite/ld-size/size-9b.c: Likewise.
	* testsuite/ld-size/size-10b.c: Likewise.
2020-06-16 22:13:20 +09:30
Alan Modra 423054bead Use __asm__ rather than asm in gold testsuite
discard_locals_test.c:28:6: error: expected declaration specifiers or
‘...’ before string constant
 asm (".Lshould_be_discarded:");
      ^

	* testsuite/discard_locals_test.c: Replace uses of asm with __asm__.
	* testsuite/discard_locals_relocatable_test.c: Likewise.
2020-06-16 22:12:39 +09:30
Gary Benson c802e8a76c Add two missing return values in gdb.python/py-nested-maps.c
Two functions in gdb.python/py-nested-maps.c are missing return
values.  This causes clang to fail to compile the file with the
following error:
  warning: control reaches end of non-void function [-Wreturn-type]

This commit fixes, by causing the two functions to return pointers
to the objects they've just allocated and initialized.  I didn't
investigate how this test had been passing with other compilers;
I'm assuming serendipity, that in each function the value to be
returned was already in the register it would need to be in to be
the function's return value.

gdb/testsuite/ChangeLog:

	* gdb.python/py-nested-maps.c (create_map): Add missing return
	value.
	(create_map_map): Likewise.
2020-06-16 12:41:28 +01:00
Alan Modra 90cd2aad03 Use CXXCOMPILE in gold/testsuite/Makefile for c++ testcases
I was playing with passing -std=c99 to an older version of gcc by
using CC="gcc-4 -std=c99", and ran into
cc1plus: error: command line option ‘-std=c99’ is valid for C/ObjC but
not for C++ [-Werror]
This obvious fix uses the correct compiler for a number of gold
testcases.

	* testsuite/Makefile.am (export_dynamic_plugin.o): Use CXXCOMPILE.
	(plugin_test_wrap_symbols_1.o): Likewise.
	(plugin_test_wrap_symbols_2.o): Likewise.
	* testsuite/Makefile.in: Regenerate.
2020-06-16 21:03:25 +09:30
Jan Beulich 2106ed9baf x86: drop SSE4a from SSE check again
Upon re-consideration in commit 569d50f1c6 ("x86: further refine SSE
check (SSE4a, SHA, GFNI)") I went too far: Mixing of SSE and AVX insns
doesn't suffer as bad a penalty on AMD CPUs as on Intel ones. SSE4a
being an AMD-only extension, it shouldn't be part of the ISA extensions
set for which the diagnostic may get issued. Undo that part.
2020-06-16 10:34:55 +02:00
Alan Modra a435742a7f Really remove tic30-aout support
bfd/
	* aout-tic30.c: Delete file.
	* Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
	(BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
	* config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
	(xc16x-*-elf): Sort properly.
	* configure.ac: Remove tic30_aout_vec.
	* targets.c: Likewise.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
gas/
	* config/tc-tic30.h: Remove OBJ_AOUT support.
	* configure.tgt: Delete tic30-*-*aout* entry.
ld/
	* emulparams/tic30aout.sh: Delete file.
	* scripttempl/tic30aout.sc: Delete file.
	* Makefile.am: Remove etic30aout.c from ALL_EMULATION_SOURCES and
	delete dependency.
	* configure.tgt: Delete tic30-*-*aout* entry.
	* testsuite/ld-scripts/sane1.d: Delete tic30-*-aout mention.
	* testsuite/ld-scripts/segment-start.d: Likewise.
	* Makefile.in: Regenerate.
	* po/BLD-POTFILES.in: Regenerate.
2020-06-16 15:57:59 +09:30
GDB Administrator 9e790a8016 Automatic date update in version.in 2020-06-16 00:00:20 +00:00
Max Filippov 7a77f1ac2c xtensa: allow runtime ABI selection
2020-06-15  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
	(XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
	(elf32xtensa_abi): New global variable.
	(xtensa_abi_choice): New function.
	(elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
	XSHAL_ABI to select PLT code.

gas/
	* config/tc-xtensa.c (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New
	macros.
	(elf32xtensa_abi): New declaration.
	(option_abi_windowed, option_abi_call0): New enum constants.
	(md_longopts): Add entries for --abi-windowed and --abi-call0.
	(md_parse_option): Add handlers for --abi-windowed and
	--abi-call0.
	(xtensa_add_config_info): Use xtensa_abi_choice instead of
	XSHAL_ABI to format ABI tag.
	* doc/as.texi (Target Xtensa options): Add --abi-windowed and
	--abi-call0 to the list of options.
	* doc/c-xtensa.texi: Add description for options --abi-windowed
	and --abi-call0.
	* testsuite/gas/xtensa/abi-call0.d: New test definition.
	* testsuite/gas/xtensa/abi-windowed.d: New test definition.
	* testsuite/gas/xtensa/abi.s: New test source.

include/
	* elf/xtensa.h (xtensa_abi_choice): New declaration.

ld/
	* emultempl/xtensaelf.em (XSHAL_ABI): Remove macro definition.
	(XTHAL_ABI_UNDEFINED, XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New
	macros.
	(elf32xtensa_abi): New declaration.
	(xt_config_info_unpack_and_check): Set elf32xtensa_abi if it is
	undefined.  Use xtensa_abi_choice instead of XSHAL_ABI to test
	ABI tag consistency.
	(xtensa_add_config_info): Use xtensa_abi_choice instead of
	XSHAL_ABI to format ABI tag.
	(PARSE_AND_LIST_PROLOGUE): Define OPTION_ABI_WINDOWED,
	OPTION_ABI_CALL0 and declare elf32xtensa_abi.
	(PARSE_AND_LIST_LONGOPTS): Add entries for --abi-windowed and
	--abi-call0.
	(PARSE_AND_LIST_OPTIONS): Add help text for --abi-windowed and
	--abi-call0.
	(PARSE_AND_LIST_ARGS_CASES): Add handlers for --abi-windowed and
	--abi-call0.
	* ld.texi: Add description for options --abi-windowed and
	--abi-call0.
2020-06-15 13:01:30 -07:00
Roland McGrath cae64165f4 gold, ld: Implement -z start-stop-visibility=... option.
gold/
	Implement -z start-stop-visibility=... option.
	* options.h (class General_options): Handle -z start-stop-visibility=.
	(General_options::start_stop_visibility_enum): New public method.
	(General_options::set_start_stop_visibility_enum): New private method.
	(General_options::start_stop_visibility_enum_): New private member.
	* options.cc (General_options::General_options): Add initializer.
	(General_options::finalize): Set this->start_stop_visibility_enum_
	from string value.
	* layout.cc (Layout::define_section_symbols): Use option setting.

bfd/
	* elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
	field of bfd_link_info.

include/
	* bfdlink.h (struct bfd_link_info): New field start_stop_visibility.

ld/
	* NEWS: Mention -z start-stop-visibility=... option for ELF.
	* ld.texi (Options): Document -z start-stop-visibility=... option.
	* ldmain.c (main): Initialize link_info.start_stop_visibility.
	* emultempl/elf.em (gld${EMULATION_NAME}_handle_option):
	Parse -z start-stop-visibility=... option.
2020-06-15 11:45:02 -07:00
Tom Tromey 6692031743 Change target_read_string API
This simplifies the target_read_string API a bit.

Note that some code was using safe_strerror on the error codes
returned by target_read_string.  It seems to me that this is incorrect
(if it was ever correct, it must have been quite a long time ago).

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

	* windows-nat.c (windows_nat::handle_output_debug_string):
	Update.
	(windows_nat::handle_ms_vc_exception): Update.
	* target.h (target_read_string): Change API.
	* target.c (target_read_string): Change API.
	* solib-svr4.c (open_symbol_file_object, svr4_read_so_list):
	Update.
	* solib-frv.c (frv_current_sos): Update.
	* solib-dsbt.c (dsbt_current_sos): Update.
	* solib-darwin.c (darwin_current_sos): Update.
	* linux-thread-db.c (inferior_has_bug): Update.
	* expprint.c (print_subexp_standard): Update.
	* ada-lang.c (ada_main_name, ada_tag_name_from_tsd)
	(ada_exception_message_1): Update.
2020-06-15 06:28:10 -06:00
Tom Tromey a5d871ddaf Remove a use of target_read_string
linux-tdep.c:dump_mapping_p uses target_read_string, but in a way that
does not really make sense.  It's better to use target_read_memory
here.

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

	* linux-tdep.c (dump_mapping_p): Use target_read_memory.
2020-06-15 06:28:10 -06:00
Tom Tromey 670e35fad9 Rewrite target_read_string
This rewrites target_read_string in terms of read_string.

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

	* valprint.c (read_string): Update comment.
	* target.c (MIN): Remove.
	(target_read_string): Rewrite.
2020-06-15 06:28:09 -06:00
Tom Tromey f5272a3bb3 Remove read_memory_string
read_memory_string is redundant and only called in a couple of spots.
This patch removes it in favor of target_read_string.

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

	* corefile.c (read_memory_string): Remove.
	* ada-valprint.c (ada_value_print_ptr): Update.
	* ada-lang.h (ada_tag_name): Change return type.
	* ada-lang.c (type_from_tag): Update.
	(ada_tag_name_from_tsd): Change return type.  Use
	target_read_string.
	(ada_tag_name): Likewise.
	* gdbcore.h (read_memory_string): Don't declare.
2020-06-15 06:28:09 -06:00
Tankut Baris Aktemur ff08abb8a2 gdb/testsuite: fix minor things in jit tests
gdb/testsuite/ChangeLog:
2020-06-15  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* gdb.base/jit-elf-so.exp: Refer to the global main_loader_basename
	variable.
	* gdb.base/jit-reader-simple.exp: Fix typo ("Built" -> "Build"),
	and use the already-defined 'options' variable.
2020-06-15 09:07:07 +02:00
Alan Modra 40be168cc4 Obsolete PowerPC PE, winnt and cygwin targets
The PowerPC PE support is so old and bitrotted that it ought to be
removed.  Test results for a cross from x86_64 with no C cross
compiler currently shows 109 fails.  I don't think anyone cares about
the target.

This FIXME in bfd/peXXigen.c has been around since 1999, git commit
277d1b5e453:

/* FIXME: This file has various tests of POWERPC_LE_PE.  Those tests
   worked when the code was in peicode.h, but no longer work now that
   the code is in peigen.c.  PowerPC NT is said to be dead.  If
   anybody wants to revive the code, you will have to figure out how
   to handle those issues.  */

and this one in gas/config/tc-ppc.c since 1995, git commit
cd557d83d61:

 * FIXME: I just noticed this. This doesn't work at all really. It it
 *        setting bits that bfd probably neither understands or uses. The
 *        correct approach (?) will have to incorporate extra fields attached
 *        to the section to hold the system specific stuff. (krk)

	* config.bfd: Obsolete powerpcle-*-pe targets.
2020-06-15 15:09:38 +09:30
Alan Modra 1298463902 Unnecessary load_lib in ld testsuite
ld-lib.exp is loaded in config/defaults.exp

	* testsuite/ld-scripts/include.exp: Don't load ld-lib.exp.
	* testsuite/ld-scripts/phdrs3.exp: Likewise.
	* testsuite/ld-scripts/rgn-at.exp: Likewise.
	* testsuite/ld-scripts/rgn-over.exp: Likewise.
	* testsuite/ld-scripts/sort.exp: Likewise.
	* testsuite/ld-discard/discard.exp: Likewise.  Use is_elf_format.
2020-06-15 15:07:13 +09:30
Alan Modra ea4b3731ec PR26103 testcase
PR 26103
	* testsuite/ld-linkonce/ref1.s,
	* testsuite/ld-linkonce/ref2.s,
	* testsuite/ld-linkonce/sym1.s,
	* testsuite/ld-linkonce/sym2.s,
	* testsuite/ld-linkonce/sym3.s: New test files.
	* testsuite/ld-linkonce/linkonce.exp: Run tests for PE too.
	Add pr26103 test.  Remove unnecessary load_lib.
2020-06-15 12:11:27 +09:30
Alan Modra 75cfe082c0 PR26103, Assertion failure with symbols defined in link-once sections
PR 26103
	* elflink.c (elf_link_add_archive_symbols): Exclude undefined
	symbols that were defined in discarded sections.
	* cofflink.c (coff_link_check_archive_element): Likewise.
	(coff_link_add_symbols): Set indx to -3 for symbols defined in
	discarded sections.
	(_bfd_coff_write_global_sym): Don't emit such symbols.
	libcoff-in.h (struct coff_link_hash_entry): Update indx comment.
	libcoff.h: Regenerate.
2020-06-15 12:10:06 +09:30
Alan Modra cda58d5f97 ld-linkonce test
* testsuite/ld-linkonce/zeroeh_x.s: Rename from x.s.
	* testsuite/ld-linkonce/zeroeh_y.s: Rename from y.s.
	* testsuite/ld-linkonce/zeroehl32.d: Adjust for renaming.  Support
	big-endian output.  Run for powerpc.
2020-06-15 12:08:33 +09:30
GDB Administrator 5d0fdfee24 Automatic date update in version.in 2020-06-15 00:00:07 +00:00
Hannes Domani 2c074f4902 Handle Windows drives in rbreak paths
Fixes this testsuite fail on Windows:
FAIL: gdb.base/fullpath-expand.exp: rbreak XXX/fullpath-expand-func.c:func

If the found colon is actually part of a Windows drive, look for another.

gdb/ChangeLog:

2020-06-14  Hannes Domani  <ssbssa@yahoo.de>

	* symtab.c (rbreak_command): Ignore Windows drive colon.
2020-06-14 17:38:23 +02:00
H.J. Lu efe30057d2 x86: Correct xsusldtrk mnemonic
The correct mnemonic is xsusldtrk, not xsuspldtrk.

gas/

	PR gas/26115
	* testsuite/gas/i386/tsxldtrk.d: Replace xsuspldtrk with
	xsusldtrk.
	* testsuite/gas/i386/tsxldtrk.s: Likewise.
	* testsuite/gas/i386/x86-64-tsxldtrk.d: Likewise.
	* testsuite/gas/i386/x86-64-tsxldtrk.s: Likewise.

opcodes/

	PR gas/26115
	* i386-dis.c (prefix_table): Replace xsuspldtrk with xsusldtrk.
	* i386-opc.tbl: Likewise.
	* i386-tbl.h: Regenerated.
2020-06-14 05:18:35 -07:00
GDB Administrator 83015056b2 Automatic date update in version.in 2020-06-14 00:00:13 +00:00
GDB Administrator 10059956ee Automatic date update in version.in 2020-06-13 00:00:15 +00:00
Simon Marchi 6a17d503c4 gdb: mention removed GDBserver host support in NEWS
gdb/ChangeLog:

	* NEWS: Mention removed GDBserver host support.

Change-Id: Ib9e212e525d12ac7f3f9b5c056adc5bf9c4d52cd
2020-06-12 16:06:46 -04:00
Simon Marchi 84b300de36 gdbserver: remove support for ARM/WinCE
This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove win32-arm-low.cc, wincecompat.cc.
	* configure.srv: Remove mingw32ce cases.
	* server.h, win32-low.cc: Remove __MINGW32CE__-guarded code.
	* win32-low.h (to_back_slashes): Remove.
	* win32-arm-low.cc, wincecompat.cc, wincecompat.h: Remove.

Change-Id: Ib75c0b55b0ab7caca38bbeff5f2fa9397a8e7e8d
2020-06-12 16:06:45 -04:00
Simon Marchi 96c16e2b7f gdbserver: remove support for Tile
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): linux-tile-low.cc.
	* configure.srv: Remove tilegx case.
	* linux-tile-low.cc: Remove.

Change-Id: I1c2910d04ddbd6013e5d228047106b41d80f9477
2020-06-12 16:06:45 -04:00
Simon Marchi bd1467aee8 gdbserver: remove support for M32R
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove linux-m32r-low.cc.
	* configure.srv: Remove m32r case.
	* linux-m32r-low.cc: Remove.

Change-Id: I5617b2b1fd92aeec19b38e0e3c0b78adaafdb35b
2020-06-12 16:06:44 -04:00
Simon Marchi 7b46bf6f83 gdbserver: remove support for CRIS
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove linux-cris-low.c.
	* configure.srv: Remove cris cases.
	* linux-cris-low.cc, linux-crisv32-low.cc: Remove.

Change-Id: Ib3ff436b03373548215f15540a47f39cbec5f512
2020-06-12 16:06:43 -04:00
Simon Marchi 1fa29f56ba gdbserver: remove support for Blackfin
This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove linux-bfin-low.c.
	* configure.srv: Remove bfin case.
	* linux-bfin-low.cc: Remove.
	* linux-low.cc: Remove BFIN-conditional code.

Change-Id: I846310d15e6386118ec7eabb1b87e647174560fb
2020-06-12 16:06:42 -04:00
Simon Marchi 613f149a90 gdbserver: remove support for Neutrino
This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

	* configure: Re-generate.
	* configure.ac: Remove srv_qnx test.
	* configure.srv: Remove nto case.
	* nto-low.cc, nto-low.h, nto-x86-low.cc: Remove.
	* remote-utils.c: Remove __QNX__-guarded code.

Change-Id: I8a1ad9c740a69352da1f6993778dbf951eebb22f
2020-06-12 16:06:41 -04:00
Simon Marchi fdb95bf546 gdbserver: remove support for LynxOS
This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

	* configure: Re-generate.
	* configure.ac: Remove srv_lynxos test.
	* configure.srv: Remove lynxos cases.
	* lynx-i386-low.cc, lynx-low.cc, lynx-low.h, lynx-ppc-low.c:
	Remove.

Change-Id: I239d1cf1fc7b4c7a174251bc7981707eaba7d972
2020-06-12 16:06:41 -04:00
Simon Marchi c00094dc7a gdbserver: small cleanup of README file
Fix a few outdated or incoherent things in the README:

- Don't mention remote.c nor *-stub.c files as references for the remote
  protocol.  remote.c is in GDB, not GDBserver, and *-stub.c files don't
  exist today.  Add a link to the documentation instead.

- In the "server (target) side" section, use `:2345` instead of
  `host:2345`.  It currently says that using `host:2345` means we would
  expect a connection from `host`.  That's not what I would expect by
  passing a host part here.  If I passed `11.22.33.44:2345` as the listen
  address, I would expect it to instruct gdbserver to listen only on that
  (11.22.33.44) network interface, not to expect a connection from host
  `11.22.33.44`.  So, remove that part of the sentence.

- Remove the list of supported target, refer to configure.srv instead.
  Keeping a list here is bound to lose sync with reality.

- In the cross-compile instructions, I don't think it's necessary to mention
  "In a Bourne shell".

- In the cross-compile instructions, I don't know what passing
  `your-target-name` to configure does, I don't think it's valid.  Use
  `make all-gdbserver` as in the instructions just above.

gdbserver/ChangeLog:

	* README: Fix a few outdated or incoherent things.

Change-Id: I79349e25bc1bc53447855e0dea6cc7b9630f4553
2020-06-12 16:01:35 -04:00
Tom de Vries 8118159c69 [gdbserver] Fix Wlto-type-mismatch for debug_agent
When building gdb including gdbserver with CFLAGS/CXXFLAGS -O2 -g -flto=auto,
I run into:
...
src/gdbserver/../gdbsupport/agent.h:47:13: error: type of 'debug_agent' \
  does not match original declaration [-Werror=lto-type-mismatch]
 extern bool debug_agent;
             ^
src/gdbserver/ax.cc:28:5: note: type 'int' should match type 'bool'
 int debug_agent = 0;
     ^
src/gdbserver/ax.cc:28:5: note: 'debug_agent' was previously declared here
src/gdbserver/ax.cc:28:5: note: code may be misoptimized unless \
  -fno-strict-aliasing is used
...

Fix this by changing the type of debug_agent in ax.cc from int to bool.

Tested on x86_64-linux.
2020-06-12 18:36:56 +02:00
Andrew Burgess a29d511281 gdb/testsuite: Prevent globals leaking between test scripts
Many of the test scripts create variables in the global namespace,
these variables will then be present for the following test scripts.
In most cases this is harmless, but in some cases this can cause
problems.

For example, if a variable is created as an array in one script, but
then assigned as a scalar in a different script, this will cause a TCL
error.

The solution proposed in this patch is to have the GDB test harness
record a list of all known global variables at the point just before
we source the test script.  Then, after the test script has run, we
again iterate over all global variables.  Any variable that was not in
the original list is deleted, unless it was marked as a persistent global
variable using gdb_persistent_global.

The assumption here is that no test script should need to create a
global variable that will outlive the lifetime of the test script
itself.  With this patch in place all tests currently seem to pass, so
the assumption seems to hold.

gdb/testsuite/ChangeLog:

2020-06-12  Andrew Burgess  <andrew.burgess@embecosm.com>
	    Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (gdb_known_globals, gdb_persistent_globals): New global.
	(gdb_persistent_global, gdb_persistent_global_no_decl): New proc.
	(gdb_setup_known_globals): New proc.
	(gdb_cleanup_globals): New proc.
	* lib/gdb.exp (load_lib): New override proc.
	(gdb_stdin_log_init): Set var in_file as persistent global.
	* lib/pascal.exp (gdb_stdin_log_init): Set vars
	pascal_compiler_is_gpc, pascal_compiler_is_fpc, gpc_compiler and
	fpc_compiler as persistent global.
2020-06-12 15:09:33 +02:00
Tom de Vries 8c74a764f2 [gdb/testsuite] Don't leak tuiterm.exp spawn override
In lib/tuiterm.exp the builtin spawn is overridden by a tui-specific version.

After running the first test-case that imports tuiterm.exp, the override
remains active, so it can cause trouble in subsequent test-cases, even if they
do not import tuiterm.exp.  See f.i. commit c8d4f6dfd9 "[gdb/testsuite] Fix
spawn in tuiterm.exp".

Fix this by:
- adding a variable gdb_finish_hooks which is a list of procs to run during
  gdb_finish
- adding a proc tuiterm_env that is used in test-cases instead of
  "load_lib tuiterm.exp".
- letting tuiterm_env:
  - install the tui-specific spawn version, and
  - use the gdb_finish_hooks to schedule restoring the builtin spawn
    version.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-12  Tom de Vries  <tdevries@suse.de>

	* lib/tuiterm.exp (spawn): Rename to ...
	(tui_spawn): ... this.
	(toplevel): Move rename of spawn ...
	(gdb_init_tuiterm): ... here.  New proc.
	(gdb_finish_tuiterm): New proc.
	* lib/gdb.exp (gdb_finish_hooks): New global var.
	(gdb_finish): Handle gdb_finish_hooks.
	(tuiterm_env): New proc.
	* gdb.python/tui-window.exp: Replace load_lib tuiterm.exp with
	tuiterm_env.
	* gdb.tui/basic.exp: Same.
	* gdb.tui/corefile-run.exp: Same.
	* gdb.tui/empty.exp: Same.
	* gdb.tui/list-before.exp: Same.
	* gdb.tui/list.exp: Same.
	* gdb.tui/main.exp: Same.
	* gdb.tui/new-layout.exp: Same.
	* gdb.tui/regs.exp: Same.
	* gdb.tui/resize.exp: Same.
	* gdb.tui/tui-layout-asm-short-prog.exp: Same.
	* gdb.tui/tui-layout-asm.exp: Same.
	* gdb.tui/tui-missing-src.exp: Same.
	* gdb.tui/winheight.exp: Same.
2020-06-12 13:29:43 +02:00
Tom de Vries 26783bce15 [gdb/testsuite] Don't abort testrun for invalid command in test-case
Say we add a call to foobar at the end of a test-case, and run the
test-suite.  We'll run into a dejagnu error:
...
ERROR: (DejaGnu) proc "foobar" does not exist.
...
and the test-suite run is aborted.

It's reasonable that the test-case is aborted, but it's not reasonable that
the testsuite run is aborted.

Problems in one test-case should not leak into other test-cases, and they
generally don't.  The exception is the "invalid command name" problem due to
an override of ::unknown in dejagnu's framework.exp.

Fix this by reverting dejagnu's ::unknown override for the duration of each
test-case, using the gdb_init/gdb_finish hooks.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-12  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26110
	* lib/gdb.exp (gdb_init): Revert dejagnu's override of ::unknown.
	(gdb_finish): Reinstall dejagnu's override of ::unknown.
2020-06-12 09:13:17 +02:00