Commit Graph

92346 Commits

Author SHA1 Message Date
Pedro Alves 1b0261195e Simplify completion_list_add_name | remove sym_text / sym_text_len
sym_text_len existed to strip parameters out of the lookup name.  Now
that that's handled by the lookup_name_info objects, the
sym_text/sym_text_len parameters are no longer necessary.

gdb/ChangeLog:
2017-11-08  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_make_symbol_completion_list): Remove text and
	text_len locals and don't pass them down.
	* symtab.c (completion_list_add_name): Remove
	sym_text/sym_text_len parameters and adjust.
	(completion_list_add_symbol, completion_list_add_msymbol)
	(completion_list_objc_symbol, completion_list_add_fields)
	(add_symtab_completions): Likewise.
	(default_collect_symbol_completion_matches_break_on)
	(collect_file_symbol_completion_matches): Remove sym_text_len
	local and don't pass it down.
	* symtab.h (completion_list_add_name): Remove
	sym_text/sym_text_len parameters.
2017-11-08 16:05:45 +00:00
Pedro Alves c62446b12b lookup_name_info::make_ignore_params
A few places in the completion code look for a "(" to find a
function's parameter list, in order to strip it, because psymtabs (and
gdb index) don't include parameter info in the symbol names.

See compare_symbol_name and
default_collect_symbol_completion_matches_break_on.

This is too naive.  Consider:

 ns_overload2_test::([TAB]

We'd want to complete that to:
 ns_overload2_test::(anonymous namespace)::struct_overload2_test

Or:

 b (anonymous namespace)::[TAB]

That currently completes to:

 b (anonymous namespace)

Which is obviously broken.  This patch makes that work.

Also, the current compare_symbol_name hack means that while this
works:

 "b function([TAB]"  ->  "b function()"

This does not:

 "b function ([TAB]"

This patch fixes that.  Whitespace "ignoring" now Just Works, i.e.,
assuming a symbol named "function(int, long)", this:
 b function (   int , lon[TAB]
completes to:
 b function (   int , long)

To address all of this, this patch builds on top of the rest of the
series, and pushes the responsibility of stripping parameters from a
lookup name to the new lookup_name_info object, where we can apply
per-language rules.  Also note that we now only make a version of the
lookup name with parameters stripped out where it's actually required
to do that, in the psymtab and GDB index code.

For C++, the right way to strip parameters is with "cp_remove_params",
which uses a real parser (cp-name-parser.y) to split the name into a
component tree and then discards parameters.

The trouble for completion is that in that case we have an incomplete
name, like "foo::func(int" and thus cp_remove_params throws an error.

This patch sorts that by adding a cp_remove_params_if_any variant of
cp_remove_params that tries removing characters from the end of the
string until cp_remove_params works.  So cp_remove_params_if_any
behaves like this:

With a complete name:

   "foo::func(int)"  => foo::func(int)  # cp_remove_params_1 succeeds the first time.

With an incomplete name:

   "foo::func(int"  => NULL             # cp_remove_params fails the first time.
   "foo::func(in"   => NULL             # and again...
   "foo::func(i"    => NULL             # and again...
   "foo::func("     => NULL             # and again...
   "foo::func"      => "foo::func"      # success!

Note that even if this approach removes significant rightmost
characters, it's still OK, because this parameter stripping is only
necessary for psymtabs and gdb index, where we're determining whether
to expand a symbol table.  Say cp_remove_params_if_any returned
"foo::" above for "foo::func(int".  That'd cause us to expand more
symtabs than ideal (because we'd expand all symtabs with symbols that
start with "foo::", not just "foo::func"), but then when we actually
look for completion matches, we'd still use the original lookup name,
with parameter information ["foo::func(int"], and thus we'll return no
false positive to the user.  Whether the stripping works as intended
and doesn't strip too much is thus covered by a unit test instead of a
testsuite test.

The "if_any" part of the name refers to the fact that while
cp_remove_params returns NULL if the input name has no parameters in
the first place, like:

   "foo::func"      => NULL         # cp_remove_params

cp_remove_params_if_any still returns the function name:

   "foo::func"      => "foo::func"  # cp_remove_params_if_any

gdb/ChangeLog:
2017-11-08  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
	unittests/lookup_name_info-selftests.c.
	(SUBDIR_UNITTESTS_OBS): Add lookup_name_info-selftests.o.
	* cp-support.c: Include "selftest.h".
	(cp_remove_params_1): Rename from cp_remove_params.  Add
	'require_param' parameter, and handle it.
	(cp_remove_params): Reimplement.
	(cp_remove_params_if_any): New.
	(selftests::quote): New.
	(selftests::check_remove_params): New.
	(selftests::test_cp_remove_params): New.
	(_initialize_cp_support): Install
	selftests::test_cp_remove_params.
	* cp-support.h (cp_remove_params_if_any): Declare.
	* dwarf2read.c :Include "selftest.h".
	(dw2_expand_symtabs_matching_symbol): Use
	lookup_name_info::make_ignore_params.
	(selftests::dw2_expand_symtabs_matching::mock_mapped_index)
	(selftests::dw2_expand_symtabs_matching::string_or_null)
	(selftests::dw2_expand_symtabs_matching::check_match)
	(selftests::dw2_expand_symtabs_matching::test_symbols)
	(selftests::dw2_expand_symtabs_matching::run_test): New.
	(_initialize_dwarf2_read): Register
	selftests::dw2_expand_symtabs_matching::run_test.
	* psymtab.c (psym_expand_symtabs_matching): Use
	lookup_name_info::make_ignore_params.
	* symtab.c (demangle_for_lookup_info::demangle_for_lookup_info):
	If the lookup name wants to ignore parameters, strip them.
	(compare_symbol_name): Remove sym_text/sym_text_len parameters and
	code handling '('.
	(completion_list_add_name): Don't pass down sym_text/sym_text_len.
	(default_collect_symbol_completion_matches_break_on): Don't try to
	strip parameters.
	* symtab.h (lookup_name_info::lookup_name_info): Add
	'ignore_parameters' parameter.
	(lookup_name_info::ignore_parameters)
	(lookup_name_info::make_ignore_params): New methods.
	(lookup_name_info::m_ignore_parameters): New field.
	* unittests/lookup_name_info-selftests.c: New file.
2017-11-08 16:02:24 +00:00
Pedro Alves 61920122ba Reorder/reindent dw2_expand_symtabs_matching & friends
The previous patch had added dw2_expand_symtabs_matching_symbol and
dw2_expand_marked_cus forward declarations and did not reindent
dw2_expand_marked_cus to avoid moving the code around while changing
it at the same time.

gdb/ChangeLog:
2017-11-08  Pedro Alves  <palves@redhat.com>

	* dwarf2read.c (dw2_expand_marked_cus)
	(dw2_expand_symtabs_matching_symbol): Remove forward declarations.
	(dw2_expand_symtabs_matching): Move further below.
	(dw2_expand_marked_cus): Reindent.
2017-11-08 16:02:24 +00:00
Pedro Alves 3f563c840a Optimize .gdb_index symbol name searching
As mentioned in the previous patch, .gdb_index name lookup got
significantly slower with the previous patch.

This patch addresses that, and in the process makes .gdb_index name
searching faster than what we had before the previous patch, even.
Using the same test:

 $ cat script.cmd
 set pagination off
 set $count = 0
 while $count < 400
   complete b string_prin
   printf "count = %d\n", $count
   set $count = $count + 1
 end

 $ time gdb --batch -q ./gdb-with-index -ex "source script.cmd"

I got, before the previous patch (-O2, x86-64):

 real    0m1.773s
 user    0m1.737s
 sys     0m0.040s

and after this patch:

 real    0m1.361s
 user    0m1.315s
 sys     0m0.040s

The basic idea here is simple: instead of always iterating over all
the symbol names in the index, we build an accelerator/sorted name
table and binary search names in it.

Later in the series, we'll want to support wild matching for C++ too,
so this mechanism already considers that.  For example, say that
you're looking up functions/methods named "func", no matter the
containing namespace/class.  If we sorted the table by qualified name,
then we obviously wouldn't be able to find those symbols with a binary
search:

  func
  ns1:🅰️🅱️:func
  ns1:🅱️:func
  ns2::func

(function symbol names in .gdb_index have no parameter info, like psymbols)

To address that out, we put an entry for each name component in the
sorted table.  something like this:

  Table Entry       Actual symbol
  ---------------------------------
  func              func

  func              ns1:🅰️🅱️:func
  b::func           ns1:🅰️🅱️:func
  a:🅱️:func        ns1:🅰️🅱️:func
  ns1:🅰️🅱️:func   ns1:🅰️🅱️:func

  func              ns1:🅱️:func
  b::func           ns1:🅱️:func
  ns1:🅱️:func      ns1:🅱️:func

  func              ns2::func
  ns2::func         ns2::func

Which sorted results in this:

  Table Entry       Actual symbol
  ---------------------------------
  a:🅱️:func        ns1:🅰️🅱️:func
  b::func           ns1:🅰️🅱️:func
  b::func           ns1:🅱️:func
  func              func
  func              ns1:🅰️🅱️:func
  func              ns1:🅱️:func
  func              ns2::func
  ns1:🅰️🅱️:func   ns1:🅰️🅱️:func
  ns1:🅱️:func      ns1:🅱️:func
  ns2::func         ns2::func

And we can binary search this.

Note that a binary search approach works for both completion and
regular lookup, while a name hashing approach only works for normal
symbol looking, since obviously "fun" and "func" have different
hashes.

At first I was a bit wary of these tables potentially growing GDB's
memory significantly.  But I did an experiment that convinced it's not
a worry at all.  I hacked gdb to count the total number of entries in
all the tables, attached that gdb to my system/Fedora's Firefox
(Fedora's debug packages uses .gdb_index), did "set max-completions
unlimited", and then hit "b [TAB]" to cause everything to expand.

That resulted in 1351355 name_components.  Each entry takes 8 bytes,
so that's 10810840 bytes (ignoring std::vector overhead), or ~10.3 MB.
That's IMO too small to worry about, given GDB was using over 7400MB
total at that point.  I.e., we're talking about 0.1% increase.

dw2_expand_symtabs_matching unit tests covering this will be added in
a follow up patch.

If the size of this table turns out to be a concern, I have an idea to
reduce the size of the table further at the expense of a bit more code
-- the vast majority of the name offsets are either 0 or fit in
8-bits:

 total name_component = 1351355, of which,
 name_component::name_offset instances need  0 bits = 679531
 name_component::name_offset instances need  8 bits = 669526
 name_component::name_offset instances need 16 bits = 2298
 name_component::name_offset instances need 32 bits = 0
 name_component::idx instances need 0 bits  = 51
 name_component::idx instances need 8 bits  = 8361
 name_component::idx instances need 16 bits = 280329
 name_component::idx instances need 32 bits = 1062614

so we could have separate tables for 0 name_offset, 8-bit name_offset
and 32-bit name_offset.  That'd give us roughly:

 679531 * 0 + 669526 * 1 + 2298 * 4 + 1062614 * 4 = 4929174, or ~4.7MB

with only 8-bit and 32-bit tables, that'd be:

 1349057 * 1 + 2298 * 4 + 4 * 1351355 = 6763669 bytes, or ~6.5MB.

I don't think we need to bother though.

I also timed:

 $ time gdb --batch -q -p `pidof firefox`
 $ time gdb --batch -q -p `pidof firefox` -ex "b main"
 $ time gdb --batch -q -p `pidof firefox` -ex "set max-completion unlimited" -ex "complete b "

and compared before previous patch vs this patch, and I didn't see a
significant difference, seemingly because time to read debug info
dominates.  The "complete b " variant of the test takes ~2min
currently...  (I have a follow up series that speeds that up
somewhat.)

gdb/ChangeLog:
2017-11-08  Pedro Alves  <palves@redhat.com>

	* dwarf2read.c (byte_swap, MAYBE_SWAP): Move higher up in file.
	(struct name_component): New.
	(mapped_index::name_components): New field.
	(mapped_index::symbol_name_at): New method.
	(dwarf2_read_index): Call mapped_index ctor.
	(dw2_map_matching_symbols): Add comment about name_components
	table.
	(dw2_expand_symtabs_matching): Factor part to...
	(dw2_expand_symtabs_matching_symbol): ... this new function.
	Build name components table, and lookup symbols in it before
	calling the name matcher.
	(dw2_expand_marked_cus): New, factored out from
	dw2_expand_symtabs_matching.
	(dwarf2_per_objfile_free): Call the mapped_index's dtor.
2017-11-08 16:02:24 +00:00
Pedro Alves b5ec771e60 Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
Summary:
 - This is preparation for supporting wild name matching on C++ too.
 - This is also preparation for TAB-completion fixes.
 - Makes symbol name matching (think strcmp_iw) be based on a per-language method.
 - Merges completion and non-completion name comparison (think
   language_ops::la_get_symbol_name_cmp generalized).
 - Avoid re-hashing lookup name multiple times
 - Centralizes preparing a name for lookup (Ada name encoding / C++ Demangling),
   both completion and non-completion.
 - Fixes Ada latent bug with verbatim name matches in expressions
 - Makes ada-lang.c use common|symtab.c completion code a bit more.

Ada's wild matching basically means that

 "(gdb) break foo"

will find all methods named "foo" in all packages.  Translating to
C++, it's roughly the same as saying that "break klass::method" sets
breakpoints on all "klass::method" methods of all classes, no matter
the namespace.  A following patch will teach GDB about fullname vs
wild matching for C++ too.  This patch is preparatory work to get
there.

Another idea here is to do symbol name matching based on the symbol
language's algorithm.  I.e., avoid dependency on current language set.

This allows for example doing

  (gdb) b foo::bar< int > (<tab>

and having gdb name match the C++ symbols correctly even if the
current language is C or Assembly (or Rust, or Ada, or ...), which can
easily happen if you step into an Assembly/C runtime library frame.

By encapsulating all the information related to a lookup name in a
class, we can also cache hash computation for a given language in the
lookup name object, to avoid recomputing it over and over.

Similarly, because we don't really know upfront which languages the
lookup name will be matched against, for each language we store the
lookup name transformed into a search name.  E.g., for C++, that means
demangling the name.  But for Ada, it means encoding the name.  This
actually forces us to centralize all the different lookup name
encoding in a central place, resulting in clearer code, IMO.  See
e.g., the new ada_lookup_name_info class.

The lookup name -> symbol search name computation is also done only
once per language.

The old language->la_get_symbol_name_cmp / symbol_name_cmp_ftype are
generalized to work with both completion, and normal symbol look up.

At some point early on, I had separate completion vs non-completion
language vector entry points, but a single method ends up being better
IMO for simplifying things -- the more we merge the completion /
non-completion name lookup code paths, the less changes for bugs
causing completion vs normal lookup finding different symbols.

The ada-lex.l change is necessary because when doing

  (gdb) p <UpperCase>

then the name that is passed to write_ write_var_or_type ->
ada_lookup_symbol_list misses the "<>", i.e., it's just "UpperCase",
and we end up doing a wild match against "UpperCase" lowercased by
ada_lookup_name_info's constructor.  I.e., "uppercase" wouldn't ever
match "UpperCase", and the symbol lookup fails.

This wouldn't cause any regression in the testsuite, but I added a new
test that would pass before the patch and fail after, if it weren't
for that fix.

This is latent bug that happens to go unnoticed because that
particular path was inconsistent with the rest of Ada symbol lookup by
not lowercasing the lookup name.

Ada's symbol_completion_add is deleted, replaced by using common
code's completion_list_add_name.  To make the latter work for Ada, we
needed to add a new output parameter, because Ada wants to return back
a custom completion candidates that are not the symbol name.

With this patch, minimal symbol demangled name hashing is made
consistent with regular symbol hashing.  I.e., it now goes via the
language vector's search_name_hash method too, as I had suggested in a
previous patch.

dw2_expand_symtabs_matching / .gdb_index symbol names were a
challenge.  The problem is that we have no way to telling what is the
language of each symbol name found in the index, until we expand the
corresponding full symbol, which is off course what we're trying to
avoid.  Language information is simply not considered in the index
format...  Since the symbol name hashing and comparison routines are
per-language, we now have a problem.  The patch sorts this out by
matching each name against all languages.  This is inneficient, and
indeed slows down completion several times.  E.g., with:

 $ cat script.cmd
 set pagination off
 set $count = 0
 while $count < 400
   complete b string_prin
   printf "count = %d\n", $count
   set $count = $count + 1
 end

 $ time gdb --batch -q ./gdb-with-index -ex "source script-string_printf.cmd"

I get, before patch (-O2, x86-64):

 real    0m1.773s
 user    0m1.737s
 sys     0m0.040s

While after patch (-O2, x86-64):

 real    0m9.843s
 user    0m9.482s
 sys     0m0.034s

However, the following patch will optimize this, and will actually
make this use case faster compared to the "before patch" above:

 real    0m1.321s
 user    0m1.285s
 sys     0m0.039s

gdb/ChangeLog:
2017-11-08   Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_encode): Rename to ..
	(ada_encode_1): ... this.  Add throw_errors parameter and handle
	it.
	(ada_encode): Reimplement.
	(match_name): Delete, folded into full_name.
	(resolve_subexp): No longer pass the encoded name to
	ada_lookup_symbol_list.
	(should_use_wild_match): Delete.
	(name_match_type_from_name): New.
	(ada_lookup_simple_minsym): Use lookup_name_info and the
	language's symbol_name_matcher_ftype.
	(add_symbols_from_enclosing_procs, ada_add_local_symbols)
	(ada_add_block_renamings): Adjust to use lookup_name_info.
	(ada_lookup_name): New.
	(add_nonlocal_symbols, ada_add_all_symbols)
	(ada_lookup_symbol_list_worker, ada_lookup_symbol_list)
	(ada_iterate_over_symbols): Adjust to use lookup_name_info.
	(ada_name_for_lookup): Delete.
	(ada_lookup_encoded_symbol): Construct a verbatim name.
	(wild_match): Reverse sense of return type.  Use bool.
	(full_match): Reverse sense of return type.  Inline bits of old
	match_name here.
	(ada_add_block_symbols): Adjust to use lookup_name_info.
	(symbol_completion_match): Delete, folded into...
	(ada_lookup_name_info::matches): ... .this new method.
	(symbol_completion_add): Delete.
	(ada_collect_symbol_completion_matches): Add name_match_type
	parameter.  Adjust to use lookup_name_info and
	completion_list_add_name.
	(get_var_value, ada_add_global_exceptions): Adjust to use
	lookup_name_info.
	(ada_get_symbol_name_cmp): Delete.
	(do_wild_match, do_full_match): New functions.
	(ada_lookup_name_info::ada_lookup_name_info): New method.
	(ada_symbol_name_matches, ada_get_symbol_name_matcher): New
	functions.
	(ada_language_defn): Install ada_get_symbol_name_matcher.
	* ada-lex.l (processId): If name starts with '<', copy it
	verbatim.
	* block.c (block_iter_match_step, block_iter_match_first)
	(block_iter_match_next, block_lookup_symbol)
	(block_lookup_symbol_primary, block_find_symbol): Adjust to use
	lookup_name_info.
	* block.h (block_iter_match_first, block_iter_match_next)
	(ALL_BLOCK_SYMBOLS_WITH_NAME): Adjust to use lookup_name_info.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Adjust comments to
	refer to la_get_symbol_name_matcher.
	* completer.c (complete_files_symbols)
	(collect_explicit_location_matches, symbol_completer): Pass a
	symbol_name_match_type down.
	* completer.h (class completion_match, completion_match_result):
	New classes.
	(completion_tracker::reset_completion_match_result): New method.
	(completion_tracker::m_completion_match_result): New field.
	* cp-support.c (make_symbol_overload_list_block): Adjust to use
	lookup_name_info.
	(cp_fq_symbol_name_matches, cp_get_symbol_name_matcher): New
	functions.
	* cp-support.h (cp_get_symbol_name_matcher): New declaration.
	* d-lang.c: Adjust comments to refer to
	la_get_symbol_name_matcher.
	* dictionary.c (dict_vector) <iter_match_first, iter_match_next>:
	Adjust to use lookup_name_info.
	(dict_iter_match_first, dict_iter_match_next)
	(iter_match_first_hashed, iter_match_next_hashed)
	(iter_match_first_linear, iter_match_next_linear): Adjust to work
	with a lookup_name_info.
	* dictionary.h (dict_iter_match_first, dict_iter_match_next):
	Likewise.
	* dwarf2read.c (dw2_lookup_symbol): Adjust to use lookup_name_info.
	(dw2_map_matching_symbols): Adjust to use symbol_name_match_type.
	(gdb_index_symbol_name_matcher): New class.
	(dw2_expand_symtabs_matching) Adjust to use lookup_name_info and
	gdb_index_symbol_name_matcher.  Accept a NULL symbol_matcher.
	* f-lang.c (f_collect_symbol_completion_matches): Adjust to work
	with a symbol_name_match_type.
	(f_language_defn): Adjust comments to refer to
	la_get_symbol_name_matcher.
	* go-lang.c (go_language_defn): Adjust comments to refer to
	la_get_symbol_name_matcher.
	* language.c (default_symbol_name_matcher)
	(language_get_symbol_name_matcher): New functions.
	(unknown_language_defn, auto_language_defn): Adjust comments to
	refer to la_get_symbol_name_matcher.
	* language.h (symbol_name_cmp_ftype): Delete.
	(language_defn) <la_collect_symbol_completion_matches>: Add match
	type parameter.
	<la_get_symbol_name_cmp>: Delete field.
	<la_get_symbol_name_matcher>: New field.
	<la_iterate_over_symbols>: Adjust to use lookup_name_info.
	(default_symbol_name_matcher, language_get_symbol_name_matcher):
	Declare.
	* linespec.c (iterate_over_all_matching_symtabs)
	(iterate_over_file_blocks): Adjust to use lookup_name_info.
	(find_methods): Add language parameter, and use lookup_name_info
	and the language's symbol_name_matcher_ftype.
	(linespec_complete_function): Adjust.
	(lookup_prefix_sym): Use lookup_name_info.
	(add_all_symbol_names_from_pspace): Adjust.
	(find_superclass_methods): Add language parameter and pass it
	down.
	(find_method): Pass symbol language down.
	(find_linespec_symbols): Don't demangle or Ada encode here.
	(search_minsyms_for_name): Add lookup_name_info parameter.
	(add_matching_symbols_to_info): Add name_match_type parameter.
	Use lookup_name_info.
	* m2-lang.c (m2_language_defn): Adjust comments to refer to
	la_get_symbol_name_matcher.
	* minsyms.c: Include <algorithm>.
	(add_minsym_to_demangled_hash_table): Remove table parameter and
	add objfile parameter.  Use search_name_hash, and add language to
	demangled languages vector.
	(struct found_minimal_symbols): New struct.
	(lookup_minimal_symbol_mangled, lookup_minimal_symbol_demangled):
	New functions.
	(lookup_minimal_symbol): Adjust to use them.  Don't canonicalize
	input names here.  Use lookup_name_info instead.  Lookup up
	demangled names once for each language in the demangled names
	vector.
	(iterate_over_minimal_symbols): Use lookup_name_info.  Lookup up
	demangled names once for each language in the demangled names
	vector.
	(build_minimal_symbol_hash_tables): Adjust.
	* minsyms.h (iterate_over_minimal_symbols): Adjust to pass down a
	lookup_name_info.
	* objc-lang.c (objc_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* objfiles.h: Include <vector>.
	(objfile_per_bfd_storage) <demangled_hash_languages>: New field.
	* opencl-lang.c (opencl_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* p-lang.c (pascal_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* psymtab.c (psym_lookup_symbol): Use lookup_name_info.
	(match_partial_symbol): Use symbol_name_match_type,
	lookup_name_info and psymbol_name_matches.
	(lookup_partial_symbol): Use lookup_name_info.
	(map_block): Use symbol_name_match_type and lookup_name_info.
	(psym_map_matching_symbols): Use symbol_name_match_type.
	(psymbol_name_matches): New.
	(recursively_search_psymtabs): Use lookup_name_info and
	psymbol_name_matches.  Rename 'kind' parameter to 'domain'.
	(psym_expand_symtabs_matching): Use lookup_name_info.  Rename
	'kind' parameter to 'domain'.
	* rust-lang.c (rust_language_defn): Adjust comment to refer to
	la_get_symbol_name_matcher.
	* symfile-debug.c (debug_qf_map_matching_symbols)
	(debug_qf_map_matching_symbols): Use symbol_name_match_type.
	(debug_qf_expand_symtabs_matching): Use lookup_name_info.
	* symfile.c (expand_symtabs_matching): Use lookup_name_info.
	* symfile.h (quick_symbol_functions) <map_matching_symbols>:
	Adjust to use symbol_name_match_type.
	<expand_symtabs_matching>: Adjust to use lookup_name_info.
	(expand_symtabs_matching): Adjust to use lookup_name_info.
	* symmisc.c (maintenance_expand_symtabs): Use
	lookup_name_info::match_any ().
	* symtab.c (symbol_matches_search_name): New.
	(eq_symbol_entry): Adjust to use lookup_name_info and the
	language's matcher.
	(demangle_for_lookup_info::demangle_for_lookup_info): New.
	(lookup_name_info::match_any): New.
	(iterate_over_symbols, search_symbols): Use lookup_name_info.
	(compare_symbol_name): Add language, lookup_name_info and
	completion_match_result parameters, and use them.
	(completion_list_add_name): Make extern.  Add language and
	lookup_name_info parameters.  Use them.
	(completion_list_add_symbol, completion_list_add_msymbol)
	(completion_list_objc_symbol): Add lookup_name_info parameters and
	adjust.  Pass down language.
	(completion_list_add_fields): Add lookup_name_info parameters and
	adjust.  Pass down language.
	(add_symtab_completions): Add lookup_name_info parameters and
	adjust.
	(default_collect_symbol_completion_matches_break_on): Add
	name_match_type parameter, and use it.  Use lookup_name_info.
	(default_collect_symbol_completion_matches)
	(collect_symbol_completion_matches): Add name_match_type
	parameter, and pass it down.
	(collect_symbol_completion_matches_type): Adjust.
	(collect_file_symbol_completion_matches): Add name_match_type
	parameter, and use lookup_name_info.
	* symtab.h: Include <string> and "common/gdb_optional.h".
	(enum class symbol_name_match_type): New.
	(class ada_lookup_name_info): New.
	(struct demangle_for_lookup_info): New.
	(class lookup_name_info): New.
	(symbol_name_matcher_ftype): New.
	(SYMBOL_MATCHES_SEARCH_NAME): Use symbol_matches_search_name.
	(symbol_matches_search_name): Declare.
	(MSYMBOL_MATCHES_SEARCH_NAME): Delete.
	(default_collect_symbol_completion_matches)
	(collect_symbol_completion_matches)
	(collect_file_symbol_completion_matches): Add name_match_type
	parameter.
	(iterate_over_symbols): Use lookup_name_info.
	(completion_list_add_name): Declare.
	* utils.c (enum class strncmp_iw_mode): Moved to utils.h.
	(strncmp_iw_with_mode): Now extern.
	* utils.h (enum class strncmp_iw_mode): Moved from utils.c.
	(strncmp_iw_with_mode): Declare.

gdb/testsuite/ChangeLog:
2017-11-08   Pedro Alves  <palves@redhat.com>

	* gdb.ada/complete.exp (p <Exported_Capitalized>): New test.
	(p Exported_Capitalized): New test.
	(p exported_capitalized): New test.
2017-11-08 16:02:24 +00:00
Pedro Alves 5ffa079369 Per-language symbol name hashing algorithm
Currently, we have a mess of symbol name hashing/comparison routines.
There's msymbol_hash for mangled names, and dict_hash and
msymbol_hash_iw for demangled names.  Then there's strcmp_iw,
strcmp_iw_ordered and Ada's full_match/wild_match, which all have to
agree with the hashing routines.  That's why dict_hash is really about
Ada names.  From the inconsistency department, minimal symbol hashing
doesn't go via dict_hash, so Ada's wild matching can't ever work with
minimal symbols.

This patch starts fixing this, by doing two things:

#1 - adds a language vector method to let each language decide how to
     compute a symbol name hash.

#2 - makes dictionaries know the language of the symbols they hold,
     and then use the dictionaries language to decide which hashing
     method to use.

For now, this is just scaffolding, since all languages install the
default method.  The series will make C++ install its own hashing
method later on, and will add per-language symbol name comparison
routines too.

This patch was originally based on a patch that Keith wrote for the
libcc1/C++ WIP support.

gdb/ChangeLog:
2017-11-08  Keith Seitz  <keiths@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_language_defn): Install
	default_search_name_hash.
	* buildsym.c (struct buildsym_compunit): <language>: New field.
	(finish_block_internal): Pass language when creating dictionaries.
	(start_buildsym_compunit, start_symtab): New language parameters.
	Use them.
	(restart_symtab): Pass down compilation unit's language.
	* buildsym.h (enum language): Forward declare.
	(start_symtab): New 'language' parameter.
	* c-lang.c (c_language_defn, cplus_language_defn)
	(asm_language_defn, minimal_language_defn): Install
	default_search_name_hash.
	* coffread.c (coff_start_symtab): Adjust.
	* d-lang.c (d_language_defn): Install default_search_name_hash.
	* dbxread.c (struct symloc): Add 'pst_language' field.
	(PST_LANGUAGE): Define.
	(start_psymtab, read_ofile_symtab): Use it.
	(process_one_symbol): New 'language' parameter.  Pass it down.
	* dictionary.c (struct dictionary) <language>: New field.
	(DICT_LANGUAGE): Define.
	(dict_create_hashed, dict_create_hashed_expandable)
	(dict_create_linear, dict_create_linear_expandable): New parameter
	'language'.  Set the dictionary's language.
	(iter_match_first_hashed): Adjust to rename.
	(insert_symbol_hashed): Assert we don't see mismatching
	languages.  Adjust to rename.
	(dict_hash): Rename to ...
	(default_search_name_hash): ... this and make extern.
	* dictionary.h (struct language_defn): Forward declare.
	(dict_create_hashed): New parameter 'language'.
	* dwarf2read.c (dwarf2_start_symtab): Pass down language.
	* f-lang.c (f_language_defn): Install default_search_name_hash.
	* go-lang.c (go_language_defn): Install default_search_name_hash.
	* jit.c (finalize_symtab): Pass compunit's language to dictionary
	creation.
	* language.c (unknown_language_defn, auto_language_defn):
	* language.h (language_defn::la_search_name_hash): New field.
	(default_search_name_hash): Declare.
	* m2-lang.c (m2_language_defn): Install default_search_name_hash.
	* mdebugread.c (new_block): New parameter 'language'.
	* mdebugread.c (parse_symbol): Pass symbol language to block
	allocation.
	(psymtab_to_symtab_1): Pass down language.
	(new_symtab): Pass compunit's language to block allocation.
	* objc-lang.c (objc_language_defn): Install
	default_search_name_hash.
	* opencl-lang.c (opencl_language_defn):
	* p-lang.c (pascal_language_defn): Install
	default_search_name_hash.
	* rust-lang.c (rust_language_defn): Install
	default_search_name_hash.
	* stabsread.h (enum language): Forward declare.
	(process_one_symbol): Add 'language' parameter.
	* symtab.c (search_name_hash): New function.
	* symtab.h (search_name_hash): Declare.
	* xcoffread.c (read_xcoff_symtab): Pass language to start_symtab.
2017-11-08 16:02:24 +00:00
Pedro Alves 2a1dde5da2 Fix "make test-cp-name-parser"
src/gdb/cp-name-parser.y: In function ‘int main(int, char**)’:
src/gdb/cp-name-parser.y:2132:30: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
   char *str2, *extra_chars = "", c;
                              ^

Simply don't initialize the variable, it's not necessary.

gdb/ChangeLog:
2017-11-08  Pedro Alves  <palves@redhat.com>

	* cp-name-parser.y (main): Don't initialize extra_chars.
2017-11-08 15:28:50 +00:00
Nick Clifton 2841837fac Fix typo in changelog 2017-11-08 14:34:32 +00:00
Nick Clifton c0e7cef715 Split the AArch64 Crypto instructions for AES and SHA1+2 into their own options (+aes and +sha2).
The new options are:

	+aes: Enables the AES instructions of Armv8-a,
	      enabled by default with +crypto.

	+sha2: Enables the SHA1 and SHA2 instructions of Armv8-a,
	       enabled by default with +crypto.

These options have been turned on by default when +crypto
is used, as such no breakage is expected.

The reason for the split is because with the introduction of Armv8.4-a
the implementation of AES has explicitly been made independent of the
implementation of the other crypto extensions. Backporting the split does
not break any of the previous requirements and so is safe to do.

gas	* config/tc-aarch64.c
	(aarch64_features): Include AES and SHA2 in CRYPTO.
	Add SHA2 and AES.

include	* opcode/aarch64.h:
	(AARCH64_FEATURE_SHA2, AARCH64_FEATURE_AES): New.

opcodes	* aarch64-tbl.h (aarch64_feature_crypto): Add AES and SHA2.
	(aarch64_feature_sha2, aarch64_feature_aes): New.
	(SHA2, AES): New.
	(AES_INSN, SHA2_INSN): New.
	(pmull, pmull2, aese, aesd, aesmc, aesimc): Change to AES_INS.
	(sha1h, sha1su1, sha256su0, sha1c, sha1p,
	 sha1m, sha1su0, sha256h, sha256h2, sha256su1):
	Change to SHA2_INS.
2017-11-08 14:30:53 +00:00
Jiong Wang dec41383ff Adds command line support for Armv8.4-A, via the new command line option -march=armv8.4-a. Add support for "+dotprod" ARM feature (required for ARMv8.4-A). Add assembler and disassembler support for new FP16 instructions introduced in Armv8.4-A
gas	* config/tc-arm.c (arm_extensions):
	(arm_archs): New entry for "armv8.4-a".
	Add FPU_ARCH_DOTPROD_NEON_VFP_ARMV8.
	(arm_ext_v8_2): New variable.
	(enum arm_reg_type): New enumeration REG_TYPE_NSD.
	(reg_expected_msgs): New entry for REG_TYPE_NSD.
	(parse_typed_reg_or_scalar): Handle REG_TYPE_NSD.
	(parse_scalar): Support REG_TYPE_VFS.
	(enum operand_parse_code): New enumerations OP_RNSD and OP_RNSD_RNSC.
	(parse_operands): Handle OP_RNSD and OP_RNSD_RNSC.
	(NEON_SHAPE_DEF): New entries for DHH and DHS.
	(neon_scalar_for_fmac_fp16_long): New function to generate Rm encoding
	for new FP16 instructions in ARMv8.2-A.
	(do_neon_fmac_maybe_scalar_long): New function to encode new FP16
	instructions in ARMv8.2-A.
	(do_neon_vfmal): Wrapper function for vfmal.
	(do_neon_vfmsl): Wrapper function for vfmsl.
	(insns): New entries for vfmal and vfmsl.
	* doc/c-arm.texi (-march): Document "armv8.4-a".
	* testsuite/gas/arm/dotprod-mandatory.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16.s: New test source.
	* testsuite/gas/arm/armv8_2-a-fp16-illegal.s: New test source.
	* testsuite/gas/arm/armv8_2-a-fp16.d: New test.
	* testsuite/gas/arm/armv8_3-a-fp16.d: New test.
	* testsuite/gas/arm/armv8_4-a-fp16.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16-thumb2.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16-illegal.d: New test.
	* testsuite/gas/arm/armv8_2-a-fp16-illegal.l: New error file.

opcodes	* arm-dis.c (coprocessor_opcodes): New entries for ARMv8.2-A new
	FP16 instructions, including vfmal.f16 and vfmsl.f16.

include	* opcode/arm.h (ARM_AEXT2_V8_4A): Include Dot Product feature.
	(ARM_EXT2_V8_4A): New macro.
	(ARM_AEXT2_V8_4A): Likewise.
	(ARM_ARCH_V8_4A): Likewise.
2017-11-08 13:15:12 +00:00
Alan Modra 6e98b3428b xtensa message pluralization
* config/tc-xtensa.c (finish_vinsn): Properly pluralize error message.
2017-11-08 14:33:48 +10:30
GDB Administrator b346cb961f Automatic date update in version.in 2017-11-08 00:00:20 +00:00
Tom Tromey 95a6b0a106 Constify execute_command
This constifies execute_command and fixes up the callers.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* event-top.h (command_handler): Constify.
	* record-full.c (cmd_record_full_start): Update.
	* thread.c (thread_apply_all_command): Update.
	* printcmd.c (eval_command): Update.
	* mi/mi-main.c (mi_execute_cli_command): Update.
	(mi_execute_async_cli_command): Update.
	* tui/tui-stack.c (tui_update_command): Update.
	* cli/cli-interp.c (safe_execute_command): Constify.
	* record.c (record_start): Update.
	(record_start, record_stop, cmd_record_start): Update.
	* record-btrace.c (cmd_record_btrace_bts_start): Update.
	(cmd_record_btrace_pt_start): Update.
	(cmd_record_btrace_start): Update.
	(cmd_record_btrace_start): Update.
	* reverse.c (exec_reverse_once): Update.
	* python/python.c (execute_gdb_command): Don't copy the command.
	* event-top.c (command_line_handler): Update.
	(command_handler): Constify.
	* defs.h (deprecated_call_command_hook): Constify.
	* cli/cli-script.h (execute_user_command): Constify.
	* cli/cli-script.c (execute_user_command): Constify.
	(execute_cmd_pre_hook, execute_cmd_post_hook): Constify.
	(enum command_control_type): Update.
	* main.c (catch_command_errors): Remove non-const overload.
	(catch_command_errors_ftype): Remove.
	* python/py-cmd.c (cmdpy_function): Constify.
	* guile/scm-cmd.c (cmdscm_function): Constify.
	* cli/cli-dump.c (call_dump_func): Constify.
	* cli/cli-decode.c (do_const_cfunc): Constify.
	(do_sfunc): Constify.
	(cmd_func): Constify.
	* gdbcmd.h (execute_command, execute_command_to_string): Constify.
	* top.h (execute_command): Constify.
	* top.c (execute_command): Constify.
	(execute_command_to_string): Constify.
	(deprecated_call_command_hook): Constify.
	* command.h (cmd_func): Constify.
	* cli/cli-decode.h (struct cmd_list_element) <func>: Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey eb4c3f4aaa Constify add_setshow_*
This constifies the add_setshow_* family of functions, and then fixes
up the fallout.  The bulk of this patch was written by script.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (catch_ada_exception_command): Constify.
	(catch_assert_command): Constify.
	* break-catch-throw.c (catch_catch_command, catch_throw_command)
	(catch_rethrow_command): Constify.
	(catch_exception_command_1): Constify.
	* breakpoint.h (add_catch_command): Constify.
	* break-catch-syscall.c (catch_syscall_command_1): Constify.
	(catch_syscall_split_args): Constify.
	* break-catch-sig.c (catch_signal_command): Constify.
	(catch_signal_split_args): Constify.
	* cli/cli-decode.h (struct cmd_list_element) <function>: Use
	cmd_const_sfunc_ftype.
	* cli/cli-decode.c (add_setshow_cmd_full): Constify.
	(add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
	(add_setshow_boolean_cmd, add_setshow_filename_cmd)
	(add_setshow_string_cmd, struct cmd_list_element)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
	Constify.
	(set_cmd_sfunc): Constify.
	(empty_sfunc): Constify.
	* command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
	(add_setshow_boolean_cmd, add_setshow_filename_cmd)
	(add_setshow_string_cmd, add_setshow_string_noescape_cmd)
	(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
	(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
	(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
	Constify.
	(set_cmd_sfunc): Constify.
	(cmd_sfunc_ftype): Remove.
	* compile/compile.c (set_compile_args): Constify.
	* infrun.c (set_disable_randomization): Constify.
	* infcmd.c (set_args_command, set_cwd_command): Constify.
	* breakpoint.c (set_condition_evaluation_mode): Constify.
	(add_catch_command): Constify.
	(catch_fork_command_1, catch_exec_command_1)
	(catch_load_command_1, catch_unload_command_1): Constify.
	(catch_load_or_unload): Constify.
	* guile/scm-param.c (pascm_set_func): Constify.
	(add_setshow_generic): Constify.
	* python/py-param.c (get_set_value): Constify.
	* top.h (set_verbose): Constify.
	* tui/tui-win.c (tui_set_var_cmd): Constify.
	* mi/mi-main.c (set_mi_async_command): Constify.
	* cli/cli-logging.c (set_logging_overwrite)
	(set_logging_redirect): Constify.
	* value.c (set_max_value_size): Constify.
	* valprint.c (set_input_radix, set_output_radix): Constify.
	* utils.c (set_width_command, set_height_command): Constify.
	* typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify.
	* tracepoint.c (set_disconnected_tracing)
	(set_circular_trace_buffer, set_trace_buffer_size)
	(set_trace_user, set_trace_notes, set_trace_stop_notes): Constify.
	* top.c (set_history_size_command, set_verbose, set_editing)
	(set_gdb_datadir, set_history_filename): Constify.
	* target.c (set_targetdebug, maint_set_target_async_command)
	(maint_set_target_non_stop_command, set_target_permissions)
	(set_write_memory_permission): Constify.
	(open_target): Constify.
	* target-descriptions.c (set_tdesc_filename_cmd): Constify.
	* target-dcache.c (set_stack_cache, set_code_cache): Constify.
	* symtab.c (set_symbol_cache_size_handler): Constify.
	* symfile.c (set_ext_lang_command): Constify.
	* symfile-debug.c (set_debug_symfile): Constify.
	* source.c (set_directories_command): Constify.
	* solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify.
	* serial.c (set_parity): Constify.
	* rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify.
	* remote.c (set_remote_exec_file, set_remotebreak)
	(set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify.
	* record.c (set_record_insn_history_size)
	(set_record_call_history_size): Constify.
	* record-full.c (set_record_full_insn_max_num): Constify.
	* proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify.
	* osabi.c (set_osabi): Constify.
	* mips-tdep.c (set_mips64_transfers_32bit_regs)
	(reinit_frame_cache_sfunc, mips_abi_update): Constify.
	* maint.c (maintenance_set_profile_cmd): Constify.
	* linux-thread-db.c (set_libthread_db_search_path): Constify.
	* language.c (set_language_command, set_range_command)
	(set_case_command): Constify.
	* infrun.c (set_non_stop, set_observer_mode)
	(set_stop_on_solib_events, set_schedlock_func)
	(set_exec_direction_func): Constify.
	* infcmd.c (set_inferior_tty_command): Constify.
	* disasm.c (set_disassembler_options_sfunc): Constify.
	* demangle.c (set_demangling_command): Constify.
	* dcache.c (set_dcache_size, set_dcache_line_size): Constify.
	* cris-tdep.c (set_cris_version, set_cris_mode)
	(set_cris_dwarf2_cfi): Constify.
	* corefile.c (set_gnutarget_command): Constify.
	* charset.c (set_host_charset_sfunc, set_target_charset_sfunc)
	(set_target_wide_charset_sfunc): Constify.
	* breakpoint.c (update_dprintf_commands): Constify.
	* auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify.
	* arm-tdep.c (set_fp_model_sfunc, arm_set_abi)
	(set_disassembly_style_sfunc): Constify.
	* arch-utils.c (set_endian, set_architecture): Constify.
	* alpha-tdep.c (reinit_frame_cache_sfunc): Constify.
	* agent.c (set_can_use_agent): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 5fed81ff35 Remove cmd_cfunc_ftype
This removes cmd_cfunc_ftype and the non-const overload of add_cmd;
then fixes up the fallout.

For the most part this patch is straightforward.  There are a few
files (go32-nat.c, windows-nat.c, and gnu-nat.c) that I could not
compile; so I made a best effort there.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* go32-nat.c (go32_sysinfo, go32_sldt, go32_sgdt, go32_sidt)
	(go32_pde, go32_pte, go32_pte_for_address): Constify.
	* gnu-nat.c (_parse_bool_arg, show_thread_default_pause_cmd)
	(set_thread_default_pause_cmd, set_thread_default_run_cmd)
	(show_thread_default_run_cmd, set_thread_default_detach_sc_cmd)
	(parse_int_arg, show_thread_default_detach_sc_cmd)
	(set_signals_cmd, show_signals_cmd, set_sig_thread_cmd)
	(show_sig_thread_cmd, set_stopped_cmd, show_stopped_cmd)
	(set_exceptions_cmd, show_exceptions_cmd, set_task_pause_cmd)
	(show_task_pause_cmd, set_task_detach_sc_cmd)
	(show_task_detach_sc_cmd, set_task_exc_port_cmd)
	(set_noninvasive_cmd, set_thread_pause_cmd)
	(show_thread_pause_cmd, set_thread_run_cmd, show_thread_run_cmd)
	(set_thread_detach_sc_cmd, show_thread_detach_sc_cmd)
	(set_thread_exc_port_cmd, thread_takeover_sc_cmd): Constify.
	* windows-nat.c (display_selectors): Constify.
	* cli/cli-decode.h (struct cmd_list_element) <function>: Remove
	non-const "cfunc".
	* cli/cli-decode.c (set_cmd_cfunc): Remove non-const overload.
	(cmd_cfunc_eq): Likewise.
	(struct cmd_list_element): Likewise.
	(do_cfunc): Remove.
	(cli_user_command_p): Update.
	* command.h (add_cmd): Remove non-const overload.
	(cmd_cfunc_ftype): Remove typedef.
	(cmd_cfunc_eq): Remove non-const overload.
	* value.c (show_values): Constify.
	* thread.c (thread_apply_all_command): Constify.
	* symfile.c (load_command): Constify.
	* source.c (directory_command): Constify.
	* maint.c (maintenance_internal_error)
	(maintenance_demangler_warning, maintenance_space_display)
	(maintenance_print_architecture, maintenance_translate_address)
	(maintenance_info_selftests, maintenance_internal_warning):
	Constify.
	* breakpoint.c (disable_trace_command, enable_trace_command):
	Constify.
	* auto-load.c (info_auto_load_local_gdbinit, add_auto_load_dir):
	Constify.
	(add_auto_load_safe_path): Constify.
	* guile/scm-auto-load.c (info_auto_load_guile_scripts): Constify.
	* top.h (show_commands): Constify.
	* linux-thread-db.c (info_auto_load_libthread_db): Constify.
	* sparc64-tdep.c (adi_examine_command): Constify.
	(adi_assign_command): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 1d12d88f18 Constify add_info
This patch constifies add_info and updates all the info commands.  The
bulk of this patch was written using a script; and then I did a manual
pass to fix up the remaining compilation errors.

I could not compile every changed file; in particular nto-procfs.c,
gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the
correctness by inspection.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* frame.h (info_locals_command, info_args_command): Constify.
	* auto-load.h (auto_load_info_scripts): Constify.
	* inferior.h (registers_info): Constify.
	* copying.c: Rebuild.
	* copying.awk: Constify generated commands.
	* auto-load.c (auto_load_info_scripts)
	(info_auto_load_gdb_scripts): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Take a
	cmd_const_cfunc_ftype.
	* command.h (add_info): Take a cmd_const_cfunc_ftype.
	* tui/tui-win.c (tui_all_windows_info): Constify.
	* python/py-auto-load.c (info_auto_load_python_scripts):
	Constify.
	* cli/cli-cmds.c (show_command): Remove non-const overload.
	* tracepoint.c (info_tvariables_command, info_scope_command):
	Constify.
	(info_static_tracepoint_markers_command): Constify.
	* thread.c (info_threads_command): Constify.
	(print_thread_info_1): Constify.
	* target.c (info_target_command): Constify.
	* symtab.c (info_sources_command, info_functions_command)
	(info_types_command): Constify.
	(info_variables_command): Remove non-const overload.
	* symfile.c (info_ext_lang_command): Constify.
	* stack.c (info_frame_command, info_locals_command)
	(info_args_command): Constify.
	(backtrace_command): Remove non-const overload.
	* source.c (info_source_command, info_line_command): Constify.
	* solib.c (info_sharedlibrary_command): Constify.
	* skip.c (info_skip_command): Constify.
	* ser-go32.c (info_serial_command): Constify.
	* reverse.c (info_bookmarks_command): Constify.
	* printcmd.c (info_symbol_command, info_address_command)
	(info_display_command): Constify.
	* osdata.c (info_osdata_command): Constify.
	* objc-lang.c (info_selectors_command, info_classes_command):
	Constify.
	* nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify.
	* memattr.c (info_mem_command): Constify.
	* macrocmd.c (info_macro_command, info_macros_command): Constify.
	* linux-fork.c (info_checkpoints_command): Constify.
	* infrun.c (info_signals_command): Constify.
	* inflow.c (info_terminal_command): Constify.
	* inferior.c (info_inferiors_command): Constify.
	(print_inferior): Constify.
	* infcmd.c (info_program_command, info_all_registers_command)
	(info_registers_command, info_vector_command)
	(info_float_command): Constify.
	(registers_info): Constify.
	* gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd)
	(info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd):
	Constify.
	* f-valprint.c (info_common_command): Constify.
	* dcache.c (info_dcache_command): Constify.
	(dcache_info_1): Constify.
	* darwin-nat-info.c (info_mach_tasks_command)
	(info_mach_task_command, info_mach_ports_command)
	(info_mach_port_command, info_mach_threads_command)
	(info_mach_thread_command, info_mach_regions_command)
	(info_mach_regions_recurse_command, info_mach_region_command)
	(info_mach_exceptions_command): Constify.
	(get_task_from_args): Constify.
	* cp-support.c (info_vtbl_command): Constify.
	* breakpoint.c (info_watchpoints_command)
	(info_tracepoints_command): Constify.
	(info_breakpoints_command): Remove non-const overload.
	* avr-tdep.c (avr_io_reg_read_command): Constify.
	* auxv.c (info_auxv_command): Constify.
	* ada-tasks.c (info_tasks_command): Constify.
	(info_task): Constify.
	* ada-lang.c (info_exceptions_command): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 0b39b52e6e Constify add_com
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes
up all the command implementations.

In most cases this is trivial.

In a couple of places I had to again introduce a temporary non-const
overload.  These overloads will be removed when add_info is
constified.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* solib.h (no_shared_libraries): Constify.
	* frame.h (return_command): Constify.
	* cli/cli-cmds.h (quit_command): Constify.
	* top.h (quit_command, execute_command): Constify.
	* target.h (flash_erase_command): Constify.
	* inferior.h (set_inferior_args, attach_command): Constify.
	* tracepoint.h (start_tracing, stop_tracing): Constify.
	* breakpoint.h (break_command, tbreak_command)
	(hbreak_command_wrapper, thbreak_command_wrapper)
	(rbreak_command_wrapper, watch_command_wrapper)
	(awatch_command_wrapper, rwatch_command_wrapper)
	(get_tracepoint_by_number): Constify.
	* symtab.c (info_variables_command, rbreak_command)
	(symtab_symbol_info): Constify.
	(info_variables_command): Add non-const overload.
	* top.c (dont_repeat_command): Constify.
	* breakpoint.c (ignore_command, commands_command)
	(condition_command, tbreak_command, hbreak_command)
	(thbreak_command, clear_command, break_command)
	(info_breakpoints_command, watch_command, rwatch_command)
	(awatch_command, trace_command, ftrace_command, strace_command)
	(trace_pass_command, break_range_command, dprintf_command)
	(agent_printf_command, get_tracepoint_by_number)
	(watch_maybe_just_location, trace_pass_command): Constify.
	(info_breakpoints_command): Add non-const overload.
	* tracefile.c (tsave_command): Constify.
	* infcmd.c (attach_command, disconnect_command, signal_command)
	(queue_signal_command, stepi_command, nexti_command)
	(finish_command, next_command, step_command, until_command)
	(advance_command, jump_command, continue_command, run_command)
	(start_command, starti_command, interrupt_command)
	(run_command_1, set_inferior_args, step_1): Constify.
	* inferior.c (add_inferior_command, remove_inferior_command)
	(clone_inferior_command): Constify.
	* linux-fork.c (checkpoint_command, restart_command): Constify.
	* windows-nat.c (signal_event_command): Constify.
	* guile/guile.c (guile_repl_command, guile_command): Constify.
	* printcmd.c (x_command, display_command, printf_command)
	(output_command, set_command, call_command, print_command)
	(eval_command): Constify.
	(non_const_set_command): Remove.
	(_initialize_printcmd): Update.
	* source.c (forward_search_command, reverse_search_command):
	Constify.
	* jit.c (jit_reader_load_command, jit_reader_unload_command):
	Constify.
	* infrun.c (handle_command): Constify.
	* memattr.c (mem_command): Constify.
	* stack.c (return_command, up_command, up_silently_command)
	(down_command, down_silently_command, frame_command)
	(backtrace_command, func_command, backtrace_command_1): Constify.
	(backtrace_command): Add non-const overload.
	* remote-sim.c (simulator_command): Constify.
	* exec.c (set_section_command): Constify.
	* tracepoint.c (tdump_command, trace_variable_command)
	(tstatus_command, tstop_command, tstart_command)
	(end_actions_pseudocommand, while_stepping_pseudocommand)
	(collect_pseudocommand, teval_pseudocommand, actions_command)
	(start_tracing, stop_tracing): Constify.
	* value.c (init_if_undefined_command): Constify.
	* tui/tui-stack.c (tui_update_command): Constify.
	* tui/tui-win.c (tui_refresh_all_command)
	(tui_set_tab_width_command, tui_set_win_height_command)
	(tui_set_focus_command, tui_scroll_forward_command)
	(tui_scroll_backward_command, tui_scroll_left_command)
	(tui_scroll_right_command, parse_scrolling_args, tui_set_focus)
	(tui_set_win_height): Constify.
	* tui/tui-layout.c (tui_layout_command): Constify.
	* procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd)
	(proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd)
	(proc_untrace_sysexit_cmd): Constify.
	* remote.c (threadlist_test_cmd, threadinfo_test_cmd)
	(threadset_test_cmd, threadlist_update_test_cmd)
	(threadalive_test): Constify.
	* objc-lang.c (print_object_command): Constify.
	* command.h (add_com): Constify.
	* cli/cli-dump.c (restore_command): Constify.
	* cli/cli-cmds.c (pwd_command, echo_command, quit_command)
	(help_command, complete_command, shell_command, edit_command)
	(list_command, disassemble_command, make_command)
	(apropos_command, alias_command): Constify.
	* cli/cli-script.c (document_command, define_command)
	(while_command, if_command, validate_comname): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* target.c (do_monitor_command, flash_erase_command): Constify.
	* regcache.c (reg_flush_command): Constify.
	* reverse.c (reverse_step, reverse_next, reverse_stepi)
	(reverse_nexti, reverse_continue, reverse_finish)
	(save_bookmark_command, goto_bookmark_command)
	(exec_reverse_once): Constify.
	* python/python.c (python_interactive_command, python_command):
	Constify.
	* typeprint.c (ptype_command, whatis_command, whatis_exp):
	Constify.
	* solib.c (sharedlibrary_command, no_shared_libraries): Constify.
	* gcore.c (gcore_command): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 85c4be7c83 Add set_repeat_arguments function
The "x", "list", and "show commands" commands have special repetition
behavior: repeating the command doesn't re-run it with the same
arguments

This is currently implemented by modifying the passed-in argument; but
that won't work properly with const arguments (and seems pretty
obscure besides).

This patch adds a new "set_repeat_arguments" function and changes the
relevant places to call it.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* printcmd.c (x_command): Call set_repeat_arguments.
	* cli/cli-cmds.c (list_command): Call set_repeat_arguments.
	* top.c (repeat_arguments): New global.
	(set_repeat_arguments): New function.
	(execute_command): Handle repeat_arguments.
	(show_commands): Calls set_repeat_arguments.
	* command.h (set_repeat_arguments): Declare.
2017-11-07 13:59:09 -07:00
Tom Tromey 022643b445 Remove cleanup from backtrace_command
This removes a cleanup from backtrace_command, replacing it with
std::string.  This patch temporarily changes backtrace_command so that
the parameter is named "args_in" and is immediately constified; this
is fixed again in the constification patch.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* stack.c (backtrace_command): Use std::string.
	(backtrace_command_1): Make "count_exp" const.
2017-11-07 13:59:09 -07:00
Tom Tromey 5614fb7720 Constify add_path and friends
This constifies add_path, mod_path, and directory_switch.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* source.c (directory_switch, mod_path, add_path): Constify.
	* defs.h (add_path, mod_path, directory_switch): Constify.
	* mi/mi-cmd-env.c (env_mod_path): Constify.
2017-11-07 13:59:09 -07:00
Tom Tromey 6be9a197d9 Make strip_bg_char return a unique_xmalloc_ptr
This changes strip_bg_char to return a unique_xmalloc_ptr and removes
several cleanups.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* infcmd.c (strip_bg_char): Return gdb::unique_xmalloc_ptr.
	(run_command_1, continue_command, step_1, jump_command)
	(signal_command, until_command, advance_command, finish_command)
	(attach_command): Update.
2017-11-07 13:59:09 -07:00
Tom Tromey c2252c0dd8 Make set_cmd_cfunc private
set_cmd_cfunc is only used in cli-decode.c, and I don't think there is
a good reason to expose it directly.  So, this patch makes it private.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* command.h (set_cmd_cfunc): Don't declare.
	* cli/cli-decode.c (set_cmd_cfunc): Now static.
2017-11-07 13:59:08 -07:00
Tom Tromey 1ee870c524 Constify add_com_suppress_notification
This constifies add_com_suppress_notification and fixes the one
caller.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* stack.c (select_frame_command): Constify.
	* cli/cli-decode.c (add_com_suppress_notification): Constify.
	* command.h (add_com_suppress_notification): Constify.
2017-11-07 13:59:08 -07:00
Tom Tromey ee7ddd7132 Constify add_abbrev_prefix_cmd
This changes add_abbrev_prefix_cmd to take a const-taking callback
function and then fixes the one caller.

gdb/ChangeLog
2017-11-07  Tom Tromey  <tom@tromey.com>

	* breakpoint.c (stop_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Constify.
	* command.h (add_abbrev_prefix_cmd): Constify.
2017-11-07 13:59:08 -07:00
Andrew Burgess 52eab766df opcodes/arc: Fix incorrect insn_class for some nps insns
A small number of NPS400 instruction incorrectly used NONE as an
insn_class_t, which would trigger a build warning.  Fixed by changing to
MISC.

opcodes/ChangeLog:

	* arc-nps400-tbl.h: Change incorrect use of NONE to MISC.
2017-11-07 20:24:21 +00:00
Jim Wilson 016f5a3777 Fix typo in my email address.
binutils/
	* MAINTAINERS (RISC-V): Fix typo in my email address.
2017-11-07 09:43:18 -08:00
Palmer Dabbelt 180093c763 RISC-V: Add Jim Wilson as a maintainer, and clean up our entries
Jim has recently started working at SiFive, where he'll be contributing
to our binutils port.  Andrew and I would like him to be a maintainer.
My understanding is that this is right place to ask.

I've also changed my address to my SiFive one, where I also work -- it
seems cleaner to have everyone use our proper email address.  While I
was in there, I noticed a trailing space after Andrew's name so I went
ahead and removed it as well.

binutils/ChangeLog

2017-11-07  Palmer Dabbelt  <palmer@sifive.com>

        * MAINTAINERS (RISC-V): Add Jim Wilson as a maintainer.
        Clean up Andrew's entry (remove trailing space, add tabs).
        Change Palmer's email address, and clean up entry (add tabs).
2017-11-07 09:22:04 -08:00
Jim Wilson f77bb6c56b RISC-V: Fix riscv g++ testsuite EH failures.
This fixes some EH failures for the medany code model in the g++ testsuite.
The problem is that the assembler is computing some values in the eh_frame
section as constants, that instead should have had relocs to be resolved by
the linker.  This happens in output_cfi_insn in the DW_CFA_advance_loc case
where it compares label frags and immediately simplifies if they are the
same.  We can fix that by forcing a new frag after every instruction
that the linker can reduce in size.  I've also added a testcase to verify
the fix.  This was tested with binutils make check, and gcc/g++ make checks on
qemu for medlow and medany code models.

	gas/
	* config/tc-riscv.c (append_insn): Call frag_wane and frag_new at
	end for linker optimizable relocs.
	* testsuite/gas/riscv/eh-relocs.d: New.
	* testsuite/gas/riscv/eh-relocs.s: New.
	* testsuite/gas/riscv/riscv.exp: Run eh-relocs test.
2017-11-07 09:13:52 -08:00
Palmer Dabbelt 1270b047fd RISC-V: Add satp as an alias for sptbr
The RISC-V privileged ISA changed the name of sptbr (Supervisor Page
Table Base Register) to satp (Supervisor Address Translation and
Protection) to reflect the fact it could be used for more than just
paging.  This patch adds an alias, as they're the same register.

include/ChangeLog

2017-11-06  Palmer Dabbelt  <palmer@dabbelt.com>

        * opcode/riscv-opc.h (sptbr): Rename to satp.
        (CSR_SPTBR): Rename to CSR_SATP.
        (sptbr): Alias to CSR_SATP.

gas/ChangeLog

2017-11-06  Palmer Dabbelt  <palmer@dabbelt.com>

        * testsuite/gas/riscv/satp.d: New test.
        testsuite/gas/riscv/satp.s: Likewise.
        testsuite/gas/riscv/riscv.exp: Likewise.
        config/tc-riscv.c (md_begin): Handle CSR aliases.
2017-11-07 09:00:37 -08:00
Pedro Alves a02b41a7e6 Add some more breakpoint/location range tests
Some extra thoroughness tests that I had over here.

gdb/testsuite/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* gdb.cp/ena-dis-br-range.exp: Add more tests.
2017-11-07 11:16:09 +00:00
Pedro Alves 95e95a6de2 Make breakpoint/location number parsing error output consistent
... and also make GDB catch a few more cases of invalid input.

This fixes the inconsistency in GDB's output (e.g., "bad" vs "Bad")
exposed by the new tests added in the previous commit.

Also, makes the "0-0" and "inverted range" cases be loud errors.

Also makes GDB reject negative breakpoint number in ranges.  We
already rejected negative number literals, but you could still subvert
that via convenience variables, like:

  (gdb) set $bp -1
  (gdb) disable $bp.1-2

The change to get_number_trailer fixes a bug exposed by the new tests.
The function did not handle parsing "-$num".  [This wasn't visible in
the gdb.multi/tids.exp (which has similar tests) because the TID range
parsing is implemented differently.]

gdb/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (extract_bp_kind): New enum.
	(extract_bp_num, extract_bp_or_bp_range): New functions, partially
	factored out from ...
	(extract_bp_number_and_location): ... here.
	* cli/cli-utils.c (get_number_trailer): Handle '-$variable'.

gdb/testsuite/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* gdb.base/ena-dis-br.exp (test_ena_dis_br): Adjust test.
	* gdb.cp/ena-dis-br-range.exp: Adjust tests.
	(disable_invalid, disable_inverted, disable_negative): New
	procedures.
	("bad numbers"): New set of tests.
2017-11-07 11:07:19 +00:00
Pedro Alves cee62dbd87 Add base 'enable/disable invalid location range' tests
This adds tests that exercise the "bad breakpoint number" paths.
Specifically:

 - malformed ranges
 - use of explicit 0 as bp/loc number.
 - inverted ranges

I'm adding this as a baseline to improve.  This shows that there's a
lot of inconsistency in GDB's output (e.g., "bad" vs "Bad").

Also, IMO, the "0-0" and inverted range cases should be loud errors.

That and more will all be addressed in the next patch.

gdb/testsuite/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* gdb.cp/ena-dis-br-range.exp: Add tests.
2017-11-07 11:06:49 +00:00
Pedro Alves cc638e867c Breakpoint location parsing: always error instead of warning
It's odd that when parsing a breakpoint or location number, we error out
in most cases, but warn in others.

  (gdb) disable 1-
  bad breakpoint number at or near: '1-'
  (gdb) disable -1
  bad breakpoint number at or near: '-1'
  (gdb) disable .foo
  bad breakpoint number at or near: '.foo'
  (gdb) disable foo.1
  Bad breakpoint number 'foo.1'
  (gdb) disable 1.foo
  warning: bad breakpoint number at or near '1.foo'

This changes GDB to always error out.  It required touching one testcase
that expected the warning.

gdb/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (extract_bp_number_and_location): Change return
	type to void.  Throw error instead of warning.
	(enable_disable_command): Adjust.

gdb/testsuite/ChangeLog:
2017-11-07  Pedro Alves  <palves@redhat.com>

	* gdb.base/ena-dis-br.exp: Don't expect "warning:".
2017-11-07 11:06:00 +00:00
Xavier Roirand d0fe47010f Allow enabling/disabling breakpoint location ranges
When a breakpoint has multiple locations, like e.g.:

 Num  Type       Disp Enb  Address    What
 1    breakpoint keep y    <MULTIPLE>
 1.1                  y    0x080486a2 in void foo<int>()...
 1.2                  y    0x080486ca in void foo<double>()...
 [....]
 1.5                  y    0x080487fa in void foo<long>()...

it's possible to enable/disable the individual locations using the
'<breakpoint_number>.<location_number>' syntax, like e.g.:

 (gdb) disable 1.2 1.3 1.4 1.5

That's inconvenient when you have a long list of locations to disable,
however.

This patch adds shorthand for the above, by making it possible to
specify a range of locations with the following syntax (similar to
thread id ranges):

 <breakpoint_number>.<first_location_number>-<last_location_number>

For example, the command above can now be simplified to:

 (gdb) disable 1.2-5

gdb/ChangeLog:
2017-11-07  Xavier Roirand  <roirand@adacore.com>
	    Pedro Alves  <palves@redhat.com>

	* breakpoint.c (map_breakpoint_number_range): New, factored out
	from ...
	(map_breakpoint_numbers): ... here.
	(find_location_by_number): Change parameters from string to
	breakpoint number and location.
	(extract_bp_number_and_location): New function.
	(enable_disable_bp_num_loc)
	(enable_disable_breakpoint_location_range)
	(enable_disable_command): New functions, factored out ...
	(enable_command, disable_command): ... these functions, and
	adjusted to support ranges.
	* NEWS: Document enable/disable breakpoint location range feature.

gdb/doc/ChangeLog:
2017-11-07  Xavier Roirand  <roirand@adacore.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Set Breaks): Document support for breakpoint
	location ranges in the enable/disable commands.

gdb/testsuite/ChangeLog:
2017-11-07  Xavier Roirand  <roirand@adacore.com>
	    Pedro Alves  <palves@redhat.com>

	* gdb.base/ena-dis-br.exp: Add reference to
	gdb.cp/ena-dis-br-range.exp.
	* gdb.cp/ena-dis-br-range.exp: New file.
	* gdb.cp/ena-dis-br-range.cc: New file.
2017-11-07 11:00:31 +00:00
Tamar Christina 0198d5e6fc This patch similarly to the AArch64 one enables Dot Product support by default for the Cortex-A55 and Cortex-A75 which have hardware support for these instructions.
gas	* config/tc-arm.c (arm_cpus):
	Change FPU_ARCH_CRYPTO_NEON_VFP_ARMV8
	into FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_DOTPROD.

include	* opcode/arm.h (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_DOTPROD):
	New macro.
2017-11-07 10:17:21 +00:00
Alan Modra db84fff3f8 PowerPC64 statistics message
Fixes "linker stubs in 1 groups".

	* elf64-ppc.c (ppc64_elf_build_stubs): Correct pluralization in
	statistics message.
2017-11-07 18:50:03 +10:30
Alan Modra e54e9ac577 bundle_lock message tidy
I'd edited these thinking that there might be cases where the counts
were one, but on further investigation it appears not.  What's left
here are some minor tweaks.

	* read.c (assemble_one, s_bundle_unlock): Formatting.
	Consistently add comma and "bytes" to error message.
	* testsuite/gas/i386/bundle-bad.l: Adjust to suit.
2017-11-07 17:01:17 +10:30
Alan Modra d3a49aa80b readelf ngettext fixes
This patch is a first pass at fixing readelf message pluralization.
I've deliberately not fixed the "out of memory" errors since it's very
unlikely that they will ever be complaining about not being able to
allocate for a single entry, and a few others where the size is very
unlikely to be 1 byte.

Then there are messages like this one:
"Out of %lu items there are %zu bucket clashes (longest of %zu entries).\n"
I suppose this could be split into three parts, "Of %lu items ",
"there are %zu bucket clashes ", and "(longest of %zu entries).\n",
each part being printed separately, but that might not be ideal for
sentence construction in other languages.  For now I'm punting on this
one.

Changes to readelf output require lots of testsuite adjustment..

binutils/
	* dwarf.c (read_uleb128): Properly pluralize messages.
	(display_debug_lines_raw, display_debug_loc): Likewise.
	(display_debug_names, process_cu_tu_index): Likewise.
	* od-macho.c (dump_code_signature_superblob): Likewise.
	* readelf.c (process_program_headers): Likewise.
	(process_section_header, process_relocs): Likewise.
	(hppa_process_unwind, arm_process_unwind): Likewise.
	(process_dynamic_section, process_version_sections): Likewise.
	(process_symbol_table, process_syminfo): Likewise.
	(apply_relocations, process_mips_specific): Likewise.
	(process_gnu_liblist, process_notes_at): Likewise.
	(process_archive): Likewise.
	* testsuite/binutils-all/dw2-1.W,
	* testsuite/binutils-all/dw2-3.W,
	* testsuite/binutils-all/dw2-3gabi.W,
	* testsuite/binutils-all/dw5.S,
	* testsuite/binutils-all/dw5.W,
	* testsuite/binutils-all/i386/compressed-1a.d,
	* testsuite/binutils-all/libdw2-compressedgabi.out,
	* testsuite/binutils-all/objdump.W,
	* testsuite/binutils-all/readelf.r,
	* testsuite/binutils-all/readelf.r-64,
	* testsuite/binutils-all/x86-64/compressed-1a.d: Update
	for pluralization fixes.
gas/
	* testsuite/gas/arm/got_prel.d,
	* testsuite/gas/elf/dwarf2-1.d,
	* testsuite/gas/elf/dwarf2-2.d,
	* testsuite/gas/elf/dwarf2-3.d,
	* testsuite/gas/elf/dwarf2-5.d,
	* testsuite/gas/elf/dwarf2-6.d,
	* testsuite/gas/i386/debug1.d,
	* testsuite/gas/i386/dw2-compress-1.d,
	* testsuite/gas/i386/dw2-compress-3a.d,
	* testsuite/gas/i386/dw2-compress-3b.d,
	* testsuite/gas/i386/dw2-compressed-1.d,
	* testsuite/gas/i386/dw2-compressed-3a.d,
	* testsuite/gas/i386/dw2-compressed-3b.d,
	* testsuite/gas/i386/ilp32/x86-64-localpic.d,
	* testsuite/gas/i386/localpic.d,
	* testsuite/gas/i386/x86-64-localpic.d,
	* testsuite/gas/ia64/pr13167.d,
	* testsuite/gas/mips/loc-swap-2.d,
	* testsuite/gas/mips/loc-swap.d,
	* testsuite/gas/mips/micromips@loc-swap-2.d,
	* testsuite/gas/mips/micromips@loc-swap.d,
	* testsuite/gas/mips/mips16-dwarf2-n32.d,
	* testsuite/gas/mips/mips16-dwarf2.d,
	* testsuite/gas/mips/mips16@loc-swap-2.d,
	* testsuite/gas/mips/mips16@loc-swap.d,
	* testsuite/gas/mips/mips16e@loc-swap.d,
	* testsuite/gas/mmix/bspec-1.d,
	* testsuite/gas/mmix/bspec-2.d,
	* testsuite/gas/tic6x/unwind-1.d,
	* testsuite/gas/tic6x/unwind-2.d,
	* testsuite/gas/tic6x/unwind-3.d: Update for pluralization
	fixes.
ld/
	* testsuite/ld-aarch64/ifunc-13.d,
	* testsuite/ld-aarch64/ifunc-15.d,
	* testsuite/ld-aarch64/ifunc-20.d,
	* testsuite/ld-alpha/tlsbin.rd,
	* testsuite/ld-alpha/tlspic.rd,
	* testsuite/ld-arm/ifunc-3.rd,
	* testsuite/ld-arm/ifunc-9.rd,
	* testsuite/ld-arm/unwind-mix.d,
	* testsuite/ld-arm/unwind-rel.d,
	* testsuite/ld-cris/hiddef1.d,
	* testsuite/ld-cris/libdso-13.d,
	* testsuite/ld-cris/libdso-2.d,
	* testsuite/ld-cris/pr16044.d,
	* testsuite/ld-cris/tls-local-63.d,
	* testsuite/ld-cris/tls-local-64.d,
	* testsuite/ld-cris/tls-und-38.d,
	* testsuite/ld-cris/tls-und-42.d,
	* testsuite/ld-cris/tls-und-46.d,
	* testsuite/ld-cris/tls-und-50.d,
	* testsuite/ld-cris/weakref3.d,
	* testsuite/ld-cris/weakref4.d,
	* testsuite/ld-elf/comm-data2r.rd,
	* testsuite/ld-elf/discard1.d,
	* testsuite/ld-elf/discard2.d,
	* testsuite/ld-elf/pr19539.d,
	* testsuite/ld-elf/pr22374-1.r,
	* testsuite/ld-elf/pr22374-2.r,
	* testsuite/ld-i386/combreloc.d,
	* testsuite/ld-i386/emit-relocs-nacl.rd,
	* testsuite/ld-i386/emit-relocs.rd,
	* testsuite/ld-i386/pr13302.d,
	* testsuite/ld-i386/pr17709-nacl.rd,
	* testsuite/ld-i386/pr17709.rd,
	* testsuite/ld-i386/pr19539.d,
	* testsuite/ld-i386/pr19615.d,
	* testsuite/ld-i386/pr19636-1a.d,
	* testsuite/ld-i386/pr19636-1e.d,
	* testsuite/ld-i386/pr19636-1f.d,
	* testsuite/ld-i386/pr19636-2a.d,
	* testsuite/ld-i386/pr19636-2b.d,
	* testsuite/ld-i386/pr19636-2d-nacl.d,
	* testsuite/ld-i386/pr19636-2e-nacl.d,
	* testsuite/ld-i386/pr19636-3a.d,
	* testsuite/ld-i386/pr19636-3d.d,
	* testsuite/ld-i386/pr19636-3e.d,
	* testsuite/ld-i386/pr19636-4a.d,
	* testsuite/ld-i386/pr19645.d,
	* testsuite/ld-i386/pr19827-nacl.rd,
	* testsuite/ld-i386/pr19827.rd,
	* testsuite/ld-i386/pr20253-4a.d,
	* testsuite/ld-i386/pr20253-4b.d,
	* testsuite/ld-i386/pr20253-5.d,
	* testsuite/ld-i386/tlsbin-nacl.rd,
	* testsuite/ld-i386/tlsbin.rd,
	* testsuite/ld-i386/tlspic-nacl.rd,
	* testsuite/ld-i386/tlspic.rd,
	* testsuite/ld-i386/undefweakb.d,
	* testsuite/ld-ia64/tlsbin.rd,
	* testsuite/ld-ia64/tlspic.rd,
	* testsuite/ld-ifunc/ifunc-13-i386.d,
	* testsuite/ld-ifunc/ifunc-13-x86-64.d,
	* testsuite/ld-ifunc/ifunc-15-i386.d,
	* testsuite/ld-ifunc/ifunc-15-x86-64.d,
	* testsuite/ld-ifunc/ifunc-20-i386.d,
	* testsuite/ld-ifunc/ifunc-20-x86-64.d,
	* testsuite/ld-ifunc/ifunc-23a-x86.d,
	* testsuite/ld-ifunc/ifunc-23b-x86.d,
	* testsuite/ld-ifunc/ifunc-23c-x86.d,
	* testsuite/ld-ifunc/ifunc-24a-x86.d,
	* testsuite/ld-ifunc/ifunc-24b-x86.d,
	* testsuite/ld-ifunc/ifunc-24c-x86.d,
	* testsuite/ld-ifunc/ifunc-25a-x86.d,
	* testsuite/ld-ifunc/ifunc-25b-x86.d,
	* testsuite/ld-ifunc/ifunc-25c-x86.d,
	* testsuite/ld-m68k/got-1.d,
	* testsuite/ld-mips-elf/vxworks1.rd,
	* testsuite/ld-powerpc/ambiguousv1.d,
	* testsuite/ld-powerpc/ambiguousv1b.d,
	* testsuite/ld-powerpc/ambiguousv2.d,
	* testsuite/ld-powerpc/ambiguousv2b.d,
	* testsuite/ld-powerpc/tlsexe.r,
	* testsuite/ld-powerpc/tlsexe32.r,
	* testsuite/ld-powerpc/tlsexetoc.r,
	* testsuite/ld-powerpc/tlsso.r,
	* testsuite/ld-powerpc/tlsso32.r,
	* testsuite/ld-powerpc/tlstocso.r,
	* testsuite/ld-powerpc/vle-multiseg-1.d,
	* testsuite/ld-powerpc/vle-multiseg-2.d,
	* testsuite/ld-powerpc/vle-multiseg-3.d,
	* testsuite/ld-s390/tlsbin.rd,
	* testsuite/ld-s390/tlsbin_64.rd,
	* testsuite/ld-s390/tlspic.rd,
	* testsuite/ld-s390/tlspic_64.rd,
	* testsuite/ld-sh/ld-r-1.d,
	* testsuite/ld-sh/sh64/gotplt.d,
	* testsuite/ld-sh/shared-1.d,
	* testsuite/ld-sh/tlsbin-2.d,
	* testsuite/ld-sh/tlspic-2.d,
	* testsuite/ld-sparc/gotop32.rd,
	* testsuite/ld-sparc/gotop64.rd,
	* testsuite/ld-sparc/tlssunpic32.rd,
	* testsuite/ld-sparc/tlssunpic64.rd,
	* testsuite/ld-sparc/vxworks1-lib.rd,
	* testsuite/ld-tic6x/shlib-app-1.rd,
	* testsuite/ld-tic6x/shlib-app-1b.rd,
	* testsuite/ld-tic6x/shlib-app-1r.rd,
	* testsuite/ld-tic6x/shlib-app-1rb.rd,
	* testsuite/ld-tic6x/shlib-noindex.rd,
	* testsuite/ld-vax-elf/export-class-data.rd,
	* testsuite/ld-x86-64/pr13082-1a.d,
	* testsuite/ld-x86-64/pr13082-1b.d,
	* testsuite/ld-x86-64/pr13082-2a.d,
	* testsuite/ld-x86-64/pr13082-2b.d,
	* testsuite/ld-x86-64/pr13082-3a.d,
	* testsuite/ld-x86-64/pr13082-3c.d,
	* testsuite/ld-x86-64/pr13082-4a.d,
	* testsuite/ld-x86-64/pr13082-5a.d,
	* testsuite/ld-x86-64/pr13082-5b.d,
	* testsuite/ld-x86-64/pr13082-6a.d,
	* testsuite/ld-x86-64/pr13082-6b.d,
	* testsuite/ld-x86-64/pr17709-nacl.rd,
	* testsuite/ld-x86-64/pr17709.rd,
	* testsuite/ld-x86-64/pr19539a.d,
	* testsuite/ld-x86-64/pr19539b.d,
	* testsuite/ld-x86-64/pr19615.d,
	* testsuite/ld-x86-64/pr19636-1a.d,
	* testsuite/ld-x86-64/pr19636-1d.d,
	* testsuite/ld-x86-64/pr19636-1e.d,
	* testsuite/ld-x86-64/pr19636-2a.d,
	* testsuite/ld-x86-64/pr19636-2e.d,
	* testsuite/ld-x86-64/pr19636-2f.d,
	* testsuite/ld-x86-64/pr19636-3a.d,
	* testsuite/ld-x86-64/pr19645.d,
	* testsuite/ld-x86-64/pr19807-2b.d,
	* testsuite/ld-x86-64/pr19807-2d.d,
	* testsuite/ld-x86-64/pr19827-nacl.rd,
	* testsuite/ld-x86-64/pr19827.rd,
	* testsuite/ld-x86-64/pr20253-4a.d,
	* testsuite/ld-x86-64/pr20253-4b.d,
	* testsuite/ld-x86-64/pr20253-4d.d,
	* testsuite/ld-x86-64/pr20253-4e.d,
	* testsuite/ld-x86-64/pr20253-5a.d,
	* testsuite/ld-x86-64/pr20253-5b.d,
	* testsuite/ld-x86-64/tlsbin-nacl.rd,
	* testsuite/ld-x86-64/tlsbin.rd,
	* testsuite/ld-x86-64/tlspic-nacl.rd,
	* testsuite/ld-x86-64/tlspic.rd,
	* testsuite/ld-x86-64/tlspic2-nacl.rd: Update for
	pluralization fixes.
2017-11-07 17:01:16 +10:30
Alan Modra 992a06eea4 gas and ld pluralization fixes
gas/
	* as.c (main): Properly pluralize messages.
	* frags.c (frag_grow): Likewise.
	* read.c (emit_expr_with_reloc, emit_expr_fix): Likewise.
	(parse_bitfield_cons): Likewise.
	* write.c (fixup_segment, compress_debug, write_contents): Likewise.
	(relax_segment): Likewise.
	* config/tc-arm.c (s_arm_elf_cons): Likewise.
	* config/tc-cr16.c (l_cons): Likewise.
	* config/tc-i370.c (i370_elf_cons): Likewise.
	* config/tc-m68k.c (m68k_elf_cons): Likewise.
	* config/tc-msp430.c (msp430_operands): Likewise.
	* config/tc-s390.c (s390_elf_cons, s390_literals): Likewise.
	* config/tc-mcore.c (md_apply_fix): Likewise.
	* config/tc-tic54x.c (md_assemble): Likewise.
	* config/tc-xtensa.c (xtensa_elf_cons): Likewise.
	(xg_expand_assembly_insn): Likewise.
	* config/xtensa-relax.c (build_transition): Likewise.
ld/
	* ldlang.c (lang_size_sections_1): Properly pluralize messages.
	(lang_check_section_addresses): Likewise.
2017-11-07 17:00:37 +10:30
Alan Modra f3ce9b3a00 Require ngettext in test of system gettext implementation
If binutils is going to use ngettext, then we'd better arrange for
intl/ to be compiled if the system gettext lacks ngettext.

	* configure.ac: Invole AM_GNU_GETTEXT with need_ngettext.
	* configure: Regenerate.
	* aclocal.m4: Regenerate.
2017-11-07 15:56:44 +10:30
Alan Modra 6003e27e76 ngettext support
binutils has lacked proper pluralization of output messages for a long
time, for example, readelf will display information about a section
that "contains 1 entries" or "There are 1 section headers".  Fixing
this properly requires us to use ngettext, because other languages
have different rules to English.

This patch defines macros for ngettext and friends to handle builds
with --disable-nls, and tidies the existing nls support.  I've
redefined gettext rather than just defining "_" as dgettext in bfd and
opcodes in case someone wants to use gettext there (which might
conceivably happen with generated code).

bfd/
	* sysdep.h: Formatting, comment fixes.
	(gettext, ngettext): Redefine when ENABLE_NLS.
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
	(_): Define using gettext.
	(textdomain, bindtextdomain): Use safer "do nothing".
	* hosts/alphavms.h (textdomain, bindtextdomain): Likewise.
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
opcodes/
	* opintl.h: Formatting, comment fixes.
	(gettext, ngettext): Redefine when ENABLE_NLS.
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
	(_): Define using gettext.
	(textdomain, bindtextdomain): Use safer "do nothing".
binutils/
	* sysdep.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gas/
	* asintl.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gold/
	* system.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
ld/
	* ld.h (textdomain, bindtextdomain): Use safer "do nothing".
	(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
2017-11-07 15:52:52 +10:30
GDB Administrator 84d5321fdf Automatic date update in version.in 2017-11-07 00:00:21 +00:00
Luis Machado 635dc5b2e5 Update my e-mail address.
gdb/ChangeLog:
2017-11-06  Luis Machado  <luis.machado@linaro.org>

	* MAINTAINERS (Write After Approval): Update my e-mail address.
2017-11-06 15:39:09 -02:00
Pedro Alves 556e5da513 Simplify child_terminal_inferior
The comment about Lynx in child_terminal_init reads a bit odd, since
it's not exactly clear what "This" in "This is for Lynx" is referring
to.  Looking back in history makes it clearer.  When the comment was
originally added, in commit 91ecc8efa9, back in 1994, the code
looked like this:

~~~
#ifdef PROCESS_GROUP_TYPE
#ifdef PIDGET
      /* This is for Lynx, and should be cleaned up by having Lynx be
         a separate debugging target with a version of
         target_terminal_init_inferior which passes in the process
         group to a generic routine which does all the work (and the
         non-threaded child_terminal_init_inferior can just pass in
         inferior_pid to the same routine).  */
      inferior_process_group = PIDGET (inferior_pid);
#else
      inferior_process_group = inferior_pid;
#endif
#endif
~~~

So this looked like it was about when GDB was growing support for
multi-threading, and inferior_pid was still a single int for most
ports.

Eventually we got ptid_t, so the comment isn't really useful today.
Particularly more so since we no longer support Lynx as a GDB host.

The only caller left of child_terminal_init_with_pgrp is gnu-nat.c
(the Hurd), and that target uses fork-child, so when we reach
gnu_terminal_init after spawning a new child, the current inferior
must already have the PID set, and the child must be a process group
leader.

We can't add a 'getpgid(inf->pid) == inf->pid' assertion to
child_terminal_init though (like a previous version of this patch was
doing [1]), because child_terminal_init is also reached after
attaching to a process.  If we did, the new
gdb.base/attach-non-pgrp-leader.exp test would fail, with:

  (gdb) attach 12415
  Attaching to program: build/gdb/testsuite/outputs/gdb.base/attach-non-pgrp-leader/attach-non-pgrp-leader, process 12415
  src/gdb/inflow.c:180: internal-error: void child_terminal_init(target_ops*): Assertion `getpgid (inf->pid) == inf->pid' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) FAIL: gdb.base/attach-non-pgrp-leader.exp: child: attach to child (GDB internal error)

I'm not making GDB save the pgid for attached processes with getpgid
for now, because the saved process group affects other things which
I'm leaving for following patches, like e.g., the "interrupt" command.

[1] - https://sourceware.org/ml/gdb-patches/2017-11/msg00039.html

gdb/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* gnu-nat.c (gnu_terminal_init): Delete.
	(gnu_target): Don't install gnu_terminal_init.
	* inflow.c (child_terminal_init_with_pgrp): Delete, merged with ...
	(child_terminal_init): ... this function.
2017-11-06 16:59:13 +00:00
Pedro Alves 46f67f80dd Test attaching to a process that isn't a process group leader
The patch at
<https://sourceware.org/ml/gdb-patches/2017-11/msg00039.html> was
proposing to add an assertion to child_terminal_init that turns out
would fail if you tried to attach to a process that isn't a process
group leader.

Since the testsuite failed to catch the problem, this commit adds a
new testcase that would catch it, like:

  (gdb) attach 12415
  Attaching to program: build/gdb/testsuite/outputs/gdb.base/attach-non-pgrp-leader/attach-non-pgrp-leader, process 12415
  src/gdb/inflow.c:180: internal-error: void child_terminal_init(target_ops*): Assertion `getpgid (inf->pid) == inf->pid' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) FAIL: gdb.base/attach-non-pgrp-leader.exp: child: attach to child (GDB internal error)

gdb/testsuite/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* gdb.base/attach-non-pgrp-leader.c: New.
	* gdb.base/attach-non-pgrp-leader.exp: New.
2017-11-06 16:32:04 +00:00
Pedro Alves d1928160a3 Don't check termio.h and sgtty.h in common/common.m4 either
common/common.m4 still had checks for termio.h/sgtty.h that are stale
now.  Remove them.

gdb/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* common/common.m4 (GDB_AC_COMMON): No longer check termio.h nor
	sgtty.h.
	* config.in, configure: Regenerate.

gdb/gdbserver/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* config.in, configure: Regenerate.
2017-11-06 16:19:12 +00:00
Pedro Alves 6aa899ce25 Eliminate STOP_SIGNAL, use SIGTSTP directly
The STOP_SIGNAL macro was originally added for Convex Unix
(https://en.wikipedia.org/wiki/Convex_Computer).

In:

  git show 7a67dd45ca1c:gdb/m-convex.h

we see:

~~~
  /* Use SIGCONT rather than SIGTSTP because convex Unix occasionally
     turkeys SIGTSTP.  I think.  */

  #define STOP_SIGNAL SIGCONT
~~~

That's gdb-3.5, 1990...  In gdb/ChangeLog-3.x we see:

~~~
Tue Apr 18 13:43:37 1989  Randall Smith  (randy at apple-gunkies.ai.mit.edu)

        Various changes involved in 1) getting gdb to work on the convex,
	[...]
        Made whatever signal indicates a stop configurable (via macro
        STOP_SIGNAL).
        (main): Setup use of above as a signal handler.  Added check for
        "-nw" in args already processed.
        (command_line_input): SIGTSTP ==>STOP_SIGNAL.
~~~

Support for Convex Unix is long gone, and nothing else overrides
STOP_SIGNAL.  So just use SIGTSTP directly, removing a little
obfuscation.

(I don't really understand why we override [1] readline's SIGTSTP
handler (only) when reading scripts (and then fail to restore it
properly, assuming SIG_DFL...), but I'll leave that for another pass.

[1] - Actually, starting with readline 6.3, readline is no longer
installing its handlers while GDB is in control...)

gdb/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* event-top.c: Check SIGTSTP instead of STOP_SIGNAL thoughout.
	(async_init_signals): Adjust.
	(handle_stop_sig): Rename to ...
	(handle_sigtstp): ... this.
	(async_stop_sig): Rename to ...
	(async_sigtstp_handler): ... this, and delete STOP_SIGNAL !=
	SIGTSTP path.
	* event-top.h: Move signal.h include to the top.  Check SIGTSTP
	instead of STOP_SIGNAL thoughout.
	(handle_stop_sig): Rename to ...
	(handle_sigtstp): ... this.
	* top.c (command_line_input): Replace STOP_SIGNAL -> SIGTSTP.
2017-11-06 16:13:05 +00:00
Pedro Alves a94799ac1e Don't set terminal flags twice in a row
I find this odd 'set flags twice' ancient code and comment annoyingly
distracting.  It may well be that the reason for the double-set was
simply a copy/paste mistake, and that we've been doing this for
decades [1] for no good reason.  Let's just get rid of it, and if we
find a real reason, add it back with a comment explaining why it's
necessary.

[1] This double-set was already in gdb 2.4 / 1988, the oldest release
we have sources for, and imported in git.  From 'git show 7b4ac7e1ed
inflow.c':

   +void
   +terminal_inferior ()
   +{
   +  if (terminal_is_ours)   /*  && inferior_thisrun_terminal == 0) */
   +    {
   +      fcntl (0, F_SETFL, tflags_inferior);
   +      fcntl (0, F_SETFL, tflags_inferior);

The "is there a reason" comment was added in 1993, by:

  commit a88797b5ea
  Author:     Fred Fish <fnf@specifix.com>
  AuthorDate: Thu Aug 5 01:33:45 1993 +0000

gdb/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* inflow.c (child_terminal_inferior, child_terminal_ours_1): No
	longer set flags twice in row.
2017-11-06 16:12:25 +00:00
Pedro Alves 726e13564b Assume termios is available, remove support for termio and sgtty
This commit garbage collects the termio and sgtty support.

GDB's terminal handling code still has support for the old termio and
sgtty interfaces in addition to termios.  However, I think it's pretty
safe to assume that for a long, long time, Unix-like systems provide
termios.  GNU/Linux, Solaris, Cygwin, AIX, DJGPP, macOS and the BSDs
all have had termios.h for many years.  Looking around the web, I
found discussions about FreeBSD folks trying to get rid of old sgtty.h
a decade ago:

  https://lists.freebsd.org/pipermail/freebsd-hackers/2007-March/019983.html

So I think support for termio and sgtty in GDB is just dead code that
is never compiled anywhere and is just getting in the way.  For
example, serial_noflush_set_tty_state and the raw<->cooked concerns
mentioned in inflow.c only exist because of sgtty (see
hardwire_noflush_set_tty_state).

Regtested on GNU/Linux.

Confirmed that I can still build Solaris, DJGPP and AIX GDB and that
the resulting GDBs still include the termios.h-guarded code.
Confirmed mingw-w64 GDB still builds and skips the termios.h-guarded
code.

gdb/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* Makefile.in (SER_HARDWIRE): Update comment.
	(HFILES_NO_SRCDIR): Remove gdb_termios.h.
	* common/gdb_termios.h: Delete file.
	* common/job-control.c: Include termios.h and unistd.h instead of
	gdb_termios.h.
	(gdb_setpgid): Remove HAVE_TERMIOS || TIOCGPGRP preprocessor
	check.
	(have_job_control): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
	Remove sgtty code.
	* configure.ac: No longer check for termio.h and sgtty.h.
	* configure: Regenerate.
	* inflow.c: Include termios.h instead of gdb_termios.h.  Replace
	PROCESS_GROUP_TYPE checks with HAVE_TERMIOS_H checks throughout.
	Replace PROCESS_GROUP_TYPE references with pid_t references
	throughout.
	(gdb_getpgrp): Delete.
	(set_initial_gdb_ttystate): Use tcgetpgrp instead of gdb_getpgrp.
	(child_terminal_inferior): Remove comment.  Remove sgtty code.
	(child_terminal_ours_1): Use tcgetpgrp directly instead of
	gdb_getpgrp.  Use serial_set_tty_state instead aof
	serial_noflush_set_tty_state.  Remove sgtty code.
	* inflow.h: Include unistd.h instead of gdb_termios.h.  Replace
	PROCESS_GROUP_TYPE check with HAVE_TERMIOS_H check.
	(inferior_process_group): Now returns pid_t.
	* ser-base.c (ser_base_noflush_set_tty_state): Delete.
	* ser-base.h (ser_base_noflush_set_tty_state): Delete.
	* ser-event.c (serial_event_ops): Update.
	* ser-go32.c (dos_noflush_set_tty_state): Delete.
	(dos_ops): Update.
	* ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): Update.
	* ser-pipe.c (pipe_ops): Update.
	* ser-tcp.c (tcp_ops): Update.
	* ser-unix.c: Include termios.h instead of gdb_termios.h.  Remove
	HAVE_TERMIOS checks.
	[HAVE_TERMIO] (struct hardwire_ttystate): Delete.
	[HAVE_SGTTY] (struct hardwire_ttystate): Delete.
	(get_tty_state, set_tty_state): Drop termio and sgtty code, and
	assume termios.
	(hardwire_noflush_set_tty_state): Delete.
	(hardwire_print_tty_state, hardwire_drain_output)
	(hardwire_flush_output, hardwire_flush_input)
	(hardwire_send_break, hardwire_raw, hardwire_setbaudrate)
	(hardwire_setstopbits, hardwire_setparity): Drop termio and sgtty
	code, and assume termios.
	(hardwire_ops): Update.
	(_initialize_ser_hardwire): Remove HAVE_TERMIOS check.
	* serial.c (serial_noflush_set_tty_state): Delete.
	* serial.h (serial_noflush_set_tty_state): Delete.
	(serial_ops::noflush_set_tty_state): Delete.

gdb/gdbserver/ChangeLog:
2017-11-06  Pedro Alves  <palves@redhat.com>

	* configure.ac: No longer check for termio.h and sgtty.h.
	* configure: Regenerate.
	* remote-utils.c: Include termios.h instead of gdb_termios.h.
	(remote_open): Check HAVE_TERMIOS_H instead of HAVE_TERMIOS.
	Remove termio and sgtty code.
2017-11-06 15:36:46 +00:00
Ulrich Weigand 1cfb73dbb7 Target FP: Merge doublest.c and dfp.c into target-float.c
Now that all target FP operations are performed via target-float.c,
this file remains the sole caller of functions in doublest.c and dfp.c.
Therefore, this patch merges the latter files into the former and
makes all their function static there.

gdb/ChangeLog:
2017-11-06  Ulrich Weigand  <uweigand@de.ibm.com>

	* Makefile.in (SFILES): Remove doublest.c and dfp.c.
	(HFILES_NO_SRCDIR): Remove doublest.h and dfp.h.
	(COMMON_OBS): Remove doublest.o and dfp.o.
	Do not build target-float.c (instead of doublest.c)
	with -Wformat-nonliteral.

	* doublest.c: Remove file.
	* doublest.h: Remove file.
	* dfp.c: Remove file.
	* dfp.h: Remove file.

	* target-float.c: Do not include "doublest.h" and "dfp.h".
	(DOUBLEST): Move here from doublest.h.
	(enum float_kind): Likewise.
	(FLOATFORMAT_CHAR_BIT): Likewise.
	(FLOATFORMAT_LARGEST_BYTES): Likewise.
	(floatformat_totalsize_bytes): Move here from doublest.c.  Make static.
	(floatformat_precision): Likewise.
	(floatformat_normalize_byteorder, get_field, put_field): Likewise.
	(floatformat_is_negative, floatformat_classify, floatformat_mantissa):
	Likewise.
	(host_float_format, host_double_format, host_long_double_format):
	Likewise.
	(floatformat_to_string, floatformat_from_string): Likewise.
	(floatformat_to_doublest): Likewise.  Also, inline the original
	convert_floatformat_to_doublest.
	(floatformat_from_doublest): Likewise.  Also, inline the original
	convert_floatformat_from_doublest.

	Include "dpd/decimal128.h", "dpd/decimal64.h", and "dpd/decimal32.h".
	(MAX_DECIMAL_STRING): Move here from dfp.c.
	(match_endianness): Likewise.
	(set_decnumber_context, decimal_check_errors): Likewise.
	(decimal_from_number, decimal_to_number): Likewise.
	(decimal_to_string, decimal_from_string): Likewise.  Make static.
	(decimal_from_longest, decimal_from_ulongest): Likewise.
	(decimal_to_longest): Likewise.
	(decimal_binop, decimal_is_zero, decimal_compare): Likewise.
	(decimal_convert): Likewise.
2017-11-06 16:04:03 +01:00