Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: print size of downloaded debuginfod binary
Date: Fri, 11 Dec 2020 12:23:51 -0700	[thread overview]
Message-ID: <87ft4cgn94.fsf@tromey.com> (raw)
In-Reply-To: <a3a93356-c8e0-8352-5665-d2ccbd7a15f8@suse.de> (Tom de Vries's message of "Fri, 11 Dec 2020 18:54:43 +0100")

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> +  gdb::optional<ui_out::progress_meter> meter;

Seems like a bit of a shame to have an optional here, but then
essentially require optional-style behavior in the CLI ui-out as well
(in deferring output until the first update).

Maybe it could be done in progress_meter itself.  Not sure.

Tom> -      /* Print this message only once.  */
Tom> -      data->has_printed = true;
Tom> -      printf_filtered ("Downloading %s %ps...\n",
Tom> -		       data->desc,
Tom> -		       styled_string (file_name_style.style (), data->fname));
Tom> +      float size_in_mb = 1.0f * total / (1024 * 1024);
Tom> +      std::stringstream message;
Tom> +      message.precision (2);
Tom> +      message << "Downloading " << size_in_mb << " MB " << data->desc
Tom> +	      << " " << data->fname;

Seems like this could use string_printf.
I suspect there's some way to preserve the styling but offhand I don't
recall what it is.  Maybe you have to use string_file to accomplish that.

Tom

  reply	other threads:[~2020-12-11 19:23 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
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 [this message]
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=87ft4cgn94.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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