gdb: include gdbsupport/buildargv.h in ser-mingw.c
[binutils-gdb.git] / gdb / symfile.c
index 89469a3d3dcdee05c385794fc3fa7adb7ba64cfa..a60892b08db1bfb508826b214e054aad1f0ef4d9 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>
@@ -1261,8 +1262,8 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
 
   if (separate_debug_file_debug)
     {
-      printf_filtered (_("  Trying %s..."), name.c_str ());
-      gdb_flush (gdb_stdout);
+      fprintf_filtered (gdb_stdlog, _("  Trying %s..."), name.c_str ());
+      gdb_flush (gdb_stdlog);
     }
 
   gdb_bfd_ref_ptr abfd (gdb_bfd_open (name.c_str (), gnutarget));
@@ -1270,7 +1271,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
   if (abfd == NULL)
     {
       if (separate_debug_file_debug)
-       printf_filtered (_(" no, unable to open.\n"));
+       fprintf_filtered (gdb_stdlog, _(" no, unable to open.\n"));
 
       return 0;
     }
@@ -1294,7 +1295,8 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
          && abfd_stat.st_ino == parent_stat.st_ino)
        {
          if (separate_debug_file_debug)
-           printf_filtered (_(" no, same file as the objfile.\n"));
+           fprintf_filtered (gdb_stdlog,
+                             _(" no, same file as the objfile.\n"));
 
          return 0;
        }
@@ -1308,7 +1310,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
   if (!file_crc_p)
     {
       if (separate_debug_file_debug)
-       printf_filtered (_(" no, error computing CRC.\n"));
+       fprintf_filtered (gdb_stdlog, _(" no, error computing CRC.\n"));
 
       return 0;
     }
@@ -1326,7 +1328,8 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
          if (!gdb_bfd_crc (parent_objfile->obfd, &parent_crc))
            {
              if (separate_debug_file_debug)
-               printf_filtered (_(" no, error computing CRC.\n"));
+               fprintf_filtered (gdb_stdlog,
+                                 _(" no, error computing CRC.\n"));
 
              return 0;
            }
@@ -1338,13 +1341,13 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
                 name.c_str (), objfile_name (parent_objfile));
 
       if (separate_debug_file_debug)
-       printf_filtered (_(" no, CRC doesn't match.\n"));
+       fprintf_filtered (gdb_stdlog, _(" no, CRC doesn't match.\n"));
 
       return 0;
     }
 
   if (separate_debug_file_debug)
-    printf_filtered (_(" yes!\n"));
+    fprintf_filtered (gdb_stdlog, _(" yes!\n"));
 
   return 1;
 }
@@ -1379,8 +1382,9 @@ find_separate_debug_file (const char *dir,
                          unsigned long crc32, struct objfile *objfile)
 {
   if (separate_debug_file_debug)
-    printf_filtered (_("\nLooking for separate debug info (debug link) for "
-                      "%s\n"), objfile_name (objfile));
+    fprintf_filtered (gdb_stdlog,
+                     _("\nLooking for separate debug info (debug link) for "
+                       "%s\n"), objfile_name (objfile));
 
   /* First try in the same directory as the original file.  */
   std::string debugfile = dir;
@@ -2273,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)
@@ -2286,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
@@ -2306,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."));
@@ -3259,8 +3263,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;
@@ -3308,7 +3312,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
@@ -3321,7 +3325,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
@@ -3334,7 +3338,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