* dwarf2read.c (new_symbol_full): Remove cast.
[deliverable/binutils-gdb.git] / gdb / symtab.c
index 7c06b41509432a06bfe2d66cf219bdc53f474118..68d654db2c97f955e63262572bc9fa576b31b803 100644 (file)
@@ -1,6 +1,6 @@
 /* Symbol table lookup for the GNU debugger, GDB.
 
-   Copyright (C) 1986-2004, 2007-2012 Free Software Foundation, Inc.
+   Copyright (C) 1986-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -164,7 +164,12 @@ compare_filenames_for_search (const char *filename, const char *search_name)
 
   /* Either the names must completely match, or the character
      preceding the trailing SEARCH_NAME segment of FILENAME must be a
-     directory separator.  */
+     directory separator.
+
+     The HAS_DRIVE_SPEC purpose is to make FILENAME "c:file.c"
+     compatible with SEARCH_NAME "file.c".  In such case a compiler had
+     to put the "c:file.c" name into debug info.  Such compatibility
+     works only on GDB built for DOS host.  */
   return (len == search_len
          || IS_DIR_SEPARATOR (filename[len - search_len - 1])
          || (HAS_DRIVE_SPEC (filename)
@@ -224,13 +229,13 @@ iterate_over_some_symtabs (const char *name,
       {
         const char *fp = symtab_to_fullname (s);
 
-        if (fp != NULL && FILENAME_CMP (full_path, fp) == 0)
+        if (FILENAME_CMP (full_path, fp) == 0)
           {
            if (callback (s, data))
              return 1;
           }
 
-       if (fp != NULL && !is_abs && compare_filenames_for_search (fp, name))
+       if (!is_abs && compare_filenames_for_search (fp, name))
          {
            if (callback (s, data))
              return 1;
@@ -240,24 +245,27 @@ iterate_over_some_symtabs (const char *name,
     if (real_path != NULL)
       {
         const char *fullname = symtab_to_fullname (s);
+       char *rp = gdb_realpath (fullname);
+       struct cleanup *cleanups = make_cleanup (xfree, rp);
 
-        if (fullname != NULL)
-          {
-            char *rp = gdb_realpath (fullname);
-
-            make_cleanup (xfree, rp);
-            if (FILENAME_CMP (real_path, rp) == 0)
+       if (FILENAME_CMP (real_path, rp) == 0)
+         {
+           if (callback (s, data))
              {
-               if (callback (s, data))
-                 return 1;
+               do_cleanups (cleanups);
+               return 1;
              }
+         }
 
-           if (!is_abs && compare_filenames_for_search (rp, name))
+       if (!is_abs && compare_filenames_for_search (rp, name))
+         {
+           if (callback (s, data))
              {
-               if (callback (s, data))
-                 return 1;
+               do_cleanups (cleanups);
+               return 1;
              }
-          }
+         }
+       do_cleanups (cleanups);
       }
     }
 
@@ -457,7 +465,7 @@ symbol_init_cplus_specific (struct general_symbol_info *gsymbol,
 
 void
 symbol_set_demangled_name (struct general_symbol_info *gsymbol,
-                           char *name,
+                           const char *name,
                            struct objfile *objfile)
 {
   if (gsymbol->language == language_cplus)
@@ -1555,10 +1563,6 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
   const struct block *block;
   struct symtab *s;
 
-  if (objfile->sf)
-    objfile->sf->qf->pre_expand_symtabs_matching (objfile, block_index,
-                                                 name, domain);
-
   ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
     {
       bv = BLOCKVECTOR (s);
@@ -1916,11 +1920,6 @@ basic_lookup_transparent_type (const char *name)
 
   ALL_OBJFILES (objfile)
   {
-    if (objfile->sf)
-      objfile->sf->qf->pre_expand_symtabs_matching (objfile,
-                                                   GLOBAL_BLOCK,
-                                                   name, STRUCT_DOMAIN);
-
     ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
       {
        bv = BLOCKVECTOR (s);
@@ -1949,10 +1948,6 @@ basic_lookup_transparent_type (const char *name)
 
   ALL_OBJFILES (objfile)
   {
-    if (objfile->sf)
-      objfile->sf->qf->pre_expand_symtabs_matching (objfile, STATIC_BLOCK,
-                                                   name, STRUCT_DOMAIN);
-
     ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
       {
        bv = BLOCKVECTOR (s);
@@ -2551,9 +2546,6 @@ find_line_symtab (struct symtab *symtab, int line,
                                                         symtab->filename);
       }
 
-      /* Get symbol full file name if possible.  */
-      symtab_to_fullname (symtab);
-
       ALL_SYMTABS (objfile, s)
       {
        struct linetable *l;
@@ -2561,9 +2553,8 @@ find_line_symtab (struct symtab *symtab, int line,
 
        if (FILENAME_CMP (symtab->filename, s->filename) != 0)
          continue;
-       if (symtab->fullname != NULL
-           && symtab_to_fullname (s) != NULL
-           && FILENAME_CMP (symtab->fullname, s->fullname) != 0)
+       if (FILENAME_CMP (symtab_to_fullname (symtab),
+                         symtab_to_fullname (s)) != 0)
          continue;     
        l = LINETABLE (s);
        ind = find_line_common (l, line, &exact, 0);
@@ -3294,7 +3285,7 @@ sources_info (char *ignore, int from_tty)
   {
     const char *fullname = symtab_to_fullname (s);
 
-    output_source_filename (fullname ? fullname : s->filename, &data);
+    output_source_filename (fullname, &data);
   }
   printf_filtered ("\n\n");
 
This page took 0.026681 seconds and 4 git commands to generate.