mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Randy Dunlap <rdunlap@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	<kgdb-bugreport@lists.sourceforge.net>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Subject: Re: [PATCH 2/3] kdb: drop newline in unknown command output
Date: Fri, 8 Dec 2017 12:33:38 -0600	[thread overview]
Message-ID: <5165029d-3b50-2c35-518a-f7ab80b63f36@windriver.com> (raw)
In-Reply-To: <3ca9b50e-b297-8995-c93c-e56fb91c3a47@infradead.org>

On 12/08/2017 12:19 PM, Randy Dunlap wrote:
> From: Randy Dunlap <rdunlap@infradead.org>
> 



Thanks for the series Randy.   I'll get these applied, but I will take
a look at changing this patch slightly.


> When an unknown command is entered, kdb prints "Unknown kdb command:"
> and then the unknown text, including the newline character. This
> causes the ending single-quote mark to be printed on the next line
> by itself, so just change the ending newline character to a null
> character (end of string) so that it won't be "printed."
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jason Wessel <jason.wessel@windriver.com>
> Cc: kgdb-bugreport@lists.sourceforge.net
> ---
>   kernel/debug/kdb/kdb_main.c |   11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> --- lnx-415-rc1.orig/kernel/debug/kdb/kdb_main.c
> +++ lnx-415-rc1/kernel/debug/kdb/kdb_main.c
> @@ -1150,6 +1150,16 @@ void kdb_set_current_task(struct task_st
>   	kdb_current_regs = NULL;
>   }
>   
> +static void drop_newline(char *buf)
> +{
> +	size_t len = strlen(buf);
> +
> +	if (len == 0)
> +		return;
> +	if (*(buf + len - 1) == '\n')
> +		*(buf + len - 1) = '\0';
> +}
> +
>   /*
>    * kdb_local - The main code for kdb.  This routine is invoked on a
>    *	specific processor, it is not global.  The main kdb() routine
> @@ -1327,6 +1337,7 @@ do_full_getstr:
>   		cmdptr = cmd_head;
>   		diag = kdb_parse(cmdbuf);
>   		if (diag == KDB_NOTFOUND) {
> +			drop_newline(cmdbuf);


We might be able to get away with just adjusting the pointer in the kdb_parse instead of adding the drop_newline because we are returning error anyway and the parse needs to be called again in the future for a new command.


Thanks,
Jason.

>   			kdb_printf("Unknown kdb command: '%s'\n", cmdbuf);
>   			diag = 0;
>   		}
> 
> 

      reply	other threads:[~2017-12-08 18:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 18:19 Randy Dunlap
2017-12-08 18:33 ` Jason Wessel [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=5165029d-3b50-2c35-518a-f7ab80b63f36@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=daniel.thompson@linaro.org \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    /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

all inboxes | Powered by JetHome®