Commit b0f73bc7 authored by Randy Dunlap's avatar Randy Dunlap Committed by Jason Wessel

kdb: drop newline in unknown command output

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: default avatarRandy Dunlap <rdunlap@infradead.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: kgdb-bugreport@lists.sourceforge.net
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
parent 1e0ce03b
...@@ -1150,6 +1150,16 @@ void kdb_set_current_task(struct task_struct *p) ...@@ -1150,6 +1150,16 @@ void kdb_set_current_task(struct task_struct *p)
kdb_current_regs = NULL; 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 * kdb_local - The main code for kdb. This routine is invoked on a
* specific processor, it is not global. The main kdb() routine * specific processor, it is not global. The main kdb() routine
...@@ -1327,6 +1337,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, ...@@ -1327,6 +1337,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
cmdptr = cmd_head; cmdptr = cmd_head;
diag = kdb_parse(cmdbuf); diag = kdb_parse(cmdbuf);
if (diag == KDB_NOTFOUND) { if (diag == KDB_NOTFOUND) {
drop_newline(cmdbuf);
kdb_printf("Unknown kdb command: '%s'\n", cmdbuf); kdb_printf("Unknown kdb command: '%s'\n", cmdbuf);
diag = 0; diag = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment