public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [RFA 0/6] Remove some uses of is_mi_like_p
Date: Mon, 30 Apr 2018 18:52:00 -0000	[thread overview]
Message-ID: <871sew4jdf.fsf@tromey.com> (raw)
In-Reply-To: <5ff777cb-ce59-b818-d19f-60450e8fa414@redhat.com> (Pedro Alves's	message of "Mon, 30 Apr 2018 19:36:28 +0100")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I'm not sure what you mean exactly, but I've wished before that
Pedro> we could write ui-out field output mixed in with plain text with
Pedro> something like:

Pedro> ui_out-> field_fmt (_("Field 1 is 0x%pF, at 0x%pF\n"),
Pedro>                      ui_field_int ("field1", var1),
Pedro>                      ui_field_func ("func_name", var2));

Pedro> That's allow proper i18n, and would allow things like colorizing.

Pedro> I guess that this is something like what you mean, only you
Pedro> probably have it more thought through.

Haha, I wouldn't say that.

What I was thinking, though, was a combination of:

* teaching gdb to know when an escape sequence doesn't contribute to the
  column count (I have a patch for this);
* moving all such formatting to a special formatting language;
* and finally, letting users set the formats.


So for the above example, the emission code would just look something
like:

   ui_out->field_int ("field1", var1);
   ui_out->field_core_addr ("func_name", var2);

Elsewhere the CLI would set up the default format for this table (or
tuple or list):

   cli_out_register ("field-info-entry",
                     "Field 1 is %{field1:x}, at %{field2:x}\n");

Colorizing could be done by just changing the format.  Users could
rearrange the columns or do other simple-ish customization as well.  If
we were feeling really ambitious we could replace annotations this way.

I was also thinking that the column widths could be removed from the
producers and put into these format strings.

However, there are various tricky cases here, due to the ways that
is_mi_like_p has been abused so far, and also the complicated ways that
messages are actually constructed.  I have a (partial) list on my other
machine, if you really want to go into the weeds.


Another idea I had was to do all this, only from Python.  I have some
code in this direction as well.  However it seemed to me that, although
Python would allow more flexibility (advanced users could program it),
on the other hand it's better for the gdb core to be cleaned up if
possible.

Tom

      reply	other threads:[~2018-04-30 18:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 14:07 Tom Tromey
2018-04-30 14:07 ` [RFA 6/6] Remove a use of is_mi_like_p from darwin-nat-info.c Tom Tromey
2018-04-30 14:07 ` [RFA 1/6] Make do_is_mi_like_p const Tom Tromey
2018-04-30 14:07 ` [RFA 4/6] Remove a use of is_mi_like_p from tracepoint.c Tom Tromey
2018-04-30 14:07 ` [RFA 5/6] Remove some is_mi_like_p from breakpoint code Tom Tromey
2018-04-30 14:07 ` [RFA 2/6] Remove some uses of is_mi_like_p from py-framefilter.c Tom Tromey
2018-04-30 14:07 ` [RFA 3/6] Remove some uses of is_mi_like_p from spu-tdep.c Tom Tromey
2018-04-30 18:36 ` [RFA 0/6] Remove some uses of is_mi_like_p Pedro Alves
2018-04-30 18:52   ` Tom Tromey [this message]

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=871sew4jdf.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).