0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/module.h>
0012 #include <linux/kdb.h>
0013
0014
0015
0016
0017
0018 static int kdb_hello_cmd(int argc, const char **argv)
0019 {
0020 if (argc > 1)
0021 return KDB_ARGCOUNT;
0022
0023 if (argc)
0024 kdb_printf("Hello %s.\n", argv[1]);
0025 else
0026 kdb_printf("Hello world!\n");
0027
0028 return 0;
0029 }
0030
0031 static kdbtab_t hello_cmd = {
0032 .name = "hello",
0033 .func = kdb_hello_cmd,
0034 .usage = "[string]",
0035 .help = "Say Hello World or Hello [string]",
0036 };
0037
0038 static int __init kdb_hello_cmd_init(void)
0039 {
0040
0041
0042
0043
0044 kdb_register(&hello_cmd);
0045 return 0;
0046 }
0047
0048 static void __exit kdb_hello_cmd_exit(void)
0049 {
0050 kdb_unregister(&hello_cmd);
0051 }
0052
0053 module_init(kdb_hello_cmd_init);
0054 module_exit(kdb_hello_cmd_exit);
0055
0056 MODULE_AUTHOR("WindRiver");
0057 MODULE_DESCRIPTION("KDB example to add a hello command");
0058 MODULE_LICENSE("GPL");