]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Print downloading notification only when file is found on server users/amerey/debuginfod
authorAaron Merey <amerey@redhat.com>
Tue, 25 Feb 2020 21:42:55 +0000 (16:42 -0500)
committerAaron Merey <amerey@redhat.com>
Tue, 25 Feb 2020 21:42:55 +0000 (16:42 -0500)
gdb/debuginfod-support.c

index 7bb1207c0b911f69d83b2a53c19ff5fbf6e57369..53e3a50d31f0609b4ae7d026911cf56ce003cdba 100644 (file)
@@ -43,7 +43,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
 #else
 #include <elfutils/debuginfod.h>
 
-/* TODO: Use debuginfod API extensions to print filename from progressfn.  */
+/* TODO: Use debuginfod API extensions instead of these globals.  */
 static const char *fname;
 static bool has_printed;
 
@@ -52,17 +52,17 @@ progressfn (debuginfod_client *c, long cur, long total)
 {
   if (check_quit_flag ())
     {
-      printf_filtered ("Cancelling download of %ps...\n",
-                      styled_string (file_name_style.style (), fname));
+      printf_unfiltered ("Cancelling download of %ps...\n",
+                        styled_string (file_name_style.style (), fname));
       return 1;
     }
 
-  if (!has_printed)
+  if (!has_printed && total != 0)
     {
       /* Print this message only once.  */
       has_printed = true;
       printf_unfiltered ("Debuginfod downloading %ps...\n",
-                      styled_string (file_name_style.style (), fname));
+                        styled_string (file_name_style.style (), fname));
     }
 
   return 0;
@@ -106,11 +106,9 @@ debuginfod_source_query (const unsigned char *build_id,
 
   /* TODO: Add 'set debug debuginfod' command to control when error messages are shown.  */
   if (fd.get () < 0 && fd.get () != -ENOENT)
-    {
-      printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
-                      strerror (-fd.get ()),
-                      styled_string (file_name_style.style (),  srcpath));
-    }
+    printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
+                    strerror (-fd.get ()),
+                    styled_string (file_name_style.style (),  srcpath));
   else
     destname->reset (xstrdup (srcpath));