diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index e114f100064c..8e8c10aa0a63 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -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); +} diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h index d350b8a2d487..cdf2ce7d1f93 100644 --- a/sys/ddb/db_command.h +++ b/sys/ddb/db_command.h @@ -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 */ diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index b8867b87a43a..b3fabfc3ea7f 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -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 */ diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index 11f6ba15042b..9f473a4d709c 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -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) diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c index 85d6a29d88af..bc0a370c0a89 100644 --- a/sys/ddb/db_variables.c +++ b/sys/ddb/db_variables.c @@ -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 #include #include +#include /* @@ -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));