From c14aa7ae4820b9e50a391cdb2e5ed91d81933ccd Mon Sep 17 00:00:00 2001 From: bde Date: Fri, 24 Nov 1995 13:53:05 +0000 Subject: [PATCH] Completed function declarations and/or added prototypes. Removed `extern' from prototypes. Sorted prototypes. Uniformized idempotency ifdefs. --- sys/ddb/db_access.h | 16 +++--- sys/ddb/db_break.h | 25 +++++---- sys/ddb/db_command.h | 9 ++-- sys/ddb/db_lex.h | 23 ++++---- sys/ddb/db_output.h | 13 ++--- sys/ddb/db_sym.h | 35 ++++++++---- sys/ddb/db_variables.h | 17 +++--- sys/ddb/db_watch.h | 22 ++++---- sys/ddb/ddb.h | 119 ++++++++++++++++++++++------------------- 9 files changed, 152 insertions(+), 127 deletions(-) diff --git a/sys/ddb/db_access.h b/sys/ddb/db_access.h index dbf3d2112115..c5682e796b31 100644 --- a/sys/ddb/db_access.h +++ b/sys/ddb/db_access.h @@ -23,11 +23,11 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_access.h,v 1.3 1993/11/07 17:39:20 wollman Exp $ + * $Id: db_access.h,v 1.4 1995/05/30 07:56:47 rgrimes Exp $ */ #ifndef _DDB_DB_ACCESS_H_ -#define _DDB_DB_ACCESS_H_ 1 +#define _DDB_DB_ACCESS_H_ /* * Author: David B. Golub, Carnegie Mellon University @@ -38,10 +38,8 @@ */ #include /* expression types */ -extern db_expr_t db_get_value(/* db_addr_t addr, - int size, - boolean_t is_signed */); -extern void db_put_value(/* db_addr_t addr, - int size, - db_expr_t value */); -#endif /* _DDB_DB_ACCESS_H_ */ +db_expr_t db_get_value __P((db_addr_t addr, int size, + boolean_t is_signed)); +void db_put_value __P((db_addr_t addr, int size, db_expr_t value)); + +#endif /* !_DDB_DB_ACCESS_H_ */ diff --git a/sys/ddb/db_break.h b/sys/ddb/db_break.h index efe62c717e29..743c666c7073 100644 --- a/sys/ddb/db_break.h +++ b/sys/ddb/db_break.h @@ -23,14 +23,14 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_break.h,v 1.2 1993/10/16 16:47:09 rgrimes Exp $ + * $Id: db_break.h,v 1.3 1995/05/30 07:56:51 rgrimes Exp $ */ /* * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 */ -#ifndef _DDB_DB_BREAK_H_ +#ifndef _DDB_DB_BREAK_H_ #define _DDB_DB_BREAK_H_ #include @@ -53,12 +53,17 @@ struct db_breakpoint { }; typedef struct db_breakpoint *db_breakpoint_t; -extern db_breakpoint_t db_find_breakpoint(); -extern db_breakpoint_t db_find_breakpoint_here(); -extern void db_set_breakpoints(); -extern void db_clear_breakpoints(); +db_breakpoint_t db_breakpoint_alloc __P((void)); +void db_breakpoint_free __P((db_breakpoint_t bkpt)); +void db_clear_breakpoints __P((void)); +void db_delete_breakpoint __P((vm_map_t map, db_addr_t addr)); +void db_delete_temp_breakpoint __P((db_breakpoint_t bkpt)); +db_breakpoint_t db_find_breakpoint __P((vm_map_t map, db_addr_t addr)); +db_breakpoint_t db_find_breakpoint_here __P((db_addr_t addr)); +void db_list_breakpoints __P((void)); +void db_set_breakpoint __P((vm_map_t map, db_addr_t addr, + int count)); +void db_set_breakpoints __P((void)); +db_breakpoint_t db_set_temp_breakpoint __P((db_addr_t addr)); -extern db_breakpoint_t db_set_temp_breakpoint(/* db_addr_t addr */); -extern void db_delete_temp_breakpoint(/* db_breakpoint_t bkpt */); - -#endif _DDB_DB_BREAK_H_ +#endif /* !_DDB_DB_BREAK_H_ */ diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h index 3b6d77ae7102..d9906b4eed33 100644 --- a/sys/ddb/db_command.h +++ b/sys/ddb/db_command.h @@ -23,11 +23,11 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_command.h,v 1.5 1994/08/18 22:34:21 wollman Exp $ + * $Id: db_command.h,v 1.6 1995/05/30 07:56:54 rgrimes Exp $ */ #ifndef _DDB_DB_COMMAND_H_ -#define _DDB_DB_COMMAND_H_ 1 +#define _DDB_DB_COMMAND_H_ /* * Author: David B. Golub, Carnegie Mellon University @@ -41,7 +41,7 @@ #include #include -extern void db_command_loop(); +void db_command_loop __P((void)); extern db_addr_t db_dot; /* current location */ extern db_addr_t db_last_addr; /* last explicit address typed */ @@ -50,5 +50,4 @@ extern db_addr_t db_prev; /* last address examined extern db_addr_t db_next; /* next address to be examined or written */ - -#endif /* _DDB_DB_COMMAND_H_ */ +#endif /* !_DDB_DB_COMMAND_H_ */ diff --git a/sys/ddb/db_lex.h b/sys/ddb/db_lex.h index 0be7d4ac4a18..da8797926a3f 100644 --- a/sys/ddb/db_lex.h +++ b/sys/ddb/db_lex.h @@ -23,11 +23,11 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_lex.h,v 1.4 1994/08/18 22:34:24 wollman Exp $ + * $Id: db_lex.h,v 1.5 1995/05/30 07:57:01 rgrimes Exp $ */ #ifndef _DDB_DB_LEX_H_ -#define _DDB_DB_LEX_H_ 1 +#define _DDB_DB_LEX_H_ /* * Author: David B. Golub, Carnegie Mellon University @@ -36,13 +36,13 @@ /* * Lexical analyzer. */ -extern int db_read_line(); -extern void db_flush_line(); -extern int db_read_char(); -extern void db_unread_char(/* char c */); -extern int db_read_token(); -extern void db_unread_token(/* int t */); -extern void db_flush_lex(); +void db_flush_lex __P((void)); +void db_flush_line __P((void)); +int db_read_char __P((void)); +int db_read_line __P((void)); +int db_read_token __P((void)); +void db_unread_char __P((int c)); +void db_unread_token __P((int t)); extern int db_tok_number; #define TOK_STRING_SIZE 120 @@ -70,7 +70,4 @@ extern char db_tok_string[TOK_STRING_SIZE]; #define tSHIFT_R 19 #define tDOTDOT 20 - - - -#endif /* _DDB_DB_LEX_H_ */ +#endif /* !_DDB_DB_LEX_H_ */ diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index 3a2f5fd321a9..73e95e52fbe9 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -23,11 +23,11 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_output.h,v 1.6 1994/09/27 12:15:53 davidg Exp $ + * $Id: db_output.h,v 1.7 1995/05/30 07:57:04 rgrimes Exp $ */ #ifndef _DDB_DB_OUTPUT_H_ -#define _DDB_DB_OUTPUT_H_ 1 +#define _DDB_DB_OUTPUT_H_ /* * Author: David B. Golub, Carnegie Mellon University @@ -38,7 +38,8 @@ * Printing routines for kernel debugger. */ -extern void db_force_whitespace(); -extern int db_print_position(); -extern void db_end_line(); -#endif /* _DDB_DB_OUTPUT_H_ */ +void db_end_line __P((void)); +void db_force_whitespace __P((void)); +int db_print_position __P((void)); + +#endif /* !_DDB_DB_OUTPUT_H_ */ diff --git a/sys/ddb/db_sym.h b/sys/ddb/db_sym.h index 319279dab56b..3a16c08c8ef0 100644 --- a/sys/ddb/db_sym.h +++ b/sys/ddb/db_sym.h @@ -23,11 +23,11 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_sym.h,v 1.7 1995/03/16 18:11:00 bde Exp $ + * $Id: db_sym.h,v 1.8 1995/05/30 07:57:11 rgrimes Exp $ */ #ifndef _DDB_DB_SYM_H_ -#define _DDB_DB_SYM_H_ 1 +#define _DDB_DB_SYM_H_ /* * Author: Alessandro Forin, Carnegie Mellon University @@ -74,13 +74,13 @@ extern boolean_t db_qualify_ambiguous_names; /* * Functions exported by the symtable module */ -extern void db_add_symbol_table(); +void db_add_symbol_table __P((char *, char *, char *, char *)); /* extend the list of symbol tables */ -extern db_sym_t db_search_symbol(/* db_expr_t, db_strategy_t, int* */); +db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *)); /* find symbol given value */ -extern void db_symbol_values(/* db_sym_t, char**, db_expr_t* */); +void db_symbol_values __P((db_sym_t, char **, db_expr_t *)); /* return name and value of symbol */ #define db_find_sym_and_offset(val,namep,offp) \ @@ -91,13 +91,26 @@ extern void db_symbol_values(/* db_sym_t, char**, db_expr_t* */); db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0) /* ditto, but no locals */ -extern int db_eqname(/* char*, char*, char */); +int db_eqname __P((char *, char *, char)); /* strcmp, modulo leading char */ -extern void db_printsym(/* db_expr_t, db_strategy_t */); +void db_printsym __P((db_expr_t, db_strategy_t)); /* print closest symbol to a value */ -extern boolean_t db_line_at_pc(db_sym_t, char **, int *, db_expr_t); -extern int db_sym_numargs(db_sym_t, int *, char **); -extern int X_db_sym_numargs(db_symtab_t *, db_sym_t, int *, char **); -#endif /* _DDB_DB_SYM_H_ */ +boolean_t db_line_at_pc __P((db_sym_t, char **, int *, db_expr_t)); +int db_sym_numargs __P((db_sym_t, int *, char **)); + +boolean_t X_db_line_at_pc __P((db_symtab_t *symtab, db_sym_t cursym, + char **filename, int *linenum, + db_expr_t off)); +db_sym_t X_db_lookup __P((db_symtab_t *stab, char *symstr)); +db_sym_t X_db_search_symbol __P((db_symtab_t *symtab, db_addr_t off, + db_strategy_t strategy, + db_expr_t *diffp)); +void X_db_sym_init __P((int *symtab, char *esymtab, char *name)); +int X_db_sym_numargs __P((db_symtab_t *, db_sym_t, int *, + char **)); +void X_db_symbol_values __P((db_sym_t sym, char **namep, + db_expr_t *valuep)); + +#endif /* !_DDB_DB_SYM_H_ */ diff --git a/sys/ddb/db_variables.h b/sys/ddb/db_variables.h index 76aeedecaf62..55519a8b2c75 100644 --- a/sys/ddb/db_variables.h +++ b/sys/ddb/db_variables.h @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_variables.h,v 1.3 1993/11/25 01:30:14 wollman Exp $ + * $Id: db_variables.h,v 1.4 1995/05/30 07:57:19 rgrimes Exp $ */ /* @@ -31,27 +31,30 @@ * Date: 7/90 */ -#ifndef _DB_VARIABLES_H_ -#define _DB_VARIABLES_H_ +#ifndef _DDB_DB_VARIABLES_H_ +#define _DDB_DB_VARIABLES_H_ /* * Debugger variables. */ +struct db_variable; +typedef int db_varfcn_t __P((struct db_variable *vp, db_expr_t *valuep, + int op)); struct db_variable { char *name; /* Name of variable */ int *valuep; /* value of variable */ /* function to call when reading/writing */ - int (*fcn)(/* db_variable *vp, db_expr_t *valuep, int op */); + db_varfcn_t *fcn; #define DB_VAR_GET 0 #define DB_VAR_SET 1 }; -#define FCN_NULL ((int (*)())0) +#define FCN_NULL ((db_varfcn_t *)0) extern struct db_variable db_vars[]; /* debugger variables */ extern struct db_variable *db_evars; extern struct db_variable db_regs[]; /* machine registers */ extern struct db_variable *db_eregs; -extern void db_read_variable(struct db_variable *, db_expr_t *); +void db_read_variable __P((struct db_variable *, db_expr_t *)); -#endif /* _DB_VARIABLES_H_ */ +#endif /* _!DDB_DB_VARIABLES_H_ */ diff --git a/sys/ddb/db_watch.h b/sys/ddb/db_watch.h index 61cb7c1806bb..aed0a32ebc3e 100644 --- a/sys/ddb/db_watch.h +++ b/sys/ddb/db_watch.h @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_watch.h,v 1.3 1994/08/18 22:34:29 wollman Exp $ + * $Id: db_watch.h,v 1.4 1995/05/30 07:57:21 rgrimes Exp $ */ /* @@ -31,8 +31,8 @@ * Date: 10/90 */ -#ifndef _DDB_DB_WATCH_ -#define _DDB_DB_WATCH_ +#ifndef _DDB_DB_WATCH_H_ +#define _DDB_DB_WATCH_H_ #include #include @@ -48,13 +48,11 @@ typedef struct db_watchpoint { struct db_watchpoint *link; /* link in in-use or free chain */ } *db_watchpoint_t; -extern boolean_t db_find_watchpoint(/* vm_map_t map, db_addr_t addr, - db_regs_t *regs */); +void db_delete_watchpoint __P((vm_map_t map, db_addr_t addr)); +boolean_t db_find_watchpoint __P((vm_map_t map, db_addr_t addr, + db_regs_t *regs)); +void db_list_watchpoints __P((void)); +void db_set_watchpoint __P((vm_map_t map, db_addr_t addr, + vm_size_t size)); - - -extern void db_set_watchpoint(/* vm_map_t map, db_addr_t addr, vm_size_t size */); -extern void db_delete_watchpoint(/* vm_map_t map, db_addr_t addr */); -extern void db_list_watchpoints(); - -#endif _DDB_DB_WATCH_ +#endif /* !_DDB_DB_WATCH_H_ */ diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index 23702b28cb7f..2175167e646e 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -27,19 +27,22 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ddb.h,v 1.5 1995/03/16 18:11:01 bde Exp $ + * $Id: ddb.h,v 1.6 1995/05/30 07:57:24 rgrimes Exp $ */ /* * Necessary declarations for the `ddb' kernel debugger. */ -#ifndef __h_ddb_ddb -#define __h_ddb_ddb 1 +#ifndef _DDB_DDB_H_ +#define _DDB_DDB_H_ #include /* type definitions */ #include +typedef void db_cmdfcn_t __P((db_expr_t addr, boolean_t have_addr, + db_expr_t count, char *modif)); + /* * Global variables... */ @@ -52,62 +55,70 @@ extern int db_radix; extern int db_max_width; extern int db_tab_stop_width; +struct vm_map; /* forward declaration */ + /* * Functions... */ -extern void -db_read_bytes(vm_offset_t addr, register int size, register char *data); + +void cnpollc __P((int)); +void db_check_interrupt __P((void)); +void db_clear_watchpoints __P((void)); +db_addr_t db_disasm __P((db_addr_t loc, boolean_t altfmt)); + /* instruction disassembler */ +void db_error __P((char *s)); +int db_expression __P((db_expr_t *valuep)); +int db_get_variable __P((db_expr_t *valuep)); +struct vm_map *db_map_addr __P((vm_offset_t)); +boolean_t db_map_current __P((struct vm_map *)); +boolean_t db_map_equal __P((struct vm_map *, struct vm_map *)); +void db_print_loc_and_inst __P((db_addr_t loc)); +void db_printf __P((const char *fmt, ...)); +void db_putchar __P((int c)); +void db_read_bytes __P((vm_offset_t addr, int size, char *data)); /* machine-dependent */ - -extern void -db_write_bytes(vm_offset_t addr, register int size, register char *data); +int db_readline __P((char *lstart, int lsize)); +void db_restart_at_pc __P((boolean_t watchpt)); +void db_set_watchpoints __P((void)); +void db_single_step __P((db_regs_t *regs)); +void db_skip_to_eol __P((void)); +boolean_t db_stop_at_pc __P((boolean_t *is_breakpoint)); +#define db_strcpy strcpy +void db_trap __P((int type, int code)); +int db_value_of_name __P((char *name, db_expr_t *valuep)); +void db_write_bytes __P((vm_offset_t addr, int size, char *data)); /* machine-dependent */ +void kdb_init __P((void)); +void kdbprintf __P((const char *fmt, ...)); +void kdbprinttrap __P((int, int)); -struct vm_map; /* forward declaration */ +db_cmdfcn_t db_breakpoint_cmd; +db_cmdfcn_t db_continue_cmd; +db_cmdfcn_t db_delete_cmd; +db_cmdfcn_t db_deletewatch_cmd; +db_cmdfcn_t db_examine_cmd; +db_cmdfcn_t db_fncall; +db_cmdfcn_t db_listbreak_cmd; +db_cmdfcn_t db_listwatch_cmd; +db_cmdfcn_t db_panic; +db_cmdfcn_t db_print_cmd; +db_cmdfcn_t db_ps; +db_cmdfcn_t db_search_cmd; +db_cmdfcn_t db_set_cmd; +db_cmdfcn_t db_show_regs; +db_cmdfcn_t db_single_step_cmd; +db_cmdfcn_t db_stack_trace_cmd; +db_cmdfcn_t db_trace_until_call_cmd; +db_cmdfcn_t db_trace_until_matching_cmd; +db_cmdfcn_t db_watchpoint_cmd; +db_cmdfcn_t db_write_cmd; -extern boolean_t db_map_equal(struct vm_map *, struct vm_map *); -extern boolean_t db_map_current(struct vm_map *); -extern struct vm_map *db_map_addr(vm_offset_t); +#if 0 +db_cmdfcn_t db_help_cmd; +db_cmdfcn_t db_show_all_threads; +db_cmdfcn_t db_show_one_thread; +db_cmdfcn_t ipc_port_print; +db_cmdfcn_t vm_page_print; +#endif -#define db_strcpy strcpy -extern int db_expression (db_expr_t *valuep); - -typedef void db_cmd_fcn(db_expr_t, int, db_expr_t, char *); - -extern db_cmd_fcn db_listbreak_cmd, db_listwatch_cmd, db_show_regs; -extern db_cmd_fcn db_print_cmd, db_examine_cmd, db_set_cmd, db_search_cmd; -extern db_cmd_fcn db_write_cmd, db_delete_cmd, db_breakpoint_cmd; -extern db_cmd_fcn db_deletewatch_cmd, db_watchpoint_cmd; -extern db_cmd_fcn db_single_step_cmd, db_trace_until_call_cmd; -extern db_cmd_fcn db_trace_until_matching_cmd, db_continue_cmd; -extern db_cmd_fcn db_stack_trace_cmd; - -extern db_addr_t db_disasm(db_addr_t loc, boolean_t altfmt); - /* instruction disassembler */ - -extern int db_value_of_name (char *name, db_expr_t *valuep); -extern int db_get_variable (db_expr_t *valuep); -extern void db_putchar (int c); -extern void db_error (char *s); -extern int db_readline (char *lstart, int lsize); -extern void db_printf (const char *fmt, ...); -extern void db_check_interrupt(void); -extern void db_print_loc_and_inst (db_addr_t loc); - -extern void db_clear_watchpoints (void); -extern void db_set_watchpoints (void); - -extern void db_restart_at_pc(boolean_t watchpt); -extern boolean_t db_stop_at_pc(boolean_t *is_breakpoint); - -extern void db_skip_to_eol (void); -extern void db_single_step (db_regs_t *regs); - -extern void db_trap (int type, int code); - -extern void cnpollc(int); - -extern void kdb_init(void); -extern void kdbprinttrap(int, int); - -#endif /* __h_ddb_ddb */ +#endif /* !_DDB_DDB_H_ */