summaryrefslogtreecommitdiff
path: root/gdb/parser-defs.h
AgeCommit message (Collapse)Author
2018-01-02Update copyright year range in all GDB filesJoel Brobecker
gdb/ChangeLog: Update copyright year range in all GDB files
2017-12-30C++-ify parser_stateTom Tromey
This mildly C++-ifies parser_state and stap_parse_info -- just enough to remove some cleanups. This version includes the changes implemented by Simon. Regression tested by the buildbot. gdb/ChangeLog 2017-12-30 Tom Tromey <tom@tromey.com> Simon Marchi <simon.marchi@ericsson.com> * stap-probe.h (struct stap_parse_info): Add constructor, destructor. * stap-probe.c (stap_parse_argument): Update. * rust-exp.y (rust_lex_tests): Update. * parser-defs.h (struct parser_state): Add constructor, destructor, release method. <expout>: Change type to expression_up. (null_post_parser): Change type. (initialize_expout, reallocate_expout): Remove. * parse.c (parser_state::parser_state): Rename from initialize_expout. (parser_state::release): Rename from reallocate_expout. (write_exp_elt, parse_exp_in_context_1, increase_expout_size): Update. (null_post_parser): Change type of "exp". * dtrace-probe.c (dtrace_probe::build_arg_exprs): Update. * ada-lang.c (resolve, resolve_subexp) (replace_operator_with_call): Change type of "expp". * language.h (struct language_defn) <la_post_parser>: Change type of "expp".
2017-10-25Target FP: Use target format throughout expression parsingUlrich Weigand
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-09-04Make "p S::method() const::static_var" work tooPedro Alves
Trying to print a function local static variable of a const-qualified method still doesn't work after the previous fixes: (gdb) p 'S::method() const'::static_var $1 = {i1 = 1, i2 = 2, i3 = 3} (gdb) p S::method() const::static_var No symbol "static_var" in specified context. The reason is that the expression parser/evaluator loses the "const", and the above unquoted case is just like trying to print a variable of the non-const overload, if it exists, even. As if the above unquoted case had been written as: (gdb) p S::method()::static_var No symbol "static_var" in specified context. We can see the problem without static vars in the picture. With: struct S { void method (); void method () const; }; Compare: (gdb) print 'S::method(void) const' $1 = {void (const S * const)} 0x400606 <S::method() const> (gdb) print S::method(void) const $2 = {void (S * const)} 0x4005d8 <S::method()> # wrong method! That's what we need to fix. If we fix that, the function local static case starts working. The grammar production for function/method types is this one: exp: exp '(' parameter_typelist ')' const_or_volatile This results in a TYPE_INSTANCE expression evaluator operator. For the example above, we get something like this ("set debug expression 1"): ... 0 TYPE_INSTANCE 1 TypeInstance: Type @0x560fda958be0 (void) 5 OP_SCOPE Type @0x560fdaa544d8 (S) Field name: `method' ... While evaluating TYPE_INSTANCE, we end up in value_struct_elt_for_reference, trying to find the method named "method" that has the prototype recorded in TYPE_INSTANCE. In this case, TYPE_INSTANCE says that we're looking for a method that has "(void)" as parameters (that's what "1 TypeInstance: Type @0x560fda958be0 (void)" above means. The trouble is that nowhere in this mechanism do we communicate to value_struct_elt_for_reference that we're looking for the _const_ overload. value_struct_elt_for_reference only compared parameters, and the non-const "method()" overload has matching parameters, so it's considered the right match... Conveniently, the "const_or_volatile" production in the grammar already records "const" and "volatile" info in the type stack. The type stack is not used in this code path, but we can borrow the information. The patch converts the info in the type stack to an "instance flags" enum, and adds that as another element in TYPE_INSTANCE operators. This type instance flags is then applied to the temporary type that is passed to value_struct_elt_for_reference for matching. The other side of the problem is that methods in the debug info aren't marked const/volatile, so with that in place, the matching never finds const/volatile-qualified methods. The problem is that in the DWARF, there's no indication at all whether a method is const/volatile qualified... For example (c++filt applied to the linkage name for convenience): <2><d3>: Abbrev Number: 6 (DW_TAG_subprogram) <d4> DW_AT_external : 1 <d4> DW_AT_name : (indirect string, offset: 0x3df): method <d8> DW_AT_decl_file : 1 <d9> DW_AT_decl_line : 58 <da> DW_AT_linkage_name: (indirect string, offset: 0x5b2): S::method() const <de> DW_AT_declaration : 1 <de> DW_AT_object_pointer: <0xe6> <e2> DW_AT_sibling : <0xec> I see the same with both GCC and Clang. The patch works around this by extracting the cv qualification from the "const" and "volatile" in the demangled name. This will need further tweaking for "&" and "const &" overloads, but we don't support them in the parser yet, anyway. The TYPE_CONST changes were necessary otherwise the comparisons in valops.c: if (TYPE_CONST (intype) != TYPE_FN_FIELD_CONST (f, j)) continue; would fail, because when both TYPE_CONST() TYPE_FN_FIELD_CONST() were true, their values were different. BTW, I'm recording the const/volatile-ness of methods in the TYPE_FN_FIELD info because #1 - I'm not sure it's kosher to change the method's type directly (vs having to call make_cv_type to create a new type), and #2 it's what stabsread.c does: ... case 'A': /* Normal functions. */ new_sublist->fn_field.is_const = 0; new_sublist->fn_field.is_volatile = 0; (*pp)++; break; case 'B': /* `const' member functions. */ new_sublist->fn_field.is_const = 1; new_sublist->fn_field.is_volatile = 0; ... After all this, this finally all works: print S::method(void) const $1 = {void (const S * const)} 0x400606 <S::method() const> (gdb) p S::method() const::static_var $2 = {i1 = 1, i2 = 2, i3 = 3} gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * c-exp.y (function_method, function_method_void): Add current instance flags to TYPE_INSTANCE. * dwarf2read.c (check_modifier): New. (compute_delayed_physnames): Assert that only C++ adds delayed physnames. Mark fn_fields as const/volatile depending on physname. * eval.c (make_params): New type_instance_flags parameter. Use it as the new type's instance flags. (evaluate_subexp_standard) <TYPE_INSTANCE>: Extract the instance flags element and pass it to make_params. * expprint.c (print_subexp_standard) <TYPE_INSTANCE>: Handle instance flags element. (dump_subexp_body_standard) <TYPE_INSTANCE>: Likewise. * gdbtypes.h: Include "enum-flags.h". (type_instance_flags): New enum-flags type. (TYPE_CONST, TYPE_VOLATILE, TYPE_RESTRICT, TYPE_ATOMIC) (TYPE_CODE_SPACE, TYPE_DATA_SPACE): Return boolean. * parse.c (operator_length_standard) <TYPE_INSTANCE>: Adjust. (follow_type_instance_flags): New function. (operator_check_standard) <TYPE_INSTANCE>: Adjust. * parser-defs.h (follow_type_instance_flags): Declare. * valops.c (value_struct_elt_for_reference): const/volatile must match too. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/func-static.c (S::method const, S::method volatile) (S::method volatile const): New methods. (c_s, v_s, cv_s): New instances. (main): Call method() on them. * gdb.base/func-static.exp (syntax_re, cannot_resolve_re): New variables. (cannot_resolve): New procedure. (cxx_scopes_list): Test cv methods. Add print-scope-quote and print-quote-unquoted columns. (do_test): Test printing each scope too.
2017-04-05-Wwrite-strings: The RestPedro Alves
This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-03-20Support rvalue reference type in parserArtemiy Volkov
This patch implements correct parsing of C++11 rvalue reference typenames. This is done in full similarity to the handling of regular references by adding a '&&' token handling in c-exp.y, defining an rvalue reference type piece, and implementing a follow type derivation in follow_types(). gdb/ChangeLog PR gdb/14441 * c-exp.y (ptr_operator): Handle the '&&' token in the typename. * parse.c (insert_type): Change assert statement. (follow_types): Handle rvalue reference types. * parser-defs.h (enum type_pieces) <tp_rvalue_reference>: New constant.
2017-03-14Make length_of_subexp staticSimon Marchi
It isn't used anywhere else than the file it's defined in. gdb/ChangeLog: * parse.c (length_of_subexp): Make static. * parser-defs.h (length_of_subexp): Remove.
2017-01-01update copyright year range in GDB filesJoel Brobecker
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.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-08-01Replace the block_found global with explicit data-flowPierre-Marie de Rodat
As Pedro suggested on gdb-patches@ (see https://sourceware.org/ml/gdb-patches/2015-05/msg00714.html), this change makes symbol lookup functions return a structure that includes both the symbol found and the block in which it was found. This makes it possible to get rid of the block_found global variable and thus makes block hunting explicit. gdb/ * ada-exp.y (write_object_renaming): Replace struct ada_symbol_info with struct block_symbol. Update field references accordingly. (block_lookup, select_possible_type_sym): Likewise. (find_primitive_type): Likewise. Also update call to ada_lookup_symbol to extract the symbol itself. (write_var_or_type, write_name_assoc): Likewise. * ada-lang.h (struct ada_symbol_info): Remove. (ada_lookup_symbol_list): Replace struct ada_symbol_info with struct block_symbol. (ada_lookup_encoded_symbol, user_select_syms): Likewise. (ada_lookup_symbol): Return struct block_symbol instead of a mere symbol. * ada-lang.c (defns_collected): Replace struct ada_symbol_info with struct block_symbol. (resolve_subexp, ada_resolve_function, sort_choices, user_select_syms, is_nonfunction, add_defn_to_vec, num_defns_collected, defns_collected, symbols_are_identical_enums, remove_extra_symbols, remove_irrelevant_renamings, add_lookup_symbol_list_worker, ada_lookup_symbol_list, ada_iterate_over_symbols, ada_lookup_encoded_symbol, get_var_value): Likewise. (ada_lookup_symbol): Return a block_symbol instead of a mere symbol. Replace struct ada_symbol_info with struct block_symbol. (ada_lookup_symbol_nonlocal): Likewise. (standard_lookup): Make block passing explicit through lookup_symbol_in_language. * ada-tasks.c (get_tcb_types_info): Update the calls to lookup_symbol_in_language to extract the mere symbol out of the returned value. (ada_tasks_inferior_data_sniffer): Likewise. * ax-gdb.c (gen_static_field): Likewise for the call to lookup_symbol. (gen_maybe_namespace_elt): Deal with struct symbol_in_block from lookup functions. (gen_expr): Likewise. * c-exp.y: Likewise. Remove uses of block_found. (lex_one_token, classify_inner_name, c_print_token): Likewise. (classify_name): Likewise. Rename the "sym" local variable to "bsym". * c-valprint.c (print_unpacked_pointer): Likewise. * compile/compile-c-symbols.c (convert_symbol_sym): Promote the "sym" parameter from struct symbol * to struct block_symbol. Use it to remove uses of block_found. Deal with struct symbol_in_block from lookup functions. (gcc_convert_symbol): Likewise. Update the call to convert_symbol_sym. * compile/compile-object-load.c (compile_object_load): Deal with struct symbol_in_block from lookup functions. * cp-namespace.c (cp_lookup_nested_symbol_1, cp_lookup_nested_symbol, cp_lookup_bare_symbol, cp_search_static_and_baseclasses, cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports, cp_lookup_symbol_imports_or_template, cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace, lookup_namespace_scope, cp_lookup_nonlocal, find_symbol_in_baseclass): Return struct symbol_in_block instead of mere symbols and deal with struct symbol_in_block from lookup functions. * cp-support.c (inspect_type, replace_typedefs, cp_lookup_rtti_type): Deal with struct symbol_in_block from lookup functions. * cp-support.h (cp_lookup_symbol_nonlocal, cp_lookup_symbol_from_namespace, cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol): Return struct symbol_in_block instead of mere symbols. * d-exp.y (d_type_from_name, d_module_from_name, push_variable, push_module_name): Deal with struct symbol_in_block from lookup functions. Remove uses of block_found. * eval.c (evaluate_subexp_standard): Update call to cp_lookup_symbol_namespace. * f-exp.y: Deal with struct symbol_in_block from lookup functions. Remove uses of block_found. (yylex): Likewise. * gdbtypes.c (lookup_typename, lookup_struct, lookup_union, lookup_enum, lookup_template_type, check_typedef): Deal with struct symbol_in_block from lookup functions. * guile/scm-frame.c (gdbscm_frame_read_var): Likewise. * guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise. (gdbscm_lookup_global_symbol): Likewise. * gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise. * go-exp.y: Likewise. Remove uses of block_found. (package_name_p, classify_packaged_name, classify_name): Likewise. * infrun.c (insert_exception_resume_breakpoint): Likewise. * jv-exp.y (push_variable): Likewise. * jv-lang.c (java_lookup_class, get_java_object_type): Likewise. * language.c (language_bool_type): Likewise. * language.h (struct language_defn): Update la_lookup_symbol_nonlocal to return a struct symbol_in_block rather than a mere symbol. * linespec.c (find_label_symbols): Deal with struct symbol_in_block from lookup functions. * m2-exp.y: Likewise. Remove uses of block_found. (yylex): Likewise. * mi/mi-cmd-stack.c (list_args_or_locals): Likewise. * objc-lang.c (lookup_struct_typedef, find_imps): Likewise. * p-exp.y: Likewise. Remove uses of block_found. (yylex): Likewise. * p-valprint.c (pascal_val_print): Likewise. * parse.c (write_dollar_variable): Likewise. Remove uses of block_found. * parser-defs.h (struct symtoken): Turn the SYM field into a struct symbol_in_block. * printcmd.c (address_info): Deal with struct symbol_in_block from lookup functions. * python/py-frame.c (frapy_read_var): Likewise. * python/py-symbol.c (gdbpy_lookup_symbol, gdbpy_lookup_global_symbol): Likewise. * skip.c (skip_function_command): Likewise. * solib-darwin.c (darwin_lookup_lib_symbol): Return a struct symbol_in_block instead of a mere symbol. * solib-spu.c (spu_lookup_lib_symbol): Likewise. * solib-svr4.c (elf_lookup_lib_symbol): Likewise. * solib.c (solib_global_lookup): Likewise. * solist.h (solib_global_lookup): Likewise. (struct target_so_ops): Update lookup_lib_global_symbol to return a struct symbol_in_block rather than a mere symbol. * source.c (select_source_symtab): Deal with struct symbol_in_block from lookup functions. * stack.c (print_frame_args, iterate_over_block_arg_vars): Likewise. * symfile.c (set_initial_language): Likewise. * symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct symbol_in_block. (SYMBOL_LOOKUP_FAILED_P): New predicate as a macro. (struct symbol_cache_slot): Turn the FOUND field into a struct symbol_in_block. (block_found): Remove. (eq_symbol_entry): Update to deal with struct symbol_in_block in cache slots. (symbol_cache_lookup): Return a struct symbol_in_block rather than a mere symbol. (symbol_cache_mark_found): Add a BLOCK parameter to fill appropriately the cache slots. Update callers. (symbol_cache_dump): Update cache slots handling to the type change. (lookup_symbol_in_language, lookup_symbol, lookup_language_this, lookup_symbol_aux, lookup_local_symbol, lookup_symbol_in_objfile, lookup_global_symbol_from_objfile, lookup_symbol_in_objfile_symtabs, lookup_symbol_in_objfile_from_linkage_name, lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block, lookup_static_symbol, lookup_global_symbol): Return a struct symbol_in_block rather than a mere symbol. Deal with struct symbol_in_block from other lookup functions. Remove uses of block_found. (lookup_symbol_in_block): Remove uses of block_found. (struct global_sym_lookup_data): Turn the RESULT field into a struct symbol_in_block. (lookup_symbol_global_iterator_cb): Update references to the RESULT field. (search_symbols): Deal with struct symbol_in_block from lookup functions. * symtab.h (struct symbol_in_block): New structure. (block_found): Remove. (lookup_symbol_in_language, lookup_symbol, basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block, looku_static_symbol, lookup_global_symbol, lookup_symbol_in_block, lookup_language_this, lookup_global_symbol_from_objfile): Return a struct symbol_in_block rather than just a mere symbol. Update comments to remove mentions of block_found. * valops.c (find_function_in_inferior, value_struct_elt_for_reference, value_maybe_namespace_elt, value_of_this): Deal with struct symbol_in_block from lookup functions. * value.c (value_static_field, value_fn_field): Likewise.
2015-02-27C++ keyword cleanliness, mostly auto-generatedPedro Alves
This patch renames symbols that happen to have names which are reserved keywords in C++. Most of this was generated with Tromey's cxx-conversion.el script. Some places where later hand massaged a bit, to fix formatting, etc. And this was rebased several times meanwhile, along with re-running the script, so re-running the script from scratch probably does not result in the exact same output. I don't think that matters anyway. gdb/ 2015-02-27 Tom Tromey <tromey@redhat.com> Pedro Alves <palves@redhat.com> Rename symbols whose names are reserved C++ keywords throughout. gdb/gdbserver/ 2015-02-27 Tom Tromey <tromey@redhat.com> Pedro Alves <palves@redhat.com> Rename symbols whose names are reserved C++ keywords throughout.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-10-26Move block_found decl to symtab.h.Doug Evans
gdb/ChangeLog: * parser-defs.h (block_found): Move decl from here ... * symtab.h (block_found): ... to here.
2014-07-30Update comments to operator_checkYao Qi
Hello, I happen to read the code and find the comments to operator_check are incorrect. This patch is to fix the comments per my understanding. The comments and field operator_check was added by this patch https://sourceware.org/ml/gdb-patches/2010-04/msg00556.html but the inconsistency between code and comments wasn't pointed out during the review. gdb: 2014-07-30 Yao Qi <yao@codesourcery.com> * parser-defs.h (struct exp_descriptor) <operator_check>: Update comments. * parse.c (exp_iterate): Update comments.
2014-03-27Remove `expout*' globals from parser-defs.hSergio Durigan Junior
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-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker
2013-10-02Constification of parse_linespec and fallout:Keith Seitz
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-08-05remove msymbol_objfileTom Tromey
This is another patch in my ongoing series to "split" objfile to share more read-only data across inferiors. See http://sourceware.org/gdb/wiki/ObjfileSplitting When symbols are finally shared, there will be no back-link from the symbol to its containing objfile, because there may be more than one such objfile. So, all such back-links must be removed. One hidden back-link is the msymbol_objfile function. Since (eventually) a symbol may appear in more than one objfile, trying to look up the objfile given just a symbol cannot work. This patch removes msymbol_objfile in favor of using a bound minimal symbol. It introduces a new function to make this conversion simpler in some spots. The bonus of this patch is that using msymbol_objfile is slower than simply looking up the owning objfile in the first place. Built and regtested on x86-64 Fedora 18. * ada-exp.y (write_var_or_type): Use bound_minimal_symbol. * ada-lang.c (ada_lookup_simple_minsym): Return bound_minimal_symbol. * ada-lang.h (ada_lookup_simple_minsym): Update. * c-exp.y (variable): Use lookup_bound_minimal_symbol. * f-exp.y (variable): Use lookup_bound_minimal_symbol. * go-exp.y (variable): Use lookup_bound_minimal_symbol. * jv-exp.y (push_expression_name): Use lookup_bound_minimal_symbol. * m2-exp.y (variable): Use lookup_bound_minimal_symbol. * minsyms.c (msymbol_objfile): Remove. (lookup_minimal_symbol_internal): New function, from lookup_minimal_symbol. (lookup_minimal_symbol): Rewrite using lookup_minimal_symbol_internal. (lookup_bound_minimal_symbol): New function. * minsyms.h (msymbol_objfile): Remove. (lookup_bound_minimal_symbol): Declare. * p-exp.y (variable): Use lookup_bound_minimal_symbol. * parse.c (write_exp_msymbol): Change parameter to a bound_minimal_symbol. (write_dollar_variable): Use lookup_bound_minimal_symbol. * parser-defs.h (write_exp_msymbol): Update. * printcmd.c (address_info): Use lookup_bound_minimal_symbol. * symfile.c (simple_read_overlay_table): Use lookup_bound_minimal_symbol. * symtab.c (skip_prologue_sal): Don't use msymbol_objfile. (search_symbols): Likewise. (print_msymbol_info): Take a bound_minimal_symbol argument. (symtab_symbol_info, rbreak_command): Update. * symtab.h (struct symbol_search) <msymbol>: Change type to bound_minimal_symbol. * valops.c (find_function_in_inferior): Use lookup_bound_minimal_symbol. * value.c (value_fn_field): Use lookup_bound_minimal_symbol.
2013-06-26I found this issue when I was debugging something else on IA-64. BothSergio Durigan Junior
ax-gdb.h and parser-defs.h could be made more self-contained by forward declaring types or including the necessary header files. This commit does this. 2013-06-26 Sergio Durigan Junior <sergiodj@redhat.com> * ax-gdb.h (union exp_element): Forward declare. * parser-defs.h: Include expression.h.
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker
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.
2012-12-07 * ada-lang.c (ada_make_symbol_completion_list): Add 'code'Tom Tromey
argument, assertion. * c-exp.y (typebase): Add completion productions. * completer.c (expression_completer): Handle tag completion. * expression.h (parse_expression_for_completion): Add argument. * f-lang.c (f_make_symbol_completion_list): Add 'code' argument. * language.h (struct language_defn) <la_make_symbol_completion_list>: Add 'code' argument. * parse.c (expout_tag_completion_type, expout_completion_name): New globals. (mark_struct_expression): Add assertion. (mark_completion_tag): New function. (parse_exp_in_context): Initialize new globals. (parse_expression_for_completion): Add 'code' argument. Handle tag completion. * parser-defs.h (mark_completion_tag): Declare. * symtab.c (default_make_symbol_completion_list_break_on): Add 'code' argument. Update. (default_make_symbol_completion_list): Add 'code' argument. (make_symbol_completion_list): Update. (make_symbol_completion_type): New function. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list): Update. (make_symbol_completion_type): Declare. testsuite * gdb.base/break1.c (enum some_enum, union some_union): New. (some_enum_global, some_union_global, some_value): New globals. * gdb.base/completion.exp: Add tag completion tests.
2012-12-03 * ada-exp.y (write_object_renaming, write_var_or_type)Tom Tromey
(write_ambiguous_var, write_var_from_sym): Make blocks const. * ada-lang.c (replace_operator_with_call) (find_old_style_renaming_symbol): Make blocks const. * ada-lang.h (ada_find_renaming_symbol): Update. (struct ada_symbol_info) <block>: Now const. * breakpoint.c (watch_command_1): Update. * breakpoint.h (struct watchpoint) <exp_valid_block, cond_exp_valid_block>: Now const. * c-exp.y (classify_inner_name, classify_name): Make block argument const. * expprint.c (print_subexp_standard) <OP_VAR_VALUE>: Make 'b' const. * expression.h (innermost_block, parse_exp_1): Update. (union exp_element) <block>: Now const. * gdbtypes.c (lookup_template_type, lookup_enum, lookup_union) (lookup_struct): Make block argument const. * gdbtypes.h (lookup_template_type): Update. * go-exp.y (classify_name, classify_packaged_name) (package_name_p): Make block argument const. * objc-lang.c (lookup_struct_typedef): Make block argument const. * objc-lang.h (lookup_struct_typedef): Update. * parse.c (parse_exp_in_context, parse_exp_1) (write_exp_elt_block): Make block arguments const. (expression_context_block, innermost_block): Now const. * parser-defs.h (write_exp_elt_block): Update. (expression_context_block, innermost_block, block_found): Now const. * printcmd.c (struct display) <block>: Now const. * symtab.h (lookup_struct, lookup_union, lookup_enum): Update. * valops.c (address_of_variable): Make block argument const. * value.h (value_of_variable): Update. * varobj.c (struct varobj_root) <valid_block>: Now const.
2012-10-19Document exp_descriptor.op_name should never return NULL.Joel Brobecker
This documents a constaint that struct exp_descriptor's "op_name" method implementation should obey. This might not have been part of the initial design, but is currently true of all instantiations, and already assumed by the current users. gdb/ChangeLog: * parser-defs.h (struct exp_descriptor): Document constraint on return value for "op_name" callbacks.
2012-07-06 PR exp/9608:Tom Tromey
* c-exp.y (%union) <tvec>: Change type. (func_mod): Now uses <tvec> type. (exp): Update for tvec change. (direct_abs_decl): Push the typelist. (func_mod): Return a typelist. (nonempty_typelist): Update for tvec change. * gdbtypes.c (lookup_function_type_with_arguments): New function. * gdbtypes.h (lookup_function_type_with_arguments): Declare. * parse.c (pop_type_list): New function. (push_typelist): New function. (follow_types): Handle tp_function_with_arguments. * parser-defs.h (type_ptr): New typedef. Define a VEC. (enum type_pieces) <tp_function_with_arguments>: New constant. (union type_stack_elt) <typelist_val>: New field. (push_typelist): Declare. testsuite * gdb.base/whatis.exp: Add regression test.
2012-07-06 * c-exp.y (%union) <type_stack>: New field.Tom Tromey
(abs_decl, direct_abs_decl): Use <type_stack> type. Update. (ptr_operator_ts): New production. (ptype): Update. * parse.c (type_stack_reserve): New function. (check_type_stack_depth): Use it. (pop_type_stack, append_type_stack, push_type_stack) (get_type_stack, type_stack_cleanup): New functions. (follow_types): Handle tp_type_stack. (_initialize_parse): Simplify initialization. * parser-defs.h (enum type_pieces) <tp_type_stack>: New constant. (union type_stack_elt) <stack_val>: New field. (get_type_stack, append_type_stack, push_type_stack) (type_stack_cleanup): Declare. testsuite * gdb.base/whatis.exp: Add tests.
2012-07-06 * parser-defs.h (type_stack, type_stack_size, type_stack_depth):Tom Tromey
Remove. (struct type_stack): New. * parse.c (type_stack, type_stack_size, type_stack_depth): Remove. (type_stack): New global. (parse_exp_in_context, check_type_stack_depth) (insert_into_type_stack, insert_type, push_type, push_type_int) (insert_type_address_space, pop_type, pop_type_int) (_initialize_parse): Update.
2012-06-19 PR exp/9514:Tom Tromey
* parser-defs.h (insert_type, insert_type_address_space): Declare. (push_type_address_space): Remove. * parse.c (insert_into_type_stack): New function. (insert_type): Likewise. (insert_type_address_space): Rename from push_type_address_space. Insert tp_space_identifier. * c-exp.y (ptr_operator): New production. (abs_decl): Use ptr_operator. (space_identifier): Call insert_type_address_space. (ptype): Don't use const_or_volatile_or_space_identifier. (const_or_volatile_noopt): Call insert_type. (conversion_type_id, conversion_declarator): New productions. (operator): Use conversion_type_id. testsuite * gdb.base/whatis.exp: Add tests.
2012-04-272012-04-27 Sergio Durigan Junior <sergiodj@redhat.com>Sergio Durigan Junior
Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-01-09 * parser-defs.h (namecopy): Delete.Doug Evans
* parse.c (namecopy, namecopy_size): Move into copy_name.
2012-01-04Copyright year update in most files of the GDB Project.Joel Brobecker
gdb/ChangeLog: Copyright year update in most files of the GDB Project.
2011-09-16gdb/Jan Kratochvil
Code cleanup. * parse.c (write_exp_elt): Change argument to pass a pointer of union `exp_element' instead of an element of the same and make the function static. (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): Change argument of `write_exp_elt' function call. Remove extra spaces from comments. * parser-defs.h (write_exp_elt): Remove prototype.
2011-01-102011-01-10 Michael Snyder <msnyder@vmware.com>Michael Snyder
* nto-procfs.c: Comment cleanup, mostly periods and spaces. * nto-tdep.c: Ditto. * nto-tdep.h: Ditto. * objc-exp.y: Ditto. * objc-lang.c: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * observer.c: Ditto. * opencl-lang.c: Ditto. * osabi.c: Ditto. * parse.c: Ditto. * parser-defs.h: Ditto. * p-exp.y: Ditto. * p-lang.c: Ditto. * posix-hdep.c: Ditto. * ppcbug-rom.c: Ditto. * ppc-linux-nat.c: Ditto. * ppc-linux-tdep.c: Ditto. * ppc-linux-tdep.h: Ditto. * ppcnbsd-tdep.c: Ditto. * ppcobsd-tdep.c: Ditto. * ppcobsd-tdep.h: Ditto. * ppc-sysv-tdep.c: Ditto. * ppc-tdep.h: Ditto. * printcmd.c: Ditto. * proc-abi.c: Ditto. * proc-flags.c: Ditto. * procfs.c: Ditto. * proc-utils.h: Ditto. * progspace.h: Ditto. * prologue-value.c: Ditto. * prologue-value.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * ravenscar-sparc-thread.c: Ditto. * ravenscar-thread.c: Ditto. * ravenscar-thread.h: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote.c: Ditto. * remote-fileio.c: Ditto. * remote-fileio.h: Ditto. * remote.h: Ditto. * remote-m32r-sdi.c: Ditto. * remote-mips.c: Ditto. * remote-sim.c: Ditto. * rs6000-aix-tdep.c: Ditto. * rs6000-nat.c: Ditto. * rs6000-tdep.c: Ditto.
2011-01-01run copyright.sh for 2011.Joel Brobecker
2010-08-19 PR exp/11926Doug Evans
* parser-defs.h (parse_float, parse_c_float): Declare. * parse.c (parse_float, parse_c_float): New function. * c-exp.y (parse_number): Call parse_c_float. * objc-exp.y (parse_number): Ditto. * p-exp.y (parse_number): Ditto. Use ANSI/ISO-style definition. * jv-exp.y (parse_number): Call parse_float, fix suffix handling. testsuite/ * gdb.base/printcmds.exp (test_float_accepted): New function. Move existing float tests there. Add tests for floats with suffixes. (test_float_rejected): New function. * gdb.java/jv-print.exp (test_float_accepted): New function. (test_float_rejected): New function. * gdb.objc/print.exp: New file. * gdb.pascal/print.exp: New file. * lib/objc.exp: New file.
2010-06-042010-06-04 Sergio Durigan Junior <sergiodj@redhat.com>Sergio Durigan Junior
* ada-lang.c (ada_operator_length): Constify `struct expression'. * parse.c (operator_length): Likewise. (operator_length_standard): Likewise. * parser-defs.h (operator_length): Likewise. (operator_length_standard): Likewise. (struct exp_descriptor <operator_length>): Likewise.
2010-05-02gdb/Jan Kratochvil
* ada-lang.c (lim_warning): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * amd64-tdep.c (amd64_insn_length_fprintf): Likewise. * cli-out.c (cli_field_fmt): New ATTRIBUTE_PRINTF. (cli_message, out_field_fmt): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * complaints.c (find_complaint): New ATTRIBUTE_PRINTF. (vcomplaint): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * complaints.h (complaint, internal_complaint): Likewise. * defs.h: Change ATTR_FORMAT to ATTRIBUTE_PRINTF in the top comment. (ATTR_FORMAT): Remove. (query, nquery, yquery, vprintf_filtered, vfprintf_filtered) (fprintf_filtered, fprintfi_filtered, printf_filtered, printfi_filtered) (vprintf_unfiltered, vfprintf_unfiltered, fprintf_unfiltered) (printf_unfiltered, xasprintf, xvasprintf, xstrprintf, xstrvprintf) (xsnprintf, verror, error, vfatal, fatal, internal_verror) (internal_error, internal_vwarning, internal_warning, warning) (vwarning): Change ATTR_FORMAT to ATTRIBUTE_PRINTF. * disasm.c (fprintf_disasm): Likewise. * exceptions.c (throw_it): Likewise. * exceptions.h (exception_fprintf, throw_verror, throw_vfatal) (throw_error): Likewise. * language.h (type_error, range_error): Likewise. * linespec.c (cplusplus_error): Likewise. * mi/mi-interp.c (mi_interp_query_hook): Likewise. * mi/mi-out.c (mi_field_fmt, mi_message): Likewise. * monitor.c (monitor_debug): Likewise. * parser-defs.h (parser_fprintf): Likewise. * serial.h (serial_printf): Likewise. * tui/tui-hooks.c (tui_query_hook): Likewise. * ui-out.c (default_field_fmt, default_message, uo_field_fmt) (uo_message): Likewise. * ui-out.h (ui_out_field_fmt, ui_out_message): Likewise. * utils.c (vfprintf_maybe_filtered, internal_vproblem, defaulted_query): Likewise. * xml-support.h (gdb_xml_debug, gdb_xml_error): Likewise.
2010-04-22gdb/Jan Kratochvil
Fix crashes on dangling display expressions. * ada-lang.c (ada_operator_check): New function. (ada_exp_descriptor): Fill-in the field operator_check. * c-lang.c (exp_descriptor_c): Fill-in the field operator_check. * jv-lang.c (exp_descriptor_java): Likewise. * m2-lang.c (exp_descriptor_modula2): Likewise. * scm-lang.c (exp_descriptor_scm): Likewise. * parse.c (exp_descriptor_standard): Likewise. (operator_check_standard): New function. (exp_iterate, exp_uses_objfile_iter, exp_uses_objfile): New functions. * parser-defs.h (struct exp_descriptor): New field operator_check. (operator_check_standard, exp_uses_objfile): New declarations. * printcmd.c: Remove the inclusion of solib.h. (display_uses_solib_p): Remove the function. (clear_dangling_display_expressions): Call lookup_objfile_from_block and exp_uses_objfile instead of display_uses_solib_p. * solist.h (struct so_list) <objfile>: New comment. * symtab.c (lookup_objfile_from_block): Remove the static qualifier. * symtab.h (lookup_objfile_from_block): New declaration. (struct general_symbol_info) <obj_section>: Extend the comment. gdb/testsuite/ Fix crashes on dangling display expressions. * gdb.base/solib-display.exp: Call gdb_gnu_strip_debug if LIBSEPDEBUG is SEP. (lib_flags): Remove the "debug" keyword. (libsepdebug): New variable for iterating new loop. (save_pf_prefix): New variable wrapping the loop. (sep_lib_flags): New variable derived from LIB_FLAGS. Use it. * lib/gdb.exp (gdb_gnu_strip_debug): Document the return code.
2010-02-10gdbTom Tromey
* parser-defs.h (parser_debug): Declare. * parse.c (_initialize_parse): Install "debug parser" set/show command. (parser_debug): New global. (show_parserdebug): New function. * c-exp.y (c_parse): Set yydebug. gdb/testsuite * gdb.texinfo (Debugging Output): Document set debug parser and show debug parser.
2010-01-01Update copyright year in most headers.Joel Brobecker
Automatic update by copyright.sh.
2009-03-20gdb:Tom Tromey
2009-03-19 Tom Tromey <tromey@redhat.com> Julian Brown <julian@codesourcery.com> PR i18n/7220, PR i18n/7821, PR exp/8815, PR exp/9103, PR i18n/9401, PR exp/9613: * NEWS: Update * value.h (value_typed_string): Declare. (val_print_string): Update. * valprint.h (print_char_chars): Update. * valprint.c (print_char_chars): Add type argument. Update. (val_print_string): Likewise. * valops.c (value_typed_string): New function. * utils.c (host_char_to_target): New function. (parse_escape): Use host_char_to_target, host_hex_value. Update. Remove '^' case. (no_control_char_error): Remove. * typeprint.c (print_type_scalar): Update. * scm-valprint.c (scm_scmval_print): Update. * scm-lang.h (scm_printchar, scm_printstr): Update. * scm-lang.c (scm_printchar): Add type argument. (scm_printstr): Likewise. * printcmd.c (print_formatted): Update. (print_scalar_formatted): Update. (printf_command) <wide_string_arg, wide_char_arg>: New constants. Handle '%lc' and '%ls'. * parser-defs.h (struct typed_stoken): New type. (struct stoken_vector): Likewise. (write_exp_string_vector): Declare. * parse.c (write_exp_string_vector): New function. * p-valprint.c (pascal_val_print): Update. * p-lang.h (is_pascal_string_type, pascal_printchar, pascal_printstr): Update. * p-lang.c (is_pascal_string_type): Remove 'char_size' argument. Add 'char_type' argument. (pascal_emit_char): Add type argument. (pascal_printchar): Likewise. (pascal_printstr): Likewise. * objc-lang.c (objc_emit_char): Add type argument. (objc_printchar): Likewise. (objc_printstr): Likewise. * macroexp.c (get_character_constant): Handle unicode characters. Use c_parse_escape. (get_string_literal): Handle unicode strings. Use c_parse_escape. * m2-valprint.c (print_unpacked_pointer): Update. (m2_print_array_contents): Update. (m2_val_print): Update. * m2-lang.c (m2_emit_char): Add type argument. (m2_printchar): Likewise. (m2_printstr): Likewise. * language.h (struct language_defn) <la_printchar>: Add type argument. <la_printstr, la_emitchar>: Likewise. (LA_PRINT_CHAR): Likewise. (LA_PRINT_STRING): Likewise. (LA_EMIT_CHAR): Likewise. * language.c (unk_lang_emit_char): Add type argument. (unk_lang_printchar): Likewise. (unk_lang_printstr): Likewise. * jv-valprint.c (java_val_print): Update. * jv-lang.c (java_emit_char): Add type argument. * f-valprint.c (f_val_print): Update. * f-lang.c (f_emit_char): Add type argument. (f_printchar): Likewise. (f_printstr): Likewise. * expprint.c (print_subexp_standard): Update. * charset.h (target_wide_charset): Declare. (c_target_char_has_backslash_escape, c_parse_backslash, host_char_print_literally, host_char_to_target, target_char_to_host, target_char_to_control_char): Remove. (enum transliterations): New type. (convert_between_encodings): Declare. (HOST_ESCAPE_CHAR): New define. (host_letter_to_control_character, host_hex_value): Declare. (enum wchar_iterate_result): New enum. (struct wchar_iterator): Declare. (make_wchar_iterator, make_cleanup_wchar_iterator, wchar_iterator, wchar_push_back): Declare. * charset-list.h: New file. * c-valprint.c (textual_name): New function. (textual_element_type): Handle wide character types. (c_val_print): Pass original type to textual_element_type. Handle wide character types. (c_value_print): Use textual_element_type. Pass original type of value to val_print. * c-lang.h (enum c_string_type): New type. (c_printchar, c_printstr): Update. * c-lang.c (classify_type): New function. (print_wchar): Likewise. (c_emit_char): Add type argument. Handle wide characters. (c_printchar): Likewise. (c_printstr): Add type argument. Handle wide and multibyte character sets. (convert_ucn): New function. (emit_numeric_character): Likewise. (convert_octal): Likewise. (convert_hex): Likewise. (ADVANCE): New macro. (convert_escape): New function. (parse_one_string): Likewise. (evaluate_subexp_c): Likewise. (exp_descriptor_c): New global. (c_language_defn): Use exp_descriptor_c. (cplus_language_defn): Likewise. (asm_language_defn): Likewise. (minimal_language_defn): Likewise. (charset_for_string_type): New function. * c-exp.y (%union): Add 'svec' and 'tsval'. (CHAR): New token. (exp): Add CHAR production. (string_exp): Rewrite. (exp) <string_exp>: Rewrite. (tempbuf): Now global. (tempbuf_init): New global. (parse_string_or_char): New function. (yylex) <tempbuf>: Now global. <tokptr, tempbufindex, tempbufsize, token_string, class_prefix>: Remove. Handle 'u', 'U', and 'L' prefixes. Call parse_string_or_char. (c_parse_escape): New function. * auxv.c (fprint_target_auxv): Update. * ada-valprint.c (ada_emit_char): Add type argument. (ada_printchar): Likewise. (ada_print_scalar): Update. (printstr): Add type argument. Update calls to ada_emit_char. (ada_printstr): Add type argument. (ada_val_print_array): Update. (ada_val_print_1): Likewise. * ada-lang.c (emit_char): Add type argument. * ada-lang.h (ada_emit_char, ada_printchar, ada_printstr): Add type arguments. * gdb_locale.h: Include langinfo.h. * charset.c (_initialize_charset): Set default host charset from the locale. Don't register charsets. Add target-wide-charset commands. Call find_charset_names. (struct charset, struct translation): Remove. (GDB_DEFAULT_HOST_CHARSET): Remove. (GDB_DEFAULT_TARGET_WIDE_CHARSET): New define. (target_wide_charset_name): New global. (show_host_charset_name): Handle "auto". (show_target_wide_charset_name): New function. (host_charset_enum, target_charset_enum): Remove. (charset_enum): New global. (all_charsets, register_charset, lookup_charset, all_translations, register_translation, lookup_translation): Remove. (simple_charset, ascii_print_literally, ascii_to_control): Remove. (iso_8859_print_literally, iso_8859_to_control, iso_8859_family_charset): Remove. (ebcdic_print_literally, ebcdic_to_control, ebcdic_family_charset): Remove. (struct cached_iconv, check_iconv_cache, cached_iconv_convert, register_iconv_charsets): Remove. (target_wide_charset_be_name, target_wide_charset_le_name): New globals. (identity_either_char_to_other): Remove. (set_be_le_names, validate): New functions. (backslashable, backslashed, represented): Remove. (default_c_target_char_has_backslash_escape): Remove. (default_c_parse_backslash, iconv_convert): Remove. (ascii_to_iso_8859_1_table, ascii_to_ebcdic_us_table, ascii_to_ibm1047_table, iso_8859_1_to_ascii_table, iso_8859_1_to_ebcdic_us_table, iso_8859_1_to_ibm1047_table, ebcdic_us_to_ascii_table, ebcdic_us_to_iso_8859_1_table, ebcdic_us_to_ibm1047_table, ibm1047_to_ascii_table, ibm1047_to_iso_8859_1_table, ibm1047_to_ebcdic_us_table): Remove. (table_convert_char, table_translation, simple_table_translation): Remove. (current_host_charset, current_target_charset, c_target_char_has_backslash_escape_func, c_target_char_has_backslash_escape_baton): Remove. (c_parse_backslash_func, c_parse_backslash_baton): Remove. (host_char_to_target_func, host_char_to_target_baton): Remove. (target_char_to_host_func, target_char_to_host_baton): Remove. (cached_iconv_host_to_target, cached_iconv_target_to_host): Remove. (lookup_charset_or_error, check_valid_host_charset): Remove. (set_host_and_target_charsets): Remove. (set_host_charset, set_target_charset): Remove. (set_host_charset_sfunc, set_target_charset_sfunc): Rewrite. (set_target_wide_charset_sfunc): New function. (show_charset): Print target wide character set. (host_charset, target_charset): Rewrite. (target_wide_charset): New function. (c_target_char_has_backslash_escape): Remove. (c_parse_backslash): Remove. (host_letter_to_control_character): New function. (host_char_print_literally): Remove. (host_hex_value): New function. (target_char_to_control_char): Remove. (cleanup_iconv): New function. (convert_between_encodings): New function. (target_char_to_host): Remove. (struct wchar_iterator): Define. (make_wchar_iterator, make_cleanup_wchar_iterator, wchar_iterator, wchar_push_back): New functions. (do_cleanup_iterator): New function. (char_ptr): New typedef. (charsets): New global. (add_one, find_charset_names): New functions. (default_charset_names): New global. (auto_host_charset_name): Likewise. * aclocal.m4, config.in, configure: Rebuild. * configure.ac: Call AM_LANGINFO_CODESET. (GDB_DEFAULT_HOST_CHARSET): Default to UTF-8. (AM_ICONV): Invoke earlier. * acinclude.m4: Include codeset.m4. Subst LIBICONV_INCLUDE and LIBICONV_LIBDIR. Check for libiconv in build tree. * Makefile.in (LIBICONV_LIBDIR, LIBICONV_INCLUDE): New macros. (INTERNAL_CFLAGS_BASE): Add LIBICONV_INCLUDE. (INTERNAL_LDFLAGS): Add LIBICONV_LIBDIR. * gdb_obstack.h (obstack_grow_wstr): New define. * gdb_wchar.h: New file. * defs.h: Include it. gdb/testsuite: * gdb.base/store.exp: Update for change to escape output. * gdb.base/callfuncs.exp (fetch_all_registers): Update for change to escape output. * gdb.base/pointers.exp: Update for change to escape output. * gdb.base/long_long.exp (gdb_test_long_long): Update for change to escape output. * gdb.base/constvars.exp (do_constvar_tests): Update for change to escape output. * gdb.base/call-rt-st.exp (print_struct_call): Update for change to escape output. * gdb.cp/ref-types.exp (gdb_start_again): Update for change to escape output. * gdb.base/setvar.exp: Update for change to escape output. * lib/gdb.exp (default_gdb_start): Set LC_CTYPE to C. * gdb.base/printcmds.exp (test_print_all_chars): Update for change to escape output. (test_print_string_constants): Likewise. * gdb.base/charset.exp (valid_host_charset): Check size of wchar_t. Handle UCS-2 and UCS-4. Add tests for wide and unicode cases. Handle "auto"-related output. * gdb.base/charset.c (char16_t, char32_t): New typedefs. (uvar, Uvar): New globals. gdb/doc: * gdb.texinfo (Character Sets): Remove obsolete text. Document set target-wide-charset. (Requirements): Mention iconv.
2009-01-03 Updated copyright notices for most files.Joel Brobecker
2008-09-11 * expression.h (struct expression): New member GDBARCH.Ulrich Weigand
* 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 * parser-defs.h (write_exp_msymbol): Remove TEXT_SYMBOL_TYPEUlrich Weigand
and DATA_SYMBOL_TYPE arguments. * parse.c (write_exp_msymbol): Remove TEXT_SYMBOL_TYPE and DATA_SYMBOL_TYPE arguments. Replace use of builtin_type_CORE_ADDR. (write_dollar_variable): Update call. * ada-exp.y (write_var_or_type): Update call. * c-exp.y: Likewise. * f-exp.y: Likewise. * jv-exp.y: Likewise. * m2-exp.y: Likewise. * objc-exp.y: Likewise. * p-exp.y: Likewise.
2008-06-06gdbTom Tromey
* value.h (evaluate_subexpression_type, extract_field_op): Declare. * printcmd.c (_initialize_printcmd): Use expression_completer for 'p', 'inspect', 'call'. * parser-defs.h (parse_field_expression): Declare. * parse.c: Include exceptions.h. (in_parse_field, expout_last_struct): New globals. (mark_struct_expression): New function. (prefixify_expression): Return int. (prefixify_subexp): Return int. Use expout_last_struct. (parse_exp_1): Update. (parse_exp_in_context): Add 'out_subexp' argument. Handle in_parse_field. (parse_field_expression): New function. * expression.h (parse_field_expression): Declare. (in_parse_field): Likewise. * eval.c (evaluate_subexpression_type): New function. (extract_field_op): Likewise. * completer.h (expression_completer): Declare. * completer.c (expression_completer): New function. (count_struct_fields, add_struct_fields): New functions. * c-exp.y (yyparse): Redefine. (COMPLETE): New token. (exp): New productions. (saw_name_at_eof, last_was_structop): New globals. (yylex): Return COMPLETE when needed. Recognize in_parse_field. (c_parse): New function. * breakpoint.c (_initialize_breakpoint): Use expression_completer for watch, awatch, and rwatch. * Makefile.in (parse.o): Depend on exceptions_h. gdb/testsuite * gdb.base/break1.c (struct some_struct): New struct. (values): New global. * gdb.base/completion.exp: Add field name completion test. gdb/doc * gdb.texinfo (Completion): Add field name example.
2008-01-01 Updated copyright notices for most files.Daniel Jacobowitz
2007-10-252007-10-25 Wu Zhou <woodzltc@cn.ibm.com>Thiago Jung Bauermann
Thiago Jung Bauermann <bauerman@br.ibm.com> * c-exp.y (YYSTYPE): Add typed_val_decfloat for decimal floating point in YYSTYPE union. (DECFLOAT) Add token and expression element handling code. (parse_number): Parse DFP constants, which end with suffix 'df', 'dd' or 'dl'. Return DECFLOAT. * eval.c (evaluate_subexp_standard): Call value_from_decfloat to handle OP_DECFLOAT. * expression.h (enum exp_opcode): Add an opcode (OP_DECFLOAT) for DFP constants. (union exp_element): Add decfloatconst to represent DFP elements, which is 16 bytes by default. * parse.c (write_exp_elt_decfloatcst): New function to write a decimal float const into the expression. (operator_length_standard): Set operator length for OP_DECFLOAT to 4. * parser-defs.h (write_exp_elt_decfloatcst): Prototype. * valarith.c (value_neg): Add code to handle the negation operation of DFP values. * value.c (value_from_decfloat): New function to get the value from a decimal floating point. * value.h (value_from_decfloat): Prototype.
2007-08-23 Switch the license of all .c files to GPLv3.Joel Brobecker
Switch the license of all .h files to GPLv3. Switch the license of all .cc files to GPLv3.
2007-06-05 * hppa-hpux-tdep.c (args_for_find_stub, HP_ACC_EH_notify_hook,Ulrich Weigand
HP_ACC_EH_set_hook_value, HP_ACC_EH_notify_callback, HP_ACC_EH_break, HP_ACC_EH_catch_throw, HP_ACC_EH_catch_catch, __eh_notification, hp_cxx_exception_support, hp_cxx_exception_support_initialized, eh_notify_hook_addr, eh_notify_callback_addr, eh_break_addr, eh_catch_throw_addr, break_callback_sal, setup_d_pid_in_inferior, find_stub_with_shl_get, cover_find_stub_with_shl_get, initialize_hp_cxx_exception_support, child_enable_exception_callback, current_ex_event, child_get_current_exception_event): Remove. (hppa_hpux_inferior_created): Remove. (hppa_hpux_init_abi): Do not install hppa_hpux_inferior_created. * breakpoint.h (deprecated_exception_catchpoints_are_fragile): Remove. (deprecated_exception_support_initialized): Remove. * breakpoint.c (deprecated_exception_catchpoints_are_fragile): Remove. (deprecated_exception_support_initialized): Remove. (breakpoint_init_inferior): Remove handling of non-zero deprecated_exception_catchpoints_are_fragile. * symtab.h (deprecated_hp_som_som_object_present): Remove. * symtab.c (deprecated_hp_som_som_object_present): Remove. * c-typeprint.c (c_type_print_base): Remove handling of non-zero deprecated_hp_som_som_object_present. * eval.c (evaluate_subexp_standard): Likewise. * valops.c (value_cast): Likewise. * parse.c (parse_nested_classes_for_hpacc, coloncolon): Remove. * parser-defs.h (parse_nested_classes_for_hpacc): Remove. * c-exp.y (yylex): Do not call parse_nested_classes_for_hpacc.
2007-01-09Copyright updates for 2007.Daniel Jacobowitz
2006-10-102006-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>Daniel Jacobowitz
Daniel Jacobowitz <dan@codesourcery.com> * Makefile.in (expprint.o, parse.o, target.o): Update. * dwarf2loc.c (dwarf_expr_tls_address): Move body to target_translate_tls_address. Call it. * eval.c (evaluate_subexp_standard): Handle UNOP_MEMVAL_TLS. * expprint.c (print_subexp_standard): Likewise. (op_name_standard, dump_subexp_body_standard): Likewise. * expression.h (enum exp_opcode): Add UNOP_MEMVAL_TLS. (union exp_element): Add objfile. * parse.c (write_exp_elt_objfile): New function. (msym_tls_symbol_type): New. (write_exp_msymbol): Handle TLS. (operator_length_standard): Handle UNOP_MEMVAL_TLS. (build_parse): Initialize msym_tls_symbol_type. * parser-defs.h (write_exp_elt_objfile): New prototype. * target.c (target_translate_tls_address): New. * target.h (target_translate_tls_address): Add prototype. 2006-10-09 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.threads/tls-nodebug.c, gdb.threads/tls-nodebug.exp: New test.