]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vt,console,kdb: automatically set kdb LINES variable
authorJason Wessel <jason.wessel@windriver.com>
Thu, 5 Aug 2010 14:22:30 +0000 (09:22 -0500)
committerJason Wessel <jason.wessel@windriver.com>
Thu, 5 Aug 2010 14:22:30 +0000 (09:22 -0500)
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>
drivers/char/vt.c
include/linux/kdb.h
kernel/debug/kdb/kdb_private.h

index 117ce99115dc1cfe8e36d7e16768738de9625dbd..4a9eb3044e52c068641d1a3ddccd3682fdf228c3 100644 (file)
 #include <linux/io.h>
 #include <asm/system.h>
 #include <linux/uaccess.h>
+#include <linux/kdb.h>
 
 #define MAX_NR_CON_DRIVER 16
 
@@ -3442,6 +3443,22 @@ int con_debug_enter(struct vc_data *vc)
        console_blanked = 0;
        if (vc->vc_sw->con_debug_enter)
                ret = vc->vc_sw->con_debug_enter(vc);
+#ifdef CONFIG_KGDB_KDB
+       /* Set the initial LINES variable if it is not already set */
+       if (vc->vc_rows < 999) {
+               int linecount;
+               char lns[4];
+               const char *setargs[3] = {
+                       "set",
+                       "LINES",
+                       lns,
+               };
+               if (kdbgetintenv(setargs[0], &linecount)) {
+                       snprintf(lns, 4, "%i", vc->vc_rows);
+                       kdb_set(2, setargs);
+               }
+       }
+#endif /* CONFIG_KGDB_KDB */
        return ret;
 }
 EXPORT_SYMBOL_GPL(con_debug_enter);
index ccb2b3ec0fe899769c161a844b13204d3894fd77..ea6e5244ed3f0b77d8ff644ee975d21945494a17 100644 (file)
@@ -114,4 +114,8 @@ enum {
        KDB_INIT_EARLY,
        KDB_INIT_FULL,
 };
+
+extern int kdbgetintenv(const char *, int *);
+extern int kdb_set(int, const char **);
+
 #endif /* !_KDB_H */
index 97d3ba69775df3b66120f0e7579fc8fba0d896da..c438f545a3217eca47dcae2ff98618467971a9f7 100644 (file)
@@ -144,9 +144,7 @@ extern int kdb_getword(unsigned long *, unsigned long, size_t);
 extern int kdb_putword(unsigned long, unsigned long, size_t);
 
 extern int kdbgetularg(const char *, unsigned long *);
-extern int kdb_set(int, const char **);
 extern char *kdbgetenv(const char *);
-extern int kdbgetintenv(const char *, int *);
 extern int kdbgetaddrarg(int, const char **, int*, unsigned long *,
                         long *, char **);
 extern int kdbgetsymval(const char *, kdb_symtab_t *);