[PATCH 09/15] KDB: Add pshelp command.

From: Mike Travis
Date: Mon Mar 25 2013 - 14:51:52 EST


This patch restores the capability for providing help with the
PS and BT arguments.

Cc: Anton Vorontsov <anton.vorontsov@xxxxxxxxxx>
Cc: Sasha Levin <sasha.levin@xxxxxxxxxx>
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Dimitri Sivanich <sivanich@xxxxxxx>
Signed-off-by: Mike Travis <travis@xxxxxxx>
---
kernel/debug/kdb/kdb_main.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

--- linux.orig/kernel/debug/kdb/kdb_main.c
+++ linux/kernel/debug/kdb/kdb_main.c
@@ -2787,6 +2787,32 @@ static int kdb_grep_help(int argc, const
}

/*
+ * display help for the ps and bt status flag
+ */
+static int kdb_ps_help(int argc, const char **argv)
+{
+ kdb_printf("The meaning of the State flag in ps command output:\n");
+ kdb_printf(" R RUNNING\n");
+ kdb_printf(" D TASK_UNINTERRUPTIBLE\n");
+ kdb_printf(" S TASK_INTERRUPTIBLE\n");
+ kdb_printf(" T TASK_STOPPED\n");
+ kdb_printf(" C TASK_TRACED\n");
+ kdb_printf(" Z EXIT_ZOMBIE\n");
+ kdb_printf(" E EXIT_DEAD\n");
+ kdb_printf(" U UNRUNNABLE\n");
+ kdb_printf(" M sleeping DAEMON\n");
+ kdb_printf(" I IDLE\n");
+ kdb_printf(" (note that most idles are named 'kworker/NN')\n");
+ kdb_printf("\n");
+ kdb_printf(
+ "The above can be specified to ps and bta to select tasks\n");
+ kdb_printf(" A all of above\n");
+ kdb_printf(" default is RDSTCZEU (not Idle or sleeping Daemon)\n");
+ return 0;
+}
+
+
+/*
* kdb_register_repeat - This function is used to register a kernel
* debugger command.
* Inputs:
@@ -2972,6 +2998,8 @@ static void __init kdb_inittab(void)
"Enter kgdb mode", 0, KDB_REPEAT_NONE);
kdb_register_repeat("ps", kdb_ps, "[<flags>|A]",
"Display active task list", 0, KDB_REPEAT_NONE);
+ kdb_register_repeat("pshelp", kdb_ps_help, "",
+ "Display help for the ps and bt task State flag", 0, KDB_REPEAT_NONE);
kdb_register_repeat("pid", kdb_pid, "<pidnum>",
"Switch to another task", 0, KDB_REPEAT_NONE);
kdb_register_repeat("reboot", kdb_reboot, "",

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/