Commit Graph

62 Commits

Author SHA1 Message Date
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Tom Tromey 4268ec187d Recognize _ in attribute names
Ada attribute names can contain "_", but the lexer currently does not
allow this -- even though the "attributes" array lists some attributes
spelled this way.

This patch fixes the bug and adds test cases for the existing
attributes.

This was reviewed off-list by Joel.  I'm checking it in.

gdb/ChangeLog
2019-06-14  Tom Tromey  <tromey@adacore.com>

	* ada-lex.l: Allow "_" in attribute names.

gdb/testsuite/ChangeLog
2019-06-14  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/formatted_ref.exp (test_p_x_addr): Check
	'unchecked_access and 'unrestricted_access as well.
2019-06-14 08:02:20 -06:00
Dilyan Palauzov fcd60b848e Add noyywrap to ada-lex.l
This patch comes from PR ada/21406.  It adds the noyywrap option to
ada-lex.l.  This was already done (by the same author) for other .l
files in the binutils-gdb tree, so it seems reasonably safe.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-03  Dilyan Palauzov  <dilyan.palauzov@aegee.org>

	PR ada/21406:
	* ada-exp.y (yywrap): Don't define.
	* ada-lex.l (%option): Add noyywrap
	(yywrap): Remove.
2019-05-03 17:03:56 -06:00
Tom Tromey 5776fca307 Move lexptr and prev_lexptr to parser_state
This removes the lexptr and prev_lexptr globals, in favor of members
of parser_state.  prev_lexptr could be isolated to each parser, but
since every parser uses it, that did not seem necessary.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (struct rust_parser) <lex_hex, lex_escape,
	lex_operator, push_back>: New methods.
	Update all rules.
	(rust_parser::lex_hex, lex_escape): Rename and update.
	(rust_parser::lex_string, rust_parser::lex_identifier): Update.
	(rust_parser::lex_operator): Rename and update.
	(rust_parser::lex_number, rustyylex, rustyyerror)
	(rust_lex_test_init, rust_lex_test_sequence)
	(rust_lex_test_push_back, rust_lex_tests): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add "input"
	parameter.
	<lexptr, prev_lexptr>: New members.
	(lexptr, prev_lexptr): Don't declare.
	* parse.c (lexptr, prev_lexptr): Remove globals.
	(parse_exp_in_context): Update.
	* p-exp.y (yylex, yyerror): Update.
	* m2-exp.y (parse_number, yylex, yyerror): Update.
	* go-exp.y (lex_one_token, yyerror): Update.
	* f-exp.y (match_string_literal, yylex, yyerror): Update.
	* d-exp.y (lex_one_token, yyerror): Update.
	* c-exp.y (scan_macro_expansion, finished_macro_expansion)
	(lex_one_token, yyerror): Update.
	* ada-lex.l (YY_INPUT): Update.
	(rewind_to_char): Update.
	* ada-exp.y (yyerror): Update.
2019-04-04 19:55:11 -06:00
Tom Tromey 8621b685bf Move comma_terminates global to parser_state
This moves the comma_terminates global to parser_state.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rustyylex, rust_lex_tests): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add new
	parameter.
	<comma_terminates>: New member.
	(comma_terminates): Don't declare global.
	* parse.c (comma_terminates): Remove global.
	(parse_exp_in_context): Update.
	* p-exp.y (yylex): Update.
	* m2-exp.y (yylex): Update.
	* go-exp.y (lex_one_token): Update.
	* f-exp.y (yylex): Update.
	* d-exp.y (lex_one_token): Update.
	* c-exp.y (lex_one_token): Update.
	* ada-lex.l: Update.
2019-04-04 19:55:11 -06:00
Tom Tromey 28aaf3fdf9 Remove paren_depth global
This removes the "paren_depth" global.  In most cases, it is made into
a static global in a given parser.  I consider this a slight
improvement, because it makes it clear that the variable isn't used
for communication between different modules of gdb.  The one exception
is the Rust parser, which already incorporates all local state into a
transient object; in this case the parser depth is now a member.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (struct rust_parser) <paren_depth>: New member.
	(rustyylex, rust_lex_test_init, rust_lex_test_one)
	(rust_lex_test_sequence, rust_lex_test_push_back): Update.
	* parser-defs.h (paren_depth): Don't declare.
	* parse.c (paren_depth): Remove global.
	(parse_exp_in_context): Update.
	* p-exp.y (paren_depth): New global.
	(pascal_parse): Initialize it.
	* m2-exp.y (paren_depth): New global.
	(m2_parse): Initialize it.
	* go-exp.y (paren_depth): New global.
	(go_parse): Initialize it.
	* f-exp.y (paren_depth): New global.
	(f_parse): Initialize it.
	* d-exp.y (paren_depth): New global.
	(d_parse): Initialize it.
	* c-exp.y (paren_depth): New global.
	(c_parse): Initialize it.
	* ada-lex.l (paren_depth): New global.
	(lexer_init): Initialize it.
2019-04-04 19:55:10 -06:00
Tom Tromey fa9f5be683 Turn parse_gdbarch into a method
This changes parse_gdbarch into a method of parser_state.  This patch
was written by a script.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y: Replace "parse_gdbarch" with method call.
	* parse.c (write_dollar_variable, insert_type_address_space):
	Replace "parse_gdbarch" with method call.
	* p-exp.y (parse_type, yylex): Replace "parse_gdbarch" with method
	call.
	* objc-lang.c (end_msglist): Replace "parse_gdbarch" with method
	call.
	* m2-exp.y (parse_type, parse_m2_type, yylex): Replace
	"parse_gdbarch" with method call.
	* go-exp.y (parse_type, classify_name): Replace "parse_gdbarch"
	with method call.
	* f-exp.y (parse_type, parse_f_type, yylex): Replace
	"parse_gdbarch" with method call.
	* d-exp.y (parse_type, parse_d_type, lex_one_token): Replace
	"parse_gdbarch" with method call.
	* c-exp.y (parse_type, parse_number, classify_name): Replace
	"parse_gdbarch" with method call.
	* ada-lex.l: Replace "parse_gdbarch" with method call.
	* ada-exp.y (parse_type, find_primitive_type, type_char)
	(type_system_address): Replace "parse_gdbarch" with method call.
2019-04-04 19:55:10 -06:00
Tom Tromey cfeadda545 Fix build failure with macOS bison
PR gdb/24060 points out a compilation failure of the C, Fortran and Pascal
parsers when they are built using the macOS system bison.  The bug is a name
clash between the VARIABLE token name and the VARIABLE enumerator in ui-out.h.

This patch renames VARIABLE in c-exp.y, f-exp.y and p-exp.y to DOLLAR_VARIABLE
to avoid the clash.  It also renames similar variables in other .y files so
that all languages use the same name.

gdb/ChangeLog
2019-01-07  Tom Tromey  <tom@tromey.com>
2019-01-07  Simon Marchi  <simon.marchi@ericsson.com>

	PR gdb/24060:
	* ada-exp.y (DOLLAR_VARIABLE): Rename from SPECIAL_VARIABLE.
	* ada-lex.l (DOLLAR_VARIABLE): Likewise.
	* c-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE.
	* f-exp.y (DOLLAR_VARIABLE): Likewise.
	* m2-exp.y (DOLLAR_VARIABLE): Rename from INTERNAL_VAR.
	* p-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE.
2019-01-08 12:45:19 -05:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
H.J. Lu e9cb46ab59 Move gdb/common/diagnostics.h to include/diagnostics.h
Move gdb/common/diagnostics.h to include/diagnostics.h so that it can
be used in binutils.

gdb/

	* ada-lex.l: Include "diagnostics.h" instead of
	"common/diagnostics.h".
	* unittests/environ-selftests.c: Likewise.
	* common/diagnostics.h: Moved to ../include.

include/

	* diagnostics.h: Moved from ../gdb/common/diagnostics.h.
2018-06-01 09:40:30 -07:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04: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
Ulrich Weigand edd079d9f6 Target FP: Use target format throughout expression parsing
When parsing floating-point literals, the language parsers currently
use parse_float or some equivalent routine to parse the input string
into a DOUBLEST, which is then stored within a OP_DOUBLE expression
node.  When evaluating the expression, the OP_DOUBLE is finally
converted into a value in target format.

On the other hand, *decimal* floating-point literals are parsed
directly into target format and stored that way in a OP_DECFLOAT
expression node.  In order to eliminate the DOUBLEST, this patch
therefore unifies the handling of binary and decimal floating-
point literals and stores them both in target format within a
new OP_FLOAT expression node, replacing both OP_DOUBLE and
OP_DECFLOAT.

In order to store literals in target format, the parse_float
routine needs to know the type of the literal.  All parsers
therefore need to be changed to determine the appropriate type
(e.g. by detecting suffixes) *before* calling parse_float,
instead of after it as today.  However, this change is mostly
straightforward -- again, this is already done for decimal FP
today.

The core of the literal parsing is moved into a new routine
floatformat_from_string, mirroring floatformat_to_string.
The parse_float routine now calls either floatformat_from_string
or decimal_from_sting, allowing it to handle any type of FP
literal.

All language parsers need to be updated.  Some notes on
specific changes to the various languages:

- C: Decimal FP is now handled in parse_float, and no longer
  needs to be handled specially.

- D: Straightforward.

- Fortran: Still used a hard-coded "atof", also replaced by
  parse_float now.  Continues to always use builtin_real_s8
  as the type of literal, even though this is probably wrong.

- Go: This used to handle "f" and "l" suffixes, even though
  the Go language actually doesn't support those.  I kept this
  support for now -- maybe revisit later.  Note the the GDB
  test suite for some reason actually *verifies* that GDB supports
  those unsupported suffixes ...

- Pascal: Likewise -- this handles suffixes that are not
  supported in the language standard.

- Modula-2: Like Fortran, used to use "atof".

- Rust: Mostly straightforward, except for a unit-testing hitch.
  The code use to set a special "unit_testing" flag which would
  cause "rust_type" to always return NULL.  This makes it not
  possible to encode a literal into target format (which type?).
  The reason for this flag appears to have been that during
  unit testing, there is no "rust_parser" context set up, which
  means no "gdbarch" is available to use its types.  To fix this,
  I removed the unit_testing flag, and instead simply just set up
  a dummy rust_parser context during unit testing.

- Ada: This used to check sizeof (DOUBLEST) to determine which
  type to use for floating-point literal.  This seems questionable
  to begin with (since DOUBLEST is quite unrelated to target formats),
  and in any case we need to get rid of DOUBLEST.  I'm now simply
  always using the largest type (builtin_long_double).

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

	* doublest.c (floatformat_from_string): New function.
	* doublest.h (floatformat_from_string): Add prototype.

	* std-operator.def (OP_DOUBLE, OP_DECFLOAT): Remove, replace by ...
	(OP_FLOAT): ... this.
	* expression.h: Do not include "doublest.h".
	(union exp_element): Replace doubleconst and decfloatconst by
	new element floatconst.
	* ada-lang.c (resolve_subexp): Handle OP_FLOAT instead of OP_DOUBLE.
	(ada_evaluate_subexp): Likewise.
	* eval.c (evaluate_subexp_standard): Handle OP_FLOAT instead of
	OP_DOUBLE and OP_DECFLOAT.
	* expprint.c (print_subexp_standard): Likewise.
	(dump_subexp_body_standard): Likewise.
	* breakpoint.c (watchpoint_exp_is_const): Likewise.

	* parse.c: Include "dfp.h".
	(write_exp_elt_dblcst, write_exp_elt_decfloatcst): Remove.
	(write_exp_elt_floatcst): New function.
	(operator_length_standard): Handle OP_FLOAT instead of OP_DOUBLE
	and OP_DECFLOAT.
	(operator_check_standard): Likewise.
	(parse_float): Do not accept suffix.  Take type as input.  Return bool.
	Return target format buffer instead of host DOUBLEST.
	Use floatformat_from_string and decimal_from_string to parse
	either binary or decimal floating-point types.
	(parse_c_float): Remove.
	* parser-defs.h: Do not include "doublest.h".
	(write_exp_elt_dblcst, write_exp_elt_decfloatcst): Remove.
	(write_exp_elt_floatcst): Add prototype.
	(parse_float): Update prototype.
	(parse_c_float): Remove.

	* c-exp.y: Do not include "dfp.h".
	(typed_val_float): Use byte buffer instead of DOUBLEST.
	(typed_val_decfloat): Remove.
	(DECFLOAT): Remove.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Update to new parse_float interface.
	Parse suffixes and determine type before calling parse_float.
	Handle decimal and binary FP types the same way.

	* d-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(FLOAT_LITERAL): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Update to new parse_float interface.
	Parse suffixes and determine type before calling parse_float.

	* f-exp.y: Replace dval by typed_val_float.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Use parse_float instead of atof.

	* go-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(parse_go_float): Remove.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Call parse_float instead of parse_go_float.
	Parse suffixes and determine type before calling parse_float.

	* p-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Update to new parse_float interface.
	Parse suffixes and determine type before calling parse_float.

	* m2-exp.y: Replace dval by byte buffer val.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	(parse_number): Call parse_float instead of atof.

	* rust-exp.y (typed_val_float): Use byte buffer instead of DOUBLEST.
	(lex_number): Call parse_float instead of strtod.
	(ast_dliteral): Use OP_FLOAT instead of OP_DOUBLE.
	(convert_ast_to_expression): Handle OP_FLOAT instead of OP_DOUBLE.
	Use write_exp_elt_floatcst.
	(unit_testing): Remove static variable.
	(rust_type): Do not check unit_testing.
	(rust_lex_tests): Do not set uint_testing.  Set up dummy rust_parser.

	* ada-exp.y (type_float, type_double): Remove.
	(typed_val_float): Use byte buffer instead of DOUBLEST.
	(FLOAT): Use OP_FLOAT and write_exp_elt_floatcst.
	* ada-lex.l (processReal): Use parse_float instead of sscanf.
2017-10-25 15:32:23 +02:00
Simon Marchi d1435379df ada-lex: Ignore warnings about register keyword
Some older versions of flex (such as the one shipped with macOS) generate
code that use the register keyword, which clang warns about.  This patch
makes the compiler ignore those warnings for the portion of the code
generated by flex.

gdb/ChangeLog:

	* common/diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER):
	New macro.
	* ada-lex.l: Ignore deprecated register warnings.
2017-06-26 16:51:17 +02:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Simon Marchi 224c3ddb89 Add casts to memory allocation related calls
Most allocation functions (if not all) return a void* pointing to the
allocated memory.  In C++, we need to add an explicit cast when
assigning the result to a pointer to another type (which is the case
more often than not).

The content of this patch is taken from Pedro's branch, from commit
"(mostly) auto-generated patch to insert casts needed for C++".  I
validated that the changes make sense and manually reflowed the code to
make it respect the coding style.  I also found multiple places where I
could use XNEW/XNEWVEC/XRESIZEVEC/etc.

Thanks a lot to whoever did that automated script to insert casts, doing
it completely by hand would have taken a ridiculous amount of time.

Only files built on x86 with --enable-targets=all are modified.  This
means that all other -nat.c files are untouched and will have to be
dealt with later by using appropiate compilers.  Or maybe we can try to
build them with a regular g++ just to know where to add casts, I don't
know.

I built-tested this with --enable-targets=all and reg-tested.

Here's the changelog entry, which was not too bad to make despite the
size, thanks to David Malcom's script.  I fixed some bits by hand, but
there might be some wrong parts left (hopefully not).

gdb/ChangeLog:

	* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
	to allocation result assignment.
	* ada-exp.y (write_object_renaming): Likewise.
	(write_ambiguous_var): Likewise.
	(ada_nget_field_index): Likewise.
	(write_var_or_type): Likewise.
	* ada-lang.c (ada_decode_symbol): Likewise.
	(ada_value_assign): Likewise.
	(value_pointer): Likewise.
	(cache_symbol): Likewise.
	(add_nonlocal_symbols): Likewise.
	(ada_name_for_lookup): Likewise.
	(symbol_completion_add): Likewise.
	(ada_to_fixed_type_1): Likewise.
	(ada_get_next_arg): Likewise.
	(defns_collected): Likewise.
	* ada-lex.l (processId): Likewise.
	(processString): Likewise.
	* ada-tasks.c (read_known_tasks_array): Likewise.
	(read_known_tasks_list): Likewise.
	* ada-typeprint.c (decoded_type_name): Likewise.
	* addrmap.c (addrmap_mutable_create_fixed): Likewise.
	* amd64-tdep.c (amd64_push_arguments): Likewise.
	(amd64_displaced_step_copy_insn): Likewise.
	(amd64_classify_insn_at): Likewise.
	(amd64_relocate_instruction): Likewise.
	* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
	* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
	(initialize_current_architecture): Likewise.
	* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
	* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
	* arm-tdep.c (arm_exidx_new_objfile): Likewise.
	(arm_push_dummy_call): Likewise.
	(extend_buffer_earlier): Likewise.
	(arm_adjust_breakpoint_address): Likewise.
	(arm_skip_stub): Likewise.
	* auto-load.c (filename_is_in_pattern): Likewise.
	(maybe_add_script_file): Likewise.
	(maybe_add_script_text): Likewise.
	(auto_load_objfile_script_1): Likewise.
	* auxv.c (ld_so_xfer_auxv): Likewise.
	* ax-general.c (new_agent_expr): Likewise.
	(grow_expr): Likewise.
	(ax_reg_mask): Likewise.
	* bcache.c (bcache_full): Likewise.
	* breakpoint.c (program_breakpoint_here_p): Likewise.
	* btrace.c (parse_xml_raw): Likewise.
	* build-id.c (build_id_to_debug_bfd): Likewise.
	* buildsym.c (end_symtab_with_blockvector): Likewise.
	* c-exp.y (string_exp): Likewise.
	(qualified_name): Likewise.
	(write_destructor_name): Likewise.
	(operator_stoken): Likewise.
	(parse_number): Likewise.
	(scan_macro_expansion): Likewise.
	(yylex): Likewise.
	(c_print_token): Likewise.
	* c-lang.c (c_get_string): Likewise.
	(emit_numeric_character): Likewise.
	* charset.c (wchar_iterate): Likewise.
	* cli/cli-cmds.c (complete_command): Likewise.
	(make_command): Likewise.
	* cli/cli-dump.c (restore_section_callback): Likewise.
	(restore_binary_file): Likewise.
	* cli/cli-interp.c (cli_interpreter_exec): Likewise.
	* cli/cli-script.c (execute_control_command): Likewise.
	* cli/cli-setshow.c (do_set_command): Likewise.
	* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
	(read_pe_exported_syms): Likewise.
	* coffread.c (coff_read_struct_type): Likewise.
	(coff_read_enum_type): Likewise.
	* common/btrace-common.c (btrace_data_append): Likewise.
	* common/buffer.c (buffer_grow): Likewise.
	* common/filestuff.c (gdb_fopen_cloexec): Likewise.
	* common/format.c (parse_format_string): Likewise.
	* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
	* common/xml-utils.c (xml_escape_text): Likewise.
	* compile/compile-object-load.c (copy_sections): Likewise.
	(compile_object_load): Likewise.
	* compile/compile-object-run.c (compile_object_run): Likewise.
	* completer.c (filename_completer): Likewise.
	* corefile.c (read_memory_typed_address): Likewise.
	(write_memory_unsigned_integer): Likewise.
	(write_memory_signed_integer): Likewise.
	(complete_set_gnutarget): Likewise.
	* corelow.c (get_core_register_section): Likewise.
	* cp-name-parser.y (d_grab): Likewise.
	(allocate_info): Likewise.
	(cp_new_demangle_parse_info): Likewise.
	* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
	(cp_lookup_symbol_in_namespace): Likewise.
	(lookup_namespace_scope): Likewise.
	(find_symbol_in_baseclass): Likewise.
	(cp_lookup_nested_symbol): Likewise.
	(cp_lookup_transparent_type_loop): Likewise.
	* cp-support.c (copy_string_to_obstack): Likewise.
	(make_symbol_overload_list): Likewise.
	(make_symbol_overload_list_namespace): Likewise.
	(make_symbol_overload_list_adl_namespace): Likewise.
	(first_component_command): Likewise.
	* cp-valprint.c (cp_print_value): Likewise.
	* ctf.c (ctf_xfer_partial): Likewise.
	* d-exp.y (StringExp): Likewise.
	* d-namespace.c (d_lookup_symbol_in_module): Likewise.
	(lookup_module_scope): Likewise.
	(find_symbol_in_baseclass): Likewise.
	(d_lookup_nested_symbol): Likewise.
	* dbxread.c (find_stab_function_addr): Likewise.
	(read_dbx_symtab): Likewise.
	(dbx_end_psymtab): Likewise.
	(cp_set_block_scope): Likewise.
	* dcache.c (dcache_alloc): Likewise.
	* demangle.c (_initialize_demangler): Likewise.
	* dicos-tdep.c (dicos_load_module_p): Likewise.
	* dictionary.c (dict_create_hashed_expandable): Likewise.
	(dict_create_linear_expandable): Likewise.
	(expand_hashtable): Likewise.
	(add_symbol_linear_expandable): Likewise.
	* dwarf2-frame.c (add_cie): Likewise.
	(add_fde): Likewise.
	(dwarf2_build_frame_info): Likewise.
	* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
	(dwarf_expr_fetch_address): Likewise.
	(add_piece): Likewise.
	(execute_stack_op): Likewise.
	* dwarf2loc.c (chain_candidate): Likewise.
	(dwarf_entry_parameter_to_value): Likewise.
	(read_pieced_value): Likewise.
	(write_pieced_value): Likewise.
	* dwarf2read.c (dwarf2_read_section): Likewise.
	(add_type_unit): Likewise.
	(read_comp_units_from_section): Likewise.
	(fixup_go_packaging): Likewise.
	(dwarf2_compute_name): Likewise.
	(dwarf2_physname): Likewise.
	(create_dwo_unit_in_dwp_v1): Likewise.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(read_func_scope): Likewise.
	(read_call_site_scope): Likewise.
	(dwarf2_attach_fields_to_type): Likewise.
	(process_structure_scope): Likewise.
	(mark_common_block_symbol_computed): Likewise.
	(read_common_block): Likewise.
	(abbrev_table_read_table): Likewise.
	(guess_partial_die_structure_name): Likewise.
	(fixup_partial_die): Likewise.
	(add_file_name): Likewise.
	(dwarf2_const_value_data): Likewise.
	(dwarf2_const_value_attr): Likewise.
	(build_error_marker_type): Likewise.
	(guess_full_die_structure_name): Likewise.
	(anonymous_struct_prefix): Likewise.
	(typename_concat): Likewise.
	(dwarf2_canonicalize_name): Likewise.
	(dwarf2_name): Likewise.
	(write_constant_as_bytes): Likewise.
	(dwarf2_fetch_constant_bytes): Likewise.
	(copy_string): Likewise.
	(parse_macro_definition): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	(elf_rel_plt_read): Likewise.
	(elf_gnu_ifunc_resolve_by_cache): Likewise.
	(elf_gnu_ifunc_resolve_by_got): Likewise.
	(elf_read_minimal_symbols): Likewise.
	(elf_gnu_ifunc_record_cache): Likewise.
	* event-top.c (top_level_prompt): Likewise.
	(command_line_handler): Likewise.
	* exec.c (resize_section_table): Likewise.
	* expprint.c (print_subexp_standard): Likewise.
	* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
	* findcmd.c (parse_find_args): Likewise.
	* findvar.c (address_from_register): Likewise.
	* frame.c (get_prev_frame_always): Likewise.
	* gdb_bfd.c (gdb_bfd_ref): Likewise.
	(get_section_descriptor): Likewise.
	* gdb_obstack.c (obconcat): Likewise.
	(obstack_strdup): Likewise.
	* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
	(create_set_type): Likewise.
	(lookup_unsigned_typename): Likewise.
	(lookup_signed_typename): Likewise.
	(resolve_dynamic_union): Likewise.
	(resolve_dynamic_struct): Likewise.
	(add_dyn_prop): Likewise.
	(copy_dynamic_prop_list): Likewise.
	(arch_flags_type): Likewise.
	(append_composite_type_field_raw): Likewise.
	* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
	* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
	* go-exp.y (string_exp): Likewise.
	* go-lang.c (go_demangle): Likewise.
	* guile/guile.c (compute_scheme_string): Likewise.
	* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
	(gdbscm_canonicalize_command_name): Likewise.
	* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
	(ioscm_init_memory_port): Likewise.
	(ioscm_reinit_memory_port): Likewise.
	* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
	(gdbscm_gc_dup_argv): Likewise.
	* h8300-tdep.c (h8300_push_dummy_call): Likewise.
	* hppa-tdep.c (internalize_unwinds): Likewise.
	(read_unwind_info): Likewise.
	* i386-cygwin-tdep.c (core_process_module_section): Likewise.
	(windows_core_xfer_shared_libraries): Likewise.
	* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
	(i386_stap_parse_special_token_triplet): Likewise.
	(i386_stap_parse_special_token_three_arg_disp): Likewise.
	* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
	* inf-child.c (inf_child_fileio_readlink): Likewise.
	* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
	(inf_ptrace_store_register): Likewise.
	* infrun.c (follow_exec): Likewise.
	(displaced_step_prepare_throw): Likewise.
	(save_stop_context): Likewise.
	(save_infcall_suspend_state): Likewise.
	* jit.c (jit_read_descriptor): Likewise.
	(jit_read_code_entry): Likewise.
	(jit_symtab_line_mapping_add_impl): Likewise.
	(finalize_symtab): Likewise.
	(jit_unwind_reg_get_impl): Likewise.
	* jv-exp.y (QualifiedName): Likewise.
	* jv-lang.c (get_java_utf8_name): Likewise.
	(type_from_class): Likewise.
	(java_demangle_type_signature): Likewise.
	(java_class_name_from_physname): Likewise.
	* jv-typeprint.c (java_type_print_base): Likewise.
	* jv-valprint.c (java_value_print): Likewise.
	* language.c (add_language): Likewise.
	* linespec.c (add_sal_to_sals_basic): Likewise.
	(add_sal_to_sals): Likewise.
	(decode_objc): Likewise.
	(find_linespec_symbols): Likewise.
	* linux-fork.c (fork_save_infrun_state): Likewise.
	* linux-nat.c (linux_nat_detach): Likewise.
	(linux_nat_fileio_readlink): Likewise.
	* linux-record.c (record_linux_sockaddr): Likewise.
	(record_linux_msghdr): Likewise.
	(Do): Likewise.
	* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
	(linux_collect_regset_section_cb): Likewise.
	(linux_get_siginfo_data): Likewise.
	* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
	(try_thread_db_load_from_dir): Likewise.
	(thread_db_load_search): Likewise.
	(info_auto_load_libthread_db): Likewise.
	* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
	(m32c_m16c_pointer_to_address): Likewise.
	* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
	* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
	* machoread.c (macho_check_dsym): Likewise.
	* macroexp.c (resize_buffer): Likewise.
	(gather_arguments): Likewise.
	(maybe_expand): Likewise.
	* macrotab.c (new_macro_key): Likewise.
	(new_source_file): Likewise.
	(new_macro_definition): Likewise.
	* mdebugread.c (parse_symbol): Likewise.
	(parse_type): Likewise.
	(parse_partial_symbols): Likewise.
	(psymtab_to_symtab_1): Likewise.
	* mem-break.c (default_memory_insert_breakpoint): Likewise.
	* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
	* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
	(mi_cmd_data_read_memory_bytes): Likewise.
	(mi_cmd_data_write_memory_bytes): Likewise.
	(mi_cmd_trace_frame_collected): Likewise.
	* mi/mi-parse.c (mi_parse_argv): Likewise.
	(mi_parse): Likewise.
	* minidebug.c (lzma_open): Likewise.
	(lzma_pread): Likewise.
	* mips-tdep.c (mips_read_fp_register_single): Likewise.
	(mips_print_fp_register): Likewise.
	* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
	* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
	* mt-tdep.c (mt_register_name): Likewise.
	(mt_registers_info): Likewise.
	(mt_push_dummy_call): Likewise.
	* namespace.c (add_using_directive): Likewise.
	* nat/linux-btrace.c (perf_event_read): Likewise.
	(linux_enable_bts): Likewise.
	* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
	* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
	* nto-tdep.c (nto_find_and_open_solib): Likewise.
	(nto_parse_redirection): Likewise.
	* objc-lang.c (objc_demangle): Likewise.
	(find_methods): Likewise.
	* objfiles.c (get_objfile_bfd_data): Likewise.
	(set_objfile_main_name): Likewise.
	(allocate_objfile): Likewise.
	(objfile_relocate): Likewise.
	(update_section_map): Likewise.
	* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
	* p-exp.y (exp): Likewise.
	(yylex): Likewise.
	* p-valprint.c (pascal_object_print_value): Likewise.
	* parse.c (initialize_expout): Likewise.
	(mark_completion_tag): Likewise.
	(copy_name): Likewise.
	(parse_float): Likewise.
	(type_stack_reserve): Likewise.
	* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
	(ppu2spu_prev_register): Likewise.
	* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
	* printcmd.c (printf_wide_c_string): Likewise.
	(printf_pointer): Likewise.
	* probe.c (parse_probes): Likewise.
	* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
	(cmdpy_init): Likewise.
	* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
	* python/py-symtab.c (set_sal): Likewise.
	* python/py-unwind.c (pyuw_sniffer): Likewise.
	* python/python.c (python_interactive_command): Likewise.
	(compute_python_string): Likewise.
	* ravenscar-thread.c (get_running_thread_id): Likewise.
	* record-full.c (record_full_exec_insn): Likewise.
	(record_full_core_open_1): Likewise.
	* regcache.c (regcache_raw_read_signed): Likewise.
	(regcache_raw_read_unsigned): Likewise.
	(regcache_cooked_read_signed): Likewise.
	(regcache_cooked_read_unsigned): Likewise.
	* remote-fileio.c (remote_fileio_func_open): Likewise.
	(remote_fileio_func_rename): Likewise.
	(remote_fileio_func_unlink): Likewise.
	(remote_fileio_func_stat): Likewise.
	(remote_fileio_func_system): Likewise.
	* remote-mips.c (mips_xfer_memory): Likewise.
	(mips_load_srec): Likewise.
	(pmon_end_download): Likewise.
	* remote.c (new_remote_state): Likewise.
	(map_regcache_remote_table): Likewise.
	(remote_register_number_and_offset): Likewise.
	(init_remote_state): Likewise.
	(get_memory_packet_size): Likewise.
	(remote_pass_signals): Likewise.
	(remote_program_signals): Likewise.
	(remote_start_remote): Likewise.
	(remote_check_symbols): Likewise.
	(remote_query_supported): Likewise.
	(extended_remote_attach): Likewise.
	(process_g_packet): Likewise.
	(store_registers_using_G): Likewise.
	(putpkt_binary): Likewise.
	(read_frame): Likewise.
	(compare_sections_command): Likewise.
	(remote_hostio_pread): Likewise.
	(remote_hostio_readlink): Likewise.
	(remote_file_put): Likewise.
	(remote_file_get): Likewise.
	(remote_pid_to_exec_file): Likewise.
	(_initialize_remote): Likewise.
	* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
	(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
	* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
	(bfd_uses_spe_extensions): Likewise.
	* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
	* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
	* solib-dsbt.c (decode_loadmap): Likewise.
	(fetch_loadmap): Likewise.
	(scan_dyntag): Likewise.
	(enable_break): Likewise.
	(dsbt_relocate_main_executable): Likewise.
	* solib-frv.c (fetch_loadmap): Likewise.
	(enable_break2): Likewise.
	(frv_relocate_main_executable): Likewise.
	* solib-spu.c (spu_relocate_main_executable): Likewise.
	(spu_bfd_open): Likewise.
	* solib-svr4.c (lm_info_read): Likewise.
	(read_program_header): Likewise.
	(find_program_interpreter): Likewise.
	(scan_dyntag): Likewise.
	(elf_locate_base): Likewise.
	(open_symbol_file_object): Likewise.
	(read_program_headers_from_bfd): Likewise.
	(svr4_relocate_main_executable): Likewise.
	* solib-target.c (solib_target_relocate_section_addresses): Likewise.
	* solib.c (solib_find_1): Likewise.
	(exec_file_find): Likewise.
	(solib_find): Likewise.
	* source.c (openp): Likewise.
	(print_source_lines_base): Likewise.
	(forward_search_command): Likewise.
	* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
	* spu-tdep.c (spu2ppu_prev_register): Likewise.
	(spu_get_overlay_table): Likewise.
	* stabsread.c (patch_block_stabs): Likewise.
	(define_symbol): Likewise.
	(again:): Likewise.
	(read_member_functions): Likewise.
	(read_one_struct_field): Likewise.
	(read_enum_type): Likewise.
	(common_block_start): Likewise.
	* stack.c (read_frame_arg): Likewise.
	(backtrace_command): Likewise.
	* stap-probe.c (stap_parse_register_operand): Likewise.
	* symfile.c (syms_from_objfile_1): Likewise.
	(find_separate_debug_file): Likewise.
	(load_command): Likewise.
	(load_progress): Likewise.
	(load_section_callback): Likewise.
	(reread_symbols): Likewise.
	(add_filename_language): Likewise.
	(allocate_compunit_symtab): Likewise.
	(read_target_long_array): Likewise.
	(simple_read_overlay_table): Likewise.
	* symtab.c (symbol_set_names): Likewise.
	(resize_symbol_cache): Likewise.
	(rbreak_command): Likewise.
	(completion_list_add_name): Likewise.
	(completion_list_objc_symbol): Likewise.
	(add_filename_to_list): Likewise.
	* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
	* target-memory.c (target_write_memory_blocks): Likewise.
	* target.c (target_read_string): Likewise.
	(read_whatever_is_readable): Likewise.
	(target_read_alloc_1): Likewise.
	(simple_search_memory): Likewise.
	(target_fileio_read_alloc_1): Likewise.
	* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
	* top.c (command_line_input): Likewise.
	* tracefile-tfile.c (tfile_fetch_registers): Likewise.
	* tracefile.c (tracefile_fetch_registers): Likewise.
	* tracepoint.c (add_memrange): Likewise.
	(init_collection_list): Likewise.
	(add_aexpr): Likewise.
	(trace_dump_actions): Likewise.
	(parse_trace_status): Likewise.
	(parse_tracepoint_definition): Likewise.
	(parse_tsv_definition): Likewise.
	(parse_static_tracepoint_marker_definition): Likewise.
	* tui/tui-file.c (tui_sfileopen): Likewise.
	(tui_file_adjust_strbuf): Likewise.
	* tui/tui-io.c (tui_expand_tabs): Likewise.
	* tui/tui-source.c (tui_set_source_content): Likewise.
	* typeprint.c (find_global_typedef): Likewise.
	* ui-file.c (do_ui_file_xstrdup): Likewise.
	(ui_file_obsavestring): Likewise.
	(mem_file_write): Likewise.
	* utils.c (make_hex_string): Likewise.
	(get_regcomp_error): Likewise.
	(puts_filtered_tabular): Likewise.
	(gdb_realpath_keepfile): Likewise.
	(ldirname): Likewise.
	(gdb_bfd_errmsg): Likewise.
	(substitute_path_component): Likewise.
	* valops.c (search_struct_method): Likewise.
	(find_oload_champ_namespace_loop): Likewise.
	* valprint.c (print_decimal_chars): Likewise.
	(read_string): Likewise.
	(generic_emit_char): Likewise.
	* varobj.c (varobj_delete): Likewise.
	(varobj_value_get_print_value): Likewise.
	* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
	* windows-tdep.c (display_one_tib): Likewise.
	* xcoffread.c (read_xcoff_symtab): Likewise.
	(process_xcoff_symbol): Likewise.
	(swap_sym): Likewise.
	(scan_xcoff_symtab): Likewise.
	(xcoff_initial_scan): Likewise.
	* xml-support.c (gdb_xml_end_element): Likewise.
	(xml_process_xincludes): Likewise.
	(xml_fetch_content_from_file): Likewise.
	* xml-syscall.c (xml_list_of_syscalls): Likewise.
	* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.

gdb/gdbserver/ChangeLog:

	* ax.c (gdb_parse_agent_expr): Add cast to allocation result
	assignment.
	(gdb_unparse_agent_expr): Likewise.
	* hostio.c (require_data): Likewise.
	(handle_pread): Likewise.
	* linux-low.c (disable_regset): Likewise.
	(fetch_register): Likewise.
	(store_register): Likewise.
	(get_dynamic): Likewise.
	(linux_qxfer_libraries_svr4): Likewise.
	* mem-break.c (delete_fast_tracepoint_jump): Likewise.
	(set_fast_tracepoint_jump): Likewise.
	(uninsert_fast_tracepoint_jumps_at): Likewise.
	(reinsert_fast_tracepoint_jumps_at): Likewise.
	(validate_inserted_breakpoint): Likewise.
	(clone_agent_expr): Likewise.
	* regcache.c (init_register_cache): Likewise.
	* remote-utils.c (putpkt_binary_1): Likewise.
	(decode_M_packet): Likewise.
	(decode_X_packet): Likewise.
	(look_up_one_symbol): Likewise.
	(relocate_instruction): Likewise.
	(monitor_output): Likewise.
	* server.c (handle_search_memory): Likewise.
	(handle_qxfer_exec_file): Likewise.
	(handle_qxfer_libraries): Likewise.
	(handle_qxfer): Likewise.
	(handle_query): Likewise.
	(handle_v_cont): Likewise.
	(handle_v_run): Likewise.
	(captured_main): Likewise.
	* target.c (write_inferior_memory): Likewise.
	* thread-db.c (try_thread_db_load_from_dir): Likewise.
	* tracepoint.c (init_trace_buffer): Likewise.
	(add_tracepoint_action): Likewise.
	(add_traceframe): Likewise.
	(add_traceframe_block): Likewise.
	(cmd_qtdpsrc): Likewise.
	(cmd_qtdv): Likewise.
	(cmd_qtstatus): Likewise.
	(response_source): Likewise.
	(response_tsv): Likewise.
	(cmd_qtnotes): Likewise.
	(gdb_collect): Likewise.
	(initialize_tracepoint): Likewise.
2015-09-25 14:08:06 -04:00
Pierre-Marie de Rodat af39b3270a [Ada] Fix parsing for expressions with attributes and characters
Before this change, trying to evaluate the following Ada expression
yielded a syntax error, even though it's completely legal:

    (gdb) p s'first = 'a'
    Error in expression, near `'.

The problem lies in the lexer (gdb/ada-lex.l): at the point we reach "'a'",
we're still in the BEFORE_QUAL_QUOTE start condition (the mechanism to
distinguish character literals from other "tick" usages: qualified
expressions and attributes), so we consider that this quote is actually a
separate "tick".

This changes resets the start condition to INITIAL in the
{TICK}[a-zA-Z][a-zA-Z]+ rule (for attributes): attributes activate this
BEFORE_QUAL_QUOTE condition and in this case the above rule is always
executed rather than the <BEFORE_QUAL_QUOTE>"'" one (in flex, it's
always the longest match that is chosen). We now have instead:

    (gdb) p s'first = 'a'
    $1 = true

gdb/ChangeLog:

	* ada-lex.l: Reset the start condition to INITIAL in the rule
	that matches attributes.

gdb/testsuite/ChangeLog:

	* gdb.ada/attr_ref_and_charlit.exp: New testcase.
	* gdb.ada/attr_ref_and_charlit/foo.adb: New file.

Tested on x86_64-linux, no regression.
2015-08-20 10:12:24 +02:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Gary Benson 6d3d12ebef Include string.h in common-defs.h
This commit includes string.h in common-defs.h and removes all other
inclusions.

gdb/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* common/common-defs.h: Include string.h.
	* aarch64-tdep.c: Do not include string.h.
	* ada-exp.y: Likewise.
	* ada-lang.c: Likewise.
	* ada-lex.l: Likewise.
	* ada-typeprint.c: Likewise.
	* ada-valprint.c: Likewise.
	* aix-thread.c: Likewise.
	* alpha-linux-tdep.c: Likewise.
	* alpha-mdebug-tdep.c: Likewise.
	* alpha-nat.c: Likewise.
	* alpha-osf1-tdep.c: Likewise.
	* alpha-tdep.c: Likewise.
	* alphanbsd-tdep.c: Likewise.
	* amd64-dicos-tdep.c: Likewise.
	* amd64-linux-tdep.c: Likewise.
	* amd64-nat.c: Likewise.
	* amd64-sol2-tdep.c: Likewise.
	* amd64fbsd-tdep.c: Likewise.
	* amd64obsd-tdep.c: Likewise.
	* arch-utils.c: Likewise.
	* arm-linux-nat.c: Likewise.
	* arm-linux-tdep.c: Likewise.
	* arm-tdep.c: Likewise.
	* arm-wince-tdep.c: Likewise.
	* armbsd-tdep.c: Likewise.
	* armnbsd-nat.c: Likewise.
	* armnbsd-tdep.c: Likewise.
	* armobsd-tdep.c: Likewise.
	* avr-tdep.c: Likewise.
	* ax-gdb.c: Likewise.
	* ax-general.c: Likewise.
	* bcache.c: Likewise.
	* bfin-tdep.c: Likewise.
	* breakpoint.c: Likewise.
	* build-id.c: Likewise.
	* buildsym.c: Likewise.
	* c-exp.y: Likewise.
	* c-lang.c: Likewise.
	* c-typeprint.c: Likewise.
	* c-valprint.c: Likewise.
	* charset.c: Likewise.
	* cli-out.c: Likewise.
	* cli/cli-cmds.c: Likewise.
	* cli/cli-decode.c: Likewise.
	* cli/cli-dump.c: Likewise.
	* cli/cli-interp.c: Likewise.
	* cli/cli-logging.c: Likewise.
	* cli/cli-script.c: Likewise.
	* cli/cli-setshow.c: Likewise.
	* cli/cli-utils.c: Likewise.
	* coffread.c: Likewise.
	* common/agent.c: Likewise.
	* common/buffer.c: Likewise.
	* common/buffer.h: Likewise.
	* common/common-utils.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/filestuff.c: Likewise.
	* common/format.c: Likewise.
	* common/print-utils.c: Likewise.
	* common/rsp-low.c: Likewise.
	* common/signals.c: Likewise.
	* common/vec.h: Likewise.
	* common/xml-utils.c: Likewise.
	* core-regset.c: Likewise.
	* corefile.c: Likewise.
	* corelow.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-name-parser.y: Likewise.
	* cp-support.c: Likewise.
	* cp-valprint.c: Likewise.
	* cris-tdep.c: Likewise.
	* d-exp.y: Likewise.
	* darwin-nat.c: Likewise.
	* dbxread.c: Likewise.
	* dcache.c: Likewise.
	* demangle.c: Likewise.
	* dicos-tdep.c: Likewise.
	* disasm.c: Likewise.
	* doublest.c: Likewise.
	* dsrec.c: Likewise.
	* dummy-frame.c: Likewise.
	* dwarf2-frame.c: Likewise.
	* dwarf2loc.c: Likewise.
	* dwarf2read.c: Likewise.
	* elfread.c: Likewise.
	* environ.c: Likewise.
	* eval.c: Likewise.
	* event-loop.c: Likewise.
	* exceptions.c: Likewise.
	* exec.c: Likewise.
	* expprint.c: Likewise.
	* f-exp.y: Likewise.
	* f-lang.c: Likewise.
	* f-typeprint.c: Likewise.
	* f-valprint.c: Likewise.
	* fbsd-nat.c: Likewise.
	* findcmd.c: Likewise.
	* findvar.c: Likewise.
	* fork-child.c: Likewise.
	* frame.c: Likewise.
	* frv-linux-tdep.c: Likewise.
	* frv-tdep.c: Likewise.
	* gdb.c: Likewise.
	* gdb_bfd.c: Likewise.
	* gdbarch.c: Likewise.
	* gdbarch.sh: Likewise.
	* gdbtypes.c: Likewise.
	* gnu-nat.c: Likewise.
	* gnu-v2-abi.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-exp.y: Likewise.
	* go-lang.c: Likewise.
	* go32-nat.c: Likewise.
	* guile/guile.c: Likewise.
	* guile/scm-auto-load.c: Likewise.
	* hppa-hpux-tdep.c: Likewise.
	* hppa-linux-nat.c: Likewise.
	* hppanbsd-tdep.c: Likewise.
	* hppaobsd-tdep.c: Likewise.
	* i386-cygwin-tdep.c: Likewise.
	* i386-dicos-tdep.c: Likewise.
	* i386-linux-tdep.c: Likewise.
	* i386-nto-tdep.c: Likewise.
	* i386-sol2-tdep.c: Likewise.
	* i386-tdep.c: Likewise.
	* i386bsd-tdep.c: Likewise.
	* i386gnu-nat.c: Likewise.
	* i386nbsd-tdep.c: Likewise.
	* i386obsd-tdep.c: Likewise.
	* i387-tdep.c: Likewise.
	* ia64-libunwind-tdep.c: Likewise.
	* ia64-linux-nat.c: Likewise.
	* inf-child.c: Likewise.
	* inf-ptrace.c: Likewise.
	* inf-ttrace.c: Likewise.
	* infcall.c: Likewise.
	* infcmd.c: Likewise.
	* inflow.c: Likewise.
	* infrun.c: Likewise.
	* interps.c: Likewise.
	* iq2000-tdep.c: Likewise.
	* irix5-nat.c: Likewise.
	* jv-exp.y: Likewise.
	* jv-lang.c: Likewise.
	* jv-typeprint.c: Likewise.
	* jv-valprint.c: Likewise.
	* language.c: Likewise.
	* linux-fork.c: Likewise.
	* linux-nat.c: Likewise.
	* lm32-tdep.c: Likewise.
	* m2-exp.y: Likewise.
	* m2-typeprint.c: Likewise.
	* m32c-tdep.c: Likewise.
	* m32r-linux-nat.c: Likewise.
	* m32r-linux-tdep.c: Likewise.
	* m32r-rom.c: Likewise.
	* m32r-tdep.c: Likewise.
	* m68hc11-tdep.c: Likewise.
	* m68k-tdep.c: Likewise.
	* m68kbsd-tdep.c: Likewise.
	* m68klinux-nat.c: Likewise.
	* m68klinux-tdep.c: Likewise.
	* m88k-tdep.c: Likewise.
	* machoread.c: Likewise.
	* macrocmd.c: Likewise.
	* main.c: Likewise.
	* mdebugread.c: Likewise.
	* mem-break.c: Likewise.
	* memattr.c: Likewise.
	* memory-map.c: Likewise.
	* mep-tdep.c: Likewise.
	* mi/mi-cmd-break.c: Likewise.
	* mi/mi-cmd-disas.c: Likewise.
	* mi/mi-cmd-env.c: Likewise.
	* mi/mi-cmd-stack.c: Likewise.
	* mi/mi-cmd-var.c: Likewise.
	* mi/mi-cmds.c: Likewise.
	* mi/mi-console.c: Likewise.
	* mi/mi-getopt.c: Likewise.
	* mi/mi-interp.c: Likewise.
	* mi/mi-main.c: Likewise.
	* mi/mi-parse.c: Likewise.
	* microblaze-rom.c: Likewise.
	* microblaze-tdep.c: Likewise.
	* mingw-hdep.c: Likewise.
	* minidebug.c: Likewise.
	* minsyms.c: Likewise.
	* mips-irix-tdep.c: Likewise.
	* mips-linux-tdep.c: Likewise.
	* mips-tdep.c: Likewise.
	* mips64obsd-tdep.c: Likewise.
	* mipsnbsd-tdep.c: Likewise.
	* mipsread.c: Likewise.
	* mn10300-linux-tdep.c: Likewise.
	* mn10300-tdep.c: Likewise.
	* monitor.c: Likewise.
	* moxie-tdep.c: Likewise.
	* mt-tdep.c: Likewise.
	* nat/linux-btrace.c: Likewise.
	* nat/linux-osdata.c: Likewise.
	* nat/linux-procfs.c: Likewise.
	* nat/linux-ptrace.c: Likewise.
	* nat/linux-waitpid.c: Likewise.
	* nbsd-tdep.c: Likewise.
	* nios2-linux-tdep.c: Likewise.
	* nto-procfs.c: Likewise.
	* nto-tdep.c: Likewise.
	* objc-lang.c: Likewise.
	* objfiles.c: Likewise.
	* opencl-lang.c: Likewise.
	* osabi.c: Likewise.
	* osdata.c: Likewise.
	* p-exp.y: Likewise.
	* p-lang.c: Likewise.
	* p-typeprint.c: Likewise.
	* parse.c: Likewise.
	* posix-hdep.c: Likewise.
	* ppc-linux-nat.c: Likewise.
	* ppc-sysv-tdep.c: Likewise.
	* ppcfbsd-tdep.c: Likewise.
	* ppcnbsd-tdep.c: Likewise.
	* ppcobsd-tdep.c: Likewise.
	* printcmd.c: Likewise.
	* procfs.c: Likewise.
	* prologue-value.c: Likewise.
	* python/py-auto-load.c: Likewise.
	* python/py-gdb-readline.c: Likewise.
	* ravenscar-thread.c: Likewise.
	* regcache.c: Likewise.
	* registry.c: Likewise.
	* remote-fileio.c: Likewise.
	* remote-m32r-sdi.c: Likewise.
	* remote-mips.c: Likewise.
	* remote-notif.c: Likewise.
	* remote-sim.c: Likewise.
	* remote.c: Likewise.
	* reverse.c: Likewise.
	* rs6000-aix-tdep.c: Likewise.
	* ser-base.c: Likewise.
	* ser-go32.c: Likewise.
	* ser-mingw.c: Likewise.
	* ser-pipe.c: Likewise.
	* ser-tcp.c: Likewise.
	* ser-unix.c: Likewise.
	* serial.c: Likewise.
	* sh-tdep.c: Likewise.
	* sh64-tdep.c: Likewise.
	* shnbsd-tdep.c: Likewise.
	* skip.c: Likewise.
	* sol-thread.c: Likewise.
	* solib-dsbt.c: Likewise.
	* solib-frv.c: Likewise.
	* solib-osf.c: Likewise.
	* solib-som.c: Likewise.
	* solib-spu.c: Likewise.
	* solib-target.c: Likewise.
	* solib.c: Likewise.
	* somread.c: Likewise.
	* source.c: Likewise.
	* sparc-nat.c: Likewise.
	* sparc-sol2-tdep.c: Likewise.
	* sparc-tdep.c: Likewise.
	* sparc64-tdep.c: Likewise.
	* sparc64fbsd-tdep.c: Likewise.
	* sparc64nbsd-tdep.c: Likewise.
	* sparcnbsd-tdep.c: Likewise.
	* spu-linux-nat.c: Likewise.
	* spu-multiarch.c: Likewise.
	* spu-tdep.c: Likewise.
	* stabsread.c: Likewise.
	* stack.c: Likewise.
	* std-regs.c: Likewise.
	* symfile.c: Likewise.
	* symmisc.c: Likewise.
	* symtab.c: Likewise.
	* target.c: Likewise.
	* thread.c: Likewise.
	* tilegx-linux-nat.c: Likewise.
	* tilegx-tdep.c: Likewise.
	* top.c: Likewise.
	* tracepoint.c: Likewise.
	* tui/tui-command.c: Likewise.
	* tui/tui-data.c: Likewise.
	* tui/tui-disasm.c: Likewise.
	* tui/tui-file.c: Likewise.
	* tui/tui-layout.c: Likewise.
	* tui/tui-out.c: Likewise.
	* tui/tui-regs.c: Likewise.
	* tui/tui-source.c: Likewise.
	* tui/tui-stack.c: Likewise.
	* tui/tui-win.c: Likewise.
	* tui/tui-windata.c: Likewise.
	* tui/tui-winsource.c: Likewise.
	* typeprint.c: Likewise.
	* ui-file.c: Likewise.
	* ui-out.c: Likewise.
	* user-regs.c: Likewise.
	* utils.c: Likewise.
	* v850-tdep.c: Likewise.
	* valarith.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.
	* value.c: Likewise.
	* varobj.c: Likewise.
	* vax-tdep.c: Likewise.
	* vaxnbsd-tdep.c: Likewise.
	* vaxobsd-tdep.c: Likewise.
	* windows-nat.c: Likewise.
	* xcoffread.c: Likewise.
	* xml-support.c: Likewise.
	* xstormy16-tdep.c: Likewise.
	* xtensa-linux-nat.c: Likewise.

gdb/gdbserver/
2014-08-07  Gary Benson  <gbenson@redhat.com>

	* server.h: Do not include string.h.
	* event-loop.c: Likewise.
	* linux-low.c: Likewise.
	* regcache.c: Likewise.
	* remote-utils.c: Likewise.
	* spu-low.c: Likewise.
	* utils.c: Likewise.
2014-08-07 09:06:47 +01:00
Sergio Durigan Junior 410a0ff2df Remove `expout*' globals from parser-defs.h
This commit removes the "expout*" globals from our parser code, turning
them into a structure that is passed when an expression needs to be
evaluated.  This is the initial step to make our parser less
"globalized".

This is mostly a mechanical patch, which creates a structure containing
the "expout*" globals and then modify all the functions that handle them
in order to take the structure as argument.  It is big, and has been
reviewed at least 4 times, so I think everything is covered.

Below you can see the message links from the discussions:

- First attempt:

<https://sourceware.org/ml/gdb-patches/2012-01/msg00522.html>
Message-ID: <m3k44s7qej.fsf@gmail.com>

- Second attempt:

<https://sourceware.org/ml/gdb-patches/2012-06/msg00054.html>
Message-Id: <1338665528-5932-1-git-send-email-sergiodj@redhat.com>

- Third attempt:

<https://sourceware.org/ml/gdb-patches/2014-01/msg00949.html>
Message-Id: <1390629467-27139-1-git-send-email-sergiodj@redhat.com>

- Fourth (last) attempt:

<https://sourceware.org/ml/gdb-patches/2014-03/msg00546.html>
Message-Id: <1395463432-29750-1-git-send-email-sergiodj@redhat.com>

gdb/
2014-03-27  Sergio Durigan Junior  <sergiodj@redhat.com>

	Remove some globals from our parser.
	* language.c (unk_lang_parser): Add "struct parser_state"
	argument.
	* language.h (struct language_defn) <la_parser>: Likewise.
	* parse.c (expout, expout_size, expout_ptr): Remove variables.
	(initialize_expout): Add "struct parser_state" argument.
	Rewrite function to use the parser state.
	(reallocate_expout, write_exp_elt, write_exp_elt_opcode,
	write_exp_elt_sym, write_exp_elt_block, write_exp_elt_objfile,
	write_exp_elt_longcst, write_exp_elt_dblcst,
	write_exp_elt_decfloatcst, write_exp_elt_type,
	write_exp_elt_intern, write_exp_string, write_exp_string_vector,
	write_exp_bitstring, write_exp_msymbol, mark_struct_expression,
	write_dollar_variable): Likewise.
	(parse_exp_in_context_1): Use parser state.
	(insert_type_address_space): Add "struct parser_state" argument.
	Use parser state.
	(increase_expout_size): New function.
	* parser-defs.h: Forward declare "struct language_defn" and
	"struct parser_state".
	(expout, expout_size, expout_ptr): Remove extern declarations.
	(parse_gdbarch, parse_language): Rewrite macro declarations to
	accept the parser state.
	(struct parser_state): New struct.
	(initialize_expout, reallocate_expout, write_exp_elt_opcode,
	write_exp_elt_sym, write_exp_elt_longcst, write_exp_elt_dblcst,
	write_exp_elt_decfloatcst, write_exp_elt_type,
	write_exp_elt_intern, write_exp_string, write_exp_string_vector,
	write_exp_bitstring, write_exp_elt_block, write_exp_elt_objfile,
	write_exp_msymbol, write_dollar_variable,
	mark_struct_expression, insert_type_address_space): Add "struct
	parser_state" argument.
	(increase_expout_size): New function.
	* utils.c (do_clear_parser_state): New function.
	(make_cleanup_clear_parser_state): Likewise.
	* utils.h (make_cleanup_clear_parser_state): New function
	prototype.
	* aarch64-linux-tdep.c (aarch64_stap_parse_special_token):
	Update calls to write_exp* in order to pass the parser state.
	* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
	* i386-tdep.c (i386_stap_parse_special_token_triplet): Likewise.
	(i386_stap_parse_special_token_three_arg_disp): Likewise.
	* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
	* stap-probe.c (stap_parse_register_operand): Likewise.
	(stap_parse_single_operand): Likewise.
	(stap_parse_argument_1): Likewise.
	(stap_parse_argument): Use parser state.
	* stap-probe.h: Include "parser-defs.h".
	(struct stap_parse_info) <pstate>: New field.
	* c-exp.y (parse_type): Rewrite to use parser state.
	(yyparse): Redefine to c_parse_internal.
	(pstate): New global variable.
	(parse_number): Add "struct parser_state" argument.
	(write_destructor_name): Likewise.
	(type_exp): Update calls to write_exp* and similars in order to
	use parser state.
	(exp1, exp, variable, qualified_name, space_identifier,
	typename, typebase): Likewise.
	(write_destructor_name, parse_number, lex_one_token,
	classify_name, classify_inner_name, c_parse): Add "struct
	parser_state" argument.  Update function to use parser state.
	* c-lang.h: Forward declare "struct parser_state".
	(c_parse): Add "struct parser_state" argument.
	* ada-exp.y (parse_type): Rewrite macro to use parser state.
	(yyparse): Redefine macro to ada_parse_internal.
	(pstate): New variable.
	(write_int, write_object_renaming, write_var_or_type,
	write_name_assoc, write_exp_op_with_string, write_ambiguous_var,
	type_int, type_long, type_long_long, type_float, type_double,
	type_long_double, type_char, type_boolean, type_system_address):
	Add "struct parser_state" argument.
	(exp1, primary, simple_exp, relation, and_exp, and_then_exp,
	or_exp, or_else_exp, xor_exp, type_prefix, opt_type_prefix,
	var_or_type, aggregate, aggregate_component_list,
	positional_list, others, component_group,
	component_associations): Update calls to write_exp* and similar
	functions in order to use parser state.
	(ada_parse, write_var_from_sym, write_int,
	write_exp_op_with_string, write_object_renaming,
	find_primitive_type, write_selectors, write_ambiguous_var,
	write_var_or_type, write_name_assoc, type_int, type_long,
	type_long_long, type_float, type_double, type_long_double,
	type_char, type_boolean, type_system_address): Add "struct
	parser_state" argument.  Adjust function to use parser state.
	* ada-lang.c (parse): Likewise.
	* ada-lang.h: Forward declare "struct parser_state".
	(ada_parse): Add "struct parser_state" argument.
	* ada-lex.l (processInt, processReal): Likewise.  Adjust all
	calls to both functions.
	* f-exp.y (parse_type, parse_f_type): Rewrite macros to use
	parser state.
	(yyparse): Redefine macro to f_parse_internal.
	(pstate): New variable.
	(parse_number): Add "struct parser_state" argument.
	(type_exp, exp, subrange, typebase): Update calls to write_exp*
	and similars in order to use parser state.
	(parse_number): Adjust code to use parser state.
	(yylex): Likewise.
	(f_parse): New function.
	* f-lang.h: Forward declare "struct parser_state".
	(f_parse): Add "struct parser_state" argument.
	* jv-exp.y (parse_type, parse_java_type): Rewrite macros to use
	parser state.
	(yyparse): Redefine macro for java_parse_internal.
	(pstate): New variable.
	(push_expression_name, push_expression_name, insert_exp): Add
	"struct parser_state" argument.
	(type_exp, StringLiteral, Literal, PrimitiveType, IntegralType,
	FloatingPointType, exp1, PrimaryNoNewArray, FieldAccess,
	FuncStart, MethodInvocation, ArrayAccess, PostfixExpression,
	PostIncrementExpression, PostDecrementExpression,
	UnaryExpression, PreIncrementExpression, PreDecrementExpression,
	UnaryExpressionNotPlusMinus, CastExpression,
	MultiplicativeExpression, AdditiveExpression, ShiftExpression,
	RelationalExpression, EqualityExpression, AndExpression,
	ExclusiveOrExpression, InclusiveOrExpression,
	ConditionalAndExpression, ConditionalOrExpression,
	ConditionalExpression, Assignment, LeftHandSide): Update
	calls to write_exp* and similars in order to use parser state.
	(parse_number): Ajust code to use parser state.
	(yylex): Likewise.
	(java_parse): New function.
	(push_variable): Add "struct parser_state" argument.  Adjust
	code to user parser state.
	(push_fieldnames, push_qualified_expression_name,
	push_expression_name, insert_exp): Likewise.
	* jv-lang.h: Forward declare "struct parser_state".
	(java_parse): Add "struct parser_state" argument.
	* m2-exp.y (parse_type, parse_m2_type): Rewrite macros to use
	parser state.
	(yyparse): Redefine macro to m2_parse_internal.
	(pstate): New variable.
	(type_exp, exp, fblock, variable, type): Update calls to
	write_exp* and similars to use parser state.
	(yylex): Likewise.
	(m2_parse): New function.
	* m2-lang.h: Forward declare "struct parser_state".
	(m2_parse): Add "struct parser_state" argument.
	* objc-lang.c (end_msglist): Add "struct parser_state" argument.
	* objc-lang.h: Forward declare "struct parser_state".
	(end_msglist): Add "struct parser_state" argument.
	* p-exp.y (parse_type): Rewrite macro to use parser state.
	(yyparse): Redefine macro to pascal_parse_internal.
	(pstate): New variable.
	(parse_number): Add "struct parser_state" argument.
	(type_exp, exp1, exp, qualified_name, variable): Update calls to
	write_exp* and similars in order to use parser state.
	(parse_number, yylex): Adjust code to use parser state.
	(pascal_parse): New function.
	* p-lang.h: Forward declare "struct parser_state".
	(pascal_parse): Add "struct parser_state" argument.
	* go-exp.y (parse_type): Rewrite macro to use parser state.
	(yyparse): Redefine macro to go_parse_internal.
	(pstate): New variable.
	(parse_number): Add "struct parser_state" argument.
	(type_exp, exp1, exp, variable, type): Update calls to
	write_exp* and similars in order to use parser state.
	(parse_number, lex_one_token, classify_name, yylex): Adjust code
	to use parser state.
	(go_parse): Likewise.
	* go-lang.h: Forward declare "struct parser_state".
	(go_parse): Add "struct parser_state" argument.
2014-03-27 19:10:40 -03:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Joel Brobecker a5e619ec1f Minor coding-style fixes in ada-lex.l:find_dot_all.
gdb/ChangeLog:

        * ada-lex.l (find_dot_all): Fix coding style violations.
2013-12-05 07:38:49 +04:00
Joel Brobecker 7fb1b8b13f Ada: Reserved word "all" should not need to be spelled in lowercase.
Consider the following code:

   type Ptr is access all Integer;
   IP : Ptr := new Integer'(123);

IP is the Ada exception of a pointer to an integer. To dereference
the pointer and get its value, the user uses the reserved word "all"
as follow:

    (gdb) p ip.all
    $1 = 123

Ada being a case-insensitive language, the casing should not matter.
Unfortunately, for the reserved word "all", things don't work. For
instance:

    (gdb) p ip.ALL
    Type integer is not a structure or union type

This patch fixes the problem.

gdb/ChangeLog:

	* ada-lex.l (find_dot_all): Use strncasecmp instead of strncmp.

gdb/testsuite/ChangeLog:

        * gdb.ada/dot_all: New testcase.
2013-12-03 16:04:26 +04:00
Tom Tromey 0e9f083f4c remove gdb_string.h
This removes gdb_string.h.  This patch is purely mechanical.  I
created it by running the two commands:

    git rm common/gdb_string.h
    perl -pi -e's/"gdb_string.h"/<string.h>/;'  *.[chyl] */*.[chyl]

2013-11-18  Tom Tromey  <tromey@redhat.com>

	* common/gdb_string.h: Remove.
	* aarch64-tdep.c: Use string.h, not gdb_string.h.
	* ada-exp.y: Use string.h, not gdb_string.h.
	* ada-lang.c: Use string.h, not gdb_string.h.
	* ada-lex.l: Use string.h, not gdb_string.h.
	* ada-typeprint.c: Use string.h, not gdb_string.h.
	* ada-valprint.c: Use string.h, not gdb_string.h.
	* aix-thread.c: Use string.h, not gdb_string.h.
	* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
	* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
	* alpha-nat.c: Use string.h, not gdb_string.h.
	* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
	* alpha-tdep.c: Use string.h, not gdb_string.h.
	* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
	* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
	* amd64-linux-nat.c: Use string.h, not gdb_string.h.
	* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
	* amd64-nat.c: Use string.h, not gdb_string.h.
	* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
	* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
	* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
	* arch-utils.c: Use string.h, not gdb_string.h.
	* arm-linux-nat.c: Use string.h, not gdb_string.h.
	* arm-linux-tdep.c: Use string.h, not gdb_string.h.
	* arm-tdep.c: Use string.h, not gdb_string.h.
	* arm-wince-tdep.c: Use string.h, not gdb_string.h.
	* armbsd-tdep.c: Use string.h, not gdb_string.h.
	* armnbsd-nat.c: Use string.h, not gdb_string.h.
	* armnbsd-tdep.c: Use string.h, not gdb_string.h.
	* armobsd-tdep.c: Use string.h, not gdb_string.h.
	* avr-tdep.c: Use string.h, not gdb_string.h.
	* ax-gdb.c: Use string.h, not gdb_string.h.
	* ax-general.c: Use string.h, not gdb_string.h.
	* bcache.c: Use string.h, not gdb_string.h.
	* bfin-tdep.c: Use string.h, not gdb_string.h.
	* breakpoint.c: Use string.h, not gdb_string.h.
	* build-id.c: Use string.h, not gdb_string.h.
	* buildsym.c: Use string.h, not gdb_string.h.
	* c-exp.y: Use string.h, not gdb_string.h.
	* c-lang.c: Use string.h, not gdb_string.h.
	* c-typeprint.c: Use string.h, not gdb_string.h.
	* c-valprint.c: Use string.h, not gdb_string.h.
	* charset.c: Use string.h, not gdb_string.h.
	* cli-out.c: Use string.h, not gdb_string.h.
	* cli/cli-cmds.c: Use string.h, not gdb_string.h.
	* cli/cli-decode.c: Use string.h, not gdb_string.h.
	* cli/cli-dump.c: Use string.h, not gdb_string.h.
	* cli/cli-interp.c: Use string.h, not gdb_string.h.
	* cli/cli-logging.c: Use string.h, not gdb_string.h.
	* cli/cli-script.c: Use string.h, not gdb_string.h.
	* cli/cli-setshow.c: Use string.h, not gdb_string.h.
	* cli/cli-utils.c: Use string.h, not gdb_string.h.
	* coffread.c: Use string.h, not gdb_string.h.
	* common/common-utils.c: Use string.h, not gdb_string.h.
	* common/filestuff.c: Use string.h, not gdb_string.h.
	* common/linux-procfs.c: Use string.h, not gdb_string.h.
	* common/linux-ptrace.c: Use string.h, not gdb_string.h.
	* common/signals.c: Use string.h, not gdb_string.h.
	* common/vec.h: Use string.h, not gdb_string.h.
	* core-regset.c: Use string.h, not gdb_string.h.
	* corefile.c: Use string.h, not gdb_string.h.
	* corelow.c: Use string.h, not gdb_string.h.
	* cp-abi.c: Use string.h, not gdb_string.h.
	* cp-support.c: Use string.h, not gdb_string.h.
	* cp-valprint.c: Use string.h, not gdb_string.h.
	* cris-tdep.c: Use string.h, not gdb_string.h.
	* d-lang.c: Use string.h, not gdb_string.h.
	* dbxread.c: Use string.h, not gdb_string.h.
	* dcache.c: Use string.h, not gdb_string.h.
	* demangle.c: Use string.h, not gdb_string.h.
	* dicos-tdep.c: Use string.h, not gdb_string.h.
	* disasm.c: Use string.h, not gdb_string.h.
	* doublest.c: Use string.h, not gdb_string.h.
	* dsrec.c: Use string.h, not gdb_string.h.
	* dummy-frame.c: Use string.h, not gdb_string.h.
	* dwarf2-frame.c: Use string.h, not gdb_string.h.
	* dwarf2loc.c: Use string.h, not gdb_string.h.
	* dwarf2read.c: Use string.h, not gdb_string.h.
	* elfread.c: Use string.h, not gdb_string.h.
	* environ.c: Use string.h, not gdb_string.h.
	* eval.c: Use string.h, not gdb_string.h.
	* event-loop.c: Use string.h, not gdb_string.h.
	* exceptions.c: Use string.h, not gdb_string.h.
	* exec.c: Use string.h, not gdb_string.h.
	* expprint.c: Use string.h, not gdb_string.h.
	* f-exp.y: Use string.h, not gdb_string.h.
	* f-lang.c: Use string.h, not gdb_string.h.
	* f-typeprint.c: Use string.h, not gdb_string.h.
	* f-valprint.c: Use string.h, not gdb_string.h.
	* fbsd-nat.c: Use string.h, not gdb_string.h.
	* findcmd.c: Use string.h, not gdb_string.h.
	* findvar.c: Use string.h, not gdb_string.h.
	* fork-child.c: Use string.h, not gdb_string.h.
	* frame.c: Use string.h, not gdb_string.h.
	* frv-linux-tdep.c: Use string.h, not gdb_string.h.
	* frv-tdep.c: Use string.h, not gdb_string.h.
	* gdb.c: Use string.h, not gdb_string.h.
	* gdb_bfd.c: Use string.h, not gdb_string.h.
	* gdbarch.c: Use string.h, not gdb_string.h.
	* gdbtypes.c: Use string.h, not gdb_string.h.
	* gnu-nat.c: Use string.h, not gdb_string.h.
	* gnu-v2-abi.c: Use string.h, not gdb_string.h.
	* gnu-v3-abi.c: Use string.h, not gdb_string.h.
	* go-exp.y: Use string.h, not gdb_string.h.
	* go-lang.c: Use string.h, not gdb_string.h.
	* go32-nat.c: Use string.h, not gdb_string.h.
	* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
	* hppa-linux-nat.c: Use string.h, not gdb_string.h.
	* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
	* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
	* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
	* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
	* i386-linux-nat.c: Use string.h, not gdb_string.h.
	* i386-linux-tdep.c: Use string.h, not gdb_string.h.
	* i386-nto-tdep.c: Use string.h, not gdb_string.h.
	* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
	* i386-tdep.c: Use string.h, not gdb_string.h.
	* i386bsd-tdep.c: Use string.h, not gdb_string.h.
	* i386gnu-nat.c: Use string.h, not gdb_string.h.
	* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
	* i386obsd-tdep.c: Use string.h, not gdb_string.h.
	* i387-tdep.c: Use string.h, not gdb_string.h.
	* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
	* ia64-linux-nat.c: Use string.h, not gdb_string.h.
	* inf-child.c: Use string.h, not gdb_string.h.
	* inf-ptrace.c: Use string.h, not gdb_string.h.
	* inf-ttrace.c: Use string.h, not gdb_string.h.
	* infcall.c: Use string.h, not gdb_string.h.
	* infcmd.c: Use string.h, not gdb_string.h.
	* inflow.c: Use string.h, not gdb_string.h.
	* infrun.c: Use string.h, not gdb_string.h.
	* interps.c: Use string.h, not gdb_string.h.
	* iq2000-tdep.c: Use string.h, not gdb_string.h.
	* irix5-nat.c: Use string.h, not gdb_string.h.
	* jv-exp.y: Use string.h, not gdb_string.h.
	* jv-lang.c: Use string.h, not gdb_string.h.
	* jv-typeprint.c: Use string.h, not gdb_string.h.
	* jv-valprint.c: Use string.h, not gdb_string.h.
	* language.c: Use string.h, not gdb_string.h.
	* linux-fork.c: Use string.h, not gdb_string.h.
	* linux-nat.c: Use string.h, not gdb_string.h.
	* lm32-tdep.c: Use string.h, not gdb_string.h.
	* m2-exp.y: Use string.h, not gdb_string.h.
	* m2-typeprint.c: Use string.h, not gdb_string.h.
	* m32c-tdep.c: Use string.h, not gdb_string.h.
	* m32r-linux-nat.c: Use string.h, not gdb_string.h.
	* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
	* m32r-rom.c: Use string.h, not gdb_string.h.
	* m32r-tdep.c: Use string.h, not gdb_string.h.
	* m68hc11-tdep.c: Use string.h, not gdb_string.h.
	* m68k-tdep.c: Use string.h, not gdb_string.h.
	* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
	* m68klinux-nat.c: Use string.h, not gdb_string.h.
	* m68klinux-tdep.c: Use string.h, not gdb_string.h.
	* m88k-tdep.c: Use string.h, not gdb_string.h.
	* macrocmd.c: Use string.h, not gdb_string.h.
	* main.c: Use string.h, not gdb_string.h.
	* mdebugread.c: Use string.h, not gdb_string.h.
	* mem-break.c: Use string.h, not gdb_string.h.
	* memattr.c: Use string.h, not gdb_string.h.
	* memory-map.c: Use string.h, not gdb_string.h.
	* mep-tdep.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
	* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
	* mi/mi-cmds.c: Use string.h, not gdb_string.h.
	* mi/mi-console.c: Use string.h, not gdb_string.h.
	* mi/mi-getopt.c: Use string.h, not gdb_string.h.
	* mi/mi-interp.c: Use string.h, not gdb_string.h.
	* mi/mi-main.c: Use string.h, not gdb_string.h.
	* mi/mi-parse.c: Use string.h, not gdb_string.h.
	* microblaze-rom.c: Use string.h, not gdb_string.h.
	* microblaze-tdep.c: Use string.h, not gdb_string.h.
	* mingw-hdep.c: Use string.h, not gdb_string.h.
	* minidebug.c: Use string.h, not gdb_string.h.
	* minsyms.c: Use string.h, not gdb_string.h.
	* mips-irix-tdep.c: Use string.h, not gdb_string.h.
	* mips-linux-tdep.c: Use string.h, not gdb_string.h.
	* mips-tdep.c: Use string.h, not gdb_string.h.
	* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
	* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
	* mipsread.c: Use string.h, not gdb_string.h.
	* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
	* mn10300-tdep.c: Use string.h, not gdb_string.h.
	* monitor.c: Use string.h, not gdb_string.h.
	* moxie-tdep.c: Use string.h, not gdb_string.h.
	* mt-tdep.c: Use string.h, not gdb_string.h.
	* nbsd-tdep.c: Use string.h, not gdb_string.h.
	* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
	* nto-procfs.c: Use string.h, not gdb_string.h.
	* nto-tdep.c: Use string.h, not gdb_string.h.
	* objc-lang.c: Use string.h, not gdb_string.h.
	* objfiles.c: Use string.h, not gdb_string.h.
	* opencl-lang.c: Use string.h, not gdb_string.h.
	* osabi.c: Use string.h, not gdb_string.h.
	* osdata.c: Use string.h, not gdb_string.h.
	* p-exp.y: Use string.h, not gdb_string.h.
	* p-lang.c: Use string.h, not gdb_string.h.
	* p-typeprint.c: Use string.h, not gdb_string.h.
	* parse.c: Use string.h, not gdb_string.h.
	* posix-hdep.c: Use string.h, not gdb_string.h.
	* ppc-linux-nat.c: Use string.h, not gdb_string.h.
	* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
	* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
	* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
	* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
	* printcmd.c: Use string.h, not gdb_string.h.
	* procfs.c: Use string.h, not gdb_string.h.
	* prologue-value.c: Use string.h, not gdb_string.h.
	* python/py-auto-load.c: Use string.h, not gdb_string.h.
	* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
	* ravenscar-thread.c: Use string.h, not gdb_string.h.
	* regcache.c: Use string.h, not gdb_string.h.
	* registry.c: Use string.h, not gdb_string.h.
	* remote-fileio.c: Use string.h, not gdb_string.h.
	* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
	* remote-mips.c: Use string.h, not gdb_string.h.
	* remote-sim.c: Use string.h, not gdb_string.h.
	* remote.c: Use string.h, not gdb_string.h.
	* reverse.c: Use string.h, not gdb_string.h.
	* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
	* ser-base.c: Use string.h, not gdb_string.h.
	* ser-go32.c: Use string.h, not gdb_string.h.
	* ser-mingw.c: Use string.h, not gdb_string.h.
	* ser-pipe.c: Use string.h, not gdb_string.h.
	* ser-tcp.c: Use string.h, not gdb_string.h.
	* ser-unix.c: Use string.h, not gdb_string.h.
	* serial.c: Use string.h, not gdb_string.h.
	* sh-tdep.c: Use string.h, not gdb_string.h.
	* sh64-tdep.c: Use string.h, not gdb_string.h.
	* shnbsd-tdep.c: Use string.h, not gdb_string.h.
	* skip.c: Use string.h, not gdb_string.h.
	* sol-thread.c: Use string.h, not gdb_string.h.
	* solib-dsbt.c: Use string.h, not gdb_string.h.
	* solib-frv.c: Use string.h, not gdb_string.h.
	* solib-osf.c: Use string.h, not gdb_string.h.
	* solib-spu.c: Use string.h, not gdb_string.h.
	* solib-target.c: Use string.h, not gdb_string.h.
	* solib.c: Use string.h, not gdb_string.h.
	* somread.c: Use string.h, not gdb_string.h.
	* source.c: Use string.h, not gdb_string.h.
	* sparc-nat.c: Use string.h, not gdb_string.h.
	* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
	* sparc-tdep.c: Use string.h, not gdb_string.h.
	* sparc64-tdep.c: Use string.h, not gdb_string.h.
	* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
	* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
	* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
	* spu-linux-nat.c: Use string.h, not gdb_string.h.
	* spu-multiarch.c: Use string.h, not gdb_string.h.
	* spu-tdep.c: Use string.h, not gdb_string.h.
	* stabsread.c: Use string.h, not gdb_string.h.
	* stack.c: Use string.h, not gdb_string.h.
	* std-regs.c: Use string.h, not gdb_string.h.
	* symfile.c: Use string.h, not gdb_string.h.
	* symmisc.c: Use string.h, not gdb_string.h.
	* symtab.c: Use string.h, not gdb_string.h.
	* target.c: Use string.h, not gdb_string.h.
	* thread.c: Use string.h, not gdb_string.h.
	* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
	* tilegx-tdep.c: Use string.h, not gdb_string.h.
	* top.c: Use string.h, not gdb_string.h.
	* tracepoint.c: Use string.h, not gdb_string.h.
	* tui/tui-command.c: Use string.h, not gdb_string.h.
	* tui/tui-data.c: Use string.h, not gdb_string.h.
	* tui/tui-disasm.c: Use string.h, not gdb_string.h.
	* tui/tui-file.c: Use string.h, not gdb_string.h.
	* tui/tui-layout.c: Use string.h, not gdb_string.h.
	* tui/tui-out.c: Use string.h, not gdb_string.h.
	* tui/tui-regs.c: Use string.h, not gdb_string.h.
	* tui/tui-source.c: Use string.h, not gdb_string.h.
	* tui/tui-stack.c: Use string.h, not gdb_string.h.
	* tui/tui-win.c: Use string.h, not gdb_string.h.
	* tui/tui-windata.c: Use string.h, not gdb_string.h.
	* tui/tui-winsource.c: Use string.h, not gdb_string.h.
	* typeprint.c: Use string.h, not gdb_string.h.
	* ui-file.c: Use string.h, not gdb_string.h.
	* ui-out.c: Use string.h, not gdb_string.h.
	* user-regs.c: Use string.h, not gdb_string.h.
	* utils.c: Use string.h, not gdb_string.h.
	* v850-tdep.c: Use string.h, not gdb_string.h.
	* valarith.c: Use string.h, not gdb_string.h.
	* valops.c: Use string.h, not gdb_string.h.
	* valprint.c: Use string.h, not gdb_string.h.
	* value.c: Use string.h, not gdb_string.h.
	* varobj.c: Use string.h, not gdb_string.h.
	* vax-tdep.c: Use string.h, not gdb_string.h.
	* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
	* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
	* windows-nat.c: Use string.h, not gdb_string.h.
	* xcoffread.c: Use string.h, not gdb_string.h.
	* xml-support.c: Use string.h, not gdb_string.h.
	* xstormy16-tdep.c: Use string.h, not gdb_string.h.
	* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
2013-11-18 13:29:00 -07:00
Keith Seitz d7561cbbf2 Constification of parse_linespec and fallout:
https://sourceware.org/ml/gdb-patches/2013-09/msg01017.html
https://sourceware.org/ml/gdb-patches/2013-09/msg01018.html
https://sourceware.org/ml/gdb-patches/2013-09/msg01019.html
https://sourceware.org/ml/gdb-patches/2013-09/msg01020.html
2013-10-02 00:46:07 +00:00
Pedro Alves a0bcdaa75e More invalid pointer to pointer conversions.
As a follow up to:

  http://sourceware.org/ml/gdb-patches/2013-03/msg00449.html

In a nutshell, casts between 'char **' <-> 'unsigned char **' and
'char **' <-> 'const char **' are invalid.

I grepped for "\*\*) &" and found these.  There's another one in
demangle.c, but I've split fixing that one to a separate patch.

I think the ada_decode_symbol change is perhaps the one that could be
surprising.  The function's description has this comment, which makes
things much clearer:

   The GSYMBOL parameter is "mutable" in the C++ sense: logically
   const, but nevertheless modified to a semantically equivalent form
   when a decoded name is cached in it.  */

 const char *
 ada_decode_symbol (const struct general_symbol_info *gsymbol)

With that out of the way, I think the patch ends up being pretty
obvious.

Tested on x86_64 Fedora 17.

gdb/
2013-03-13  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (ada_decode_symbol): Cast away constness of GSYMBOL
	rather than casting 'const char * const *' to 'const char **'.
	* ada-lex.l (processInt): Make "trailer" local const.  Remove
	'const char **' cast.
	* arm-linux-tdep.c (arm_stap_parse_special_token): Add 'char *'
	locals, and use those as strtol output pointer, instead than doing
	invalid casts to from 'const char **' to 'char **'.
	(_initialize_demangle): Remove cast.
	* i386-tdep.c (i386_stap_parse_special_token): : Add 'char *'
	locals, and use those as strtol output pointer, instead than doing
	invalid casts to from 'const char **' to 'char **'.
	* solib-dsbt.c (dsbt_get_initial_loadmaps): Remove 'gdb_byte**'
	casts.
	* stap-probe.c (stap_parse_register_operand)
	(stap_parse_single_operand): Likewise.
2013-03-13 16:45:11 +00:00
Paul N. Hilfinger 82d049abf1 Allow 'thread' to be used as a variable name in expressions.
GDB treats the identifiers 'if', 'thread', and 'task' unconditionally
as expression delimiters in Ada mode, which is correct for 'if' and 'task',
but wrong for 'thread' in cases such as

      print thread

Borrowing from c-exp.y, we observe that 'thread' must be followed by
numerals, whereas identifiers never are and treat them as delimiters
only in that case.

In the process, the current also refactors and incidentally fixes the
code for rewinding the input to before the delimiting tokens.  For
example, the code

      watch expr if i > 2

fails because the input is only rewound to just before the 'i',
leaving the 'if' as part of the expression (and thus making the
rest look like trailing junk rather than a conditional clause).

gdb/ChangeLog:

    * ada-lex.l (rules): Only recognize 'thread' as a
    delimiter when followed by numerals, as for c-exp.y.
    Use new rewind_to_char function to rewind the input for
    expression-delimiting tokens.
    (rewind_to_char): New function.

gdb/testsuite/ChangeLog:

    * gdb.ada/expr_delims.exp: New file.
    * gdb.ada/expr_delims/foo.adb: New file.
    * gdb.ada/expr_delims/pck.ads: New file.
    * gdb.ada/expr_delims/pck.adb: New file.
2013-03-12 09:03:11 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Pedro Alves e308454991 2012-03-01 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_modulus_from_name): Delete.
	* ada-lex.l (lexer_init): Make static.
2012-03-01 21:03:15 +00:00
Joel Brobecker 718cb7da5d [Ada] processId: Do not modify already encoded IDs
The processID function is supposed to take a symbol name, and process it
in a way that allows us to look that symbol up.  This patch is adding
a guard to make sure that we do not apply any transformation if we detect
that we are given an already-encoded symbol name.  For instance:

    gv___XR_pck__global_variable___XE

This happens in the case where we are trying to print the value of
a renaming. To do this, we simply parse and evaluate the XR symbol
name as an expression. Without this change, the expression parser
transforms gv___XR_pck__global_variable___XE into somethink like
gv___xr_pck__global_variable___xe, which then screws up the rest
of the renaming evaluation.

gdb/ChangeLog:

        * ada-lex.p (processId): Do not modify already encoded IDs.
        Update function documentation.
2012-02-29 19:53:16 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Joel Brobecker 0ec6cd0ca9 "delete" ada-lex.c:input function, not used.
* ada-lex.l: #define YY_NO_INPUT.
2010-01-19 09:50:48 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Joel Brobecker b9ee22330a Fix break *FUN'address thread NUM.
* ada-lex.l (task): Expand rule to also match the thread keyword.
2010-01-01 06:29:10 +00:00
Joel Brobecker 70575d34a7 Fix break *FUN'address task NUM.
* ada-lex.l (task): New rule.
        * ada-lang.c (valid_task_id): Make sure the Ada task list has
        been built before using it.
2010-01-01 06:06:49 +00:00
Nathan Sidwell 5b1ba0e546 * Makefile.in: Update license to GPLv3.
* ada-exp.y: Update license to GPLv3.
	* ada-lex.l: Update license to GPLv3.
	* c-exp.y: Update license to GPLv3.
	* cp-name-parser.y: Update license to GPLv3.
	* darwin-nat-info.c: Update license to GPLv3.
	* f-exp.y: Update license to GPLv3.
	* gdb_thread_db.h: Update license to GPLv3.
	* hppanbsd-nat.c: Update license to GPLv3.
	* hppanbsd-tdep.c: Update license to GPLv3.
	* hppaobsd-tdep.c: Update license to GPLv3.
	* jv-exp.y: Update license to GPLv3.
	* m2-exp.y: Update license to GPLv3.
	* objc-exp.y: Update license to GPLv3.
	* p-exp.y: Update license to GPLv3.
	* reply_mig_hack.awk: Update license to GPLv3.
	* reverse.c: Update license to GPLv3.
	* xtensa-xtregs.c: Update license to GPLv3.
2009-03-18 08:51:11 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Ulrich Weigand 3e79cecf02 * expression.h (struct expression): New member GDBARCH.
* parse.c (parse_exp_in_context): Initialize it.
	* parser-def.h (parse_gdbarch, parse_language): New macros.

	* ada-exp.y (parse_type): New macro.
	Replace builtin_type_ macros by using parse_type.
	Replace current_language by parse_language.
	* ada-lex.l (processInt): Replace current_gdbarch by parse_gdbarch.
	Replace builtin_type_ macros.

	* c-exp.y (parse_type): New macro.
	Replace builtin_type_ macros by using parse_type.
	(parse_number): Replace current_gdbarch by parse_gdbarch.
	(yylex): Replace current_language by parse_language.

	* f-exp.y (parse_type, parse_f_type): New macros.
	Replace builtin_type_ macros by using parse_{f_,}type.
	(parse_number): Replace current_gdbarch by parse_gdbarch.
	(yylex): Replace current_language by parse_language.

	* jv-exp.y (parse_type): New macro.
	(parse_number): Replace builtin_type_ macros by using parse_type.

	* m2-exp.y (parse_type, parse_m2_type): New macros.
	Replace builtin_type_ macros by using parse_{m2_,}type.

	* objc-exp.y (parse_type): New macro.
	Replace builtin_type_ macros by using parse_type.
	(parse_number): Replace current_gdbarch by parse_gdbarch.
	(yylex): Replace current_language by parse_language.

	* p-exp.y (parse_type): New macro.
	Replace builtin_type_ macros by using parse_type.
	(parse_number): Replace current_gdbarch by parse_gdbarch.
	(yylex): Replace current_language by parse_language.
2008-09-11 14:09:37 +00:00
Paul N. Hilfinger 690cc4ebad * ada-lang.c (discrete_type_high_bound,discrete_type_low_bound): Change
API to return LONGEST values rather than struct values.
(ada_evaluate_subexp): Change to use new API of discrete_type_low_bound
and discrete_type_high_bound.
(to_fixed_range_type): Create a range type in cases where
argument is base type and its limits are representable as ints.
(ada_is_modular_type): Correct so that base type must be integral.
* ada-lex.l (TRUEKEYWORD,FALSEKEYWORD): Make 'true' and 'false'
keywords when they appear alone, since we are phasing out
direct representation of these identifiers in ebugging data.
* ada-exp.y: Define 'true' and 'false' as primaries.
(type_boolean): New function.
(type_int,type_long,type_long_long,type_floattype_double)
(type_long_double): Remove uses of current_gdbarch for consistency
with type_boolean.
(write_int): Change comment to indicate that it might write boolean
constant as well.
* ada-typeprint.c (ada_print_type): Print '(false, true)' for boolean
type, since will no longer be represented as enumerated type in
debugging data.
* ada-valprint.c (print_optional_low_bound): Handle boolean case
as well.
2008-08-19 10:10:39 +00:00
Thiago Jung Bauermann 689e4e2d8a * doublest.h (DOUBLEST_PRINT_FORMAT): Remove % from string.
(DOUBLEST_SCAN_FORMAT): Likewise.
	* dfp.c (decimal_from_floating): Use DOUBLEST_PRINT_FORMAT.
	* ada-lex.l (processReal): Prepend "%" to use of DOUBLEST_SCAN_FORMAT.
	* c-exp.y (parse_number): Likewise.
	* jv-exp.y (parse_number): Likewise.
	* objc-exp.y (parse_number): Likewise.
	* p-exp.y (parse_number): Likewise.
2008-01-09 19:27:15 +00:00
Daniel Jacobowitz 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +00:00
Ulrich Weigand ea06eb3dd8 2007-06-12 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (TARGET_FLOAT_BIT): Replace by gdbarch_float_bit.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* mdebugread.c (_initialize_mdebugread): Likewise.
	* m2-lang.c (m2_create_fundamental_type)
	(_initialize_m2_language): Likewise.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbarch.sh (TARGET_FLOAT_FORMAT): Replace by gdbarch_float_format.
	* value.c (unpack_double): Likewise (comment).
	* gdbtypes.c (build_gdbtypes): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* gdbarch.sh (TARGET_DOUBLE_BIT): Replace by gdbarch_double_bit.
	* valarith.c (value_binop): Likewise.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* mdebugread.c (_initialize_mdebugread): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* cris-tdep.c (cris_gdbarch_init): Likewise (comment).
	* c-lang.c (c_create_fundamental_type): Likewise.
	* ada-lex.l (processReal): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbarch.sh (TARGET_DOUBLE_FORMAT): Replace by gdbarch_double_format.
	* value.c (unpack_double): Likewise (comment).
	* gdbtypes.c (build_gdbtypes): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* gdbarch.sh (TARGET_LONG_DOUBLE_BIT): Replace by
	gdbarch_long_double_bit.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* ada-lex.l (processReal): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbarch.sh (TARGET_LONG_DOUBLE_FORMAT): Replace by
	gdbarch_long_double_format.
	* gdbtypes.c (build_gdbtypes): Likewise.
	* doublest.c (floatformat_from_length): Likewise.
	* gdbarch.c, gdbarch.h: Regenerate.
2007-06-12 16:33:20 +00:00
Ulrich Weigand 9a76efb656 2007-06-12 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (TARGET_SHORT_BIT): Replace by gdbarch_int_bit.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise.
	* gdbtypes.c (build_gdbtypes, gdbtypes_post_init): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* gdbarch.sh (TARGET_INT_BIT): Replace by gdbarch_int_bit.
	* c-exp.y (parse_number): Likewise.
	* objc-exp.y (parse_number): Likewise.
	* ada-lex.l (processInt): Likewise.
	* f-exp.y (parse_number): Likewise.
	* p-exp.y (parse_number): Likewise.
	* ada-lang.c (ada_create_fundamental_type, ada_language_arch_info)
	(gdbtypes_post_init, build_gdbtypes): Likewise.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* parse.c (build_parse): Likewise.
	* xcoffread.c (_initialize_xcoffread): Likewise.
	* stabsread.c (define_symbol, read_one_struct_field, read_enum_type)
	(read_range_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* f-lang.c (build_fortran_types, f_create_fundamental_type): Likewise.
	* m2-lang.c (m2_create_fundamental_type, _initialize_m2_language)
	(m2_create_fundamental_type): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* coffread.c (coff_read_enum_type): Likewise.
	* mdebugread.c (parse_symbol, _initialize_mdebugread): Likewise.
	* dwarf2read.c (new_symbol): Likewise.
	* gdbarch.sh (TARGET_LONG_BIT): Replace by gdbarch_long_bit.
	* c-exp.y (parse_number): Likewise.
	* objc-exp.y (parse_number): Likewise.
	* ada-lex.l (processInt): Likewise.
	* f-exp.y (parse_number): Likewise.
	* p-exp.y (parse_number): Likewise.
	* valarith.c (value_binop): Likewise.
	* symfile.c (read_target_long_array, simple_overlay_update_1): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbtypes.c (build_gdbtypes, gdbtypes_post_init): Likewise.
	* symfile.c (TARGET_LONG_BYTES): Likewise.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* f-lang.c (f_create_fundamental_type): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* coffread.c (decode_base_type): Likewise.
	* gdbarch.sh (TARGET_LONG_LONG_BIT): Replace by gdbarch_long_long_bit.
	* c-exp.y (parse_number): Likewise.
	* objc-exp.y (parse_number): Likewise.
	* p-exp.y (parse_number): Likewise.
	* ada-lang.c (ada_create_fundamental_type)
	(ada_language_arch_info): Likewise.
	* gdbtypes.c (gdbtypes_post_init, build_gdbtypes): Likewise.
	* stabsread.c (read_range_type): Likewise.
	* p-lang.c (pascal_create_fundamental_type): Likewise.
	* objc-lang.c (objc_create_fundamental_type): Likewise.
	* m2-lang.c (m2_create_fundamental_type): Likewise.
	* f-lang.c (f_create_fundamental_type): Likewise.
	* c-lang.c (c_create_fundamental_type): Likewise.
	* gdbarch.c, gdbarch.h: Regenerate.
2007-06-12 15:33:04 +00:00
Daniel Jacobowitz 6aba47ca06 Copyright updates for 2007. 2007-01-09 17:59:20 +00:00
Daniel Jacobowitz 253c8abb67 * ada-lex.l (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int)
(strtoulst): Moved to ...
	* utils.c (HIGH_BYTE_POSN, is_digit_in_base, digit_to_int)
	(strtoulst): ... here.  Enhanced to behave more similarly
	to strtoul.
	* defs.h (strtoulst): New prototype.
2006-09-21 13:50:51 +00:00
Daniel Jacobowitz a6205f535a * doublest.h: Conditionalize DOUBLEST on PRINTF_HAS_LONG_DOUBLE
also.
	(DOUBLEST_FORMAT): Rename to DOUBLEST_PRINT_FORMAT.
	(DOUBLEST_SCAN_FORMAT): New.
	* ada-lex.l (PRINTF_HAS_LONG_DOUBLE): Remove redefinitions.
	(processReal): Use DOUBLEST_SCAN_FORMAT.
	* c-exp.y (parse_number): Likewise.
	* jv-exp.y (parse_number): Likewise.
	* objc-exp.y (parse_number): Likewise.
	* p-exp.y (parse_number): Likewise.
2006-02-23 18:43:41 +00:00
Paul N. Hilfinger e1d5a0d256 * ada-exp.y, ada-lex.l, ada-typeprint.c: I18n markup.
* ada-tasks.c, ada-lang.c: I18n markup.
Editorial: change "can not" => "cannot" throughout.
2006-01-08 07:19:40 +00:00
Paul N. Hilfinger 52ce64369c * ada-exp.y: Considerable reorganization to move functionality
from ada-lex.l to here, where it is logically more appropriate.
	The original reason, however, was to prevent premature name
	lookups for selector names in record aggregates.
	(BLOCKNAME, TYPENAME, OBJECT_RENAMING): Remove; lexer now returns
	NAME for all of these.
	(VAR): New artificial token to clarify precedence rules.
	(OTHERS): New lexeme.
	(empty_stoken): New symbol.
	(%union): Remove ssym, voidval.
	(%type): Remove <voidval> type declarations.
	(syntax definitions): Add aggregates.
	Remove distinction between NAME, TYPENAME, BLOCKNAME, OBJECT_RENAMING.
	Rename some non-terminals to be closer to reference manual usage.
	Tighten up expression syntax to disallow certain non-Ada
	constructions such as X and then Y or else Z.
	(ada_parse): Remove initialization of left_block_context.
	(write_var_from_name): Remove.
	(write_var_or_type): New function, containing previous code from
	defunct write_var_from_name and name_lookup.
	(block_lookup): New function, moved from ada-lex.l
	(select_possible_type_sym): New function, factored out of
	name_lookup, which used to be in ada-lex.l.
	(find_primitive_type): Ditto.
	(chop_selector): Ditto.
	(write_ambiguous_var): New function, factored out of defunct
	write_var_from_name.
	(write_selectors): New function.
	(write_name_assoc): New function.
	(write_exp_op_with_string): New function.

	* ada-lex.l (processId): Change interface to return stoken.
	(tempbuf, resize_tempbuf, tempbuf_size, tempbuf_len): Remove.
	(block_lookup, name_lookup): Remove.  Functionality moved to
	ada-exp.y.
	(state IN_STRING): Remove.
	(rules): Handle string escapes in processString.
	Add 'others' token.
	Return all NAMEs, BLOCKNAMEs, OBJECT_RENAMINGs, TYPENAMEs in
	yylval.sval (as simple strings).
	All name look-ups now handled in ada-exp.y.
	Introduce "::" (COLONCOLON) token and return as separate token.
	(processId): Change return convention.  Comment.
	Leave leading "'" in place.
	(processString): New function.
	(find_dot_all): Add note to comment.
	Fix problem that allowed match only at the end.

	* ada-lang.c: Introduce aggregates.
	(find_struct_field): Add new parameter to count fields skipped, and
	allow other output parameters to be NULL.
	(value_tag_from_contents_and_address, ada_value_struct_elt): Use
	new find_struct_field.
	(ada_index_struct_field, assign_aggregate, ada_is_array_type)
	(num_visible_fields, ada_index_struct_field_1, ada_index_struct_field)
	(num_component_specs, assign_component, assign_aggregate):
	(aggregate_assign_from_choices,aggregate_assign_positional)
	(aggregate_assign_others,add_component_interval):
	New functions.
	(ada_evaluate_subexp): Declare.
	Add aggregate-related operators.
	(ada_forward_operator_length): Declare.
	(resolve_subexp): Add cases for new aggregate operators and OP_NAME.
	Consolidate Ada operators, using ada_forward_operator_length.
	(ada_search_struct_field): Search in forward order.
	(ADA_OPERATORS): Add new aggregate operators.
	(ada_operator_length, ada_op_name, ada_forward_operator_length)
	(ada_dump_subexp_body, ada_print_subexp): Handle new aggregate
	operators and OP_NAME.
	(ada_type_of_array): Use longest_to_int.
	(value_assign_to_component): New function.
	(ada_forward_operator_length, ada_op_name, ada_dump_subexp_body):
	Add OP_NAME case.
	(ada_forward_operator_length, ada_dump_subexp_body):
	Add OP_STRING case.

	* ada-lang.h (enum ada_operator): Add OP_AGGREGATE, OP_OTHERS,
	OP_CHOICES, OP_DISCRETE_RANGE, OP_POSITIONAL.
2006-01-02 09:46:34 +00:00