/*1* Created by: Jason Wessel <[email protected]>2*3* Copyright (c) 2010 Wind River Systems, Inc. All Rights Reserved.4*5* This file is licensed under the terms of the GNU General Public6* License version 2. This program is licensed "as is" without any7* warranty of any kind, whether express or implied.8*/910#include <linux/module.h>11#include <linux/kdb.h>1213/*14* All kdb shell command call backs receive argc and argv, where15* argv[0] is the command the end user typed16*/17static int kdb_hello_cmd(int argc, const char **argv)18{19if (argc > 1)20return KDB_ARGCOUNT;2122if (argc)23kdb_printf("Hello %s.\n", argv[1]);24else25kdb_printf("Hello world!\n");2627return 0;28}293031static int __init kdb_hello_cmd_init(void)32{33/*34* Registration of a dynamically added kdb command is done with35* kdb_register() with the arguments being:36* 1: The name of the shell command37* 2: The function that processes the command38* 3: Description of the usage of any arguments39* 4: Descriptive text when you run help40* 5: Number of characters to complete the command41* 0 == type the whole command42* 1 == match both "g" and "go" for example43*/44kdb_register("hello", kdb_hello_cmd, "[string]",45"Say Hello World or Hello [string]", 0);46return 0;47}4849static void __exit kdb_hello_cmd_exit(void)50{51kdb_unregister("hello");52}5354module_init(kdb_hello_cmd_init);55module_exit(kdb_hello_cmd_exit);5657MODULE_AUTHOR("WindRiver");58MODULE_DESCRIPTION("KDB example to add a hello command");59MODULE_LICENSE("GPL");606162