public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: "Alexandra Hájková via Gdb-patches" <gdb-patches@sourceware.org>
Cc: "Alexandra Hájková" <ahajkova@redhat.com>
Subject: Re: [PATCH v2] Use styled_string when defering warnings when loading separate debug files
Date: Mon, 17 Apr 2023 09:17:17 -0600	[thread overview]
Message-ID: <87jzya4jya.fsf@tromey.com> (raw)
In-Reply-To: <20230320145638.1202335-1-ahajkova@redhat.com> ("Alexandra =?utf-8?B?SMOhamtvdsOh?= via Gdb-patches"'s message of "Mon, 20 Mar 2023 15:56:38 +0100")

>>>>> "Alexandra" == Alexandra Hájková via Gdb-patches <gdb-patches@sourceware.org> writes:

Alexandra> This version uses ui_file rather instead of vector of
Alexandra> callback functions that emit warnings.

I think instead of a std::vector<string_file>, what I meant was just use
a single string_file.

The caller can make it, using something like:

  string_file file (gdb_stderr->can_emit_style_escape ());

Alexandra> +	  string_file warnings (true);

... since I think 'true' isn't always correct.

Alexandra> +	  warnings.printf ("\"%ps\":separate debug info file has no debug info",
Alexandra> +			   styled_string (file_name_style.style (),
Alexandra> +					  bfd_get_filename (abfd.get ())));

Then this printf can either add a 'warning:' prefix like warning() does,
or we can add an overload of "warning" that takes a ui_file as its first
parameter.

Alexandra> -	for (const std::string &w : warnings_vector)
Alexandra> +	for (const string_file &w : warnings_vector)
Alexandra>  	  warning ("%s", w.c_str ());

The approach I mention seems fine because the caller ends up not doing
anything except possibly printing the strings.

Alexandra> +  string_file(string_file &&other)
Alexandra> +    : m_string (std::move (other.c_str ())),
Alexandra> +    m_term_out (other.m_term_out)
Alexandra> +  {
Alexandra> +
Alexandra> +  }

Then you wouldn't need this, either.  But for future reference I think
this is just:

  string_file (string_file &&other) = default;

thanks,
Tom

  parent reply	other threads:[~2023-04-17 15:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 14:56 Alexandra Hájková
2023-03-30  8:11 ` Alexandra Petlanova Hajkova
2023-04-11 12:40   ` Alexandra Petlanova Hajkova
2023-04-17 15:17 ` Tom Tromey [this message]
2023-04-18 12:20   ` Alexandra Petlanova Hajkova
2023-04-21 14:07     ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2023-02-16 19:56 [PATCH] " Alexandra Hájková
2023-02-17 12:35 ` [PATCH v2] " Alexandra Hájková
2023-02-25 10:43   ` Andrew Burgess
2023-02-26 17:36   ` 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=87jzya4jya.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=ahajkova@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).