Add compunits range adapter to objfile
[deliverable/binutils-gdb.git] / gdb / symmisc.c
index f067292f9dd485576ce72662520b401380d28a3c..ac5c392dc5d823fc33d7022ee2aca44cab907c50 100644 (file)
@@ -64,13 +64,14 @@ print_symbol_bcache_statistics (void)
   struct program_space *pspace;
 
   ALL_PSPACES (pspace)
-    for (objfile *objfile : all_objfiles (pspace))
+    for (objfile *objfile : pspace->objfiles ())
       {
        QUIT;
        printf_filtered (_("Byte cache statistics for '%s':\n"),
                         objfile_name (objfile));
-       print_bcache_statistics (psymbol_bcache_get_bcache (objfile->psymbol_cache),
-                                "partial symbol cache");
+       print_bcache_statistics
+         (psymbol_bcache_get_bcache (objfile->partial_symtabs->psymbol_cache),
+          "partial symbol cache");
        print_bcache_statistics (objfile->per_bfd->macro_cache,
                                 "preprocessor macro cache");
        print_bcache_statistics (objfile->per_bfd->filename_cache,
@@ -85,7 +86,7 @@ print_objfile_statistics (void)
   int i, linetables, blockvectors;
 
   ALL_PSPACES (pspace)
-  for (objfile *objfile : all_objfiles (pspace))
+  for (objfile *objfile : pspace->objfiles ())
     {
       QUIT;
       printf_filtered (_("Statistics for '%s':\n"), objfile_name (objfile));
@@ -107,14 +108,17 @@ print_objfile_statistics (void)
       if (objfile->sf)
        objfile->sf->qf->print_stats (objfile);
       i = linetables = 0;
-      ALL_OBJFILE_FILETABS (objfile, cu, s)
+      for (compunit_symtab *cu : objfile->compunits ())
        {
-         i++;
-         if (SYMTAB_LINETABLE (s) != NULL)
-           linetables++;
+         for (symtab *s : compunit_filetabs (cu))
+           {
+             i++;
+             if (SYMTAB_LINETABLE (s) != NULL)
+               linetables++;
+           }
        }
-      blockvectors = std::distance (objfile_compunits (objfile).begin (),
-                                   objfile_compunits (objfile).end ());
+      blockvectors = std::distance (objfile->compunits ().begin (),
+                                   objfile->compunits ().end ());
       printf_filtered (_("  Number of symbol tables: %d\n"), i);
       printf_filtered (_("  Number of symbol tables with line tables: %d\n"),
                       linetables);
@@ -130,9 +134,10 @@ print_objfile_statistics (void)
       printf_filtered (_("  Total memory used for BFD obstack: %s\n"),
                       pulongest (obstack_memory_used (&objfile->per_bfd
                                                       ->storage_obstack)));
-      printf_filtered (_("  Total memory used for psymbol cache: %d\n"),
-                      bcache_memory_used (psymbol_bcache_get_bcache
-                                          (objfile->psymbol_cache)));
+      printf_filtered
+       (_("  Total memory used for psymbol cache: %d\n"),
+        bcache_memory_used (psymbol_bcache_get_bcache
+                            (objfile->partial_symtabs->psymbol_cache)));
       printf_filtered (_("  Total memory used for macro cache: %d\n"),
                       bcache_memory_used (objfile->per_bfd->macro_cache));
       printf_filtered (_("  Total memory used for file name cache: %d\n"),
@@ -157,16 +162,20 @@ dump_objfile (struct objfile *objfile)
   if (objfile->compunit_symtabs != NULL)
     {
       printf_filtered ("Symtabs:\n");
-      ALL_OBJFILE_FILETABS (objfile, cust, symtab)
+      for (compunit_symtab *cu : objfile->compunits ())
        {
-         printf_filtered ("%s at ", symtab_to_filename_for_display (symtab));
-         gdb_print_host_address (symtab, gdb_stdout);
-         printf_filtered (", ");
-         if (SYMTAB_OBJFILE (symtab) != objfile)
+         for (symtab *symtab : compunit_filetabs (cu))
            {
-             printf_filtered ("NOT ON CHAIN!  ");
+             printf_filtered ("%s at ",
+                              symtab_to_filename_for_display (symtab));
+             gdb_print_host_address (symtab, gdb_stdout);
+             printf_filtered (", ");
+             if (SYMTAB_OBJFILE (symtab) != objfile)
+               {
+                 printf_filtered ("NOT ON CHAIN!  ");
+               }
+             wrap_here ("  ");
            }
-         wrap_here ("  ");
        }
       printf_filtered ("\n\n");
     }
@@ -267,7 +276,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
   struct objfile *objfile = SYMTAB_OBJFILE (symtab);
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
   int i;
-  struct dict_iterator iter;
+  struct mdict_iterator miter;
   int len;
   struct linetable *l;
   const struct blockvector *bv;
@@ -323,7 +332,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
             even if we're using a hashtable, but nothing else but this message
             wants it.  */
          fprintf_filtered (outfile, ", %d syms/buckets in ",
-                           dict_size (BLOCK_DICT (b)));
+                           mdict_size (BLOCK_MULTIDICT (b)));
          fputs_filtered (paddress (gdbarch, BLOCK_START (b)), outfile);
          fprintf_filtered (outfile, "..");
          fputs_filtered (paddress (gdbarch, BLOCK_END (b)), outfile);
@@ -341,7 +350,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
          /* Now print each symbol in this block (in no particular order, if
             we're using a hashtable).  Note that we only want this
             block, not any blocks from included symtabs.  */
-         ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
+         ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym)
            {
              TRY
                {
@@ -466,7 +475,7 @@ maintenance_print_symbols (const char *args, int from_tty)
     {
       int found = 0;
 
-      for (objfile *objfile : all_objfiles (current_program_space))
+      for (objfile *objfile : current_program_space->objfiles ())
        {
          int print_for_objfile = 1;
 
@@ -477,21 +486,24 @@ maintenance_print_symbols (const char *args, int from_tty)
          if (!print_for_objfile)
            continue;
 
-         ALL_OBJFILE_FILETABS (objfile, cu, s)
+         for (compunit_symtab *cu : objfile->compunits ())
            {
-             int print_for_source = 0;
-
-             QUIT;
-             if (source_arg != NULL)
+             for (symtab *s : compunit_filetabs (cu))
                {
-                 print_for_source
-                   = compare_filenames_for_search
-                       (symtab_to_filename_for_display (s), source_arg);
-                 found = 1;
+                 int print_for_source = 0;
+
+                 QUIT;
+                 if (source_arg != NULL)
+                   {
+                     print_for_source
+                       = compare_filenames_for_search
+                       (symtab_to_filename_for_display (s), source_arg);
+                     found = 1;
+                   }
+                 if (source_arg == NULL
+                     || print_for_source)
+                   dump_symtab (s, outfile);
                }
-             if (source_arg == NULL
-                 || print_for_source)
-               dump_symtab (s, outfile);
            }
        }
 
@@ -724,7 +736,7 @@ maintenance_print_msymbols (const char *args, int from_tty)
       outfile = &arg_outfile;
     }
 
-  for (objfile *objfile : all_objfiles (current_program_space))
+  for (objfile *objfile : current_program_space->objfiles ())
     {
       QUIT;
       if (objfile_arg == NULL
@@ -744,7 +756,7 @@ maintenance_print_objfiles (const char *regexp, int from_tty)
     re_comp (regexp);
 
   ALL_PSPACES (pspace)
-    for (objfile *objfile : all_objfiles (pspace))
+    for (objfile *objfile : pspace->objfiles ())
       {
        QUIT;
        if (! regexp
@@ -766,13 +778,13 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
     re_comp (regexp);
 
   ALL_PSPACES (pspace)
-    for (objfile *objfile : all_objfiles (pspace))
+    for (objfile *objfile : pspace->objfiles ())
       {
        /* We don't want to print anything for this objfile until we
           actually find a symtab whose name matches.  */
        int printed_objfile_start = 0;
 
-       for (compunit_symtab *cust : objfile_compunits (objfile))
+       for (compunit_symtab *cust : objfile->compunits ())
          {
            int printed_compunit_symtab_start = 0;
 
@@ -851,13 +863,13 @@ maintenance_check_symtabs (const char *ignore, int from_tty)
   struct program_space *pspace;
 
   ALL_PSPACES (pspace)
-    for (objfile *objfile : all_objfiles (pspace))
+    for (objfile *objfile : pspace->objfiles ())
       {
        /* We don't want to print anything for this objfile until we
           actually find something worth printing.  */
        int printed_objfile_start = 0;
 
-       for (compunit_symtab *cust : objfile_compunits (objfile))
+       for (compunit_symtab *cust : objfile->compunits ())
          {
            int found_something = 0;
            struct symtab *symtab = compunit_primary_filetab (cust);
@@ -917,7 +929,7 @@ maintenance_expand_symtabs (const char *args, int from_tty)
     re_comp (regexp);
 
   ALL_PSPACES (pspace)
-    for (objfile *objfile : all_objfiles (pspace))
+    for (objfile *objfile : pspace->objfiles ())
       {
        if (objfile->sf)
          {
@@ -1018,9 +1030,9 @@ maintenance_info_line_tables (const char *regexp, int from_tty)
     re_comp (regexp);
 
   ALL_PSPACES (pspace)
-    for (objfile *objfile : all_objfiles (pspace))
+    for (objfile *objfile : pspace->objfiles ())
       {
-       for (compunit_symtab *cust : objfile_compunits (objfile))
+       for (compunit_symtab *cust : objfile->compunits ())
          {
            for (symtab *symtab : compunit_filetabs (cust))
              {
This page took 0.028057 seconds and 4 git commands to generate.