1. Sep 16, 2020
    • Andrew Burgess's avatar
      gdb: Convert language_data::la_varobj_ops to a method · b63a3f3f
      Andrew Burgess authored
      Convert language_data::la_varobj_ops member variable to a virtual
      method language_defn::varobj_ops.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_varobj_ops
      	initializer.
      	(ada_language::varobj_ops): New member function.
      	* c-lang.c (c_language_data): Remove la_varobj_ops
      	initializer.
      	(cplus_language_data): Likewise.
      	(cplus_language::varobj_ops): New member function.
      	(asm_language_data): Remove la_varobj_ops initializer.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* f-lang.c (f_language_data): Likewise.
      	* go-lang.c (go_language_data): Likewise.
      	* language.c (language_defn::varobj_ops): New function.
      	(unknown_language_data): Remove la_varobj_ops
      	initializer.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Remove la_varobj_ops field.
      	(language_defn::varobj_ops): Declare new member function.
      	* m2-lang.c (m2_language_data): Remove la_varobj_ops initializer.
      	* objc-lang.c (objc_language_data): Likewise.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      	* varobj.c (varobj_create): Update call to varobj_ops.
      	* varobj.h (default_varobj_ops): Delete define.
      b63a3f3f
    • Andrew Burgess's avatar
      gdb: Convert language_data::la_macro_expansion to a method · 1ac14a04
      Andrew Burgess authored
      Convert language_data::la_macro_expansion member variable to a virtual
      method language_defn::macro_expansion.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_macro_expansion
      	initializer.
      	* c-lang.c (c_language_data): Likewise.
      	(c_language::macro_expansion): New member function.
      	(cplus_language_data): Likewise.
      	(cplus_language::macro_expansion): New member function.
      	(asm_language_data): Likewise.
      	(asm_language::macro_expansion): New member function.
      	(minimal_language_data): Likewise.
      	(minimal_language::macro_expansion): New member function.
      	* d-lang.c (d_language_data): Remove la_macro_expansion
      	initializer.
      	* f-lang.c (f_language_data): Likewise.
      	* go-lang.c (go_language_data): Likewise.
      	* language.c (unknown_language_data): Likewise.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Remove la_macro_expansion field.
      	(language_defn::macro_expansion): New member function.
      	* m2-lang.c (m2_language_data): Remove la_macro_expansion
      	initializer.
      	* objc-lang.c (objc_language_data): Likewise.
      	(objc_language::macro_expansion): New member function.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	(opencl_language::macro_expansion): New member function.
      	* p-lang.c (pascal_language_data): Remove la_macro_expansion
      	initializer.
      	* rust-lang.c (rust_language_data): Likewise.
      	* symtab.c (default_collect_symbol_completion_matches_break_on):
      	Update call to macro_expansion.
      1ac14a04
    • Andrew Burgess's avatar
      gdb: Convert language_data::la_array_ordering to a method · 3a3440fb
      Andrew Burgess authored
      Convert language_data::la_array_ordering member variable to a virtual
      method language_defn::array_ordering.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_array_ordering
      	initializer.
      	* c-lang.c (c_language_data): Likewise.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* dwarf2/read.c (read_array_order): Update for call to
      	array_ordering.
      	* f-lang.c (f_language_data): Remove la_array_ordering
      	initializer.
      	(f_language::array_ordering): New member function.
      	* go-lang.c (go_language_data): Remove la_array_ordering
      	initializer.
      	* language.c (unknown_language_data): Likewise.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Delete la_array_ordering field.
      	(language_defn::array_ordering): New member function.
      	* m2-lang.c (m2_language_data): Remove la_array_ordering
      	initializer.
      	* objc-lang.c (objc_language_data): Likewise.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      3a3440fb
    • Andrew Burgess's avatar
      gdb: Convert language_data::la_case_sensitivity to a method · 0d201fa4
      Andrew Burgess authored
      Convert language_data::la_case_sensitivity member variable to a virtual
      method language_defn::case_sensitivity.
      
      This is mostly straight forward.  The only slight problem is that I
      ended up deleting this comment from ada-lang.c:
      
        /* Yes, Ada is case-insensitive, but that's not quite what this
           means.  */
      
      However, as the comment (which has existed since Ada support was first
      added to GDB) doesn't explain _why_ Ada sets case sensitivity to on
      despite being a generally case insensitive language, this doesn't
      really help me much.
      
      If I understood _why_ the setting doesn't quite mean what it seems to
      mean (at least as far as Ada is concerned) then I would extend the
      comment on language_defn::case_sensitivity (in language.h) to include
      the detail, and note how this impacts Ada.  But as it stands I've just
      deleted the comment for now.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_case_sensitivity
      	initializer.
      	* c-lang.c (c_language_data): Likewise.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* f-lang.c (f_language_data): Likewise.
      	(f_language::case_sensitivity): New member function.
      	* go-lang.c (go_language_data): Remove la_case_sensitivity
      	initializer.
      	* language.c (enum case_mode): Moved here from language.h.
      	(case_mode): Make static.
      	(show_case_command): Update for case_sensitivity being a method.
      	(set_case_command): Likewise.
      	(set_range_case): Likewise.
      	(unknown_language_data): Remove la_case_sensitivity initializer.
      	(auto_language_data): Likewise.
      	* language.h (case_mode): Delete, move enum declaration to
      	language.c.
      	(language_data): Delete la_case_sensitivity field.
      	(language_defn::case_sensitivity): New member function.
      	* m2-lang.c (m2_language_data): Remove la_case_sensitivity
      	initializer.
      	* objc-lang.c (objc_language_data): Likewise.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      0d201fa4
    • Andrew Burgess's avatar
      gdb: Convert language_data::la_range_check to a method · efdf6a73
      Andrew Burgess authored
      Convert language_data::la_range_check member variable to a virtual
      method language_defn::range_checking_on_by_default.
      
      Where the previous member variable was of type 'enum range_check', the
      new member function returns a boolean that selects between range
      checking being on or off.  This removes the possibility of a language
      having its default be the third enum state, range_check_warn, which
      no language currently used.
      
      This all makes sense I think, the language's true/false provides the
      default when the global 'set check range' is set to 'auto'.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_range_check
      	initializer.
      	* c-lang.c (c_language_data): Likewise.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* f-lang.c (f_language_data): Likewise.
      	(f_language::range_checking_on_by_default): New member function.
      	* go-lang.c (go_language_data): Remove la_range_check initializer.
      	* language.c (enum range_mode): Moved here from language.h.
      	(range_mode): Made static.
      	(show_range_command): Update to use
      	range_checking_on_by_default.
      	(set_range_command): Likewise.
      	(set_range_case): Likewise.
      	(unknown_language_data): Remove la_range_check initializer.
      	(auto_language_data): Likewise.
      	* language.h (range_mode): Delete.  Enum definition moved to
      	language.c.
      	(language_data): Remove la_range_check field.
      	(language_defn::range_checking_on_by_default): New member
      	function.
      	* m2-lang.c (m2_language_data): Remove la_range_check initializer.
      	(m2_language::range_checking_on_by_default): New member function.
      	* objc-lang.c (objc_language_data): Remove la_range_check
      	initializer.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	(pascal_language::range_checking_on_by_default): New member
      	function.
      	* rust-lang.c (rust_language_data): Remove la_range_check
      	initializer.
      	(rust_language::range_checking_on_by_default): New member
      	function.
      efdf6a73
    • Andrew Burgess's avatar
      gdb: Override store_sym_names_in_linkage_form_p for Go language · bf92aec5
      Andrew Burgess authored
      When store_sym_names_in_linkage_form_p was introduced in this commit:
      
        commit 59cc4834
        Date:   Tue Mar 27 08:57:16 2018 -0500
      
            problem looking up some symbols when they have a linkage name
      
      A special case was left behind for Go, however, this special case was
      not really needed anymore, it could be handled by having
      store_sym_names_in_linkage_form_p return the true for go, instead of
      false.
      
      This commit overrides store_sym_names_in_linkage_form_p for Go, and
      then removes the special case.  As store_sym_names_in_linkage_form_p
      is only called once throughout GDB this should be perfectly safe.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* dwarf2/read.c (dwarf2_physname): Remove special case for
      	language_go.
      	* go-lang.c (go_language::store_sym_names_in_linkage_form_p): New
      	member function.
      bf92aec5
    • Andrew Burgess's avatar
      gdb: Convert la_store_sym_names_in_linkage_form_p to a method · d3355e4d
      Andrew Burgess authored
      Convert language_data::la_store_sym_names_in_linkage_form_p member
      variable to language_defn::store_sym_names_in_linkage_form_p virtual
      function.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	(ada_language::store_sym_names_in_linkage_form_p): New member
      	function.
      	* c-lang.c (c_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	(c_language::store_sym_names_in_linkage_form_p): New member
      	function.
      	(cplus_language_data): Remove la_store_sym_names_in_linkage_form_p
      	initializer.
      	(asm_language_data): Likewise.
      	(asm_language::store_sym_names_in_linkage_form_p): New member
      	function.
      	(minimal_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	(minimal_language::store_sym_names_in_linkage_form_p): New member
      	function.
      	* d-lang.c (d_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	* dwarf2/read.c (dwarf2_physname): Update call to
      	store_sym_names_in_linkage_form_p.
      	* f-lang.c (f_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	* go-lang.c (go_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	* language.c (unknown_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	(unknown_language::store_sym_names_in_linkage_form_p): New member
      	function.
      	(auto_language_data): Remove la_store_sym_names_in_linkage_form_p
      	initializer.
      	(auto_language::store_sym_names_in_linkage_form_p): New member
      	function.
      	* language.h (language_data): Remove
      	la_store_sym_names_in_linkage_form_p member variable.
      	(language_defn::store_sym_names_in_linkage_form_p): New member
      	function.
      	* m2-lang.c (m2_language_data): Remove
      	la_store_sym_names_in_linkage_form_p initializer.
      	* objc-lang.c (objc_language_data): Likewise.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      d3355e4d
    • Andrew Burgess's avatar
      gdb: Convert language_data::string_lower_bound to a method · 22c12a6c
      Andrew Burgess authored
      Convert language_data::string_lower_bound member variable to a virtual
      method language_defn::string_lower_bound.
      
      Over all of the languages we currently support there are currently
      only two values for the lower bound, 0 or 1.  I noticed that in all
      cases, if a language has C style arrays then the lower bound is 0,
      otherwise the lower bound is 1.  So the default for the virtual method
      in language.h makes use of this, which means languages don't have to
      worry about providing a string_lower_bound method at all.
      
      Except for Modula2.  This language is defined to not have C style
      arrays, but has a string_lower_bound index of 0, this behaviour is
      maintained after this commit by having Modula2 be the only language
      that overrides the string_lower_bound method.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove string_lower_bound
      	initializer.
      	* c-lang.c (c_language_data): Likewise.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* f-lang.c (f_language_data): Likewise.
      	* go-lang.c (go_language_data): Likewise.
      	* language.c (unknown_language_data): Likewise.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Remove string_lower_bound field.
      	(language_defn::string_lower_bound): New member function.
      	* m2-lang.c (m2_language_data): Remove string_lower_bound
      	initializer.
      	(m2_language::string_lower_bound): New member function.
      	* objc-lang.c (objc_language_data): Remove string_lower_bound
      	initializer.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      	* valops.c (value_cstring): Update call to string_lower_bound.
      	(value_string): Likewise.
      	* value.c (allocate_repeated_value): Likewise.
      22c12a6c
    • Andrew Burgess's avatar
      gdb: Fix an incorrect comment · 1c236ddd
      Andrew Burgess authored
      A comment uses the wrong parameter name.  Fixed in this commit.
      
      gdb/ChangeLog:
      
      	* valops.c (value_repeat): Fix incorrect argument name in comment.
      1c236ddd
    • Andrew Burgess's avatar
      gdb: Convert language_data::c_style_arrays to a method · 67bd3fd5
      Andrew Burgess authored
      Convert language_data::c_style_arrays member variable to a virtual
      method language_defn::c_style_arrays_p.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove c_style_arrays
      	initializer.
      	(ada_language::c_style_arrays_p): New member fuction.
      	* c-lang.c (c_language_data): Remove c_style_arrays
      	initializer.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* eval.c (ptrmath_type_p): Update call to c_style_arrays_p.
      	* f-lang.c (f_language_data): Remove c_style_arrays initializer.
      	(f_language::c_style_arrays_p): New member function.
      	* go-lang.c (go_language_data): Remove c_style_arrays initializer.
      	* infcall.c (value_arg_coerce): Update call to c_style_arrays_p.
      	* language.c (unknown_language_data): Remove c_style_arrays
      	initializer.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Remove c_style_arrays field.
      	(language_defn::c_style_arrays_p): New member function.
      	* m2-lang.c (m2_language_data): Remove c_style_arrays initializer.
      	(m2_language::c_style_arrays_p): New member function.
      	* objc-lang.c (objc_language_data): Remove c_style_arrays
      	initializer.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      	* valarith.c (value_subscript): Update call to c_style_arrays_p,
      	and update local variable to a bool.
      	* valops.c (value_cast): Update call to c_style_arrays_p.
      	(value_array): Likewise.
      	* value.c (coerce_array): Likewise.
      67bd3fd5
    • Andrew Burgess's avatar
      gdb: Move la_language into the language_defn class · 85967615
      Andrew Burgess authored
      Move the language_data::la_language member variable into the
      langage_defn class.
      
      I have not made the la_language member variable a method of
      langage_defn simply because of the large number of places that
      la_language is referenced throughout GDB.  I have made the new member
      variable constant though, so this should prevent accidental
      assignment.
      
      In the future we might consider converting la_language to a method,
      but right now my goal is to remove the langage_data class, so I'm
      happy to leave la_language as a constant member variable.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_language initializer.
      	* c-lang.c (c_language_data): Likewise.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	* f-lang.c (f_language_data): Likewise.
      	* go-lang.c (go_language_data): Likewise.
      	* language.c (unknown_language_data): Likewise.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Remove la_language field.
      	(language_defn::language_defn): Initialise la_language field.
      	(language_defn::la_language): New member variable.
      	* m2-lang.c (m2_language_data): Remove la_language field.
      	* objc-lang.c (objc_language_data): Likewise.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      85967615
    • Andrew Burgess's avatar
      gdb: Convert la_filename_extensions to a method · e171d6f1
      Andrew Burgess authored
      Convert language_data::la_filename_extensions member variable to a
      virtual method language_defn::filename_extensions.
      
      The new method returns a vector of filename extensions, which means
      that where previously we needed a NULL marker on the end of the list,
      we can now discard this.
      
      All of the old arrays that contained the extensions now become static
      data within each languages filename_extensions method.
      
      I've updated the single use of the filename_extensions method to make
      use of this method returning a vector.  And, just in case anyone
      accidentally adds a NULL marked into a languages extensions list, I've
      added a new assert in add_filename_language (symtab.c) to catch this.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_extensions): Delete, moved into
      	ada_language::filename_extensions.
      	(ada_language_data): Remove la_filename_extensions initializer.
      	(ada_language::filename_extensions): New member function.
      	* c-lang.c (c_extensions): Delete, moved into
      	c_language::filename_extensions.
      	(c_language_data): Remove la_filename_extensions initializer.
      	(c_language::filename_extensions): New member function.
      	(cplus_extensions): Delete, moved into
      	cplus_language::filename_extensions.
      	(cplus_language_data): Remove la_filename_extensions initializer.
      	(cplus_language::filename_extensions): New member function.
      	(asm_extensions): Delete, moved into
      	asm_language::filename_extensions.
      	(asm_language_data): Remove la_filename_extensions initializer.
      	(asm_language::filename_extensions): New member function.
      	(minimal_language_data): Remove la_filename_extensions
      	initializer.
      	* d-lang.c (d_extensions): Delete, moved into
      	d_language::filename_extensions.
      	(d_language_data): Remove la_filename_extensions initializer.
      	(d_language::filename_extensions): New member function.
      	* f-lang.c (f_extensions): Delete, moved into
      	f_language::filename_extensions.
      	(f_language_data): Remove la_filename_extensions initializer.
      	(f_language::filename_extensions): New member function.
      	* go-lang.c (go_language_data): Remove la_filename_extensions
      	initializer.
      	* language.c (add_set_language_command): Update now that
      	filename_extensions returns a vector.
      	(unknown_language_data): Remove la_filename_extensions
      	initializer.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Remove la_filename_extensions field.
      	(language_defn::filename_extensions): New member function.
      	* m2-lang.c (m2_language_data): Remove la_filename_extensions
      	initializer.
      	* objc-lang.c (objc_extensions): Delete, moved into
      	objc_language::filename_extensions.
      	(objc_language_data): Remove la_filename_extensions initializer.
      	(objc_language::filename_extensions): New member function.
      	* opencl-lang.c (opencl_language_data): Remove
      	la_filename_extensions initializer.
      	* p-lang.c (pascal_extensions): Delete, moved into
      	pascal_language::filename_extensions.
      	(pascal_language_data): Remove la_filename_extensions initializer.
      	(pascal_language::filename_extensions): New member function.
      	* rust-lang.c (rust_extensions): Delete, moved into
      	rust_language::filename_extensions.
      	(rust_language_data): Remove la_filename_extensions initializer.
      	(rust_language::filename_extensions): New member function.
      	* symfile.c (add_filename_language): Add new assert.
      e171d6f1
    • Andrew Burgess's avatar
      gdb: Convert la_name and la_natural_name to methods · 6f7664a9
      Andrew Burgess authored
      Convert the two language_data member variables la_name and
      la_natural_name to virtual methods in language_defn struct called name
      and natural_name respectively.
      
      The virtual methods in the language_defn base class are pure virtual,
      as every language must implement these, and as every language has a
      unique name there's no sensible default here.
      
      Given that every language must implement these methods I did wonder
      about making this data passed into the base class constructor, but in
      the end I went with the virtual method approach.  I'm open to changing
      this approach if people prefer the constructor approach.
      
      During updating the calls to language_defn::name I found in
      add_set_language_command a place where we took la_name and then
      capitalised the first letter to create a language name that could be
      used in the documentation string.  I replaced this with a use of
      natural_name instead as this seemed a better choice, in most cases
      this will make no difference, as for most languages the natural_name
      is just the name with the first character in upper case, but for some
      languages, for example 'Open-CL' and 'Objective-C' this is not the
      case.
      
      In the case of asm_language the name is 'asm', while the natural_name
      was previously 'assembly'.  I changed the natural name to 'Assembly',
      this makes the documentation string case above cleaner, however, this
      will change the MI output for -var-info-expression, where the 'lang'
      field will change from 'assembly' to 'Assembly'.  It is possible this
      could be a breaking change if a front-end is relying on the existing
      name.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_name and
      	la_natural_name initializers.
      	(ada_language::name): New member function.
      	(ada_language::natural_name): New member function.
      	* c-lang.c (c_language_data): Remove la_name and
      	la_natural_name initializers.
      	(c_language::name): New member function.
      	(c_language::natural_name): New member function.
      	(cplus_language_data): Remove la_name and
      	la_natural_name initializers.
      	(cplus_language::name): New member function.
      	(cplus_language::natural_name): New member function.
      	(asm_language_data): Remove la_name and
      	la_natural_name initializers.
      	(asm_language::name): New member function.
      	(asm_language::natural_name): New member function.
      	(minimal_language_data): Remove la_name and
      	la_natural_name initializers.
      	(minimal_language::name): New member function.
      	(minimal_language::natural_name): New member function.
      	* compile/compile.c (compile_to_object): Update call to
      	lanugage_defn::name.
      	* d-lang.c (d_language_data): Remove la_name and
      	la_natural_name initializers.
      	(d_language::name): New member function.
      	(d_language::natural_name): New member function.
      	* expprint.c (print_subexp_standard): Update call to
      	language_defn::name.
      	(dump_raw_expression): Likewise
      	(dump_prefix_expression): Likewise.
      	* f-lang.c (f_language_data): Remove la_name and
      	la_natural_name initializers.
      	(f_language::name): New member function.
      	(f_language::natural_name): New member function.
      	* go-lang.c (go_language_data): Remove la_name and
      	la_natural_name initializers.
      	(go_language::name): New member function.
      	(go_language::natural_name): New member function.
      	* language.c (show_language_command): Update call to
      	language_defn::name.
      	(set_language_command): Likewise.
      	(language_enum): Likewise.
      	(language_str): Likewise.
      	(add_set_language_command): Likewise, use
      	language_defn::natural_name in the doc string.
      	(unknown_language_data): Remove la_name and
      	la_natural_name initializers.
      	(unknown_language::name): New member function.
      	(unknown_language::natural_name): New member function.
      	(auto_language_data): Remove la_name and
      	la_natural_name initializers.
      	(auto_language::name): New member function.
      	(auto_language::natural_name): New member function.
      	(language_lookup_primitive_type_as_symbol): Update call to
      	language_defn::name.
      	* language.h (language_data): Remove la_name and la_natural_name
      	member variables.
      	(language_defn::name): New member function.
      	(language_defn::natural_name): New member function.
      	* m2-lang.c (m2_language_data): Remove la_name and
      	la_natural_name initializers.
      	(m2_language::name): New member function.
      	(m2_language::natural_name): New member function.
      	* mi/mi-cmd-var.c (mi_cmd_var_info_expression): Update call to
      	language_defn::natural_name.
      	* objc-lang.c (objc_language_data): Remove la_name and
      	la_natural_name initializers.
      	(objc_language::name): New member function.
      	(objc_language::natural_name): New member function.
      	* opencl-lang.c (opencl_language_data): Remove la_name and
      	la_natural_name initializers.
      	(opencl_language::name): New member function.
      	(opencl_language::natural_name): New member function.
      	* p-lang.c (pascal_language_data): Remove la_name and
      	la_natural_name initializers.
      	(pascal_language::name): New member function.
      	(pascal_language::natural_name): New member function.
      	* rust-lang.c (rust_language_data): Remove la_name and
      	la_natural_name initializers.
      	(rust_language::name): New member function.
      	(rust_language::natural_name): New member function.
      	* symtab.c (lookup_language_this): Update call to
      	language_defn::name.
      6f7664a9
    • Andrew Burgess's avatar
      gdb: Convert la_name_of_this to a method · 5bae7c4e
      Andrew Burgess authored
      Convert language_data::la_name_of_this member variable to a virtual
      method language_defn::name_of_this.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove la_name_of_this
      	initializer.
      	* ax-gdb.c (gen_expr): Update call to name_of_this.
      	* c-exp.y (classify_name): Likewise.
      	* c-lang.c (c_language_data): Remove la_name_of_this initializer.
      	(cplus_language_data): Likewise.
      	(cplus_language::name_of_this): New member function.
      	(asm_language_data): Remove la_name_of_this initializer.
      	(minimal_language_data): Likewise.
      	* d-lang.c (d_language_data): Likewise.
      	(d_language::name_of_this): New member function.
      	* expprint.c (print_subexp_standard): Update call to name_of_this.
      	* f-lang.c (f_language_data): Remove la_name_of_this initializer.
      	* go-lang.c (go_language_data): Likewise.
      	* language.c (unknown_language_data): Likewise.
      	(unknown_language::name_of_this): New member function.
      	(auto_language_data): Remove la_name_of_this initializer.
      	(auto_language::name_of_this): New member function.
      	* language.h (language_data): Delete la_name_of_this member
      	variable.
      	(language_defn::name_of_this): New member function.
      	* m2-lang.c (m2_language_data): Remove la_name_of_this
      	initializer.
      	* objc-lang.c (objc_language_data): Likewise.
      	(objc_language::name_of_this): New member function.
      	* opencl-lang.c (opencl_language_data): Remove la_name_of_this
      	initializer.
      	* p-lang.c (pascal_language_data): Likewise.
      	(pascal_language::name_of_this): New member function.
      	* rust-lang.c (rust_language_data): Remove la_name_of_this
      	initializer.
      	* symtab.c (lookup_language_this): Update call to name_of_this.
      	(lookup_symbol_aux): Likewise.
      	* valops.c (value_of_this): Likewise.
      5bae7c4e
    • Andrew Burgess's avatar
      gdb: Convert la_struct_too_deep_ellipsis to a method · 22e3f3ed
      Andrew Burgess authored
      Convert language_data::la_struct_too_deep_ellipsis member variable to
      a method in language_defn.
      
      There should be no user visible changes after this commit.
      
      gdb/ChangeLog:
      
      	* ada-lang.c (ada_language_data): Remove
      	la_struct_too_deep_ellipsis initializer.
      	(ada_language::struct_too_deep_ellipsis): New member function.
      	* c-lang.c (c_language_data): Remove la_struct_too_deep_ellipsis
      	initializer.
      	(cplus_language_data): Likewise.
      	(asm_language_data): Likewise.
      	(minimal_language_data): Likewise.
      	* cp-valprint.c (cp_print_value): Update call to
      	struct_too_deep_ellipsis.
      	* d-lang.c (d_language_data): Remove la_struct_too_deep_ellipsis
      	initializer.
      	* f-lang.c (f_language_data): Likewise.
      	(f_language::struct_too_deep_ellipsis): New member function.
      	* go-lang.c (go_language_data): Remove la_struct_too_deep_ellipsis
      	initializer.
      	* language.c (unknown_language_data): Likewise.
      	(auto_language_data): Likewise.
      	* language.h (language_data): Delete la_struct_too_deep_ellipsis
      	member variable.
      	(language_defn::struct_too_deep_ellipsis): New member function.
      	* m2-lang.c (m2_language_data): Remove la_struct_too_deep_ellipsis
      	initializer.Q
      	* objc-lang.c (objc_language_data): Likewise.
      	* opencl-lang.c (opencl_language_data): Likewise.
      	* p-lang.c (pascal_language_data): Likewise.
      	* rust-lang.c (rust_language_data): Likewise.
      	* valprint.c (val_print_check_max_depth): Update call to
      	struct_too_deep_ellipsis.
      22e3f3ed
    • Felix Willgerodt's avatar
      Add myself to gdb/MAINTAINERS. · ed29e1c7
      Felix Willgerodt authored
      gdb/ChangeLog:
      2020-09-16  Felix Willgerodt  <felix.willgerodt@intel.com>
      
      	* MAINTAINERS (Write After Approval): Add myself.
      ed29e1c7
    • Tom de Vries's avatar
      [gdb/testsuite] Fix unbalanced braces in gdb.tui/new-layout.exp · 4d91ddd3
      Tom de Vries authored
      On SLE-11 with tcl version 8.5, we run into:
      ...
      UNRESOLVED: gdb.tui/new-layout.exp: testcase aborted due to \
        invalid command name: }
      ERROR: Couldn't send tui new-layout example src 1} to GDB.
      ...
      
      Apparently tcl 8.6 is more forgiving about unbalanced braces.
      
      Expose the unbalanced braces on tcl 8.6 by temporarily wrapping the
      test-case in:
      ...
      proc do_this { args } {
          uplevel 1 {*}$args
      }
      
      do_this {
        ...
      }
      ...
      and escape them using a backslash.
      
      Tested on x86_64-linux.
      
      gdb/testsuite/ChangeLog:
      
      2020-09-16  Tom de Vries  <tdevries@suse.de>
      
      	PR testsuite/26618
      	* gdb.tui/new-layout.exp: Escape unbalanced braces.
      4d91ddd3
    • Alan Modra's avatar
      Tidy elf_symbol_from · c1229f84
      Alan Modra authored
      bfd/
      	* elf-bfd.h (elf_symbol_from): Remove unused ABFD parameter.
      	* elf.c (ignore_section_sym, _bfd_elf_copy_private_symbol_data),
      	(swap_out_syms): Adjust elf_symbol_from invocation.
      binutils/
      	* nm.c (print_symbol): Adjust elf_symbol_from invocation.
      	* objcopy.c (is_hidden_symbol): Likewise.
      gas/
      	* config/obj-elf.c (obj_elf_visibility, elf_frob_symbol): Adjust
      	elf_symbol_from invocation.
      	* config/tc-aarch64.c (s_variant_pcs): Likewise.
      	* config/tc-m68hc11.c (s_m68hc11_mark_symbol): Likewise.
      	* config/tc-ppc.c (ppc_elf_localentry, ppc_force_relocation),
      	(ppc_fix_adjustable): Likewise.
      	* config/tc-xgate.c (xgate_frob_symbol): Likewise.
      ld/
      	* plugin.c (asymbol_from_plugin_symbol): Adjust elf_symbol_from
      	invocation.
      opcodes/
      	* ppc-dis.c (ppc_symbol_is_valid): Adjust elf_symbol_from invocation.
      c1229f84
    • Alan Modra's avatar
      PR26623, buffer overflow in ppc_symbol_is_valid · ec74481d
      Alan Modra authored
      	PR 26623
      	* elf-bfd.h (elf_symbol_from): Exclude synthetic symbols.
      ec74481d
    • Tom Tromey's avatar
      Remove TYPE_CODE_INT case from f_value_print_inner · 12d8f940
      Tom Tromey authored
      I looked through the various language value-print functions, to see if
      any code could be consolidated.  Pretty much all I found was that
      f_value_print_inner does not need to handle TYPE_CODE_INT itself, but
      can simply dispatch to the generic printer.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tom@tromey.com>
      
      	* f-valprint.c (f_value_print_inner) <case TYPE_CODE_INT>:
      	Remove.
      12d8f940
    • Tom Tromey's avatar
      Handle member pointers directly in generic_value_print · 6b5a7bc7
      Tom Tromey authored
      TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR are only used for C++, so
      it seems to me that the generic value-printing code ought to handle
      these cases -- that way, printing these objects will work even when
      the current language is not C++.  This patch implements this idea.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tom@tromey.com>
      
      	* rust-lang.c (rust_value_print_inner): Remove TYPE_CODE_MEMBERPTR
      	and TYPE_CODE_METHODPTR cases.
      	* c-valprint.c (c_value_print_memberptr): Move to valprint.c.
      	(c_value_print_inner): Update.
      	* valprint.c (generic_value_print_memberptr): New function, from
      	c_value_print_memberptr.
      	(generic_value_print): Use it.  Call cplus_print_method_ptr.
      6b5a7bc7
    • GDB Administrator's avatar
      Automatic date update in version.in · ce0e8d97
      GDB Administrator authored
      ce0e8d97
    • H.J. Lu's avatar
      PE/x86-64: Display PE relocation names · ec6653d8
      H.J. Lu authored
      For PE/x86-64, display PE relocation names:
      
      R_X86_64_64   -> IMAGE_REL_AMD64_ADDR64
      R_X86_64_32   -> IMAGE_REL_AMD64_ADDR32.
      rva32         -> IMAGE_REL_AMD64_ADDR32NB
      R_X86_64_PC32 -> IMAGE_REL_AMD64_REL32
      DISP32+1      -> IMAGE_REL_AMD64_REL32_1
      DISP32+2      -> IMAGE_REL_AMD64_REL32_2
      DISP32+3      -> IMAGE_REL_AMD64_REL32_3
      DISP32+4      -> IMAGE_REL_AMD64_REL32_4
      DISP32+5      -> IMAGE_REL_AMD64_REL32_5
      secrel32      -> IMAGE_REL_AMD64_SECREL
      
      bfd/
      
      	* coff-x86_64.c (howto_table): Display PE relocation names.
      
      gas/
      
      	* testsuite/gas/cfi/reloc-pe-i386.d: Updated.
      	* testsuite/gas/i386/x86-64-w64-pcrel.d: Likewise.
      ec6653d8
    • H.J. Lu's avatar
      elf: Check bfd_target_elf_flavour on input first · 0403e9cc
      H.J. Lu authored
      Check bfd_target_elf_flavour on input first in ldelf_after_open before
      checking elf_tdata.
      
      	* ldelf.c (ldelf_after_open): Check bfd_target_elf_flavour first.
      0403e9cc
    • Tom Tromey's avatar
      Don't use PyInt_FromLong · 47f0e2ff
      Tom Tromey authored
      Avoid the use of PyInt_FromLong, preferring gdb_py_object_from_longest
      instead.  I found found another spot that was incorrectly handling
      errors (see gdbpy_create_ptid_object) while writing this patch; it is
      fixed here.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (PyInt_FromLong): Remove define.
      	* python/py-value.c (convert_value_from_python): Use
      	gdb_py_object_from_longest.
      	* python/py-type.c (typy_get_code): Use
      	gdb_py_object_from_longest.
      	* python/py-symtab.c (salpy_get_line): Use
      	gdb_py_object_from_longest.
      	* python/py-symbol.c (sympy_get_addr_class, sympy_line): Use
      	gdb_py_object_from_longest.
      	* python/py-record.c (recpy_gap_reason_code): Use
      	gdb_py_object_from_longest.
      	* python/py-record-btrace.c (recpy_bt_insn_size)
      	(recpy_bt_func_level, btpy_list_count): Use
      	gdb_py_object_from_longest.
      	* python/py-infthread.c (gdbpy_create_ptid_object): Use
      	gdb_py_object_from_longest.  Fix error handling.
      	* python/py-framefilter.c (bootstrap_python_frame_filters): Use
      	gdb_py_object_from_longest.
      	* python/py-frame.c (frapy_type, frapy_unwind_stop_reason): Use
      	gdb_py_object_from_longest.
      	* python/py-breakpoint.c (bppy_get_type, bppy_get_number)
      	(bppy_get_thread, bppy_get_task, bppy_get_hit_count)
      	(bppy_get_ignore_count): Use gdb_py_object_from_longest.
      47f0e2ff
    • Tom Tromey's avatar
      Don't use PyLong_FromUnsignedLong · 512116ce
      Tom Tromey authored
      This changes gdb to avoid PyLong_FromUnsignedLong, preferring
      gdb_py_object_from_ulongest instead.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python.c (gdbpy_parameter_value): Use
      	gdb_py_object_from_ulongest.
      512116ce
    • Tom Tromey's avatar
      Don't use PyLong_FromLongLong · 4ab1029c
      Tom Tromey authored
      This changes gdb to avoid PyLong_FromLongLong, preferring to use
      gdb_py_object_from_longest instead.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/py-infevents.c (create_register_changed_event_object):
      	Use gdb_py_object_from_longest.
      	* python/py-exitedevent.c (create_exited_event_object): Use
      	gdb_py_object_from_longest.
      4ab1029c
    • Tom Tromey's avatar
      Don't use PyLong_FromLong · 062534d4
      Tom Tromey authored
      This changes gdb to avoid PyLong_FromLong, preferring to
      gdb_py_object_from_longest instead.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python.c (gdbpy_parameter_value): Use
      	gdb_py_object_from_longest.
      	* python/py-type.c (convert_field, typy_range): Use
      	gdb_py_object_from_longest.
      	* python/py-tui.c (gdbpy_tui_width, gdbpy_tui_height): Use
      	gdb_py_object_from_longest.
      	* python/py-lazy-string.c (stpy_get_length): Use
      	gdb_py_object_from_longest.
      	* python/py-infthread.c (thpy_get_num, thpy_get_global_num): Use
      	gdb_py_object_from_longest.
      	* python/py-infevents.c (create_memory_changed_event_object): Use
      	gdb_py_object_from_longest.
      	* python/py-inferior.c (infpy_get_num): Use
      	gdb_py_object_from_longest.
      	(infpy_get_pid): Likewise.
      062534d4
    • Tom Tromey's avatar
      Don't use gdb_py_long_from_ulongest · d1cab987
      Tom Tromey authored
      Remove the gdb_py_long_from_ulongest defines and change the Python
      layer to prefer gdb_py_object_from_ulongest.  While writing this I
      noticed that the error handling in archpy_disassemble was incorrect --
      it could call PyDict_SetItemString with a NULL value.  This patch also
      fixes this bug.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (gdb_py_long_from_ulongest): Remove
      	defines.
      	* python/py-value.c (valpy_long): Use
      	gdb_py_object_from_ulongest.
      	* python/py-symtab.c (salpy_get_pc): Use
      	gdb_py_object_from_ulongest.
      	(salpy_get_last): Likewise.
      	* python/py-record-btrace.c (recpy_bt_insn_pc): Use
      	gdb_py_object_from_ulongest.
      	* python/py-lazy-string.c (stpy_get_address): Use
      	gdb_py_object_from_ulongest.
      	* python/py-frame.c (frapy_pc): Use gdb_py_object_from_ulongest.
      	* python/py-arch.c (archpy_disassemble): Use
      	gdb_py_object_from_ulongest and gdb_py_object_from_longest.  Fix
      	error handling.
      d1cab987
    • Tom Tromey's avatar
      Don't use gdb_py_long_from_longest · 4bde49dc
      Tom Tromey authored
      Change the Python layer to avoid gdb_py_long_from_longest, and remove
      the defines.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (gdb_py_long_from_longest): Remove
      	defines.
      	* python/py-value.c (valpy_long): Use gdb_py_object_from_longest.
      	* python/py-type.c (convert_field, typy_get_sizeof): Use
      	gdb_py_object_from_longest.
      	* python/py-record-btrace.c (btpy_list_index): Use
      	gdb_py_object_from_longest.
      4bde49dc
    • Tom Tromey's avatar
      Don't use PyInt_FromSsize_t · 37431074
      Tom Tromey authored
      Change the Python layer to avoid PyInt_FromSsize_t, and remove the
      compatibility define.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* python/python-internal.h (PyInt_FromSsize_t): Remove define.
      	* python/py-record.c (recpy_element_number): Use
      	gdb_py_object_from_longest.
      	(recpy_gap_number): Likewise.
      37431074
  2. Sep 15, 2020
    • Tom Tromey's avatar
      Avoid running one Rust test against older LLVM · 08cc37dd
      Tom Tromey authored
      LLVM 8.0 introduced some changes to let the Rust compiler emit DWARF
      variant parts.  Before this change, the compiler would emit two types
      with the same name, and unfortunately gdb happens to pick the wrong
      one.  So, this patch disables the test when using an older version of
      LLVM.
      
      gdb/testsuite/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	PR rust/26197:
      	* lib/rust-support.exp (rust_llvm_version): New proc.
      	* gdb.rust/simple.exp: Check rust_llvm_version.
      08cc37dd
    • Tom Tromey's avatar
      Remove ui::num · cbe25684
      Tom Tromey authored
      I noticed that nothing uses ui::num, so this patch removes it.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* top.c (ui::ui): Update.
      	(highest_ui_num): Remove.
      	* top.h (struct ui) <num>: Remove.
      cbe25684
    • Tom Tromey's avatar
      Use arrays rather than pointers for global string constants · db92ac45
      Tom Tromey authored
      My understanding is that it's mildly better to use a static const
      array, as opposed to a "const char *", for a global string constant,
      when possible.  This makes sense to me because the pointer requires a
      load from an address, whereas the array is just the address.
      
      So, I searched for these in gdb and gdbserver.  This patch fixes the
      ones I found.
      
      gdb/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* unittests/memory-map-selftests.c (valid_mem_map): Now array.
      	* ui-style.c (ansi_regex_text): Now array.
      	* rust-exp.y (number_regex_text): Now array.
      	* linespec.c (linespec_quote_characters): Now array.
      	* jit.c (jit_break_name, jit_descriptor_name, reader_init_fn_sym):
      	Now arrays.
      
      gdbserver/ChangeLog
      2020-09-15  Tom Tromey  <tromey@adacore.com>
      
      	* linux-x86-low.cc (xmltarget_i386_linux_no_xml)
      	(xmltarget_amd64_linux_no_xml): Now arrays.
      db92ac45
    • Alan Modra's avatar
      PR26610, ARM's "VFPv3 vldr to vmov" gas testcase fail · 7e30b1eb
      Alan Modra authored
      I removed a few too many parentheses in git commit 7af67752.  This
      patch fixes that problem, rewriting the expression so it won't happen
      again.  The patch also avoids more UB with shifts of signed values.
      
      	PR 26610
      	* config/tc-arm.c (move_or_literal_pool): Correct extraction of
      	bignum.  Use unsigned "v"
      	(is_double_a_single): Make "v" and "mantissa" unsigned.  Formatting.
      	(double_to_single): Likewise.
      7e30b1eb
    • Nick Clifton's avatar
      Add note about creating a bugzilla tag for a point release. · 5b3eb5ed
      Nick Clifton authored
      	* README-how-to-make-a-release (https): Add a reminder to create a
      	new Bugzilla tag for the point release, once it has been published.
      5b3eb5ed
    • Nick Clifton's avatar
      Fix the assembler's new .nop directive so that the input line pointer is preserved. · f36eda1f
      Nick Clifton authored
      	* read.c (s_nop): Preserve the input_line_pointer around the call
      	to md_assemble.
      	* config/tc-s12z.c (md_assemble): Revert previous delta.
      f36eda1f
    • David Faust's avatar
      Change the /nop directive for the BPF port of the assembler to use the... · 6db99906
      David Faust authored
      Change the /nop directive for the BPF port of the assembler to use the encoding expected by the kernel.
      
      	* config/tc-bpf.h (md_single_noop_insn): Use 'ja 0' for no-op.
      6db99906
    • Simon Marchi's avatar
      gdb: introduce debuginfod_client_up type · d2b31b67
      Simon Marchi authored
      Introduce and use a unique pointer specialization for the
      debuginfod_client type.  The deleter calls debuginfod_end to free the
      client.
      
      gdb/ChangeLog:
      
      	* debuginfod-support.c (debuginfod_client_deleter): New.
      	(debuginfod_client_up): New.
      	(debuginfod_init): Return debuginfod_client_up.
      	(debuginfod_source_query): Adjust.
      	(debuginfod_debuginfo_query): Adjust.
      
      Change-Id: Ie56441e123ab80b78e5311c824c162cd804f68c0
      d2b31b67
    • Simon Marchi's avatar
      gdb: use make_unique_xstrdup in debuginfod-support.c · 3246bd8e
      Simon Marchi authored
      Use make_unique_xstrdup instead of reset + xstrdup.
      
      gdb/ChangeLog:
      
      	* debuginfod-support.c (debuginfod_source_query): Use
      	make_unique_xstrdup.
      
      Change-Id: Iee9524fea7630b4d6ee5c74e30c60fe222dc1d2c
      3246bd8e