All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Thompson <daniel.thompson@linaro.org>
To: Douglas Anderson <dianders@chromium.org>
Cc: kgdb-bugreport@lists.sourceforge.net,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Jason Wessel <jason.wessel@windriver.com>,
	Thorsten Blum <thorsten.blum@toblux.com>,
	Yuran Pereira <yuran.pereira@hotmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/13] kdb: Document the various "md" commands better
Date: Tue, 18 Jun 2024 12:24:02 +0100	[thread overview]
Message-ID: <20240618112402.GB11330@aspen.lan> (raw)
In-Reply-To: <20240617173426.2.I5621f286f5131c84ac71a212508ba1467ac443f2@changeid>

On Mon, Jun 17, 2024 at 05:34:36PM -0700, Douglas Anderson wrote:
> The documentation for the variouis "md" commands was inconsistent
> about documenting the command arguments. It was also hard to figure
> out what the differences between the "phys", "raw", and "symbolic"
> versions was.
>
> Update the help strings to make things more obvious.
>
> As part of this, add "bogus" commands to the table for "mdW" and
> "mdWcN" so we don't have to obscurely reference them in the normal
> "md" help. These bogus commands don't really hurt since kdb_md()
> validates argv[0] enough.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>
>  kernel/debug/kdb/kdb_main.c | 39 ++++++++++++++++++++++---------------
>  1 file changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index cbeb203785b4..47e037c3c002 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -1516,14 +1516,9 @@ static int kdb_mdr(unsigned long addr, unsigned int count)
>  }
>
>  /*
> - * kdb_md - This function implements the 'md', 'md1', 'md2', 'md4',
> - *	'md8' 'mdr' and 'mds' commands.
> + * kdb_md - This function implements the guts of the various 'md' commands.
>   *
> - *	md|mds  [<addr arg> [<line count> [<radix>]]]
> - *	mdWcN	[<addr arg> [<line count> [<radix>]]]
> - *		where W = is the width (1, 2, 4 or 8) and N is the count.
> - *		for eg., md1c20 reads 20 bytes, 1 at a time.
> - *	mdr  <addr arg>,<byte count>
> + * See the kdb help for syntax.
>   */
>  static void kdb_md_line(const char *fmtstr, unsigned long addr,
>  			int symbolic, int nosect, int bytesperword,
> @@ -2677,26 +2672,38 @@ EXPORT_SYMBOL_GPL(kdb_unregister);
>  static kdbtab_t maintab[] = {
>  	{	.name = "md",
>  		.func = kdb_md,
> -		.usage = "<vaddr>",
> -		.help = "Display Memory Contents, also mdWcN, e.g. md8c1",
> +		.usage = "<vaddr> [<lines> [<radix>]]",
> +		.help = "Display RAM using BYTESPERWORD; show MDCOUNT lines",

I'd prefer "memory" over "RAM" because it's what the mnemonic is
abbreviating. This applies to all of the below but I won't be adding a
"same here" for all of them.

Where we have to crush something to fit into one line we'd than have to
break the pattern and choose from thing like:

1. Show memory
2. Display RAM
3. Display mem

Personally I prefer #1 but could probably cope with #2.


>  		.flags = KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS,
>  	},
> -	{	.name = "mdr",
> +	{	.name = "mdW",
>  		.func = kdb_md,
> -		.usage = "<vaddr> <bytes>",
> -		.help = "Display Raw Memory",
> +		.usage = "<vaddr> [<lines> [<radix>]]",
> +		.help = "Display RAM using word size (W) of 1, 2, 4, or 8",

We need an "e.g. md8" in here somewhere. Otherwise it is not at all
obvious that W is a wildcard.

I guess that alternatively you could also try naming the command with
hint that W is a wild card (what happens if you register a command
called md<W>?).


> +		.flags = KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS,
> +	},
> +	{	.name = "mdWcN",
> +		.func = kdb_md,
> +		.usage = "<vaddr> [<lines> [<radix>]]",
> +		.help = "Display RAM using word size (W); show N words",

Same here.


>  		.flags = KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS,
>  	},
>  	{	.name = "mdp",
>  		.func = kdb_md,
> -		.usage = "<paddr> <bytes>",
> -		.help = "Display Physical Memory",
> +		.usage = "<paddr> [<lines> [<radix>]]",
> +		.help = "Display RAM given a physical address",
> +		.flags = KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS,
> +	},
> +	{	.name = "mdr",
> +		.func = kdb_md,
> +		.usage = "<vaddr> <bytes>",
> +		.help = "Display RAM as a stream of raw bytes",
>  		.flags = KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS,
>  	},
>  	{	.name = "mds",
>  		.func = kdb_md,
> -		.usage = "<vaddr>",
> -		.help = "Display Memory Symbolically",
> +		.usage = "<vaddr> [<lines>]",
> +		.help = "Display RAM 1 native word/line; find words in kallsyms",
>  		.flags = KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS,
>  	},
>  	{	.name = "mm",
> --
> 2.45.2.627.g7a2c4fd464-goog
>

  reply	other threads:[~2024-06-18 11:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18  0:34 [PATCH 00/13] kdb: Add the ability to read iomapped memory via kdb + clean up "md" commands Douglas Anderson
2024-06-18  0:34 ` [PATCH 01/13] kdb: Get rid of "minlen" for the "md" command Douglas Anderson
2024-06-18  0:34 ` [PATCH 02/13] kdb: Document the various "md" commands better Douglas Anderson
2024-06-18 11:24   ` Daniel Thompson [this message]
2024-06-18 14:42     ` Doug Anderson
2024-06-18  0:34 ` [PATCH 03/13] kdb: Use "bool" in "md" implementation where appropriate Douglas Anderson
2024-06-18  0:34 ` [PATCH 04/13] kdb: Drop "offset" and "name" args to kdbgetaddrarg() Douglas Anderson
2024-06-18  0:34 ` [PATCH 05/13] kdb: Separate out "mdr" handling Douglas Anderson
2024-06-18 11:29   ` Daniel Thompson
2024-06-18  0:34 ` [PATCH 06/13] kdb: Remove "mdW" and "mdWcN" handling of "W" == 0 Douglas Anderson
2024-06-18 11:37   ` Daniel Thompson
2024-06-18 14:42     ` Doug Anderson
2024-06-18  0:34 ` [PATCH 07/13] kdb: Tweak "repeat" handling code for "mdW" and "mdWcN" Douglas Anderson
2024-06-18 12:57   ` Daniel Thompson
2024-06-18 14:43     ` Doug Anderson
2024-06-18  0:34 ` [PATCH 08/13] kdb: In kdb_md() make `repeat` and `mdcount` calculations more obvious Douglas Anderson
2024-06-18  0:34 ` [PATCH 09/13] kdb: Use 'unsigned int' in kdb_md() where appropriate Douglas Anderson
2024-06-18 15:26   ` Daniel Thompson
2024-06-18  0:34 ` [PATCH 10/13] kdb: Replease simple_strtoul() with kstrtouint() in kdb_md() Douglas Anderson
2024-06-18  0:34 ` [PATCH 11/13] kdb: Abstract out parsing for mdWcN Douglas Anderson
2024-06-18 21:02   ` kernel test robot
2024-06-18  0:34 ` [PATCH 12/13] kdb: Add mdpW / mdpWcN commands Douglas Anderson
2024-06-18  0:34 ` [PATCH 13/13] kdb: Add mdi, mdiW / mdiWcN commands to show iomapped memory Douglas Anderson
2024-06-18 15:59   ` Daniel Thompson
2024-06-18 19:33     ` Doug Anderson
2024-06-21 15:43       ` Daniel Thompson
2024-06-21 19:52         ` Doug Anderson

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=20240618112402.GB11330@aspen.lan \
    --to=daniel.thompson@linaro.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dianders@chromium.org \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@toblux.com \
    --cc=yuran.pereira@hotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.