public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH 4/5] gdb: add "info index-cache stats", deprecate "show index-cache stats"
Date: Thu, 4 Nov 2021 15:19:30 -0400	[thread overview]
Message-ID: <a075575a-4e34-08c9-fefa-0b17c0494351@polymtl.ca> (raw)
In-Reply-To: <87cznfkbxu.fsf@tromey.com>



On 2021-11-04 14:33, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> The "show index-cache stats" command is used to show some statistics
> Simon> about the index-cache usage.  I believe this is not a good use of a show
> Simon> command, as it is not a setting.
> 
> I think "show" is generally used for any information about the debugger,
> not just settings.
> 
> A long, long time ago there was some effort to split 'info' and 'show'
> this way.  The details of this discussion are long lost, as far as I
> know, but the outcome lives on in the help and manual:
> 
> 'info'
>      This command (abbreviated 'i') is for describing the state of your
>      program.
> 
> 'show'
>      In contrast to 'info', 'show' is for describing the state of GDB
>      itself.  You can change most of the things you can 'show', by using [...]
> 
> So I tend to think "show index-cache stats" is more correct.

Ah, I didn't know about that, thanks.

Then I still wonder what to do about:

    (gdb) interpreter-exec mi "-gdb-show index-cache"
    ~"\n"
    ~"    Cache hits (this session): 0\n"
    ~"  Cache misses (this session): 0\n"
    ~"\n"
    ~"The index cache is currently disabled.\n"
    ^done

The answer is probably to output those numbers using uiout fields in the
command implementation.  If I hack that, I get:

    ...
    ^done,hits="0",misses="0"

which looks good.

What's nice about "show" is that we don't need to add a new MI command
for everything: -gdb-show just works with any child of the "show"
command.  It would be nice to have the same thing with info, have an
"-info" MI command that works with "info" command children.  Of course,
these commands would have to be MI-aware (emit information using uiout
fields), but that's much easier than adding new MI commands for each.

So, I'll drop this patch then, and consider changing the "show
index-cache stats" implementation to use uiout fields (although I am not
aware of any frontend interested in using the the index-cache stats
data).

Simon

  reply	other threads:[~2021-11-04 19:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 15:50 [PATCH 0/5] Change some index-cache commands Simon Marchi
2021-11-01 15:50 ` [PATCH 1/5] gdb: pass/return setting setter/getter scalar values by value Simon Marchi
2021-11-04 18:27   ` Tom Tromey
2021-11-04 18:59     ` Simon Marchi
2021-11-04 19:51       ` Simon Marchi
2021-11-01 15:50 ` [PATCH 2/5] gdb: remove unnecessary cmd_list_element::aliases nullptr checks Simon Marchi
2021-11-04 18:29   ` Tom Tromey
2021-11-04 19:45     ` Simon Marchi
2021-11-01 15:50 ` [PATCH 3/5] gdb: remove command_class enum class_deprecated Simon Marchi
2021-11-04 18:30   ` Tom Tromey
2021-11-04 19:45     ` Simon Marchi
2021-11-01 15:50 ` [PATCH 4/5] gdb: add "info index-cache stats", deprecate "show index-cache stats" Simon Marchi
2021-11-04 18:33   ` Tom Tromey
2021-11-04 19:19     ` Simon Marchi [this message]
2021-11-01 15:50 ` [PATCH 5/5] gdb: introduce "set index-cache enabled", deprecate "set index-cache on/off" Simon Marchi
2021-11-04 18:36   ` Tom Tromey
2021-11-04 19:51     ` Simon Marchi

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=a075575a-4e34-08c9-fefa-0b17c0494351@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).