Skip to content

Commit

Permalink
vt,console,kdb: automatically set kdb LINES variable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
CC: David Airlie <[email protected]>
CC: Andrew Morton <[email protected]>
  • Loading branch information
jwessel committed Aug 5, 2010
1 parent b45cfba commit 81d4450
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
17 changes: 17 additions & 0 deletions drivers/char/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
#include <linux/io.h>
#include <asm/system.h>
#include <linux/uaccess.h>
#include <linux/kdb.h>

#define MAX_NR_CON_DRIVER 16

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions include/linux/kdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 0 additions & 2 deletions kernel/debug/kdb/kdb_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit 81d4450

Please sign in to comment.