diff options
| author | Jason Wessel <jason.wessel@windriver.com> | 2010-10-11 11:20:14 -0400 |
|---|---|---|
| committer | Jason Wessel <jason.wessel@windriver.com> | 2010-10-22 16:34:11 -0400 |
| commit | f7030bbc446430ecd12c9ad02cf0ea94934e5f91 (patch) | |
| tree | 1a281ffa0c2686fa898081781a0c7b9bbc2d5b00 /include/linux/kdb.h | |
| parent | fb70b5888b70b0b50f738fbfc019445493112eb1 (diff) | |
kdb: Allow kernel loadable modules to add kdb shell functions
In order to allow kernel modules to dynamically add a command to the
kdb shell the kdb_register, kdb_register_repeat, kdb_unregister, and
kdb_printf need to be exported as GPL symbols.
Any kernel module that adds a dynamic kdb shell function should only
need to include linux/kdb.h.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'include/linux/kdb.h')
| -rw-r--r-- | include/linux/kdb.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/linux/kdb.h b/include/linux/kdb.h index ea6e5244ed3..deda197ced6 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h | |||
| @@ -28,6 +28,41 @@ extern int kdb_poll_idx; | |||
| 28 | extern int kdb_initial_cpu; | 28 | extern int kdb_initial_cpu; |
| 29 | extern atomic_t kdb_event; | 29 | extern atomic_t kdb_event; |
| 30 | 30 | ||
| 31 | /* Types and messages used for dynamically added kdb shell commands */ | ||
| 32 | |||
| 33 | #define KDB_MAXARGS 16 /* Maximum number of arguments to a function */ | ||
| 34 | |||
| 35 | typedef enum { | ||
| 36 | KDB_REPEAT_NONE = 0, /* Do not repeat this command */ | ||
| 37 | KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ | ||
| 38 | KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ | ||
| 39 | } kdb_repeat_t; | ||
| 40 | |||
| 41 | typedef int (*kdb_func_t)(int, const char **); | ||
| 42 | |||
| 43 | /* KDB return codes from a command or internal kdb function */ | ||
| 44 | #define KDB_NOTFOUND (-1) | ||
| 45 | #define KDB_ARGCOUNT (-2) | ||
| 46 | #define KDB_BADWIDTH (-3) | ||
| 47 | #define KDB_BADRADIX (-4) | ||
| 48 | #define KDB_NOTENV (-5) | ||
| 49 | #define KDB_NOENVVALUE (-6) | ||
| 50 | #define KDB_NOTIMP (-7) | ||
| 51 | #define KDB_ENVFULL (-8) | ||
| 52 | #define KDB_ENVBUFFULL (-9) | ||
| 53 | #define KDB_TOOMANYBPT (-10) | ||
| 54 | #define KDB_TOOMANYDBREGS (-11) | ||
| 55 | #define KDB_DUPBPT (-12) | ||
| 56 | #define KDB_BPTNOTFOUND (-13) | ||
| 57 | #define KDB_BADMODE (-14) | ||
| 58 | #define KDB_BADINT (-15) | ||
| 59 | #define KDB_INVADDRFMT (-16) | ||
| 60 | #define KDB_BADREG (-17) | ||
| 61 | #define KDB_BADCPUNUM (-18) | ||
| 62 | #define KDB_BADLENGTH (-19) | ||
| 63 | #define KDB_NOBP (-20) | ||
| 64 | #define KDB_BADADDR (-21) | ||
| 65 | |||
| 31 | /* | 66 | /* |
| 32 | * kdb_diemsg | 67 | * kdb_diemsg |
| 33 | * | 68 | * |
| @@ -105,9 +140,17 @@ int kdb_process_cpu(const struct task_struct *p) | |||
| 105 | /* kdb access to register set for stack dumping */ | 140 | /* kdb access to register set for stack dumping */ |
| 106 | extern struct pt_regs *kdb_current_regs; | 141 | extern struct pt_regs *kdb_current_regs; |
| 107 | 142 | ||
| 143 | /* Dynamic kdb shell command registration */ | ||
| 144 | extern int kdb_register(char *, kdb_func_t, char *, char *, short); | ||
| 145 | extern int kdb_register_repeat(char *, kdb_func_t, char *, char *, | ||
| 146 | short, kdb_repeat_t); | ||
| 147 | extern int kdb_unregister(char *); | ||
| 108 | #else /* ! CONFIG_KGDB_KDB */ | 148 | #else /* ! CONFIG_KGDB_KDB */ |
| 109 | #define kdb_printf(...) | 149 | #define kdb_printf(...) |
| 110 | #define kdb_init(x) | 150 | #define kdb_init(x) |
| 151 | #define kdb_register(...) | ||
| 152 | #define kdb_register_repeat(...) | ||
| 153 | #define kdb_uregister(x) | ||
| 111 | #endif /* CONFIG_KGDB_KDB */ | 154 | #endif /* CONFIG_KGDB_KDB */ |
| 112 | enum { | 155 | enum { |
| 113 | KDB_NOT_INITIALIZED, | 156 | KDB_NOT_INITIALIZED, |
