add a new option DDB_COMMANDONENTER.
which can be useful for eg. broken console input.
This commit is contained in:
parent
980a85a52a
commit
ac41acf302
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files,v 1.741 2005/11/25 17:33:56 thorpej Exp $
|
||||
# $NetBSD: files,v 1.742 2005/11/26 12:16:44 yamt Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
|
@ -202,6 +202,7 @@ defflag opt_mbr.h COMPAT_386BSD_MBRPART
|
|||
defflag opt_ddb.h DDB
|
||||
defparam opt_ddbparam.h DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE
|
||||
DDB_BREAK_CHAR DDB_KEYCODE SYMTAB_SPACE
|
||||
DDB_COMMANDONENTER
|
||||
defflag opt_kgdb.h KGDB
|
||||
defparam opt_kgdb.h KGDB_DEV KGDB_DEVNAME KGDB_DEVPORT
|
||||
KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_command.c,v 1.79 2005/06/01 12:25:27 drochner Exp $ */
|
||||
/* $NetBSD: db_command.c,v 1.80 2005/11/26 12:16:44 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -31,11 +31,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.79 2005/06/01 12:25:27 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.80 2005/11/26 12:16:44 yamt Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ddbparam.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -201,6 +202,10 @@ static const struct db_command db_command_table[] = {
|
|||
};
|
||||
|
||||
static const struct db_command *db_last_command = NULL;
|
||||
#if defined(DDB_COMMANDONENTER)
|
||||
const char *db_cmd_on_enter = ___STRING(DDB_COMMANDONENTER);
|
||||
#endif /* defined(DDB_COMMANDONENTER) */
|
||||
#define DB_LINE_SEP ';'
|
||||
|
||||
/*
|
||||
* Utility routine - discard tokens through end-of-line.
|
||||
|
@ -244,6 +249,27 @@ db_command_loop(void)
|
|||
db_recover = &db_jmpbuf;
|
||||
(void) setjmp(&db_jmpbuf);
|
||||
|
||||
#if defined(DDB_COMMANDONENTER)
|
||||
if (db_cmd_on_enter != NULL) {
|
||||
const struct db_command *dummy = NULL;
|
||||
const char *cmd = db_cmd_on_enter;
|
||||
|
||||
while (*cmd != '\0') {
|
||||
const char *ep = cmd;
|
||||
|
||||
while (*ep != '\0' && *ep != DB_LINE_SEP) {
|
||||
ep++;
|
||||
}
|
||||
db_set_line(cmd, ep);
|
||||
db_command(&dummy, db_command_table);
|
||||
cmd = ep;
|
||||
if (*cmd == DB_LINE_SEP) {
|
||||
cmd++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* defined(DDB_COMMANDONENTER) */
|
||||
|
||||
while (!db_cmd_loop_done) {
|
||||
if (db_print_position() != 0)
|
||||
db_printf("\n");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_lex.c,v 1.18 2003/05/17 09:58:03 scw Exp $ */
|
||||
/* $NetBSD: db_lex.c,v 1.19 2005/11/26 12:16:45 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.18 2003/05/17 09:58:03 scw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.19 2005/11/26 12:16:45 yamt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -52,7 +52,8 @@ db_expr_t db_tok_number;
|
|||
char db_tok_string[TOK_STRING_SIZE];
|
||||
|
||||
static char db_line[120];
|
||||
static char *db_lp, *db_endlp;
|
||||
static const char *db_lp;
|
||||
static const char *db_endlp;
|
||||
|
||||
static int db_look_char = 0;
|
||||
static int db_look_token = 0;
|
||||
|
@ -70,11 +71,18 @@ db_read_line(void)
|
|||
i = db_readline(db_line, sizeof(db_line));
|
||||
if (i == 0)
|
||||
return (0); /* EOI */
|
||||
db_lp = db_line;
|
||||
db_endlp = db_lp + i;
|
||||
db_set_line(db_line, db_line + i);
|
||||
return (i);
|
||||
}
|
||||
|
||||
void
|
||||
db_set_line(const char *sp, const char *ep)
|
||||
{
|
||||
|
||||
db_lp = sp;
|
||||
db_endlp = ep;
|
||||
}
|
||||
|
||||
static void
|
||||
db_flush_line(void)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_lex.h,v 1.13 2002/02/15 07:33:51 simonb Exp $ */
|
||||
/* $NetBSD: db_lex.h,v 1.14 2005/11/26 12:16:45 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
|
@ -35,6 +35,7 @@
|
|||
void db_flush_lex(void);
|
||||
char *db_num_to_str(db_expr_t);
|
||||
int db_read_line(void);
|
||||
void db_set_line(const char *, const char *);
|
||||
int db_read_token(void);
|
||||
void db_unread_token(int);
|
||||
|
||||
|
|
Loading…
Reference in New Issue