From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFAv2] Output the Ada task name in more messages, output task names between "".
Date: Wed, 14 Aug 2019 04:56:00 -0000 [thread overview]
Message-ID: <c11c9212a6151d1efe1f1aa81587e776e1e92807.camel@skynet.be> (raw)
In-Reply-To: <8736i4wzk8.fsf@tromey.com>
On Tue, 2019-08-13 at 15:00 -0600, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> Also, task names are output between double quotes, similarly to what GDB
> Philippe> does for thread names.
>
> Philippe> (gdb) info task
> Philippe> ID TID P-ID Pri State Name
> Philippe> * 1 555555759030 48 Runnable "main_task"
>
> I am not sure about using the quoting here. I had talked my way into
> it, but then I saw the implementation...
>
> Philippe> +static std::string
> Philippe> +task_to_str (int taskno, const ada_task_info *task_info)
> Philippe> +{
> Philippe> + if (task_info->name[0] == '\0')
>
> Looks like this function has too much indentation.
>
> Philippe> + const struct ada_task_info *const task_info =
> Philippe> + &data->task_list[taskno - 1];
>
> The "=" should be on the next line here.
>
> Philippe> + if (uiout->is_mi_like_p ())
> Philippe> + uiout->field_string ("name",
> Philippe> + task_info->name[0] != '\0' ? task_info->name
> Philippe> + : _("<no name>"));
> Philippe> + else
> Philippe> + {
> Philippe> + uiout->field_fmt ("name",
> Philippe> + "\"%s\"",
> Philippe> + task_info->name[0] != '\0' ? task_info->name
> Philippe> + : _("<no name>"));
> Philippe> + }
>
> I'm not a big fan of using is_mi_like_p in general, and here it seems
> especially ugly.
The above code can probably be made less ugly, e.g. by using one single
call to field_fmt and ensure quotes are not output when is_mi_like_p.
But if we want to have quotes around task names (like thread names), and
not break the mi interface, I do not see how to not use is_mi_like_p
(which is used at a lot of places for such things).
So, I can either rollback the addition of quotes, or (slightly) cleanup
the code above.
What do you prefer ?
(or any other suggestion about how to do quotes cleanly?).
Thanks
Philippe
next prev parent reply other threads:[~2019-08-14 4:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-04 15:11 Philippe Waroquiers
2019-08-04 16:23 ` Eli Zaretskii
2019-08-13 21:00 ` Tom Tromey
2019-08-14 4:56 ` Philippe Waroquiers [this message]
2019-08-14 17:31 ` Tom Tromey
2019-08-14 22:08 ` Philippe Waroquiers
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=c11c9212a6151d1efe1f1aa81587e776e1e92807.camel@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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