Remove LA_PRINT_TYPE
[binutils-gdb.git] / gdb / symfile.c
index 6787f37d5c30efb590e5331d7057c994795fd796..1a64fc797423762178dde552fff39da31a86e052 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic symbol file reading for the GNU debugger, GDB.
 
-   Copyright (C) 1990-2021 Free Software Foundation, Inc.
+   Copyright (C) 1990-2022 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
@@ -40,7 +40,7 @@
 #include "regcache.h"
 #include "filenames.h"         /* for DOSish file names */
 #include "gdb-stabs.h"
-#include "gdb_obstack.h"
+#include "gdbsupport/gdb_obstack.h"
 #include "completer.h"
 #include "bcache.h"
 #include "hashtab.h"
@@ -61,6 +61,7 @@
 #include "gdbsupport/selftest.h"
 #include "cli/cli-style.h"
 #include "gdbsupport/forward-scope-exit.h"
+#include "gdbsupport/buildargv.h"
 
 #include <sys/types.h>
 #include <fcntl.h>
@@ -2276,8 +2277,8 @@ add_symbol_file_command (const char *args, int from_tty)
      statements because hex_string returns a local static
      string.  */
 
-  printf_unfiltered (_("add symbol table from file \"%s\""),
-                    filename.get ());
+  printf_filtered (_("add symbol table from file \"%s\""),
+                  filename.get ());
   section_addr_info section_addrs;
   std::vector<sect_opt>::const_iterator it = sect_opts.begin ();
   if (!seen_addr)
@@ -2289,7 +2290,7 @@ add_symbol_file_command (const char *args, int from_tty)
       const char *sec = it->name;
 
       if (section_addrs.empty ())
-       printf_unfiltered (_(" at\n"));
+       printf_filtered (_(" at\n"));
       addr = parse_and_eval_address (val);
 
       /* Here we store the section offsets in the order they were
@@ -2309,13 +2310,13 @@ add_symbol_file_command (const char *args, int from_tty)
         so we can't determine what section names are valid.  */
     }
   if (seen_offset)
-      printf_unfiltered (_("%s offset by %s\n"),
-                        (section_addrs.empty ()
-                         ? _(" with all sections")
-                         : _("with other sections")),
-                        paddress (gdbarch, offset));
+    printf_filtered (_("%s offset by %s\n"),
+                    (section_addrs.empty ()
+                     ? _(" with all sections")
+                     : _("with other sections")),
+                    paddress (gdbarch, offset));
   else if (section_addrs.empty ())
-    printf_unfiltered ("\n");
+    printf_filtered ("\n");
 
   if (from_tty && (!query ("%s", "")))
     error (_("Not confirmed."));
@@ -2606,9 +2607,9 @@ reread_symbols (int from_tty)
 
          if (!objfile_has_symbols (objfile))
            {
-             wrap_here ("");
+             gdb_stdout->wrap_here (0);
              printf_filtered (_("(no debugging symbols found)\n"));
-             wrap_here ("");
+             gdb_stdout->wrap_here (0);
            }
 
          /* We're done reading the symbol file; finish off complaints.  */
@@ -2773,13 +2774,13 @@ deduce_language_from_filename (const char *filename)
 struct symtab *
 allocate_symtab (struct compunit_symtab *cust, const char *filename)
 {
-  struct objfile *objfile = cust->objfile;
+  struct objfile *objfile = cust->objfile ();
   struct symtab *symtab
     = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symtab);
 
   symtab->filename = objfile->intern (filename);
   symtab->fullname = NULL;
-  symtab->language = deduce_language_from_filename (filename);
+  symtab->set_language (deduce_language_from_filename (filename));
 
   /* This can be very verbose with lots of headers.
      Only print at higher debug levels.  */
@@ -2803,19 +2804,10 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename)
     }
 
   /* Add it to CUST's list of symtabs.  */
-  if (cust->filetabs == NULL)
-    {
-      cust->filetabs = symtab;
-      cust->last_filetab = symtab;
-    }
-  else
-    {
-      cust->last_filetab->next = symtab;
-      cust->last_filetab = symtab;
-    }
+  cust->add_filetab (symtab);
 
   /* Backlink to the containing compunit symtab.  */
-  symtab->compunit_symtab = cust;
+  symtab->set_compunit (cust);
 
   return symtab;
 }
@@ -2831,7 +2823,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
                                               struct compunit_symtab);
   const char *saved_name;
 
-  cu->objfile = objfile;
+  cu->set_objfile (objfile);
 
   /* The name we record here is only for display/debugging purposes.
      Just save the basename to avoid path issues (too long for display,
@@ -2839,7 +2831,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
   saved_name = lbasename (name);
   cu->name = obstack_strdup (&objfile->objfile_obstack, saved_name);
 
-  COMPUNIT_DEBUGFORMAT (cu) = "unknown";
+  cu->set_debugformat ("unknown");
 
   if (symtab_create_debug)
     {
@@ -2857,8 +2849,8 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
 void
 add_compunit_symtab_to_objfile (struct compunit_symtab *cu)
 {
-  cu->next = cu->objfile->compunit_symtabs;
-  cu->objfile->compunit_symtabs = cu;
+  cu->next = cu->objfile ()->compunit_symtabs;
+  cu->objfile ()->compunit_symtabs = cu;
 }
 \f
 
@@ -3210,13 +3202,13 @@ list_overlays_command (const char *args, int from_tty)
              name = bfd_section_name (osect->the_bfd_section);
 
              printf_filtered ("Section %s, loaded at ", name);
-             fputs_filtered (paddress (gdbarch, lma), gdb_stdout);
+             puts_filtered (paddress (gdbarch, lma));
              puts_filtered (" - ");
-             fputs_filtered (paddress (gdbarch, lma + size), gdb_stdout);
+             puts_filtered (paddress (gdbarch, lma + size));
              printf_filtered (", mapped at ");
-             fputs_filtered (paddress (gdbarch, vma), gdb_stdout);
+             puts_filtered (paddress (gdbarch, vma));
              puts_filtered (" - ");
-             fputs_filtered (paddress (gdbarch, vma + size), gdb_stdout);
+             puts_filtered (paddress (gdbarch, vma + size));
              puts_filtered ("\n");
 
              nmapped++;
@@ -3262,8 +3254,8 @@ map_overlay_command (const char *args, int from_tty)
                                                                        sec2))
                {
                  if (info_verbose)
-                   printf_unfiltered (_("Note: section %s unmapped by overlap\n"),
-                                      bfd_section_name (sec2->the_bfd_section));
+                   printf_filtered (_("Note: section %s unmapped by overlap\n"),
+                                    bfd_section_name (sec2->the_bfd_section));
                  sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2.  */
                }
          return;
@@ -3311,7 +3303,7 @@ overlay_auto_command (const char *args, int from_tty)
   overlay_debugging = ovly_auto;
   enable_overlay_breakpoints ();
   if (info_verbose)
-    printf_unfiltered (_("Automatic overlay debugging enabled."));
+    printf_filtered (_("Automatic overlay debugging enabled."));
 }
 
 /* Function: overlay_manual_command
@@ -3324,7 +3316,7 @@ overlay_manual_command (const char *args, int from_tty)
   overlay_debugging = ovly_on;
   disable_overlay_breakpoints ();
   if (info_verbose)
-    printf_unfiltered (_("Overlay debugging enabled."));
+    printf_filtered (_("Overlay debugging enabled."));
 }
 
 /* Function: overlay_off_command
@@ -3337,7 +3329,7 @@ overlay_off_command (const char *args, int from_tty)
   overlay_debugging = ovly_off;
   disable_overlay_breakpoints ();
   if (info_verbose)
-    printf_unfiltered (_("Overlay debugging disabled."));
+    printf_filtered (_("Overlay debugging disabled."));
 }
 
 static void