aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/debug
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@infradead.org>2017-12-08 13:19:23 -0500
committerJason Wessel <jason.wessel@windriver.com>2018-01-25 09:41:14 -0500
commitb0f73bc7f1793997eb48bd14e3db51c3c95e2098 (patch)
tree071edb1dc81c1c3372c56069391d7db16e75ae8e /kernel/debug
parent1e0ce03bf142454f38a5fc050bf4fd698d2d36d8 (diff)
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: 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 Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel/debug')
-rw-r--r--kernel/debug/kdb/kdb_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index ff6047d3b73f..6055231544a0 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -1150,6 +1150,16 @@ void kdb_set_current_task(struct task_struct *p)
1150 kdb_current_regs = NULL; 1150 kdb_current_regs = NULL;
1151} 1151}
1152 1152
1153static void drop_newline(char *buf)
1154{
1155 size_t len = strlen(buf);
1156
1157 if (len == 0)
1158 return;
1159 if (*(buf + len - 1) == '\n')
1160 *(buf + len - 1) = '\0';
1161}
1162
1153/* 1163/*
1154 * kdb_local - The main code for kdb. This routine is invoked on a 1164 * kdb_local - The main code for kdb. This routine is invoked on a
1155 * specific processor, it is not global. The main kdb() routine 1165 * specific processor, it is not global. The main kdb() routine
@@ -1327,6 +1337,7 @@ do_full_getstr:
1327 cmdptr = cmd_head; 1337 cmdptr = cmd_head;
1328 diag = kdb_parse(cmdbuf); 1338 diag = kdb_parse(cmdbuf);
1329 if (diag == KDB_NOTFOUND) { 1339 if (diag == KDB_NOTFOUND) {
1340 drop_newline(cmdbuf);
1330 kdb_printf("Unknown kdb command: '%s'\n", cmdbuf); 1341 kdb_printf("Unknown kdb command: '%s'\n", cmdbuf);
1331 diag = 0; 1342 diag = 0;
1332 } 1343 }