* ada-lang.c (ada_decode_symbol): Check and set 'ada_mangled'.
[deliverable/binutils-gdb.git] / gdb / ada-lang.c
index 43d6e3c4fc366572e5694059574ffd9047b95805..0329dd9eb87abc15c2d6d7b66cbd59be0791e8cf 100644 (file)
@@ -1297,30 +1297,28 @@ static struct htab *decoded_names_store;
    when a decoded name is cached in it.  */
 
 const char *
-ada_decode_symbol (const struct general_symbol_info *gsymbol)
+ada_decode_symbol (const struct general_symbol_info *arg)
 {
-  struct general_symbol_info *gsymbol_rw
-    = (struct general_symbol_info *) gsymbol;
-  const char **resultp
-    = &gsymbol_rw->language_specific.mangled_lang.demangled_name;
+  struct general_symbol_info *gsymbol = (struct general_symbol_info *) arg;
+  const char **resultp =
+    &gsymbol->language_specific.mangled_lang.demangled_name;
 
-  if (*resultp == NULL)
+  if (!gsymbol->ada_mangled)
     {
       const char *decoded = ada_decode (gsymbol->name);
+      struct obstack *obstack = gsymbol->language_specific.obstack;
 
-      if (gsymbol->obj_section != NULL)
-        {
-         struct objfile *objf = gsymbol->obj_section->objfile;
+      gsymbol->ada_mangled = 1;
 
-         *resultp = obstack_copy0 (&objf->objfile_obstack,
-                                   decoded, strlen (decoded));
-        }
-      /* Sometimes, we can't find a corresponding objfile, in which
-         case, we put the result on the heap.  Since we only decode
-         when needed, we hope this usually does not cause a
-         significant memory leak (FIXME).  */
-      if (*resultp == NULL)
+      if (obstack != NULL)
+       *resultp = obstack_copy0 (obstack, decoded, strlen (decoded));
+      else
         {
+         /* Sometimes, we can't find a corresponding objfile, in
+            which case, we put the result on the heap.  Since we only
+            decode when needed, we hope this usually does not cause a
+            significant memory leak (FIXME).  */
+
           char **slot = (char **) htab_find_slot (decoded_names_store,
                                                   decoded, INSERT);
 
This page took 0.03477 seconds and 4 git commands to generate.