Trivial patch to remove dependency on host unsigned long type
[deliverable/binutils-gdb.git] / gdb / psymtab.c
index b799a037899431118de4717adfb01ed38fc79de7..3bab7471bc4cf658a62ae88e2b6f0dec789054dc 100644 (file)
@@ -785,8 +785,8 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 
 static void
 relocate_psymtabs (struct objfile *objfile,
-                  struct section_offsets *new_offsets,
-                  struct section_offsets *delta)
+                  const struct section_offsets *new_offsets,
+                  const struct section_offsets *delta)
 {
   struct partial_symbol **psym;
   struct partial_symtab *p;
@@ -1206,19 +1206,6 @@ psymtab_to_fullname (struct partial_symtab *ps)
   return ps->fullname;
 }
 
-static const char *
-find_symbol_file_from_partial (struct objfile *objfile, const char *name)
-{
-  struct partial_symtab *pst;
-
-  ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
-    {
-      if (lookup_partial_symbol (objfile, pst, name, 1, VAR_DOMAIN))
-       return pst->filename;
-    }
-  return NULL;
-}
-
 /*  For all symbols, s, in BLOCK that are in NAMESPACE and match NAME
     according to the function MATCH, call CALLBACK(BLOCK, s, DATA).
     BLOCK is assumed to come from OBJFILE.  Returns 1 iff CALLBACK
@@ -1400,15 +1387,21 @@ expand_symtabs_matching_via_partial
 
       if (file_matcher)
        {
+         int match;
+
          if (ps->anonymous)
            continue;
 
-         /* Before we invoke realpath, which can get expensive when many
-            files are involved, do a quick comparison of the basenames.  */
-         if (!(*file_matcher) (ps->filename, data, 0)
-             && (basenames_may_differ
+         match = (*file_matcher) (ps->filename, data, 0);
+         if (!match)
+           {
+             /* Before we invoke realpath, which can get expensive when many
+                files are involved, do a quick comparison of the basenames.  */
+             if (basenames_may_differ
                  || (*file_matcher) (lbasename (ps->filename), data, 1))
-             && !(*file_matcher) (psymtab_to_fullname (ps), data, 0))
+               match = (*file_matcher) (psymtab_to_fullname (ps), data, 0);
+           }
+         if (!match)
            continue;
        }
 
@@ -1436,7 +1429,6 @@ const struct quick_symbol_functions psym_functions =
   read_symtabs_for_function,
   expand_partial_symbol_tables,
   read_psymtabs_with_fullname,
-  find_symbol_file_from_partial,
   map_matching_symbols_psymtab,
   expand_symtabs_matching_via_partial,
   find_pc_sect_symtab_from_partial,
@@ -2001,10 +1993,10 @@ maintenance_info_psymtabs (char *regexp, int from_tty)
     }
 }
 
-/* Check consistency of psymtabs and symtabs.  */
+/* Check consistency of currently expanded psymtabs vs symtabs.  */
 
 static void
-maintenance_check_symtabs (char *ignore, int from_tty)
+maintenance_check_psymtabs (char *ignore, int from_tty)
 {
   struct symbol *sym;
   struct partial_symbol **psym;
@@ -2019,7 +2011,25 @@ maintenance_check_symtabs (char *ignore, int from_tty)
   {
     struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
-    s = psymtab_to_symtab (objfile, ps);
+    /* We don't call psymtab_to_symtab here because that may cause symtab
+       expansion.  When debugging a problem it helps if checkers leave
+       things unchanged.  */
+    s = ps->symtab;
+
+    /* First do some checks that don't require the associated symtab.  */
+    if (ps->texthigh < ps->textlow)
+      {
+       printf_filtered ("Psymtab ");
+       puts_filtered (ps->filename);
+       printf_filtered (" covers bad range ");
+       fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
+       printf_filtered (" - ");
+       fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
+       printf_filtered ("\n");
+       continue;
+      }
+
+    /* Now do checks requiring the associated symtab.  */
     if (s == NULL)
       continue;
     bv = BLOCKVECTOR (s);
@@ -2057,20 +2067,8 @@ maintenance_check_symtabs (char *ignore, int from_tty)
          }
        psym++;
       }
-    if (ps->texthigh < ps->textlow)
-      {
-       printf_filtered ("Psymtab ");
-       puts_filtered (ps->filename);
-       printf_filtered (" covers bad range ");
-       fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout);
-       printf_filtered (" - ");
-       fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout);
-       printf_filtered ("\n");
-       continue;
-      }
-    if (ps->texthigh == 0)
-      continue;
-    if (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b))
+    if (ps->texthigh != 0
+       && (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b)))
       {
        printf_filtered ("Psymtab ");
        puts_filtered (ps->filename);
@@ -2134,7 +2132,8 @@ This does not include information about individual partial symbols,\n\
 just the symbol table structures themselves."),
           &maintenanceinfolist);
 
-  add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs,
-          _("Check consistency of psymtabs and symtabs."),
+  add_cmd ("check-psymtabs", class_maintenance, maintenance_check_psymtabs,
+          _("\
+Check consistency of currently expanded psymtabs versus symtabs."),
           &maintenancelist);
 }
This page took 0.041102 seconds and 4 git commands to generate.