Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: print size of downloaded debuginfod binary
Date: Tue, 8 Dec 2020 11:16:04 +0100	[thread overview]
Message-ID: <2c28a403-a169-0dc3-9b64-58484237c8c2@suse.cz> (raw)
In-Reply-To: <c89c3c7a-e17f-63ea-b32d-3b9132a7cf2e@polymtl.ca>

[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]

On 12/7/20 6:07 PM, Simon Marchi wrote:
> 
> 
> On 2020-12-07 6:43 a.m., Martin Liška wrote:
>> With the patch, one can see now:
>>
>> Reading symbols from /usr/bin/gcc...
>> Downloading 2.69 MiB separate debug info for /usr/bin/gcc...
>> Downloading 1.00 MiB separate debug info for /lib64/ld-linux-x86-64.so.2...
>> Downloading 10.72 MiB separate debug info for /lib64/libc.so.6...
>> ...
> 

Thank you for the review.

> I think that's a good idea.  Given that we don't have a progress bar (yet), this gives clue to the user about why it might take some time.

Btw. I can also offer a WIP patch that implements the progress bar:

...
Temporary breakpoint 1 at 0x406150: file /home/marxin/Programming/gcc/gcc/gcc-main.c, line 44.
Starting program: /home/marxin/bin/gcc/bin/gcc
Downloading 1.00 MB separate debug info for /lib64/ld-linux-x86-64.so.2...10%..20%..30%..40%..50%..60%..70%..80%..90%..100%
Downloading 4.20 MB separate debug info for /lib64/libm.so.6...10%..20%..30%..40%..50%..60%..70%..80%..90%..100%
Downloading 10.72 MB separate debug info for /lib64/libc.so.6...10%..20%..30%..40%..50%

Thoughts?

> 
> Let's see if others have other opinions about this.  If nothing comes for by next week, you can go ahead and merge it.

All right,
thanks,
Martin

> 
> Simon


[-- Attachment #2: gdb-progress-bar.patch --]
[-- Type: text/x-patch, Size: 1723 bytes --]

diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index e21b2f40ca..5a810b897d 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -43,14 +43,17 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
 #else
 #include <elfutils/debuginfod.h>
 
+#define PROGRESS_STEP_PERCENT 10
+
 struct user_data
 {
   user_data (const char *desc, const char *fname)
-    : desc (desc), fname (fname), has_printed (false)
+    : desc (desc), fname (fname), next_percent_progress (PROGRESS_STEP_PERCENT), has_printed (false)
   { }
 
   const char * const desc;
   const char * const fname;
+  long next_percent_progress;
   bool has_printed;
 };
 
@@ -74,6 +77,7 @@ progressfn (debuginfod_client *c, long cur, long total)
 
   if (check_quit_flag ())
     {
+      // TODO
       printf_filtered ("Cancelling download of %s %ps...\n",
 		       data->desc,
 		       styled_string (file_name_style.style (), data->fname));
@@ -84,9 +88,23 @@ progressfn (debuginfod_client *c, long cur, long total)
     {
       /* Print this message only once.  */
       data->has_printed = true;
-      printf_filtered ("Downloading %s %ps...\n",
+      printf_filtered ("Downloading %.2f MB %s %ps.",
+		       1.0f * total / (1024 * 1024),
 		       data->desc,
 		       styled_string (file_name_style.style (), data->fname));
+      gdb_flush (gdb_stdout);
+    }
+  else if (total != 0)
+    {
+      long percent = 100 * cur / total;
+      while (percent >= data->next_percent_progress)
+	{
+	  printf ("..%ld%%", data->next_percent_progress);
+	  data->next_percent_progress += PROGRESS_STEP_PERCENT;
+	}
+      if (percent == 100)
+	printf ("\n");
+      gdb_flush (gdb_stdout);
     }
 
   return 0;


  reply	other threads:[~2020-12-08 10:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 11:43 Martin Liška
2020-12-07 17:07 ` Simon Marchi via Gdb-patches
2020-12-08 10:16   ` Martin Liška [this message]
2020-12-08 14:28     ` Simon Marchi via Gdb-patches
2020-12-09 10:51       ` Martin Liška
2020-12-09 23:26         ` Tom de Vries
2020-12-10  8:26           ` Martin Liška
2020-12-10 19:21           ` Tom Tromey
2020-12-11 17:51             ` [gdb/cli] Add a progress meter Tom de Vries
2020-12-11 17:54               ` [PATCH] gdb: print size of downloaded debuginfod binary Tom de Vries
2020-12-11 19:23                 ` Tom Tromey
2020-12-12 16:43                   ` Tom de Vries
2020-12-15 20:29                     ` Tom Tromey
2020-12-11 19:21               ` [gdb/cli] Add a progress meter Tom Tromey
2020-12-12 16:35                 ` Tom de Vries
2020-12-15 20:28                   ` Tom Tromey
2020-12-09 20:16   ` [PATCH] gdb: print size of downloaded debuginfod binary Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c28a403-a169-0dc3-9b64-58484237c8c2@suse.cz \
    --to=mliska@suse.cz \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox