From: Nir Lichtman <nir@lichtman.org>
To: jason.wessel@windriver.com, daniel.thompson@linaro.org,
dianders@chromium.org, linux-kernel@vger.kernel.org
Subject: [PATCH] kdb: Fix incorrect naming of history arrow keys in code
Date: Thu, 31 Oct 2024 19:23:50 +0000 [thread overview]
Message-ID: <20241031192350.GA26688@lichtman.org> (raw)
Problem: The kdb CLI code that handles the history up and down
navigation incorrectly names the up and down arrows as ctrl p and n.
Details: This could be some kind of left over legacy.
(maybe inspired by ddb which only reacts to ctrl p and n for history nav).
kdb doesn't react to ctrl p and n, and following the code flow with GDB
reveals that these values map to the up and down arrows.
Solution: Rename the macros accordingly and rename the function name
to reflect that it relates to arrows and not ctrl commands.
Signed-off-by: Nir Lichtman <nir@lichtman.org>
---
kernel/debug/kdb/kdb_main.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index f5f7d7fb5936..d4b407afb888 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -1123,22 +1123,22 @@ int kdb_parse(const char *cmdstr)
}
-static int handle_ctrl_cmd(char *cmd)
+static int handle_arrow_cmd(char *cmd)
{
-#define CTRL_P 16
-#define CTRL_N 14
+#define ARROW_UP 16
+#define ARROW_DOWN 14
/* initial situation */
if (cmd_head == cmd_tail)
return 0;
switch (*cmd) {
- case CTRL_P:
+ case ARROW_UP:
if (cmdptr != cmd_tail)
cmdptr = (cmdptr + KDB_CMD_HISTORY_COUNT - 1) %
KDB_CMD_HISTORY_COUNT;
strscpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
return 1;
- case CTRL_N:
+ case ARROW_DOWN:
if (cmdptr != cmd_head)
cmdptr = (cmdptr+1) % KDB_CMD_HISTORY_COUNT;
strscpy(cmd_cur, cmd_hist[cmdptr], CMD_BUFLEN);
@@ -1351,7 +1351,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
*(cmd_hist[cmd_head] +
strlen(cmd_hist[cmd_head])-1) = '\0';
}
- if (!handle_ctrl_cmd(cmdbuf))
+ if (!handle_arrow_cmd(cmdbuf))
*(cmd_cur+strlen(cmd_cur)-1) = '\0';
cmdbuf = cmd_cur;
goto do_full_getstr;
--
2.39.2
next reply other threads:[~2024-10-31 19:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 19:23 Nir Lichtman [this message]
2024-10-31 23:06 ` Doug Anderson
2024-11-01 0:26 ` Nir Lichtman
2024-11-01 6:21 ` Nir Lichtman
2024-11-01 15:29 ` Doug Anderson
2024-11-01 18:34 ` Daniel Thompson
2024-11-01 18:57 ` Nir Lichtman
2024-11-01 19:28 ` 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=20241031192350.GA26688@lichtman.org \
--to=nir@lichtman.org \
--cc=daniel.thompson@linaro.org \
--cc=dianders@chromium.org \
--cc=jason.wessel@windriver.com \
--cc=linux-kernel@vger.kernel.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®