public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [RFC 3/8] Add output styles to gdb
Date: Mon, 08 Oct 2018 22:17:00 -0000	[thread overview]
Message-ID: <87d0skccda.fsf@tromey.com> (raw)
In-Reply-To: <a0de80102b0f0aea1421667c3ac2f091@simark.ca> (Simon Marchi's	message of "Mon, 08 Oct 2018 07:10:40 -0400")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> "{refcount<10}"

Simon> Do we pass in the values as with printf?  Something like
Simon> ui_out-> format ("{refcount<10}{addr<18}{filename<40}\n", refcount,
Simon> addr, filename);

Nope, the idea is to continue to use the existing ui-out methods.  So
continuing the gdb_bfd example, this code in print_one_bfd:

  uiout->field_int ("refcount", gdata->refc);
  uiout->field_string ("addr", host_address_to_string (abfd));
  uiout->field_string ("filename", bfd_get_filename (abfd));

... would not change at all.

The idea is that the format would be registered as a set/show command
somewhere.  For tables, cli-out could look up the appropriate format
string using the table name; not sure how tuples or lists would work.

Simon> How does the underlying implementation of format knows that the
Simon> refcount variable is an int, and that addr and filename are char*?  We
Simon> go by field name too?  Or should the format specifier contain the data
Simon> type?

The above answers, but basically it would work like today -- the type is
implicit in the ui-out calls, though really at the bottom layer it is
all just strings.

Simon> I tend to think that introducing a format-based system like this is
Simon> relatively orthogonal to the coloring/styling issue.

Part of the overall idea was to let users put styling directly in the
format strings -- sorry, maybe I didn't really spell this out.  So
another example would be

  "{fg=red}{field<40}{fg=default}"

... or something along those lines.  This would conflict a bit with the
idea of styling elements the way that the current patch does it, since
then you'd have to decide what takes precedence.

Though, your note makes me think that this potential conflict really
isn't so bad and we could push forward with the current approach and
deal with more customizable formatting later.

Tom

  reply	other threads:[~2018-10-08 22:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 21:13 [RFC 0/8] add terminal styling " Tom Tromey
2018-09-06 21:13 ` [RFC 3/8] Add output styles " Tom Tromey
2018-10-06 15:53   ` Simon Marchi
2018-10-06 19:06     ` Tom Tromey
2018-10-07 21:58       ` Simon Marchi
2018-10-08  0:23         ` Tom Tromey
2018-10-08  2:02           ` Simon Marchi
2018-10-08  2:49             ` Tom Tromey
2018-10-08 11:10               ` Simon Marchi
2018-10-08 22:17                 ` Tom Tromey [this message]
2018-09-06 21:13 ` [RFC 1/8] Change wrap buffering to use a std::string Tom Tromey
2018-10-06 15:19   ` Simon Marchi
2018-10-08 22:04     ` Tom Tromey
2018-10-18 22:16       ` Tom Tromey
2018-09-06 21:13 ` [RFC 7/8] Style the gdb welcome message Tom Tromey
2018-09-06 21:13 ` [RFC 6/8] Style print_address_symbolic Tom Tromey
2018-09-06 21:13 ` [RFC 4/8] Add variable name styling Tom Tromey
2018-10-06 16:34   ` Simon Marchi
2018-09-06 21:13 ` [RFC 2/8] Add a "context" argument to add_setshow_enum_cmd Tom Tromey
2018-09-06 21:14 ` [RFC 8/8] Style the "Reading symbols" message Tom Tromey
2018-09-06 21:14 ` [RFC 5/8] Style locations when setting a breakpoint Tom Tromey
2018-10-06 16:36   ` Simon Marchi
2018-09-07  6:23 ` [RFC 0/8] add terminal styling to gdb Eli Zaretskii
2018-09-07 14:36   ` Tom Tromey
2018-09-07 14:56     ` Eli Zaretskii
2018-09-07 15:01       ` Eli Zaretskii
2018-09-07  7:25 ` Joel Brobecker
2018-10-04 13:11 ` 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=87d0skccda.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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).