- change db_cmd_list() to list commands vertically rather than horizontally
- sort entries in the various command tables, so that the `help' lists are easier to use. this included hacking db_machine_commands_install() to search for the "machine" entry to change the `more cmds' pointer, rather than assuming it was the first entry - add a `sync' command, which is effectively `reboot 0x100'. - remove db_help_cmd(); it was unused (and was almost a duplicate of db_cmd_list()). - move some extern decls to db_output.h, since they're used in more than one place now - rename NEXT_TAB to DB_NEXT_TAB and move to db_output.h
This commit is contained in:
parent
093997a6f6
commit
4a2b49cb31
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_command.c,v 1.31 1999/05/10 21:13:05 thorpej Exp $ */
|
||||
/* $NetBSD: db_command.c,v 1.32 1999/10/28 06:37:32 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -144,11 +144,36 @@ void
|
||||
db_cmd_list(table)
|
||||
struct db_command *table;
|
||||
{
|
||||
register struct db_command *cmd;
|
||||
int i, j, w, columns, lines, width, items, numcmds;
|
||||
char *p;
|
||||
|
||||
for (cmd = table; cmd->name != 0; cmd++) {
|
||||
db_printf("%-12s", cmd->name);
|
||||
db_end_line();
|
||||
for (numcmds = 0; table[numcmds].name != NULL; numcmds++) {
|
||||
w = strlen(table[numcmds].name);
|
||||
if (w > width)
|
||||
width = w;
|
||||
}
|
||||
width = DB_NEXT_TAB(width);
|
||||
items = 0;
|
||||
|
||||
columns = db_max_width / width;
|
||||
if (columns == 0)
|
||||
columns = 1;
|
||||
lines = (numcmds + columns - 1) / columns;
|
||||
for (i = 0; i < lines; i++) {
|
||||
for (j = 0; j < columns; j++) {
|
||||
p = table[j * lines + i].name;
|
||||
if (p)
|
||||
db_printf("%s", p);
|
||||
if (j * lines + i + lines >= numcmds) {
|
||||
db_putchar('\n');
|
||||
break;
|
||||
}
|
||||
w = strlen(p);
|
||||
while (w < width) {
|
||||
w = DB_NEXT_TAB(w);
|
||||
db_putchar('\t');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,84 +381,81 @@ db_pool_print_cmd(addr, have_addr, count, modif)
|
||||
*/
|
||||
|
||||
struct db_command db_show_all_cmds[] = {
|
||||
{ "procs", db_show_all_procs, 0, NULL },
|
||||
{ "callout", db_show_callout, 0, NULL },
|
||||
{ "procs", db_show_all_procs, 0, NULL },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
struct db_command db_show_cmds[] = {
|
||||
{ "all", NULL, 0, db_show_all_cmds },
|
||||
{ "registers", db_show_regs, 0, NULL },
|
||||
{ "breaks", db_listbreak_cmd, 0, NULL },
|
||||
{ "watches", db_listwatch_cmd, 0, NULL },
|
||||
{ "map", db_map_print_cmd, 0, NULL },
|
||||
{ "object", db_object_print_cmd, 0, NULL },
|
||||
{ "page", db_page_print_cmd, 0, NULL },
|
||||
{ "pool", db_pool_print_cmd, 0, NULL },
|
||||
{ NULL, NULL, 0, NULL, }
|
||||
{ "registers", db_show_regs, 0, NULL },
|
||||
{ "watches", db_listwatch_cmd, 0, NULL },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
struct db_command db_command_table[] = {
|
||||
#ifdef DB_MACHINE_COMMANDS
|
||||
/* this must be the first entry, if it exists */
|
||||
{ "machine", NULL, 0, NULL},
|
||||
#endif
|
||||
{ "print", db_print_cmd, 0, NULL },
|
||||
{ "break", db_breakpoint_cmd, 0, NULL },
|
||||
{ "c", db_continue_cmd, 0, NULL },
|
||||
{ "call", db_fncall, CS_OWN, NULL },
|
||||
{ "callout", db_show_callout, 0, NULL },
|
||||
{ "continue", db_continue_cmd, 0, NULL },
|
||||
{ "d", db_delete_cmd, 0, NULL },
|
||||
{ "delete", db_delete_cmd, 0, NULL },
|
||||
{ "dwatch", db_deletewatch_cmd, 0, NULL },
|
||||
{ "examine", db_examine_cmd, CS_SET_DOT, NULL },
|
||||
{ "x", db_examine_cmd, CS_SET_DOT, NULL },
|
||||
{ "kill", db_kill_proc, CS_OWN, NULL },
|
||||
#ifdef DB_MACHINE_COMMANDS
|
||||
{ "machine", NULL, 0, NULL },
|
||||
#endif
|
||||
{ "match", db_trace_until_matching_cmd,0, NULL },
|
||||
{ "next", db_trace_until_matching_cmd,0, NULL },
|
||||
{ "print", db_print_cmd, 0, NULL },
|
||||
{ "ps", db_show_all_procs, 0, NULL },
|
||||
{ "reboot", db_reboot_cmd, CS_OWN, NULL },
|
||||
{ "s", db_single_step_cmd, 0, NULL },
|
||||
{ "search", db_search_cmd, CS_OWN|CS_SET_DOT, NULL },
|
||||
{ "set", db_set_cmd, CS_OWN, NULL },
|
||||
{ "write", db_write_cmd, CS_MORE|CS_SET_DOT, NULL },
|
||||
{ "w", db_write_cmd, CS_MORE|CS_SET_DOT, NULL },
|
||||
{ "delete", db_delete_cmd, 0, NULL },
|
||||
{ "d", db_delete_cmd, 0, NULL },
|
||||
{ "break", db_breakpoint_cmd, 0, NULL },
|
||||
{ "dwatch", db_deletewatch_cmd, 0, NULL },
|
||||
{ "watch", db_watchpoint_cmd, CS_MORE, NULL },
|
||||
{ "step", db_single_step_cmd, 0, NULL },
|
||||
{ "s", db_single_step_cmd, 0, NULL },
|
||||
{ "continue", db_continue_cmd, 0, NULL },
|
||||
{ "c", db_continue_cmd, 0, NULL },
|
||||
{ "until", db_trace_until_call_cmd,0, NULL },
|
||||
{ "next", db_trace_until_matching_cmd,0, NULL },
|
||||
{ "match", db_trace_until_matching_cmd,0, NULL },
|
||||
{ "trace", db_stack_trace_cmd, 0, NULL },
|
||||
{ "call", db_fncall, CS_OWN, NULL },
|
||||
{ "ps", db_show_all_procs, 0, NULL },
|
||||
{ "kill", db_kill_proc, CS_OWN, NULL },
|
||||
{ "callout", db_show_callout, 0, NULL },
|
||||
{ "reboot", db_reboot_cmd, CS_OWN, NULL },
|
||||
{ "show", NULL, 0, db_show_cmds },
|
||||
{ "step", db_single_step_cmd, 0, NULL },
|
||||
{ "sync", db_sync_cmd, CS_OWN, NULL },
|
||||
{ "trace", db_stack_trace_cmd, 0, NULL },
|
||||
{ "until", db_trace_until_call_cmd,0, NULL },
|
||||
{ "w", db_write_cmd, CS_MORE|CS_SET_DOT, NULL },
|
||||
{ "watch", db_watchpoint_cmd, CS_MORE, NULL },
|
||||
{ "write", db_write_cmd, CS_MORE|CS_SET_DOT, NULL },
|
||||
{ "x", db_examine_cmd, CS_SET_DOT, NULL },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
#ifdef DB_MACHINE_COMMANDS
|
||||
|
||||
/* this function should be called to install the machine dependent
|
||||
commands. It should be called before the debugger is enabled */
|
||||
void db_machine_commands_install(ptr)
|
||||
struct db_command *ptr;
|
||||
/*
|
||||
* this function should be called to install the machine dependent
|
||||
* commands. It should be called before the debugger is enabled
|
||||
*/
|
||||
void
|
||||
db_machine_commands_install(ptr)
|
||||
struct db_command *ptr;
|
||||
{
|
||||
db_command_table[0].more = ptr;
|
||||
return;
|
||||
struct db_command *cmd;
|
||||
|
||||
for (cmd = db_command_table; cmd != 0; cmd++) {
|
||||
if (strcmp(cmd->name, "machine") == 0) {
|
||||
cmd->more = ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct db_command *db_last_command = 0;
|
||||
|
||||
void
|
||||
db_help_cmd()
|
||||
{
|
||||
struct db_command *cmd = db_command_table;
|
||||
|
||||
while (cmd->name != 0) {
|
||||
db_printf("%-12s", cmd->name);
|
||||
db_end_line();
|
||||
cmd++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
db_command_loop()
|
||||
{
|
||||
@ -559,3 +581,14 @@ db_reboot_cmd(addr, have_addr, count, modif)
|
||||
}
|
||||
cpu_reboot((int)bootflags, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
db_sync_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char * modif;
|
||||
{
|
||||
|
||||
cpu_reboot(RB_DUMP, NULL);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_command.h,v 1.13 1999/05/10 21:13:05 thorpej Exp $ */
|
||||
/* $NetBSD: db_command.h,v 1.14 1999/10/28 06:37:32 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -42,11 +42,11 @@ void db_object_print_cmd __P((db_expr_t, int, db_expr_t, char *));
|
||||
void db_page_print_cmd __P((db_expr_t, int, db_expr_t, char *));
|
||||
void db_pool_print_cmd __P((db_expr_t, int, db_expr_t, char *));
|
||||
void db_machine_commands_install __P((struct db_command *));
|
||||
void db_help_cmd __P((void));
|
||||
void db_command_loop __P((void));
|
||||
void db_error __P((char *));
|
||||
void db_fncall __P((db_expr_t, int, db_expr_t, char *));
|
||||
void db_reboot_cmd __P((db_expr_t, int, db_expr_t, char *));
|
||||
void db_sync_cmd __P((db_expr_t, int, db_expr_t, char *));
|
||||
|
||||
db_addr_t db_dot; /* current location */
|
||||
db_addr_t db_last_addr; /* last explicit address typed */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_output.c,v 1.19 1999/04/12 20:38:21 pk Exp $ */
|
||||
/* $NetBSD: db_output.c,v 1.20 1999/10/28 06:37:32 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -70,8 +70,6 @@ int db_output_position = 0; /* output column */
|
||||
int db_output_line = 0; /* output line number */
|
||||
int db_last_non_space = 0; /* last non-space character */
|
||||
int db_tab_stop_width = 8; /* how wide are tab stops? */
|
||||
#define NEXT_TAB(i) \
|
||||
((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width)
|
||||
int db_max_line = DB_MAX_LINE; /* output max lines */
|
||||
int db_max_width = DB_MAX_WIDTH; /* output line width */
|
||||
|
||||
@ -87,7 +85,7 @@ db_force_whitespace()
|
||||
|
||||
last_print = db_last_non_space;
|
||||
while (last_print < db_output_position) {
|
||||
next_tab = NEXT_TAB(last_print);
|
||||
next_tab = DB_NEXT_TAB(last_print);
|
||||
if (next_tab <= db_output_position) {
|
||||
while (last_print < next_tab) { /* DON'T send a tab!!! */
|
||||
cnputc(' ');
|
||||
@ -170,7 +168,7 @@ db_putchar(c)
|
||||
}
|
||||
else if (c == '\t') {
|
||||
/* assume tabs every 8 positions */
|
||||
db_output_position = NEXT_TAB(db_output_position);
|
||||
db_output_position = DB_NEXT_TAB(db_output_position);
|
||||
}
|
||||
else if (c == ' ') {
|
||||
/* space */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_output.h,v 1.12 1999/04/12 20:38:21 pk Exp $ */
|
||||
/* $NetBSD: db_output.h,v 1.13 1999/10/28 06:37:32 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -38,3 +38,11 @@ int db_print_position __P((void));
|
||||
void db_printf __P((const char *, ...))
|
||||
__kprintf_attribute__((__format__(__kprintf__,1,2)));
|
||||
void db_end_line __P((void));
|
||||
|
||||
extern int db_radix;
|
||||
extern int db_max_width;
|
||||
extern int db_tab_stop_width;
|
||||
extern int db_max_line;
|
||||
|
||||
#define DB_NEXT_TAB(i) \
|
||||
((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: db_variables.c,v 1.16 1999/04/12 20:38:21 pk Exp $ */
|
||||
/* $NetBSD: db_variables.c,v 1.17 1999/10/28 06:37:32 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
@ -43,6 +43,7 @@
|
||||
#include <ddb/db_command.h>
|
||||
#include <ddb/db_sym.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#include <ddb/db_output.h>
|
||||
|
||||
|
||||
/*
|
||||
@ -63,11 +64,6 @@ int db_onpanic = DDB_ONPANIC;
|
||||
int db_fromconsole = DDB_FROMCONSOLE;
|
||||
|
||||
|
||||
extern int db_radix;
|
||||
extern int db_max_width;
|
||||
extern int db_tab_stop_width;
|
||||
extern int db_max_line;
|
||||
|
||||
static int db_rw_internal_variable __P((struct db_variable *, db_expr_t *,
|
||||
int));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user