gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / ada-lang.c
index 762c124a654dae0339a179e729ea6e815e7970be..b1c689beb0fe307799cbfc20f73f1ae3ca495090 100644 (file)
@@ -1377,45 +1377,6 @@ ada_la_decode (const char *encoded, int options)
   return xstrdup (ada_decode (encoded).c_str ());
 }
 
-/* Implement la_sniff_from_mangled_name for Ada.  */
-
-static int
-ada_sniff_from_mangled_name (const char *mangled, char **out)
-{
-  std::string demangled = ada_decode (mangled);
-
-  *out = NULL;
-
-  if (demangled != mangled && demangled[0] != '<')
-    {
-      /* Set the gsymbol language to Ada, but still return 0.
-        Two reasons for that:
-
-        1. For Ada, we prefer computing the symbol's decoded name
-        on the fly rather than pre-compute it, in order to save
-        memory (Ada projects are typically very large).
-
-        2. There are some areas in the definition of the GNAT
-        encoding where, with a bit of bad luck, we might be able
-        to decode a non-Ada symbol, generating an incorrect
-        demangled name (Eg: names ending with "TB" for instance
-        are identified as task bodies and so stripped from
-        the decoded name returned).
-
-        Returning 1, here, but not setting *DEMANGLED, helps us get a
-        little bit of the best of both worlds.  Because we're last,
-        we should not affect any of the other languages that were
-        able to demangle the symbol before us; we get to correctly
-        tag Ada symbols as such; and even if we incorrectly tagged a
-        non-Ada symbol, which should be rare, any routing through the
-        Ada language should be transparent (Ada tries to behave much
-        like C/C++ with non-Ada symbols).  */
-      return 1;
-    }
-
-  return 0;
-}
-
 \f
 
                                 /* Arrays */
@@ -13958,16 +13919,12 @@ extern const struct language_data ada_language_data =
   ada_printchar,                /* Print a character constant */
   ada_printstr,                 /* Function to print string constant */
   emit_char,                    /* Function to print single char (not used) */
-  ada_print_type,               /* Print a type using appropriate syntax */
   ada_print_typedef,            /* Print a typedef using appropriate syntax */
   ada_value_print_inner,       /* la_value_print_inner */
   ada_value_print,              /* Print a top-level value */
-  NULL,                         /* Language specific skip_trampoline */
   NULL,                         /* name_of_this */
   true,                         /* la_store_sym_names_in_linkage_form_p */
   ada_lookup_symbol_nonlocal,   /* Looking up non-local symbols.  */
-  ada_la_decode,                /* Language specific symbol demangler */
-  ada_sniff_from_mangled_name,
   NULL,                         /* Language specific
                                   class_name_from_physname */
   ada_op_print_tab,             /* expression operators for printing */
@@ -13977,10 +13934,8 @@ extern const struct language_data ada_language_data =
   ada_collect_symbol_completion_matches,
   ada_watch_location_expression,
   ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
-  default_search_name_hash,
   &ada_varobj_ops,
   NULL,
-  NULL,
   ada_is_string_type,
   "(...)"                      /* la_struct_too_deep_ellipsis */
 };
@@ -14110,6 +14065,60 @@ public:
 
     return true;
   }
+
+  /* See language.h.  */
+  bool sniff_from_mangled_name (const char *mangled,
+                               char **out) const override
+  {
+    std::string demangled = ada_decode (mangled);
+
+    *out = NULL;
+
+    if (demangled != mangled && demangled[0] != '<')
+      {
+       /* Set the gsymbol language to Ada, but still return 0.
+          Two reasons for that:
+
+          1. For Ada, we prefer computing the symbol's decoded name
+          on the fly rather than pre-compute it, in order to save
+          memory (Ada projects are typically very large).
+
+          2. There are some areas in the definition of the GNAT
+          encoding where, with a bit of bad luck, we might be able
+          to decode a non-Ada symbol, generating an incorrect
+          demangled name (Eg: names ending with "TB" for instance
+          are identified as task bodies and so stripped from
+          the decoded name returned).
+
+          Returning true, here, but not setting *DEMANGLED, helps us get
+          a little bit of the best of both worlds.  Because we're last,
+          we should not affect any of the other languages that were
+          able to demangle the symbol before us; we get to correctly
+          tag Ada symbols as such; and even if we incorrectly tagged a
+          non-Ada symbol, which should be rare, any routing through the
+          Ada language should be transparent (Ada tries to behave much
+          like C/C++ with non-Ada symbols).  */
+       return true;
+      }
+
+    return false;
+  }
+
+  /* See language.h.  */
+
+  char *demangle (const char *mangled, int options) const override
+  {
+    return ada_la_decode (mangled, options);
+  }
+
+  /* See language.h.  */
+
+  void print_type (struct type *type, const char *varstring,
+                  struct ui_file *stream, int show, int level,
+                  const struct type_print_options *flags) const override
+  {
+    ada_print_type (type, varstring, stream, show, level, flags);
+  }
 };
 
 /* Single instance of the Ada language class.  */
This page took 0.026917 seconds and 4 git commands to generate.