Commit ab08e464a2cd8242fdc6e4f87f3480808364a97a

Authored by Daniel Thompson
Committed by Jason Wessel
1 parent 5454388113

kdb: Fix a prompt management bug when using | grep

Currently when the "| grep" feature is used to filter the output of a
command then the prompt is not displayed for the subsequent command.
Likewise any characters typed by the user are also not echoed to the
display. This rather disconcerting problem eventually corrects itself
when the user presses Enter and the kdb_grepping_flag is cleared as
kdb_parse() tries to make sense of whatever they typed.

This patch resolves the problem by moving the clearing of this flag
from the middle of command processing to the beginning.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

kernel/debug/kdb/kdb_main.c
... ... @@ -915,13 +915,12 @@
915 915 char *cp;
916 916 char *cpp, quoted;
917 917 kdbtab_t *tp;
918   - int i, escaped, ignore_errors = 0, check_grep;
  918 + int i, escaped, ignore_errors = 0, check_grep = 0;
919 919  
920 920 /*
921 921 * First tokenize the command string.
922 922 */
923 923 cp = (char *)cmdstr;
924   - kdb_grepping_flag = check_grep = 0;
925 924  
926 925 if (KDB_FLAG(CMD_INTERRUPT)) {
927 926 /* Previous command was interrupted, newline must not
... ... @@ -1280,6 +1279,7 @@
1280 1279 */
1281 1280 kdb_nextline = 1;
1282 1281 KDB_STATE_CLEAR(SUPPRESS);
  1282 + kdb_grepping_flag = 0;
1283 1283  
1284 1284 cmdbuf = cmd_cur;
1285 1285 *cmdbuf = '\0';