From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PUSHED] gdb: make more use of make_target_connection_string
Date: Thu, 15 Dec 2022 07:58:06 -0500 [thread overview]
Message-ID: <2d9e0814-b4a8-fba8-9422-a1c746a15ebf@simark.ca> (raw)
In-Reply-To: <53cf95c3389a3ecd97276d322e4a60fe3396a201.1671108652.git.aburgess@redhat.com>
On 12/15/22 07:53, Andrew Burgess via Gdb-patches wrote:
> Oops! I accidentally pushed this patch to master.
>
> I haven't immediately reverted it because I think it is a pretty
> obvious cleanup, but I would normally have posted this for review.
>
> If anyone has any issues with the patch then please reply, I can
> either fix any problems, or fully revert the patch if requeted.
>
> Sorry for the carelessness.
>
> Thanks,
> Andrew
I just spotted some nits, if you want to fix them up.
> diff --git a/gdb/inferior.c b/gdb/inferior.c
> index ec63e0491e5..3d2bce9df7b 100644
> --- a/gdb/inferior.c
> +++ b/gdb/inferior.c
> @@ -33,6 +33,7 @@
> #include "cli/cli-utils.h"
> #include "arch-utils.h"
> #include "target-descriptions.h"
> +#include "target-connection.h"
> #include "readline/tilde.h"
> #include "progspace-and-thread.h"
> #include "gdbsupport/buildargv.h"
> @@ -482,21 +483,13 @@ static std::string
> uiout_field_connection (process_stratum_target *proc_target)
> {
> if (proc_target == NULL)
> - {
> - return {};
> - }
> - else if (proc_target->connection_string () != NULL)
> - {
> - return string_printf ("%d (%s %s)",
> - proc_target->connection_number,
> - proc_target->shortname (),
> - proc_target->connection_string ());
> - }
> + return {};
> else
> {
> - return string_printf ("%d (%s)",
> - proc_target->connection_number,
> - proc_target->shortname ());
> + std::string conn_str
> + = make_target_connection_string (proc_target).c_str ();
I think you can remove the .c_str here.
> diff --git a/gdb/target-connection.c b/gdb/target-connection.c
> index d1da6a2d7b9..d88b9c8f563 100644
> --- a/gdb/target-connection.c
> +++ b/gdb/target-connection.c
> @@ -91,10 +91,7 @@ print_connection (struct ui_out *uiout, const char *requested_connections)
>
> process_stratum_target *t = it.second;
>
> - size_t l = strlen (t->shortname ());
> - if (t->connection_string () != NULL)
> - l += 1 + strlen (t->connection_string ());
> -
> + size_t l = strlen (make_target_connection_string (t).c_str ());
I think you can use std::string::length here.
Simon
next prev parent reply other threads:[~2022-12-15 12:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 12:53 Andrew Burgess
2022-12-15 12:58 ` Simon Marchi [this message]
2022-12-15 16:54 ` Andrew Burgess
2022-12-15 17:04 ` Simon Marchi
2022-12-16 13:31 ` Andrew Burgess
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=2d9e0814-b4a8-fba8-9422-a1c746a15ebf@simark.ca \
--to=simark@simark.ca \
--cc=aburgess@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).