gdb: rename compunit_primary_filetab to compunit_symtab::primary_filetab
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 20 Nov 2021 01:50:59 +0000 (20:50 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 6 Feb 2022 20:48:18 +0000 (15:48 -0500)
Make compunit_primary_filetab a method of compunit_symtab.

Change-Id: Iee3c4f7e36d579bf763c5bba146e5e10d6766768

gdb/dwarf2/read.c
gdb/guile/scm-block.c
gdb/psymtab.c
gdb/symfile-debug.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h

index fe274ed3a1f8bf0dadfc216c3c8915d262052c90..84877e6c7fe0d39487a1d349f80a771f3e61b0d2 100644 (file)
@@ -3113,7 +3113,7 @@ dwarf2_base_index_functions::find_last_source_symtab (struct objfile *objfile)
   if (cust == NULL)
     return NULL;
 
-  return compunit_primary_filetab (cust);
+  return cust->primary_filetab ();
 }
 
 /* See read.h.  */
index 0c63dfb25f82a78334e05451e8e79b6d4db50e31..df0ef7f0b1f0ad41a5b1533d10dc7bd57322fb58 100644 (file)
@@ -554,7 +554,7 @@ bkscm_print_block_syms_progress_smob (SCM self, SCM port,
                    : i_smob->iter.d.compunit_symtab->includes[i_smob->iter.idx]);
            gdbscm_printf (port, " %s",
                           symtab_to_filename_for_display
-                            (compunit_primary_filetab (cust)));
+                            (cust->primary_filetab ()));
            break;
          }
        case FIRST_LOCAL_BLOCK:
index ce077c67cbbe1ad008f96a87def0d936776512d5..fcbf54ab2bdd9afd48ed6b71f8176f824006b7ad 100644 (file)
@@ -631,7 +631,7 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp)
 
          if (cust == NULL)
            return NULL;
-         return compunit_primary_filetab (cust);
+         return cust->primary_filetab ();
        }
     }
   return NULL;
index ab5fc0d02728af2c5243ea60e99d61c17a6e0582..cd25789ba9b04532f26c568df83d5272586eb1c5 100644 (file)
@@ -289,7 +289,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
   if (debug_symfile)
     fprintf_filtered (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
                      retval
-                     ? debug_symtab_name (compunit_primary_filetab (retval))
+                     ? debug_symtab_name (retval->primary_filetab ())
                      : "NULL");
 
   return retval;
@@ -454,7 +454,7 @@ objfile::find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol,
     fprintf_filtered (gdb_stdlog,
                      "qf->find_pc_sect_compunit_symtab (...) = %s\n",
                      retval
-                     ? debug_symtab_name (compunit_primary_filetab (retval))
+                     ? debug_symtab_name (retval->primary_filetab ())
                      : "NULL");
 
   return retval;
@@ -495,7 +495,7 @@ objfile::find_compunit_symtab_by_address (CORE_ADDR address)
     fprintf_filtered (gdb_stdlog,
                      "qf->find_compunit_symtab_by_address (...) = %s\n",
                      result
-                     ? debug_symtab_name (compunit_primary_filetab (result))
+                     ? debug_symtab_name (result->primary_filetab ())
                      : "NULL");
 
   return result;
index 19c387d852d7e70a88a15c6bfc3d15e8cd3956df..8b57434e84fcaea1449713f72703c60028f8e8fe 100644 (file)
@@ -860,7 +860,7 @@ maintenance_check_symtabs (const char *ignore, int from_tty)
        for (compunit_symtab *cust : objfile->compunits ())
          {
            int found_something = 0;
-           struct symtab *symtab = compunit_primary_filetab (cust);
+           struct symtab *symtab = cust->primary_filetab ();
 
            QUIT;
 
index 44b5bfb43bbf27520354369c71156e844c20635b..2028e837f0f1b707ea1fc27c0d706d0468db61b1 100644 (file)
@@ -362,12 +362,12 @@ compunit_symtab::set_call_site_htab (htab_t call_site_htab)
 /* See symtab.h.  */
 
 struct symtab *
-compunit_primary_filetab (const struct compunit_symtab *cust)
+compunit_symtab::primary_filetab () const
 {
-  gdb_assert (COMPUNIT_FILETABS (cust) != NULL);
+  gdb_assert (this->filetabs != nullptr);
 
   /* The primary file symtab is the first one in the list.  */
-  return COMPUNIT_FILETABS (cust);
+  return this->filetabs;
 }
 
 /* See symtab.h.  */
@@ -375,7 +375,7 @@ compunit_primary_filetab (const struct compunit_symtab *cust)
 enum language
 compunit_language (const struct compunit_symtab *cust)
 {
-  struct symtab *symtab = compunit_primary_filetab (cust);
+  struct symtab *symtab = cust->primary_filetab ();
 
 /* The language of the compunit symtab is the language of its primary
    source file.  */
@@ -2376,7 +2376,7 @@ Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
 (if a template, try specifying an instantiation: %s<type>)."),
         block_index == GLOBAL_BLOCK ? "global" : "static",
         name,
-        symtab_to_filename_for_display (compunit_primary_filetab (cust)),
+        symtab_to_filename_for_display (cust->primary_filetab ()),
         name, name);
 }
 
index dc15c49ec8ecc493a4f45617b6f8491b078f7ed5..f6d787c45c84523bbcf4792db8b0c8fe499cbc5b 100644 (file)
@@ -1459,6 +1459,9 @@ struct compunit_symtab
     m_objfile = objfile;
   }
 
+  /* Return the primary filetab of the compunit.  */
+  symtab *primary_filetab () const;
+
   /* Set m_call_site_htab.  */
   void set_call_site_htab (htab_t call_site_htab);
 
@@ -1566,11 +1569,6 @@ compunit_filetabs (compunit_symtab *cu)
   return symtab_range (cu->filetabs);
 }
 
-/* Return the primary symtab of CUST.  */
-
-extern struct symtab *
-  compunit_primary_filetab (const struct compunit_symtab *cust);
-
 /* Return the language of CUST.  */
 
 extern enum language compunit_language (const struct compunit_symtab *cust);