[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210319171712.vlkgnmp7cbnayxdn@maple.lan>
Date: Fri, 19 Mar 2021 17:17:12 +0000
From: Daniel Thompson <daniel.thompson@...aro.org>
To: Sumit Garg <sumit.garg@...aro.org>
Cc: kgdb-bugreport@...ts.sourceforge.net, jason.wessel@...driver.com,
dianders@...omium.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kdb: Refactor kdb_defcmd implementation
On Tue, Mar 09, 2021 at 05:47:47PM +0530, Sumit Garg wrote:
> Switch to use kdbtab_t instead of separate struct defcmd_set since
> now we have kdb_register_table() to register pre-allocated kdb commands.
This needs rewriting. I've been struggling for some time to figure out
what it actually means means and how it related to the patch. I'm
starting to conclude that this might not be my fault!
> Also, switch to use a linked list for sub-commands instead of dynamic
> array which makes traversing the sub-commands list simpler.
We can't call these things sub-commands! These days a sub-commands
implies something like `git subcommand` and kdb doesn't have anything
like that.
> +struct kdb_subcmd {
> + char *scmd_name; /* Sub-command name */
> + struct list_head list_node; /* Sub-command node */
> +};
> +
> /* The KDB shell command table */
> typedef struct _kdbtab {
> char *cmd_name; /* Command name */
> @@ -175,6 +181,7 @@ typedef struct _kdbtab {
> kdb_cmdflags_t cmd_flags; /* Command behaviour flags */
> struct list_head list_node; /* Command list */
> bool is_dynamic; /* Command table allocation type */
> + struct list_head kdb_scmds_head; /* Sub-commands list */
> } kdbtab_t;
Perhaps this should be more like:
struct defcmd_set {
kdbtab_t cmd;
struct list_head commands;
};
This still gets registers using kdb_register_table() but it keeps the
macro code all in once place:
kdb_register_table(¯o->cmd, 1);
I think that is what I *meant* to suggest ;-) . It also avoids having to
talk about sub-commands! BTW I'm open to giving defcmd_set a better name
(kdb_macro?) but I don't see why we want to give all commands a macro
list.
Daniel.
Powered by blists - more mailing lists