diff options
-rw-r--r-- | include/linux/kdb.h | 43 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_io.c | 2 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_main.c | 4 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_private.h | 39 |
4 files changed, 48 insertions, 40 deletions
diff --git a/include/linux/kdb.h b/include/linux/kdb.h index ea6e5244ed3f..deda197ced62 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, |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index c9b7f4f90bba..96fdaac46a80 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
@@ -823,4 +823,4 @@ int kdb_printf(const char *fmt, ...) | |||
823 | 823 | ||
824 | return r; | 824 | return r; |
825 | } | 825 | } |
826 | 826 | EXPORT_SYMBOL_GPL(kdb_printf); | |
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index caf057a3de0e..5448990a299e 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c | |||
@@ -2783,6 +2783,8 @@ int kdb_register_repeat(char *cmd, | |||
2783 | 2783 | ||
2784 | return 0; | 2784 | return 0; |
2785 | } | 2785 | } |
2786 | EXPORT_SYMBOL_GPL(kdb_register_repeat); | ||
2787 | |||
2786 | 2788 | ||
2787 | /* | 2789 | /* |
2788 | * kdb_register - Compatibility register function for commands that do | 2790 | * kdb_register - Compatibility register function for commands that do |
@@ -2805,6 +2807,7 @@ int kdb_register(char *cmd, | |||
2805 | return kdb_register_repeat(cmd, func, usage, help, minlen, | 2807 | return kdb_register_repeat(cmd, func, usage, help, minlen, |
2806 | KDB_REPEAT_NONE); | 2808 | KDB_REPEAT_NONE); |
2807 | } | 2809 | } |
2810 | EXPORT_SYMBOL_GPL(kdb_register); | ||
2808 | 2811 | ||
2809 | /* | 2812 | /* |
2810 | * kdb_unregister - This function is used to unregister a kernel | 2813 | * kdb_unregister - This function is used to unregister a kernel |
@@ -2833,6 +2836,7 @@ int kdb_unregister(char *cmd) | |||
2833 | /* Couldn't find it. */ | 2836 | /* Couldn't find it. */ |
2834 | return 1; | 2837 | return 1; |
2835 | } | 2838 | } |
2839 | EXPORT_SYMBOL_GPL(kdb_unregister); | ||
2836 | 2840 | ||
2837 | /* Initialize the kdb command table. */ | 2841 | /* Initialize the kdb command table. */ |
2838 | static void __init kdb_inittab(void) | 2842 | static void __init kdb_inittab(void) |
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h index be775f7e81e0..1921e6e4c0bc 100644 --- a/kernel/debug/kdb/kdb_private.h +++ b/kernel/debug/kdb/kdb_private.h | |||
@@ -15,29 +15,6 @@ | |||
15 | #include <linux/kgdb.h> | 15 | #include <linux/kgdb.h> |
16 | #include "../debug_core.h" | 16 | #include "../debug_core.h" |
17 | 17 | ||
18 | /* Kernel Debugger Error codes. Must not overlap with command codes. */ | ||
19 | #define KDB_NOTFOUND (-1) | ||
20 | #define KDB_ARGCOUNT (-2) | ||
21 | #define KDB_BADWIDTH (-3) | ||
22 | #define KDB_BADRADIX (-4) | ||
23 | #define KDB_NOTENV (-5) | ||
24 | #define KDB_NOENVVALUE (-6) | ||
25 | #define KDB_NOTIMP (-7) | ||
26 | #define KDB_ENVFULL (-8) | ||
27 | #define KDB_ENVBUFFULL (-9) | ||
28 | #define KDB_TOOMANYBPT (-10) | ||
29 | #define KDB_TOOMANYDBREGS (-11) | ||
30 | #define KDB_DUPBPT (-12) | ||
31 | #define KDB_BPTNOTFOUND (-13) | ||
32 | #define KDB_BADMODE (-14) | ||
33 | #define KDB_BADINT (-15) | ||
34 | #define KDB_INVADDRFMT (-16) | ||
35 | #define KDB_BADREG (-17) | ||
36 | #define KDB_BADCPUNUM (-18) | ||
37 | #define KDB_BADLENGTH (-19) | ||
38 | #define KDB_NOBP (-20) | ||
39 | #define KDB_BADADDR (-21) | ||
40 | |||
41 | /* Kernel Debugger Command codes. Must not overlap with error codes. */ | 18 | /* Kernel Debugger Command codes. Must not overlap with error codes. */ |
42 | #define KDB_CMD_GO (-1001) | 19 | #define KDB_CMD_GO (-1001) |
43 | #define KDB_CMD_CPU (-1002) | 20 | #define KDB_CMD_CPU (-1002) |
@@ -93,17 +70,6 @@ | |||
93 | */ | 70 | */ |
94 | #define KDB_MAXBPT 16 | 71 | #define KDB_MAXBPT 16 |
95 | 72 | ||
96 | /* Maximum number of arguments to a function */ | ||
97 | #define KDB_MAXARGS 16 | ||
98 | |||
99 | typedef enum { | ||
100 | KDB_REPEAT_NONE = 0, /* Do not repeat this command */ | ||
101 | KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ | ||
102 | KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ | ||
103 | } kdb_repeat_t; | ||
104 | |||
105 | typedef int (*kdb_func_t)(int, const char **); | ||
106 | |||
107 | /* Symbol table format returned by kallsyms. */ | 73 | /* Symbol table format returned by kallsyms. */ |
108 | typedef struct __ksymtab { | 74 | typedef struct __ksymtab { |
109 | unsigned long value; /* Address of symbol */ | 75 | unsigned long value; /* Address of symbol */ |
@@ -123,11 +89,6 @@ extern int kallsyms_symbol_next(char *prefix_name, int flag); | |||
123 | extern int kallsyms_symbol_complete(char *prefix_name, int max_len); | 89 | extern int kallsyms_symbol_complete(char *prefix_name, int max_len); |
124 | 90 | ||
125 | /* Exported Symbols for kernel loadable modules to use. */ | 91 | /* Exported Symbols for kernel loadable modules to use. */ |
126 | extern int kdb_register(char *, kdb_func_t, char *, char *, short); | ||
127 | extern int kdb_register_repeat(char *, kdb_func_t, char *, char *, | ||
128 | short, kdb_repeat_t); | ||
129 | extern int kdb_unregister(char *); | ||
130 | |||
131 | extern int kdb_getarea_size(void *, unsigned long, size_t); | 92 | extern int kdb_getarea_size(void *, unsigned long, size_t); |
132 | extern int kdb_putarea_size(unsigned long, void *, size_t); | 93 | extern int kdb_putarea_size(unsigned long, void *, size_t); |
133 | 94 | ||