]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: make objfile_has_full_symbols and objfile_has_symbols methods of objfile
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 26 May 2025 15:33:44 +0000 (11:33 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 27 May 2025 13:46:28 +0000 (09:46 -0400)
They seem like good candidates to become methods, just like
objfile::has_partial_symbols.

Change-Id: Ic6df83012629c1137708b8ceb327f9868d8abcb5
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
gdb/objfiles.c
gdb/objfiles.h
gdb/solib.c
gdb/symfile.c
gdb/symtab.c

index 3c5a554785dc7ee26240d17fea97a1b2345dcf4a..d25d1a02cea1d5c7b200e078d98924e993e9d50e 100644 (file)
@@ -673,18 +673,18 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
 /* See objfiles.h.  */
 
 bool
-objfile_has_full_symbols (objfile *objfile)
+objfile::has_full_symbols ()
 {
-  return objfile->compunit_symtabs != nullptr;
+  return this->compunit_symtabs != nullptr;
 }
 
 /* See objfiles.h.  */
 
 bool
-objfile_has_symbols (objfile *objfile)
+objfile::has_symbols ()
 {
-  for (::objfile *o : objfile->separate_debug_objfiles ())
-    if (o->has_partial_symbols () || objfile_has_full_symbols (o))
+  for (::objfile *o : this->separate_debug_objfiles ())
+    if (o->has_partial_symbols () || o->has_full_symbols ())
       return true;
 
   return false;
@@ -708,7 +708,7 @@ bool
 have_full_symbols (program_space *pspace)
 {
   for (objfile *ofp : pspace->objfiles ())
-    if (objfile_has_full_symbols (ofp))
+    if (ofp->has_full_symbols ())
       return true;
 
   return false;
index bb2f05db2778a67777ba77b5a5965bccb87a67a8..41aacc372bcf96e76aa7488ef397ff3aea7fdbbb 100644 (file)
@@ -515,10 +515,16 @@ public:
     return per_bfd->gdbarch;
   }
 
-  /* Return true if OBJFILE has partial symbols.  */
-
+  /* Return true if this objfile has partial symbols.  */
   bool has_partial_symbols ();
 
+  /* Return true if this objfile has full symbols.  */
+  bool has_full_symbols ();
+
+  /* Return true if this objfile has full or partial symbols, either directly
+     or through a separate debug file.  */
+  bool has_symbols ();
+
   /* Look for a separate debug symbol file for this objfile, make use of
      build-id, debug-link, and debuginfod as necessary.  If a suitable
      separate debug symbol file is found then it is loaded using a call to
@@ -938,15 +944,6 @@ extern void free_objfile_separate_debug (struct objfile *);
 extern void objfile_relocate (struct objfile *, const section_offsets &);
 extern void objfile_rebase (struct objfile *, CORE_ADDR);
 
-/* Return true if OBJFILE has full symbols.  */
-
-extern bool objfile_has_full_symbols (objfile *objfile);
-
-/* Return true if OBJFILE has full or partial symbols, either directly
-   or through a separate debug file.  */
-
-extern bool objfile_has_symbols (objfile *objfile);
-
 /* Return true if any objfile of PSPACE has partial symbols.  */
 
 extern bool have_partial_symbols (program_space *pspace);
index 85ec6bb2f1ede061774e4f52ba83c0392e59801b..0f29edb6bca3cfebecad17025ecdaabd9e6e75bc 100644 (file)
@@ -1085,7 +1085,7 @@ print_solib_list_table (std::vector<const solib *> solib_list,
          }
 
        if (!top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
-           && so->symbols_loaded && !objfile_has_symbols (so->objfile))
+           && so->symbols_loaded && !so->objfile->has_symbols ())
          {
            so_missing_debug_info = true;
            uiout->field_string ("syms-read", "Yes (*)");
index 9a6322db30b4ac984050df4f7636c14770f2658d..680c9a54112f8a19be0f296495726c360ea791ed 100644 (file)
@@ -1101,7 +1101,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
      no separate debug file.  If there is a separate debug file which
      does not have symbols, we'll have emitted this message for that
      file, and so printing it twice is just redundant.  */
-  if (should_print && !objfile_has_symbols (objfile)
+  if (should_print && !objfile->has_symbols ()
       && objfile->separate_debug_objfile == nullptr)
     gdb_printf (_("(No debugging symbols found in %ps)\n"),
                styled_string (file_name_style.style (), name));
@@ -2323,7 +2323,7 @@ add_symbol_file_command (const char *args, int from_tty)
 
   objf = symbol_file_add (filename.get (), add_flags, &section_addrs,
                          flags);
-  if (!objfile_has_symbols (objf) && objf->per_bfd->minimal_symbol_count <= 0)
+  if (!objf->has_symbols () && objf->per_bfd->minimal_symbol_count <= 0)
     warning (_("newly-added symbol file \"%ps\" does not provide any symbols"),
             styled_string (file_name_style.style (), filename.get ()));
 
@@ -2662,7 +2662,7 @@ reread_symbols (int from_tty)
              objfile->expand_all_symtabs ();
            }
 
-         if (!objfile_has_symbols (objfile))
+         if (!objfile->has_symbols ())
            {
              gdb_stdout->wrap_here (0);
              gdb_printf (_("(no debugging symbols found)\n"));
index febd04176db77331550d8ccf7a561d43e83afafc..bbcbb8ae298475aa588e30396c29c18a2adc181f 100644 (file)
@@ -4707,7 +4707,7 @@ info_sources_worker (struct ui_out *uiout,
          if (uiout->is_mi_like_p ())
            {
              const char *debug_info_state;
-             if (objfile_has_symbols (objfile))
+             if (objfile->has_symbols ())
                {
                  if (debug_fully_readin)
                    debug_info_state = "fully-read";
@@ -4723,7 +4723,7 @@ info_sources_worker (struct ui_out *uiout,
              if (!debug_fully_readin)
                uiout->text ("(Full debug information has not yet been read "
                             "for this file.)\n");
-             if (!objfile_has_symbols (objfile))
+             if (!objfile->has_symbols ())
                uiout->text ("(Objfile has no debug information.)\n");
              uiout->text ("\n");
            }