diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-08-05 10:22:30 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-08-05 10:22:30 -0400 |
commit | 81d4450732c68aa728f2c86c0c2993c6cfc3d032 (patch) | |
tree | c332675648080d38e9f461286274534a16e7346b | |
parent | b45cfba4e9005d64d419718e7ff7f7cab44c1994 (diff) |
vt,console,kdb: automatically set kdb LINES variable
The kernel console interface stores the number of lines it is
configured to use. The kdb debugger can greatly benefit by knowing how
many lines there are on the console for the pager functionality
without having the end user compile in the setting or have to
repeatedly change it at run time.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: David Airlie <airlied@linux.ie>
CC: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r-- | drivers/char/vt.c | 17 | ||||
-rw-r--r-- | include/linux/kdb.h | 4 | ||||
-rw-r--r-- | kernel/debug/kdb/kdb_private.h | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 117ce99115dc..4a9eb3044e52 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -104,6 +104,7 @@ | |||
104 | #include <linux/io.h> | 104 | #include <linux/io.h> |
105 | #include <asm/system.h> | 105 | #include <asm/system.h> |
106 | #include <linux/uaccess.h> | 106 | #include <linux/uaccess.h> |
107 | #include <linux/kdb.h> | ||
107 | 108 | ||
108 | #define MAX_NR_CON_DRIVER 16 | 109 | #define MAX_NR_CON_DRIVER 16 |
109 | 110 | ||
@@ -3442,6 +3443,22 @@ int con_debug_enter(struct vc_data *vc) | |||
3442 | console_blanked = 0; | 3443 | console_blanked = 0; |
3443 | if (vc->vc_sw->con_debug_enter) | 3444 | if (vc->vc_sw->con_debug_enter) |
3444 | ret = vc->vc_sw->con_debug_enter(vc); | 3445 | ret = vc->vc_sw->con_debug_enter(vc); |
3446 | #ifdef CONFIG_KGDB_KDB | ||
3447 | /* Set the initial LINES variable if it is not already set */ | ||
3448 | if (vc->vc_rows < 999) { | ||
3449 | int linecount; | ||
3450 | char lns[4]; | ||
3451 | const char *setargs[3] = { | ||
3452 | "set", | ||
3453 | "LINES", | ||
3454 | lns, | ||
3455 | }; | ||
3456 | if (kdbgetintenv(setargs[0], &linecount)) { | ||
3457 | snprintf(lns, 4, "%i", vc->vc_rows); | ||
3458 | kdb_set(2, setargs); | ||
3459 | } | ||
3460 | } | ||
3461 | #endif /* CONFIG_KGDB_KDB */ | ||
3445 | return ret; | 3462 | return ret; |
3446 | } | 3463 | } |
3447 | EXPORT_SYMBOL_GPL(con_debug_enter); | 3464 | EXPORT_SYMBOL_GPL(con_debug_enter); |
diff --git a/include/linux/kdb.h b/include/linux/kdb.h index ccb2b3ec0fe8..ea6e5244ed3f 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h | |||
@@ -114,4 +114,8 @@ enum { | |||
114 | KDB_INIT_EARLY, | 114 | KDB_INIT_EARLY, |
115 | KDB_INIT_FULL, | 115 | KDB_INIT_FULL, |
116 | }; | 116 | }; |
117 | |||
118 | extern int kdbgetintenv(const char *, int *); | ||
119 | extern int kdb_set(int, const char **); | ||
120 | |||
117 | #endif /* !_KDB_H */ | 121 | #endif /* !_KDB_H */ |
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h index 97d3ba69775d..c438f545a321 100644 --- a/kernel/debug/kdb/kdb_private.h +++ b/kernel/debug/kdb/kdb_private.h | |||
@@ -144,9 +144,7 @@ extern int kdb_getword(unsigned long *, unsigned long, size_t); | |||
144 | extern int kdb_putword(unsigned long, unsigned long, size_t); | 144 | extern int kdb_putword(unsigned long, unsigned long, size_t); |
145 | 145 | ||
146 | extern int kdbgetularg(const char *, unsigned long *); | 146 | extern int kdbgetularg(const char *, unsigned long *); |
147 | extern int kdb_set(int, const char **); | ||
148 | extern char *kdbgetenv(const char *); | 147 | extern char *kdbgetenv(const char *); |
149 | extern int kdbgetintenv(const char *, int *); | ||
150 | extern int kdbgetaddrarg(int, const char **, int*, unsigned long *, | 148 | extern int kdbgetaddrarg(int, const char **, int*, unsigned long *, |
151 | long *, char **); | 149 | long *, char **); |
152 | extern int kdbgetsymval(const char *, kdb_symtab_t *); | 150 | extern int kdbgetsymval(const char *, kdb_symtab_t *); |