gdb: Convert la_store_sym_names_in_linkage_form_p to a method
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 8 Jul 2020 09:55:56 +0000 (10:55 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 16 Sep 2020 09:16:48 +0000 (10:16 +0100)
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.

14 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/c-lang.c
gdb/d-lang.c
gdb/dwarf2/read.c
gdb/f-lang.c
gdb/go-lang.c
gdb/language.c
gdb/language.h
gdb/m2-lang.c
gdb/objc-lang.c
gdb/opencl-lang.c
gdb/p-lang.c
gdb/rust-lang.c

index a337c605fc0e3c0ef815e3da9bf5965b0d82d62e..ac4ec6fde7fe4133420c920c70b1996904886ef1 100644 (file)
@@ -1,3 +1,49 @@
+2020-09-16  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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.
+
 2020-09-16  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * ada-lang.c (ada_language_data): Remove string_lower_bound
index b90e7a05bcdf295c45a2e148db1fd0c6fe02c526..723e08e0db03b305644c23ea81e8dfeaa404880f 100644 (file)
@@ -13714,7 +13714,6 @@ extern const struct language_data ada_language_data =
   array_row_major,
   macro_expansion_no,
   &ada_exp_descriptor,
-  true,                         /* la_store_sym_names_in_linkage_form_p */
   ada_op_print_tab,             /* expression operators for printing */
   &ada_varobj_ops,
 };
@@ -14203,6 +14202,11 @@ public:
   bool c_style_arrays_p () const override
   { return false; }
 
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
+
 protected:
   /* See language.h.  */
 
index ecb339c3f87665b592b2a8b5fc16b4518e145f17..c8fe630c247a9c674a47ce6653ccc6d9a4dbf941 100644 (file)
@@ -880,7 +880,6 @@ extern const struct language_data c_language_data =
   array_row_major,
   macro_expansion_c,
   &exp_descriptor_c,
-  true,                                /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
   &c_varobj_ops,
 };
@@ -943,6 +942,11 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* Single instance of the C language class.  */
@@ -986,7 +990,6 @@ extern const struct language_data cplus_language_data =
   array_row_major,
   macro_expansion_c,
   &exp_descriptor_c,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
   &cplus_varobj_ops,
 };
@@ -1195,7 +1198,6 @@ extern const struct language_data asm_language_data =
   array_row_major,
   macro_expansion_c,
   &exp_descriptor_c,
-  true,                                /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
   &default_varobj_ops,
 };
@@ -1245,6 +1247,11 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* The single instance of the ASM language class.  */
@@ -1262,7 +1269,6 @@ extern const struct language_data minimal_language_data =
   array_row_major,
   macro_expansion_c,
   &exp_descriptor_c,
-  true,                                /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
   &default_varobj_ops,
 };
@@ -1301,6 +1307,11 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* The single instance of the minimal language class.  */
index f75a973fbfb1007d15bff5052b03c391f56fe732..2c6da4723c5c3a2ec91772ef698e69adc79259a4 100644 (file)
@@ -133,7 +133,6 @@ extern const struct language_data d_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_c,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   d_op_print_tab,              /* Expression operators for printing.  */
   &default_varobj_ops,
 };
index 2c554d6d5c91f2a28cdc5b6879bccabcbf22a131..16001aa9e9bcb6f53a8c94da3f7dc1f4b9424cd4 100644 (file)
@@ -10635,7 +10635,7 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
   if (mangled != NULL)
     {
 
-      if (language_def (cu->language)->la_store_sym_names_in_linkage_form_p)
+      if (language_def (cu->language)->store_sym_names_in_linkage_form_p ())
        {
          /* Do nothing (do not demangle the symbol name).  */
        }
index 344bdb8f0c8beb745a92bf34008baad3880a5906..f4202c349644d0ae068d43d963b3a57a8561945d 100644 (file)
@@ -491,7 +491,6 @@ extern const struct language_data f_language_data =
   array_column_major,
   macro_expansion_no,
   &exp_descriptor_f,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   f_op_print_tab,              /* expression operators for printing */
   &default_varobj_ops,
 };
index c0ad0be13628fa830f5b4277f4b37d786fc5df0a..ed18f01dbdc509b4272b35b3abe91bb711052327 100644 (file)
@@ -513,7 +513,6 @@ extern const struct language_data go_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_c,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   go_op_print_tab,             /* Expression operators for printing.  */
   &default_varobj_ops,
 };
index 1866a964599c61f0dfd9600ec41c48959fe9d8bc..3503408ad21e73986ce9d753bff74230523dc053 100644 (file)
@@ -780,7 +780,6 @@ extern const struct language_data unknown_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_standard,
-  true,                                /* store_sym_names_in_linkage_form_p */
   unk_op_print_tab,            /* expression operators for printing */
   &default_varobj_ops,
 };
@@ -898,6 +897,11 @@ public:
 
   const char *name_of_this () const override
   { return "this"; }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* Single instance of the unknown language class.  */
@@ -913,7 +917,6 @@ extern const struct language_data auto_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_standard,
-  false,                       /* store_sym_names_in_linkage_form_p */
   unk_op_print_tab,            /* expression operators for printing */
   &default_varobj_ops,
 };
index d83ea132a91d2e37c5a3c02e3d873033261b88b5..10a9e707320292629a9d29d7f9caad857a062525 100644 (file)
@@ -206,28 +206,6 @@ struct language_data
 
     const struct exp_descriptor *la_exp_desc;
 
-    /* Now come some hooks for lookup_symbol.  */
-
-    /* True if the symbols names should be stored in GDB's data structures
-       for minimal/partial/full symbols using their linkage (aka mangled)
-       form; false if the symbol names should be demangled first.
-
-       Most languages implement symbol lookup by comparing the demangled
-       names, in which case it is advantageous to store that information
-       already demangled, and so would set this field to false.
-
-       On the other hand, some languages have opted for doing symbol
-       lookups by comparing mangled names instead, for reasons usually
-       specific to the language.  Those languages should set this field
-       to true.
-
-       And finally, other languages such as C or Asm do not have
-       the concept of mangled vs demangled name, so those languages
-       should set this field to true as well, to prevent any accidental
-       demangling through an unrelated language's demangler.  */
-
-    const bool la_store_sym_names_in_linkage_form_p;
-
     /* Table for printing expressions.  */
 
     const struct op_print *la_op_print_tab;
@@ -573,6 +551,27 @@ struct language_defn : language_data
   virtual char string_lower_bound () const
   { return c_style_arrays_p () ? 0 : 1; }
 
+  /* Returns true if the symbols names should be stored in GDB's data
+     structures for minimal/partial/full symbols using their linkage (aka
+     mangled) form; false if the symbol names should be demangled first.
+
+     Most languages implement symbol lookup by comparing the demangled
+     names, in which case it is advantageous to store that information
+     already demangled, and so would return false, which is the default.
+
+     On the other hand, some languages have opted for doing symbol lookups
+     by comparing mangled names instead, for reasons usually specific to
+     the language.  Those languages should override this function and
+     return true.
+
+     And finally, other languages such as C or Asm do not have the concept
+     of mangled vs demangled name, so those languages should also override
+     this function and return true, to prevent any accidental demangling
+     through an unrelated language's demangler.  */
+
+  virtual bool store_sym_names_in_linkage_form_p () const
+  { return false; }
+
 protected:
 
   /* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
index 7bd9e710377acc43b94be52169f5c613595f1ebc..577d819211478253de52627a45426c2666bcfada 100644 (file)
@@ -204,7 +204,6 @@ extern const struct language_data m2_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_modula2,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   m2_op_print_tab,             /* expression operators for printing */
   &default_varobj_ops,
 };
index 337b7a49f3c5c57380f03a0975eaffbaead01e17..7b2dbd8bfa28c0184de8906b7ca029778f03fa70 100644 (file)
@@ -328,7 +328,6 @@ extern const struct language_data objc_language_data =
   array_row_major,
   macro_expansion_c,
   &exp_descriptor_standard,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   objc_op_print_tab,           /* Expression operators for printing */
   &default_varobj_ops,
 };
index 2e3e54a2233fdd384487a45ffb67203af65eed81..f8105f21cae40f23ffd8012167763776d138899c 100644 (file)
@@ -1011,7 +1011,6 @@ extern const struct language_data opencl_language_data =
   array_row_major,
   macro_expansion_c,
   &exp_descriptor_opencl,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
   &default_varobj_ops,
 };
index b07557151dbbcb3c020436e392574d773df09d43..9ca1427098e1a51d19975e123971b0f2fad9578a 100644 (file)
@@ -257,7 +257,6 @@ extern const struct language_data pascal_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_standard,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   pascal_op_print_tab,         /* expression operators for printing */
   &default_varobj_ops,
 };
index 12fc138785d3379872e9eb46d0edef6e84b708ec..25bd965667eec3810877fd38d103bafde0b86b3a 100644 (file)
@@ -1906,7 +1906,6 @@ extern const struct language_data rust_language_data =
   array_row_major,
   macro_expansion_no,
   &exp_descriptor_rust,
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
   &default_varobj_ops,
 };