Hi all,
How do you feel about allowing minimal mode in extensions? See attached patch.
Regards,
Per
diff --git a/cmdline.c b/cmdline.c
index 0459e72..204886f 100755
--- a/cmdline.c
+++ b/cmdline.c
@@ -2199,15 +2199,6 @@ shell_command(char *cmd)
return REDIRECT_SHELL_COMMAND;
}
-int minimal_functions(char *name)
-{
- return STREQ("log", name) || STREQ("help",name) || \
- STREQ("dis", name) || STREQ("q", name) || \
- STREQ("sym", name) || STREQ("exit", name) || \
- STREQ("rd", name) || STREQ("eval", name) || \
- STREQ("set", name);
-}
-
static int
verify_args_input_file(char *fileptr)
{
diff --git a/defs.h b/defs.h
index d84d4d5..fb4a72e 100755
--- a/defs.h
+++ b/defs.h
@@ -534,6 +534,7 @@ struct args_input_file {
#define REFRESH_TASK_TABLE (0x1) /* command_table_entry flags */
#define HIDDEN_COMMAND (0x2)
#define CLEANUP (0x4) /* for extensions only */
+#define MINIMAL (0x8)
/*
* A linked list of extension table structures keeps track of the current
diff --git a/global_data.c b/global_data.c
index 2172627..a244bb1 100755
--- a/global_data.c
+++ b/global_data.c
@@ -75,20 +75,20 @@ struct command_table_entry linux_command_table[] = {
{"bt", cmd_bt, help_bt, REFRESH_TASK_TABLE},
{"btop", cmd_btop, help_btop, 0},
{"dev", cmd_dev, help_dev, 0},
- {"dis", cmd_dis, help_dis, 0},
- {"eval", cmd_eval, help_eval, 0},
- {"exit", cmd_quit, help_exit, 0},
- {"extend", cmd_extend, help_extend, 0},
+ {"dis", cmd_dis, help_dis, MINIMAL},
+ {"eval", cmd_eval, help_eval, MINIMAL},
+ {"exit", cmd_quit, help_exit, MINIMAL},
+ {"extend", cmd_extend, help_extend, MINIMAL},
{"files", cmd_files, help_files, REFRESH_TASK_TABLE},
{"foreach", cmd_foreach, help_foreach, REFRESH_TASK_TABLE},
{"fuser", cmd_fuser, help_fuser, REFRESH_TASK_TABLE},
{"gdb", cmd_gdb, help_gdb, REFRESH_TASK_TABLE},
- {"help", cmd_help, help_help, 0},
+ {"help", cmd_help, help_help, MINIMAL},
{"ipcs", cmd_ipcs, help_ipcs, REFRESH_TASK_TABLE},
{"irq", cmd_irq, help_irq, 0},
{"kmem", cmd_kmem, help_kmem, 0},
{"list", cmd_list, help__list, REFRESH_TASK_TABLE},
- {"log", cmd_log, help_log, 0},
+ {"log", cmd_log, help_log, MINIMAL},
{"mach", cmd_mach, help_mach, 0},
{"map", cmd_map, help_map, HIDDEN_COMMAND},
{"mod", cmd_mod, help_mod, 0},
@@ -99,17 +99,17 @@ struct command_table_entry linux_command_table[] = {
{"pte", cmd_pte, help_pte, 0},
{"ptob", cmd_ptob, help_ptob, 0},
{"ptov", cmd_ptov, help_ptov, 0},
- {"q", cmd_quit, help_quit, 0},
+ {"q", cmd_quit, help_quit, MINIMAL},
{"tree", cmd_tree, help_tree, REFRESH_TASK_TABLE},
- {"rd", cmd_rd, help_rd, 0},
+ {"rd", cmd_rd, help_rd, MINIMAL},
{"repeat", cmd_repeat, help_repeat, 0},
{"runq", cmd_runq, help_runq, REFRESH_TASK_TABLE},
{"search", cmd_search, help_search, 0},
- {"set", cmd_set, help_set, REFRESH_TASK_TABLE},
+ {"set", cmd_set, help_set, REFRESH_TASK_TABLE | MINIMAL},
{"sig", cmd_sig, help_sig, REFRESH_TASK_TABLE},
{"struct", cmd_struct, help_struct, 0},
{"swap", cmd_swap, help_swap, 0},
- {"sym", cmd_sym, help_sym, 0},
+ {"sym", cmd_sym, help_sym, MINIMAL},
{"sys", cmd_sys, help_sys, REFRESH_TASK_TABLE},
{"task", cmd_task, help_task, REFRESH_TASK_TABLE},
{"test", cmd_test, NULL, HIDDEN_COMMAND},
diff --git a/main.c b/main.c
index 7650b8c..357725d 100755
--- a/main.c
+++ b/main.c
@@ -687,7 +687,7 @@ main_loop(void)
if (pc->flags & MINIMAL_MODE)
error(NOTE,
- "minimal mode commands: log, dis, rd, sym, eval, set and exit\n\n");
+ "minimal mode commands: log, dis, rd, sym, eval, set, extend and exit\n\n");
pc->flags |= RUNTIME;
@@ -795,7 +795,7 @@ reattempt:
if (pc->flags & MINIMAL_MODE)
error(INFO,
"%s: command not available in minimal mode\n"
- "NOTE: minimal mode commands: log, dis, rd, sym, eval, set and exit\n",
+ "NOTE: minimal mode commands: log, dis, rd, sym, eval, set, extend and exit\n",
args[0]);
else
error(INFO, "command not found: %s\n", args[0]);
@@ -829,18 +829,21 @@ get_command_table_entry(char *name)
name = "gdb";
}
- if ((pc->flags & MINIMAL_MODE) && !minimal_functions(name))
- return NULL;
-
for (cp = pc->cmd_table; cp->name; cp++) {
if (STREQ(cp->name, name))
- return cp;
+ if (!(pc->flags & MINIMAL_MODE) || (cp->flags & MINIMAL))
+ return cp;
+ else
+ return NULL;
}
for (ext = extension_table; ext; ext = ext->next) {
for (cp = ext->command_table; cp->name; cp++) {
if (STREQ(cp->name, name)) {
- return cp;
+ if (!(pc->flags & MINIMAL_MODE) || (cp->flags & MINIMAL))
+ return cp;
+ else
+ return NULL;
}
}
}
--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility