From 058284fceb843b1fc95ffb704de3f9bd088607a9 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Fri, 24 Nov 1995 14:13:42 +0000 Subject: [PATCH] Completed function declarations and/or added prototypes and/or #includes to get the prototypes. Changed some `int's to `boolean_t's. boolean_t's are ints so they are hard to distinguish from ints. Converted function headers to old-style. ddb is written in K&R1 C except where we broke it. --- sys/ddb/db_access.c | 3 ++- sys/ddb/db_aout.c | 5 +++-- sys/ddb/db_break.c | 13 ++++++++----- sys/ddb/db_command.c | 34 ++++++++++++++++------------------ sys/ddb/db_examine.c | 12 ++++++++---- sys/ddb/db_expr.c | 8 +++++++- sys/ddb/db_input.c | 10 ++++++++-- sys/ddb/db_lex.c | 4 ++-- sys/ddb/db_output.c | 10 +++++----- sys/ddb/db_print.c | 8 ++++++-- sys/ddb/db_run.c | 14 +++++++------- sys/ddb/db_sym.c | 14 ++++---------- sys/ddb/db_variables.c | 16 +++++++++++----- sys/ddb/db_watch.c | 15 +++++++++++---- 14 files changed, 98 insertions(+), 68 deletions(-) diff --git a/sys/ddb/db_access.c b/sys/ddb/db_access.c index fb53d27f5f12..d1371804174d 100644 --- a/sys/ddb/db_access.c +++ b/sys/ddb/db_access.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_access.c,v 1.6 1994/08/18 22:34:18 wollman Exp $ + * $Id: db_access.c,v 1.7 1995/05/30 07:56:46 rgrimes Exp $ */ /* @@ -34,6 +34,7 @@ #include #include #include +#include /* * Access unaligned data items on aligned (longword) diff --git a/sys/ddb/db_aout.c b/sys/ddb/db_aout.c index 62cbba94b653..743c1bec1363 100644 --- a/sys/ddb/db_aout.c +++ b/sys/ddb/db_aout.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_aout.c,v 1.10 1995/01/25 21:37:04 bde Exp $ + * $Id: db_aout.c,v 1.11 1995/05/30 07:56:49 rgrimes Exp $ */ /* @@ -116,7 +116,8 @@ X_db_sym_init(symtab, esymtab, name) } } - db_add_symbol_table(sym_start, sym_end, name, (char *)symtab); + db_add_symbol_table((char *)sym_start, (char *)sym_end, name, + (char *)symtab); } db_sym_t diff --git a/sys/ddb/db_break.c b/sys/ddb/db_break.c index 05a4cc16a93c..77aea2fbb59d 100644 --- a/sys/ddb/db_break.c +++ b/sys/ddb/db_break.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_break.c,v 1.5 1994/08/18 22:34:19 wollman Exp $ + * $Id: db_break.c,v 1.6 1995/05/30 07:56:50 rgrimes Exp $ */ /* @@ -42,7 +42,6 @@ #include #include #include -#include #define NBREAKPOINTS 100 struct db_breakpoint db_break_table[NBREAKPOINTS]; @@ -264,7 +263,7 @@ db_list_breakpoints() void db_delete_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -276,7 +275,7 @@ db_delete_cmd(addr, have_addr, count, modif) void db_breakpoint_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -288,7 +287,11 @@ db_breakpoint_cmd(addr, have_addr, count, modif) /* list breakpoints */ void -db_listbreak_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) +db_listbreak_cmd(dummy1, dummy2, dummy3, dummy4) + db_expr_t dummy1; + boolean_t dummy2; + db_expr_t dummy3; + char * dummy4; { db_list_breakpoints(); } diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 5db69d471974..8abb2aa1bc08 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.13 1995/05/30 07:56:52 rgrimes Exp $ + * $Id: db_command.c,v 1.14 1995/08/27 02:39:39 bde Exp $ */ /* @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -61,10 +62,6 @@ db_addr_t db_next; */ boolean_t db_ed_style = TRUE; - -void db_help_cmd __P((void)); -void db_fncall __P((db_expr_t, boolean_t, db_expr_t, char *)); - /* * Utility routine - discard tokens through end-of-line. */ @@ -82,7 +79,7 @@ db_skip_to_eol() */ struct command { char * name; /* command name */ - void (*fcn)(); /* function to call */ + db_cmdfcn_t *fcn; /* function to call */ int flag; /* extra info: */ #define CS_OWN 0x1 /* non-standard syntax */ #define CS_MORE 0x2 /* standard syntax, but may have other @@ -100,6 +97,12 @@ struct command { #define CMD_AMBIGUOUS 3 #define CMD_HELP 4 +extern void db_cmd_list __P((struct command *table)); +extern int db_cmd_search __P((char *name, struct command *table, + struct command **cmdp)); +extern void db_command __P((struct command **last_cmdp, + struct command *cmd_table)); + /* * Search for command prefix. */ @@ -306,15 +309,6 @@ db_command(last_cmdp, cmd_table) * 'show' commands */ -extern void db_show_one_thread(), db_show_all_threads(); -extern void vm_page_print(); -extern void db_ps(); -extern void ipc_port_print(); -#if 0 -void db_show_help(); -#endif -void db_panic(); - struct command db_show_all_cmds[] = { #if 0 { "threads", db_show_all_threads, 0, 0 }, @@ -443,11 +437,15 @@ db_fncall(dummy1, dummy2, dummy3, dummy4) char * dummy4; { db_expr_t fn_addr; -#define MAXARGS 11 +#define MAXARGS 11 /* XXX only 10 are passed */ db_expr_t args[MAXARGS]; int nargs = 0; db_expr_t retval; - db_expr_t (*func)(); + typedef db_expr_t fcn_10args_t __P((db_expr_t, db_expr_t, db_expr_t, + db_expr_t, db_expr_t, db_expr_t, + db_expr_t, db_expr_t, db_expr_t, + db_expr_t)); + fcn_10args_t *func; int t; if (!db_expression(&fn_addr)) { @@ -455,7 +453,7 @@ db_fncall(dummy1, dummy2, dummy3, dummy4) db_flush_lex(); return; } - func = (db_expr_t (*) ()) fn_addr; + func = (fcn_10args_t *)fn_addr; /* XXX */ t = db_read_token(); if (t == tLPAREN) { diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index 8f321b936c85..f3ab7e3b79ae 100644 --- a/sys/ddb/db_examine.c +++ b/sys/ddb/db_examine.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_examine.c,v 1.7 1995/05/22 13:07:11 davidg Exp $ + * $Id: db_examine.c,v 1.8 1995/05/30 07:56:55 rgrimes Exp $ */ /* @@ -54,7 +54,7 @@ static void db_search(db_addr_t, int, db_expr_t, db_expr_t, u_int); void db_examine_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -192,7 +192,7 @@ char db_print_format = 'x'; void db_print_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -248,7 +248,11 @@ db_print_loc_and_inst(loc) * Syntax: search [/bhl] addr value [mask] [,count] */ void -db_search_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) +db_search_cmd(dummy1, dummy2, dummy3, dummy4) + db_expr_t dummy1; + boolean_t dummy2; + db_expr_t dummy3; + char * dummy4; { int t; db_addr_t addr; diff --git a/sys/ddb/db_expr.c b/sys/ddb/db_expr.c index 8f4b78f99def..389a8b1363eb 100644 --- a/sys/ddb/db_expr.c +++ b/sys/ddb/db_expr.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_expr.c,v 1.4 1994/08/13 03:49:18 wollman Exp $ + * $Id: db_expr.c,v 1.5 1995/05/30 07:56:56 rgrimes Exp $ */ /* @@ -38,6 +38,12 @@ #include #include +extern boolean_t db_add_expr __P((db_expr_t *valuep)); +extern boolean_t db_mult_expr __P((db_expr_t *valuep)); +extern boolean_t db_shift_expr __P((db_expr_t *valuep)); +extern boolean_t db_term __P((db_expr_t *valuep)); +extern boolean_t db_unary __P((db_expr_t *valuep)); + boolean_t db_term(valuep) db_expr_t *valuep; diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index c3097742eb9f..9cef6e159432 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_input.c,v 1.6 1994/08/18 22:34:23 wollman Exp $ + * $Id: db_input.c,v 1.7 1995/05/30 07:56:58 rgrimes Exp $ */ /* @@ -57,6 +57,12 @@ char * db_le; /* one past last character */ #define BLANK ' ' #define BACKUP '\b' +extern int cnmaygetc __P((void)); +extern void db_delete __P((int n, int bwd)); +extern int db_inputchar __P((int c)); +extern void db_putnchars __P((int c, int count)); +extern void db_putstring __P((char *s, int count)); + void db_putstring(s, count) char *s; @@ -194,7 +200,7 @@ db_inputchar(c) } int -cnmaygetc (void) +cnmaygetc() { return (-1); } diff --git a/sys/ddb/db_lex.c b/sys/ddb/db_lex.c index 3985c4f67e34..9f1b7fb83edf 100644 --- a/sys/ddb/db_lex.c +++ b/sys/ddb/db_lex.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_lex.c,v 1.5 1994/08/18 22:34:23 wollman Exp $ + * $Id: db_lex.c,v 1.6 1995/05/30 07:57:00 rgrimes Exp $ */ /* @@ -41,7 +41,7 @@ char db_line[120]; char * db_lp, *db_endlp; -static int db_lex(void); +static int db_lex __P((void)); int db_read_line() diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index ca92bfc912de..a5e6a5b685af 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_output.c,v 1.10 1994/10/30 20:55:44 bde Exp $ + * $Id: db_output.c,v 1.11 1995/05/30 07:57:02 rgrimes Exp $ */ /* @@ -39,6 +39,7 @@ #include #include #include +#include #include /* @@ -60,8 +61,8 @@ int db_tab_stop_width = 8; /* how wide are tab stops? */ ((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width) int db_max_width = 80; /* output line width */ - -static void db_printf_guts(const char *, va_list); +static char *db_ksprintn __P((u_long ul, int base, int *lenp)); +static void db_printf_guts __P((const char *, va_list)); /* * Force pending whitespace. @@ -160,7 +161,7 @@ db_printf(const char *fmt, ...) /*VARARGS1*/ void -kdbprintf(char *fmt, ...) +kdbprintf(const char *fmt, ...) { va_list listp; va_start(listp, fmt); @@ -377,4 +378,3 @@ number: p = (char *)db_ksprintn(ul, base, &tmp); } } } - diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c index 7f0557b5c771..91c43f3936e3 100644 --- a/sys/ddb/db_print.c +++ b/sys/ddb/db_print.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_print.c,v 1.6 1994/09/27 03:34:56 phk Exp $ + * $Id: db_print.c,v 1.7 1995/05/30 07:57:06 rgrimes Exp $ */ /* @@ -45,7 +45,11 @@ #include void -db_show_regs(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) +db_show_regs(dummy1, dummy2, dummy3, dummy4) + db_expr_t dummy1; + boolean_t dummy2; + db_expr_t dummy3; + char * dummy4; { register struct db_variable *regp; db_expr_t value, offset; diff --git a/sys/ddb/db_run.c b/sys/ddb/db_run.c index e161a73228ce..7e92501e9e6e 100644 --- a/sys/ddb/db_run.c +++ b/sys/ddb/db_run.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_run.c,v 1.4 1994/08/13 03:49:22 wollman Exp $ + * $Id: db_run.c,v 1.5 1995/05/30 07:57:08 rgrimes Exp $ */ /* @@ -61,10 +61,10 @@ int db_load_count; int db_store_count; #ifndef db_set_single_step -void db_set_single_step(/* db_regs_t *regs */); /* forward */ +extern void db_set_single_step __P((db_regs_t *regs); #endif #ifndef db_clear_single_step -void db_clear_single_step(/* db_regs_t *regs */); +extern void db_clear_single_step __P((db_regs_t *regs)); #endif boolean_t @@ -302,7 +302,7 @@ extern int db_cmd_loop_done; void db_single_step_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -329,7 +329,7 @@ db_single_step_cmd(addr, have_addr, count, modif) void db_trace_until_call_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -351,7 +351,7 @@ db_trace_until_call_cmd(addr, have_addr, count, modif) void db_trace_until_matching_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -375,7 +375,7 @@ db_trace_until_matching_cmd(addr, have_addr, count, modif) void db_continue_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index 81c7b4d94a80..64dc5d5a7958 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_sym.c,v 1.8 1995/05/22 13:07:12 davidg Exp $ + * $Id: db_sym.c,v 1.9 1995/05/30 07:57:10 rgrimes Exp $ */ /* @@ -36,14 +36,6 @@ #include #include -/* - * We import from the symbol-table dependent routines: - */ -extern db_sym_t X_db_lookup(); -extern db_sym_t X_db_search_symbol(); -extern boolean_t X_db_line_at_pc(); -extern void X_db_symbol_values(); - /* * Multiple symbol tables */ @@ -56,7 +48,9 @@ int db_nsymtab = 0; db_symtab_t *db_last_symtab; -db_sym_t db_lookup(); /* forward */ +extern db_sym_t db_lookup __P(( char *symstr)); +static char *db_qualify __P((db_sym_t sym, char *symtabname)); +extern boolean_t db_symbol_is_ambiguous __P((db_sym_t sym)); /* * Add symbol table, with given name, to list of symbol tables. diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c index 25485f5256c2..7cf10c52b025 100644 --- a/sys/ddb/db_variables.c +++ b/sys/ddb/db_variables.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_variables.c,v 1.6 1994/09/27 03:34:58 phk Exp $ + * $Id: db_variables.c,v 1.7 1995/05/30 07:57:17 rgrimes Exp $ */ /* @@ -39,7 +39,9 @@ #include #include -static void db_write_variable(struct db_variable *, db_expr_t *); +extern int db_find_variable __P((struct db_variable **varp)); +extern int db_set_variable __P((db_expr_t value)); +static void db_write_variable __P((struct db_variable *, db_expr_t *)); struct db_variable db_vars[] = { { "radix", &db_radix, FCN_NULL }, @@ -109,7 +111,7 @@ db_read_variable(vp, valuep) struct db_variable *vp; db_expr_t *valuep; { - int (*func)() = vp->fcn; + db_varfcn_t *func = vp->fcn; if (func == FCN_NULL) *valuep = *(vp->valuep); @@ -122,7 +124,7 @@ db_write_variable(vp, valuep) struct db_variable *vp; db_expr_t *valuep; { - int (*func)() = vp->fcn; + db_varfcn_t *func = vp->fcn; if (func == FCN_NULL) *(vp->valuep) = *valuep; @@ -131,7 +133,11 @@ db_write_variable(vp, valuep) } void -db_set_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) +db_set_cmd(dummy1, dummy2, dummy3, dummy4) + db_expr_t dummy1; + boolean_t dummy2; + db_expr_t dummy3; + char * dummy4; { db_expr_t value; struct db_variable *vp; diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c index b74fab9e9fa6..ae1f4250d3d8 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.5 1994/08/18 22:34:28 wollman Exp $ + * $Id: db_watch.c,v 1.6 1995/05/30 07:57:20 rgrimes Exp $ */ /* @@ -54,6 +54,9 @@ db_watchpoint_t db_next_free_watchpoint = &db_watch_table[0]; db_watchpoint_t db_free_watchpoints = 0; db_watchpoint_t db_watchpoint_list = 0; +extern db_watchpoint_t db_watchpoint_alloc __P((void)); +extern void db_watchpoint_free __P((db_watchpoint_t watch)); + db_watchpoint_t db_watchpoint_alloc() { @@ -171,7 +174,7 @@ db_list_watchpoints() void db_deletewatch_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -183,7 +186,7 @@ db_deletewatch_cmd(addr, have_addr, count, modif) void db_watchpoint_cmd(addr, have_addr, count, modif) db_expr_t addr; - int have_addr; + boolean_t have_addr; db_expr_t count; char * modif; { @@ -201,7 +204,11 @@ db_watchpoint_cmd(addr, have_addr, count, modif) /* list watchpoints */ void -db_listwatch_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummmy4) +db_listwatch_cmd(dummy1, dummy2, dummy3, dummy4) + db_expr_t dummy1; + boolean_t dummy2; + db_expr_t dummy3; + char * dummy4; { db_list_watchpoints(); }