2002-09-25 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / symtab.c
index e71206352088f7d25ac160de3f00b08284247712..a4322926e2f8d5e6030dc3cf4d41c671049f8f57 100644 (file)
@@ -38,6 +38,7 @@
 #include "demangle.h"
 #include "inferior.h"
 #include "linespec.h"
+#include "source.h"
 #include "filenames.h"         /* for FILENAME_CMP */
 
 #include "gdb_obstack.h"
@@ -438,24 +439,26 @@ symbol_init_demangled_name (struct general_symbol_info *gsymbol,
           gsymbol->language_specific.cplus_specific.demangled_name = NULL;
         }
     }
-  if (demangled == NULL
-      && (gsymbol->language == language_chill
-          || gsymbol->language == language_auto))
-    {
-      demangled =
-        chill_demangle (gsymbol->name);
-      if (demangled != NULL)
-        {
-          gsymbol->language = language_chill;
-          gsymbol->language_specific.chill_specific.demangled_name =
-            obsavestring (demangled, strlen (demangled), obstack);
-          xfree (demangled);
-        }
-      else
-        {
-          gsymbol->language_specific.chill_specific.demangled_name = NULL;
-        }
-    }
+#if 0
+  /* OBSOLETE if (demangled == NULL */
+  /* OBSOLETE     && (gsymbol->language == language_chill */
+  /* OBSOLETE         || gsymbol->language == language_auto)) */
+  /* OBSOLETE   { */
+  /* OBSOLETE     demangled = */
+  /* OBSOLETE       chill_demangle (gsymbol->name); */
+  /* OBSOLETE     if (demangled != NULL) */
+  /* OBSOLETE       { */
+  /* OBSOLETE         gsymbol->language = language_chill; */
+  /* OBSOLETE         gsymbol->language_specific.chill_specific.demangled_name = */
+  /* OBSOLETE           obsavestring (demangled, strlen (demangled), obstack); */
+  /* OBSOLETE         xfree (demangled); */
+  /* OBSOLETE       } */
+  /* OBSOLETE     else */
+  /* OBSOLETE       { */
+  /* OBSOLETE         gsymbol->language_specific.chill_specific.demangled_name = NULL; */
+  /* OBSOLETE       } */
+  /* OBSOLETE   } */
+#endif
 }
 
 
@@ -858,15 +861,20 @@ lookup_symbol_aux (const char *name, const char *mangled_name,
              /* This is a function which has a symtab for its address.  */
              bv = BLOCKVECTOR (s);
              block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-             sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
-                                        mangled_name, namespace);
+
+              /* This call used to pass `SYMBOL_NAME (msymbol)' as the
+                 `name' argument to lookup_block_symbol.  But the name
+                 of a minimal symbol is always mangled, so that seems
+                 to be clearly the wrong thing to pass as the
+                 unmangled name.  */
+             sym = lookup_block_symbol (block, name, mangled_name, namespace);
              /* We kept static functions in minimal symbol table as well as
                 in static scope. We want to find them in the symbol table. */
              if (!sym)
                {
                  block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-                 sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
-                                            mangled_name, namespace);
+                 sym = lookup_block_symbol (block, name,
+                                             mangled_name, namespace);
                }
 
              /* sym == 0 if symbol was found in the minimal symbol table
@@ -1025,15 +1033,19 @@ lookup_symbol_aux (const char *name, const char *mangled_name,
            {
              bv = BLOCKVECTOR (s);
              block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-             sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
-                                        mangled_name, namespace);
+              /* This call used to pass `SYMBOL_NAME (msymbol)' as the
+                 `name' argument to lookup_block_symbol.  But the name
+                 of a minimal symbol is always mangled, so that seems
+                 to be clearly the wrong thing to pass as the
+                 unmangled name.  */
+             sym = lookup_block_symbol (block, name, mangled_name, namespace);
              /* We kept static functions in minimal symbol table as well as
                 in static scope. We want to find them in the symbol table. */
              if (!sym)
                {
                  block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-                 sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
-                                            mangled_name, namespace);
+                 sym = lookup_block_symbol (block, name,
+                                             mangled_name, namespace);
                }
              /* If we found one, return it */
              if (sym)
@@ -3956,11 +3968,19 @@ struct symtabs_and_lines
 decode_line_spec (char *string, int funfirstline)
 {
   struct symtabs_and_lines sals;
+  struct symtab_and_line cursal;
+  
   if (string == 0)
     error ("Empty line specification.");
+    
+  /* We use whatever is set as the current source line. We do not try
+     and get a default  or it will recursively call us! */  
+  cursal = get_current_source_symtab_and_line ();
+  
   sals = decode_line_1 (&string, funfirstline,
-                       current_source_symtab, current_source_line,
+                       cursal.symtab, cursal.line,
                        (char ***) NULL);
+
   if (*string)
     error ("Junk at end of line specification: %s", string);
   return sals;
This page took 0.025744 seconds and 4 git commands to generate.