From b7aa38c1e3717649c95f58b0d01935b689bbda6a Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Fri, 13 Feb 1998 02:19:29 +0000 Subject: [PATCH] Ensure that the linker sets for commands exist by putting a standard command in each of them. This removes the need for hard-to-configure dummy instantiations of the sets. --- sys/ddb/db_command.c | 22 +++++++--------------- sys/ddb/db_watch.c | 15 +++++++-------- sys/ddb/ddb.h | 3 +-- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 0f62f88de17f..63a89bb7879e 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_command.c,v 1.23 1997/02/22 09:28:21 peter Exp $ + * $Id: db_command.c,v 1.24 1998/02/09 06:07:52 eivind Exp $ */ /* @@ -49,12 +49,8 @@ /* * Exported global variables */ -/* - * XXX when db_command is actually used, it will be generated by the linker. - * Then it should be declared extern. - */ -static struct linker_set db_cmd_set; boolean_t db_cmd_loop_done; +extern struct linker_set db_cmd_set; db_addr_t db_dot; jmp_buf db_jmpbuf; db_addr_t db_last_addr; @@ -64,7 +60,6 @@ extern struct linker_set db_show_cmd_set; static db_cmdfcn_t db_fncall; static db_cmdfcn_t db_gdb; -static db_cmdfcn_t db_panic; /* XXX this is actually forward-static. */ extern struct command db_show_cmds[]; @@ -374,7 +369,6 @@ static struct command db_show_cmds[] = { { "all", 0, 0, db_show_all_cmds }, { "registers", db_show_regs, 0, 0 }, { "breaks", db_listbreak_cmd, 0, 0 }, - { "watches", db_listwatch_cmd, 0, 0 }, #if 0 { "thread", db_show_one_thread, 0, 0 }, #endif @@ -409,7 +403,6 @@ static struct command db_command_table[] = { { "call", db_fncall, CS_OWN, 0 }, { "show", 0, 0, db_show_cmds }, { "ps", db_ps, 0, 0 }, - { "panic", db_panic, 0, 0 }, { "gdb", db_gdb, 0, 0 }, { (char *)0, } }; @@ -430,12 +423,11 @@ db_help_cmd() } #endif -static void -db_panic(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; - boolean_t dummy2; - db_expr_t dummy3; - char * dummy4; +/* + * At least one non-optional command must be implemented using + * DB_COMMAND() so that db_cmd_set gets created. Here is one. + */ +DB_COMMAND(panic, db_panic) { panic("from debugger"); } diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c index c0f951e72689..1fa3c3438c93 100644 --- a/sys/ddb/db_watch.c +++ b/sys/ddb/db_watch.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_watch.c,v 1.14 1997/02/22 09:28:33 peter Exp $ + * $Id: db_watch.c,v 1.15 1997/06/14 11:52:37 bde Exp $ */ /* @@ -32,6 +32,7 @@ */ #include +#include #include #include @@ -212,13 +213,11 @@ db_watchpoint_cmd(addr, have_addr, count, modif) db_set_watchpoint(db_map_addr(addr), addr, size); } -/* list watchpoints */ -void -db_listwatch_cmd(dummy1, dummy2, dummy3, dummy4) - db_expr_t dummy1; - boolean_t dummy2; - db_expr_t dummy3; - char * dummy4; +/* + * At least one non-optional show-command must be implemented using + * DB_SHOW_COMMAND() so that db_show_cmd_set gets created. Here is one. + */ +DB_SHOW_COMMAND(watches, db_listwatch_cmd) { db_list_watchpoints(); } diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index 6376a2000e1f..a5638947728f 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: ddb.h,v 1.14 1997/02/22 09:28:35 peter Exp $ */ /* @@ -112,7 +112,6 @@ db_cmdfcn_t db_delete_cmd; db_cmdfcn_t db_deletewatch_cmd; db_cmdfcn_t db_examine_cmd; db_cmdfcn_t db_listbreak_cmd; -db_cmdfcn_t db_listwatch_cmd; db_cmdfcn_t db_print_cmd; db_cmdfcn_t db_ps; db_cmdfcn_t db_search_cmd;