diff options
-rw-r--r-- | sys/ddb/db_access.c | 2 | ||||
-rw-r--r-- | sys/ddb/db_access.h | 2 | ||||
-rw-r--r-- | sys/ddb/db_aout.c | 41 | ||||
-rw-r--r-- | sys/ddb/db_break.c | 11 | ||||
-rw-r--r-- | sys/ddb/db_break.h | 20 | ||||
-rw-r--r-- | sys/ddb/db_command.c | 165 | ||||
-rw-r--r-- | sys/ddb/db_command.h | 19 | ||||
-rw-r--r-- | sys/ddb/db_examine.c | 28 | ||||
-rw-r--r-- | sys/ddb/db_expr.c | 5 | ||||
-rw-r--r-- | sys/ddb/db_extern.h | 80 | ||||
-rw-r--r-- | sys/ddb/db_input.c | 12 | ||||
-rw-r--r-- | sys/ddb/db_interface.h | 49 | ||||
-rw-r--r-- | sys/ddb/db_lex.c | 10 | ||||
-rw-r--r-- | sys/ddb/db_lex.h | 5 | ||||
-rw-r--r-- | sys/ddb/db_output.c | 41 | ||||
-rw-r--r-- | sys/ddb/db_output.h | 6 | ||||
-rw-r--r-- | sys/ddb/db_print.c | 12 | ||||
-rw-r--r-- | sys/ddb/db_run.c | 7 | ||||
-rw-r--r-- | sys/ddb/db_run.h | 11 | ||||
-rw-r--r-- | sys/ddb/db_sym.c | 36 | ||||
-rw-r--r-- | sys/ddb/db_sym.h | 16 | ||||
-rw-r--r-- | sys/ddb/db_trap.c | 6 | ||||
-rw-r--r-- | sys/ddb/db_variables.c | 20 | ||||
-rw-r--r-- | sys/ddb/db_variables.h | 13 | ||||
-rw-r--r-- | sys/ddb/db_watch.c | 13 | ||||
-rw-r--r-- | sys/ddb/db_watch.h | 14 | ||||
-rw-r--r-- | sys/ddb/db_write_cmd.c | 5 |
27 files changed, 465 insertions, 184 deletions
diff --git a/sys/ddb/db_access.c b/sys/ddb/db_access.c index 4914f1e02fd..cb6e4e58595 100644 --- a/sys/ddb/db_access.c +++ b/sys/ddb/db_access.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_access.c,v 1.8 1994/10/09 08:37:35 mycroft Exp $ */ +/* $OpenBSD: db_access.c,v 1.2 1996/02/20 13:35:30 mickey Exp $ */ /* * Mach Operating System diff --git a/sys/ddb/db_access.h b/sys/ddb/db_access.h index 21f0a3b76e2..f85e6825528 100644 --- a/sys/ddb/db_access.h +++ b/sys/ddb/db_access.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_access.h,v 1.6 1994/10/09 08:29:57 mycroft Exp $ */ +/* $OpenBSD: db_access.h,v 1.2 1996/02/20 13:35:30 mickey Exp $ */ /* * Mach Operating System diff --git a/sys/ddb/db_aout.c b/sys/ddb/db_aout.c index 496efc4d0ac..a2fc4a78062 100644 --- a/sys/ddb/db_aout.c +++ b/sys/ddb/db_aout.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_aout.c,v 1.12 1994/10/09 08:19:31 mycroft Exp $ */ +/* $OpenBSD: db_aout.c,v 1.3 1996/02/20 13:35:31 mickey Exp $ */ /* * Mach Operating System @@ -34,6 +34,8 @@ #include <machine/db_machdep.h> /* data types */ #include <ddb/db_sym.h> +#include <ddb/db_output.h> +#include <ddb/db_extern.h> #ifndef DB_NO_AOUT @@ -62,18 +64,19 @@ int db_symtab[SYMTAB_SPACE/sizeof(int)] = { 0, 1 }; /* * Find the symbol table and strings; tell ddb about them. */ +void X_db_sym_init(symtab, esymtab, name) - int * symtab; /* pointer to start of symbol table */ - char * esymtab; /* pointer to end of string table, + int *symtab; /* pointer to start of symbol table */ + char *esymtab; /* pointer to end of string table, for checking - rounded up to integer boundary */ - char * name; + char *name; { register struct nlist *sym_start, *sym_end; register struct nlist *sp; - register char * strtab; - register int strlen; - char * estrtab; + register char *strtab; + register int slen; + char *estrtab; #ifdef SYMTAB_SPACE if (*symtab < sizeof(int)) { @@ -90,17 +93,17 @@ X_db_sym_init(symtab, esymtab, name) sym_end = (struct nlist *)((char *)sym_start + *symtab); strtab = (char *)sym_end; - strlen = *(int *)strtab; + slen = *(int *)strtab; #ifdef SYMTAB_SPACE printf("DDB: found symbols [%d + %d bytes]\n", - *symtab, strlen); - if ((*symtab + strlen) > db_symtabsize) { + *symtab, slen); + if ((*symtab + slen) > db_symtabsize) { printf("DDB: symbols larger than SYMTAB_SPACE?\n"); return; } #else - estrtab = strtab + strlen; + estrtab = strtab + slen; #define round_to_size(x) \ (((vm_offset_t)(x) + sizeof(vm_size_t) - 1) & ~(sizeof(vm_size_t) - 1)) @@ -117,7 +120,7 @@ X_db_sym_init(symtab, esymtab, name) register int strx; strx = sp->n_un.n_strx; if (strx != 0) { - if (strx > strlen) { + if (strx > slen) { db_printf("Bad string table index (%#x)\n", strx); sp->n_un.n_name = 0; continue; @@ -183,10 +186,10 @@ X_db_search_symbol(symtab, off, strategy, diffp) diff = off - sp->n_value; symp = sp; if (diff == 0 && - (strategy == DB_STGY_PROC && - sp->n_type == (N_TEXT|N_EXT) || - strategy == DB_STGY_ANY && - (sp->n_type & N_EXT))) + ((strategy == DB_STGY_PROC && + sp->n_type == (N_TEXT|N_EXT)) || + (strategy == DB_STGY_ANY && + (sp->n_type & N_EXT)))) break; } else if (off - sp->n_value == diff) { @@ -235,7 +238,6 @@ X_db_line_at_pc(symtab, cursym, filename, linenum, off) db_expr_t off; { register struct nlist *sp, *ep; - register struct nlist *sym = (struct nlist *)cursym; unsigned long sodiff = -1UL, lndiff = -1UL, ln = 0; char *fname = NULL; @@ -333,6 +335,7 @@ X_db_sym_numargs(symtab, cursym, nargp, argnamep) /* * Initialization routine for a.out files. */ +void ddb_init() { #ifndef SYMTAB_SPACE @@ -340,10 +343,10 @@ ddb_init() extern int end; if (esym > (char *)&end) { - X_db_sym_init((int *)&end, esym, "bsd"); + X_db_sym_init((int *)&end, esym, "netbsd"); } #else - X_db_sym_init (db_symtab, 0, "bsd"); + X_db_sym_init (db_symtab, 0, "netbsd"); #endif } diff --git a/sys/ddb/db_break.c b/sys/ddb/db_break.c index e85c52f4102..45de1e72b26 100644 --- a/sys/ddb/db_break.c +++ b/sys/ddb/db_break.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_break.c,v 1.5 1994/10/09 08:19:32 mycroft Exp $ */ +/* $OpenBSD: db_break.c,v 1.2 1996/02/20 13:35:32 mickey Exp $ */ /* * Mach Operating System @@ -38,10 +38,10 @@ #include <machine/db_machdep.h> /* type definitions */ #include <ddb/db_lex.h> -#include <ddb/db_break.h> #include <ddb/db_access.h> #include <ddb/db_sym.h> #include <ddb/db_break.h> +#include <ddb/db_output.h> #define NBREAKPOINTS 100 struct db_breakpoint db_break_table[NBREAKPOINTS]; @@ -286,8 +286,13 @@ db_breakpoint_cmd(addr, have_addr, count, modif) } /* list breakpoints */ +/*ARGSUSED*/ void -db_listbreak_cmd() +db_listbreak_cmd(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { db_list_breakpoints(); } diff --git a/sys/ddb/db_break.h b/sys/ddb/db_break.h index 007b87d4540..afd3b9d2949 100644 --- a/sys/ddb/db_break.h +++ b/sys/ddb/db_break.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_break.h,v 1.7 1994/10/09 08:29:58 mycroft Exp $ */ +/* $OpenBSD: db_break.h,v 1.2 1996/02/20 13:35:33 mickey Exp $ */ /* * Mach Operating System @@ -49,16 +49,22 @@ typedef struct db_breakpoint { struct db_breakpoint *link; /* link in in-use or free chain */ } *db_breakpoint_t; -db_breakpoint_t db_find_breakpoint __P((vm_map_t, db_addr_t)); -db_breakpoint_t db_find_breakpoint_here __P((db_addr_t)); +db_breakpoint_t db_breakpoint_alloc __P((void)); +void db_breakpoint_free __P((db_breakpoint_t)); +void db_set_breakpoint __P((vm_map_t, db_addr_t, int)); +void db_delete_breakpoint __P((vm_map_t, db_addr_t)); +db_breakpoint_t db_find_breakpoint __P((vm_map_t, db_addr_t)); +db_breakpoint_t db_find_breakpoint_here __P((db_addr_t)); void db_set_breakpoints __P((void)); void db_clear_breakpoints __P((void)); - -db_breakpoint_t db_set_temp_breakpoint __P((db_addr_t)); +db_breakpoint_t db_set_temp_breakpoint __P((db_addr_t)); void db_delete_temp_breakpoint __P((db_breakpoint_t)); - +void db_list_breakpoints __P((void)); +void db_delete_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_breakpoint_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_listbreak_cmd __P((db_expr_t, int, db_expr_t, char *)); boolean_t db_map_equal __P((vm_map_t, vm_map_t)); boolean_t db_map_current __P((vm_map_t)); vm_map_t db_map_addr __P((vm_offset_t)); -#endif _DDB_DB_BREAK_H_ +#endif /* _DDB_DB_BREAK_H_ */ diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 5792e9bc6e7..b1d11187a0d 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_command.c,v 1.15 1995/10/26 14:52:33 gwr Exp $ */ +/* $OpenBSD: db_command.c,v 1.3 1996/02/20 13:35:33 mickey Exp $ */ /* * Mach Operating System @@ -31,22 +31,29 @@ */ #include <sys/param.h> #include <sys/proc.h> +#include <sys/reboot.h> #include <vm/vm.h> - #include <machine/db_machdep.h> /* type definitions */ #include <ddb/db_lex.h> #include <ddb/db_output.h> #include <ddb/db_command.h> +#include <ddb/db_break.h> +#include <ddb/db_watch.h> +#include <ddb/db_run.h> +#include <ddb/db_variables.h> +#include <ddb/db_interface.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> -#include <setjmp.h> +#include <vm/vm.h> /* * Exported global variables */ boolean_t db_cmd_loop_done; -jmp_buf *db_recover; +label_t *db_recover; /* * if 'ed' style: 'dot' is set at start of last item printed, @@ -148,7 +155,7 @@ db_command(last_cmdp, cmd_table) int t; char modif[TOK_STRING_SIZE]; db_expr_t addr, count; - boolean_t have_addr; + boolean_t have_addr = FALSE; int result; t = db_read_token(); @@ -161,8 +168,7 @@ db_command(last_cmdp, cmd_table) modif[0] = '\0'; } else if (t == tEXCL) { - void db_fncall(); - db_fncall(); + db_fncall(0, 0, 0, NULL); return; } else if (t != tIDENT) { @@ -287,13 +293,12 @@ db_map_print_cmd(addr, have_addr, count, modif) db_expr_t count; char * modif; { - extern void _vm_map_print(); boolean_t full = FALSE; if (modif[0] == 'f') full = TRUE; - _vm_map_print((vm_map_t)addr, full, db_printf); + _vm_map_print((vm_map_t) addr, full, db_printf); } /*ARGSUSED*/ @@ -304,82 +309,76 @@ db_object_print_cmd(addr, have_addr, count, modif) db_expr_t count; char * modif; { - extern void _vm_object_print(); boolean_t full = FALSE; if (modif[0] == 'f') full = TRUE; - _vm_object_print((vm_object_t)addr, full, db_printf); + _vm_object_print((vm_object_t) addr, full, db_printf); } /* * 'show' commands */ -extern void db_show_all_procs(); -extern void db_show_callout(); -extern void db_listbreak_cmd(); -extern void db_listwatch_cmd(); -extern void db_show_regs(); -void db_show_help(); struct db_command db_show_all_cmds[] = { - { "procs", db_show_all_procs,0, 0 }, - { "callout", db_show_callout,0, 0 }, - { (char *)0 } + { "procs", db_show_all_procs, 0, NULL }, + { "callout", db_show_callout, 0, NULL }, + { NULL, NULL, 0, NULL } }; struct db_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 }, - { "map", db_map_print_cmd, 0, 0 }, - { "object", db_object_print_cmd, 0, 0 }, - { (char *)0, } + { "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 }, + { NULL, NULL, 0, NULL, } }; -extern void db_print_cmd(), db_examine_cmd(), db_set_cmd(); -extern void db_search_cmd(); -extern void db_write_cmd(); -extern void db_delete_cmd(), db_breakpoint_cmd(); -extern void db_deletewatch_cmd(), db_watchpoint_cmd(); -extern void db_single_step_cmd(), db_trace_until_call_cmd(), - db_trace_until_matching_cmd(), db_continue_cmd(); -extern void db_stack_trace_cmd(); -void db_help_cmd(); -void db_fncall(); +void db_boot_sync_cmd(); +void db_boot_crash_cmd(); +void db_boot_dump_cmd(); + +struct db_command db_boot_cmds[] = { + { "sync", db_boot_sync_cmd, 0, 0 }, + { "crash", db_boot_crash_cmd, 0, 0 }, + { "dump", db_boot_dump_cmd, 0, 0 }, + { (char *)0, } +}; struct db_command db_command_table[] = { #ifdef DB_MACHINE_COMMANDS /* this must be the first entry, if it exists */ - { "machine", 0, 0, 0}, + { "machine", NULL, 0, NULL}, #endif - { "print", db_print_cmd, 0, 0 }, - { "examine", db_examine_cmd, CS_SET_DOT, 0 }, - { "x", db_examine_cmd, CS_SET_DOT, 0 }, - { "search", db_search_cmd, CS_OWN|CS_SET_DOT, 0 }, - { "set", db_set_cmd, CS_OWN, 0 }, - { "write", db_write_cmd, CS_MORE|CS_SET_DOT, 0 }, - { "w", db_write_cmd, CS_MORE|CS_SET_DOT, 0 }, - { "delete", db_delete_cmd, 0, 0 }, - { "d", db_delete_cmd, 0, 0 }, - { "break", db_breakpoint_cmd, 0, 0 }, - { "dwatch", db_deletewatch_cmd, 0, 0 }, - { "watch", db_watchpoint_cmd, CS_MORE, 0 }, - { "step", db_single_step_cmd, 0, 0 }, - { "s", db_single_step_cmd, 0, 0 }, - { "continue", db_continue_cmd, 0, 0 }, - { "c", db_continue_cmd, 0, 0 }, - { "until", db_trace_until_call_cmd,0, 0 }, - { "next", db_trace_until_matching_cmd,0, 0 }, - { "match", db_trace_until_matching_cmd,0, 0 }, - { "trace", db_stack_trace_cmd, 0, 0 }, - { "call", db_fncall, CS_OWN, 0 }, - { "ps", db_show_all_procs, 0, 0 }, - { "callout", db_show_callout, 0, 0 }, - { "show", 0, 0, db_show_cmds }, - { (char *)0, } + { "print", db_print_cmd, 0, NULL }, + { "examine", db_examine_cmd, CS_SET_DOT, NULL }, + { "x", db_examine_cmd, CS_SET_DOT, 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 }, + { "callout", db_show_callout, 0, NULL }, + { "show", NULL, 0, db_show_cmds }, + { "boot", NULL, 0, db_boot_cmds }, + { NULL, NULL, 0, NULL } }; #ifdef DB_MACHINE_COMMANDS @@ -412,8 +411,8 @@ db_help_cmd() void db_command_loop() { - jmp_buf db_jmpbuf; - jmp_buf *savejmp = db_recover; + label_t db_jmpbuf; + label_t *savejmp; extern int db_output_line; /* @@ -423,7 +422,10 @@ db_command_loop() db_next = db_dot; db_cmd_loop_done = 0; - (void) setjmp(*(db_recover = &db_jmpbuf)); + + savejmp = db_recover; + db_recover = &db_jmpbuf; + (void) setjmp(&db_jmpbuf); while (!db_cmd_loop_done) { if (db_print_position() != 0) @@ -446,7 +448,7 @@ db_error(s) if (s) db_printf(s); db_flush_lex(); - longjmp(*db_recover, 1); + longjmp(db_recover, 1); } @@ -454,15 +456,20 @@ db_error(s) * Call random function: * !expr(arg,arg,arg) */ +/*ARGSUSED*/ void -db_fncall() +db_fncall(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { db_expr_t fn_addr; #define MAXARGS 11 db_expr_t args[MAXARGS]; int nargs = 0; db_expr_t retval; - db_expr_t (*func)(); + db_expr_t (*func) __P((db_expr_t, ...)); int t; if (!db_expression(&fn_addr)) { @@ -470,7 +477,7 @@ db_fncall() db_flush_lex(); return; } - func = (db_expr_t (*) ()) fn_addr; + func = (db_expr_t (*) __P((db_expr_t, ...))) fn_addr; t = db_read_token(); if (t == tLPAREN) { @@ -507,3 +514,21 @@ db_fncall() args[5], args[6], args[7], args[8], args[9] ); db_printf("%#n\n", retval); } + +void +db_boot_sync_cmd() +{ + boot(RB_AUTOBOOT); +} + +void +db_boot_crash_cmd() +{ + boot(RB_NOSYNC | RB_DUMP); +} + +void +db_boot_dump_cmd() +{ + boot(RB_DUMP); +} diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h index 47cdf5db01f..b321b03feec 100644 --- a/sys/ddb/db_command.h +++ b/sys/ddb/db_command.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_command.h,v 1.7 1994/10/09 08:30:00 mycroft Exp $ */ +/* $OpenBSD: db_command.h,v 1.2 1996/02/20 13:35:34 mickey Exp $ */ /* * Mach Operating System @@ -32,10 +32,18 @@ /* * Command loop declarations. */ -void db_command_loop __P((void)); void db_skip_to_eol __P((void)); - -void db_error __P((char *)); /* report error */ +struct db_command; +int db_cmd_search __P((char *, struct db_command *, struct db_command **)); +void db_cmd_list __P((struct db_command *)); +void db_command __P((struct db_command **, struct db_command *)); +void db_map_print_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_object_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 *)); db_addr_t db_dot; /* current location */ db_addr_t db_last_addr; /* last explicit address typed */ @@ -49,7 +57,8 @@ db_addr_t db_next; /* next address to be examined */ struct db_command { char *name; /* command name */ - void (*fcn)(); /* function to call */ + /* function to call */ + void (*fcn) __P((db_expr_t, int, db_expr_t, char *)); int flag; /* extra info: */ #define CS_OWN 0x1 /* non-standard syntax */ #define CS_MORE 0x2 /* standard syntax, but may have other diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index 07a7c691fc3..4ed910b2ce7 100644 --- a/sys/ddb/db_examine.c +++ b/sys/ddb/db_examine.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_examine.c,v 1.9 1994/11/17 04:51:50 gwr Exp $ */ +/* $OpenBSD: db_examine.c,v 1.2 1996/02/20 13:35:35 mickey Exp $ */ /* * Mach Operating System @@ -38,12 +38,12 @@ #include <ddb/db_output.h> #include <ddb/db_command.h> #include <ddb/db_sym.h> +#include <ddb/db_access.h> +#include <ddb/db_extern.h> +#include <ddb/db_interface.h> char db_examine_format[TOK_STRING_SIZE] = "x"; -extern db_addr_t db_disasm(/* db_addr_t, boolean_t */); - /* instruction disassembler */ - /* * Examine (print) data. Syntax is: * x/[bhl][cdiorsuxz]* @@ -69,9 +69,10 @@ db_examine_cmd(addr, have_addr, count, modif) db_examine((db_addr_t) addr, db_examine_format, count); } +void db_examine(addr, fmt, count) register - db_addr_t addr; + db_addr_t addr; char * fmt; /* format string */ int count; /* repeat count */ { @@ -225,6 +226,7 @@ db_print_cmd(addr, have_addr, count, modif) db_printf("\n"); } +void db_print_loc_and_inst(loc) db_addr_t loc; { @@ -233,11 +235,12 @@ db_print_loc_and_inst(loc) (void) db_disasm(loc, FALSE); } +void db_strcpy(dst, src) register char *dst; register char *src; { - while (*dst++ = *src++) + while ((*dst++ = *src++) != '\0') ; } @@ -245,8 +248,13 @@ db_strcpy(dst, src) * Search for a value in memory. * Syntax: search [/bhl] addr value [mask] [,count] */ +/*ARGSUSED*/ void -db_search_cmd() +db_search_cmd(daddr, have_addr, dcount, modif) + db_expr_t daddr; + int have_addr; + db_expr_t dcount; + char * modif; { int t; db_addr_t addr; @@ -278,11 +286,12 @@ db_search_cmd() size = 4; } - if (!db_expression(&addr)) { + if (!db_expression(&value)) { db_printf("Address missing\n"); db_flush_lex(); return; } + addr = (db_addr_t) value; if (!db_expression(&value)) { db_printf("Value missing\n"); @@ -291,7 +300,7 @@ db_search_cmd() } if (!db_expression(&mask)) - mask = 0xffffffff; + mask = (int) ~0; t = db_read_token(); if (t == tCOMMA) { @@ -309,6 +318,7 @@ db_search_cmd() db_search(addr, size, value, mask, count); } +void db_search(addr, size, value, mask, count) register db_addr_t addr; diff --git a/sys/ddb/db_expr.c b/sys/ddb/db_expr.c index 1182a1f9993..90dd30ca696 100644 --- a/sys/ddb/db_expr.c +++ b/sys/ddb/db_expr.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_expr.c,v 1.4 1994/06/29 06:31:06 cgd Exp $ */ +/* $OpenBSD: db_expr.c,v 1.2 1996/02/20 13:35:35 mickey Exp $ */ /* * Mach Operating System @@ -37,6 +37,9 @@ #include <ddb/db_lex.h> #include <ddb/db_access.h> #include <ddb/db_command.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> +#include <ddb/db_variables.h> boolean_t db_term(valuep) diff --git a/sys/ddb/db_extern.h b/sys/ddb/db_extern.h new file mode 100644 index 00000000000..6254cedc949 --- /dev/null +++ b/sys/ddb/db_extern.h @@ -0,0 +1,80 @@ +/* $OpenBSD: db_extern.h,v 1.1 1996/02/20 13:35:36 mickey Exp $ */ + +/* + * Copyright (c) 1995 Christos Zoulas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christos Zoulas. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _DDB_DB_EXTERN_H_ +#define _DDB_DB_EXTERN_H_ + +/* db_aout.c */ +void X_db_sym_init __P((int *, char *, char *)); +db_sym_t X_db_lookup __P((db_symtab_t *, char *)); +db_sym_t X_db_search_symbol __P((db_symtab_t *, db_addr_t, db_strategy_t, + db_expr_t *)); +void X_db_symbol_values __P((db_sym_t, char **, db_expr_t *)); +void db_printsym __P((db_expr_t, db_strategy_t)); +boolean_t X_db_line_at_pc __P((db_symtab_t *, db_sym_t, char **, + int *, db_expr_t)); +int X_db_sym_numargs __P((db_symtab_t *, db_sym_t, int *, char **)); +void ddb_init __P((void)); + +/* db_examine.c */ +void db_examine_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_examine __P((db_addr_t, char *, int)); +void db_print_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_print_loc_and_inst __P((db_addr_t)); +void db_strcpy __P((char *, char *)); +void db_search_cmd __P((db_expr_t, boolean_t, db_expr_t, char *)); +void db_search __P((db_addr_t, int, db_expr_t, db_expr_t, unsigned int)); + +/* db_expr.c */ +boolean_t db_term __P((db_expr_t *)); +boolean_t db_unary __P((db_expr_t *)); +boolean_t db_mult_expr __P((db_expr_t *)); +boolean_t db_add_expr __P((db_expr_t *)); +boolean_t db_shift_expr __P((db_expr_t *)); +int db_expression __P((db_expr_t *)); + +/* db_input.c */ +void db_putstring __P((char *, int)); +void db_putnchars __P((int, int)); +void db_delete __P((int, int)); +int db_inputchar __P((int)); +int db_readline __P((char *, int)); +void db_check_interrupt __P((void)); + +/* db_print.c */ +void db_show_regs __P((db_expr_t, boolean_t, db_expr_t, char *)); + +/* db_trap.c */ +void db_trap(int, int); + +/* db_write_cmd.c */ +void db_write_cmd __P((db_expr_t, boolean_t, db_expr_t, char *)); + +#endif /* _DDB_DB_EXTERN_H_ */ diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index dd8ef077b33..fd9e51e9ced 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_input.c,v 1.6 1994/10/26 17:57:50 mycroft Exp $ */ +/* $OpenBSD: db_input.c,v 1.2 1996/02/20 13:35:37 mickey Exp $ */ /* * Mach Operating System @@ -32,7 +32,14 @@ #include <sys/param.h> #include <sys/proc.h> +#include <machine/db_machdep.h> + #include <ddb/db_output.h> +#include <ddb/db_command.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> + +#include <dev/cons.h> /* * Character input and editing. @@ -53,6 +60,8 @@ char * db_le; /* one past last character */ #define BLANK ' ' #define BACKUP '\b' +static int cnmaygetc __P((void)); + void db_putstring(s, count) char *s; @@ -240,6 +249,7 @@ db_check_interrupt() } } +static int cnmaygetc () { return (-1); diff --git a/sys/ddb/db_interface.h b/sys/ddb/db_interface.h new file mode 100644 index 00000000000..6f1642934ac --- /dev/null +++ b/sys/ddb/db_interface.h @@ -0,0 +1,49 @@ +/* $OpenBSD: db_interface.h,v 1.1 1996/02/20 13:35:37 mickey Exp $ */ + +/* + * Copyright (c) 1995 Christos Zoulas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christos Zoulas. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _DDB_DB_INTERFACE_H_ +#define _DDB_DB_INTERFACE_H_ + +/* arch/<arch>/<arch>/db_trace.c */ +void db_stack_trace_cmd __P((db_expr_t, int, db_expr_t, char *)); + +/* arch/<arch>/<arch>/db_disasm.c */ +db_addr_t db_disasm __P((db_addr_t, boolean_t)); + +/* kern/kern_synch.c */ +void db_show_all_procs __P((db_expr_t, int, db_expr_t, char *)); + +/* kern/kern_clock.c */ +void db_show_callout __P((db_expr_t, int, db_expr_t, char *)); + +/* arch/<arch>/<arch>/db_interface.c */ +void db_machine_init __P((void)); + +#endif /* _DDB_DB_INTERFACE_H_ */ diff --git a/sys/ddb/db_lex.c b/sys/ddb/db_lex.c index c4fec55bebd..8eaa29c7123 100644 --- a/sys/ddb/db_lex.c +++ b/sys/ddb/db_lex.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_lex.c,v 1.7 1994/10/09 08:56:25 mycroft Exp $ */ +/* $OpenBSD: db_lex.c,v 1.2 1996/02/20 13:35:38 mickey Exp $ */ /* * Mach Operating System @@ -34,7 +34,13 @@ */ #include <sys/param.h> +#include <machine/db_machdep.h> + #include <ddb/db_lex.h> +#include <ddb/db_output.h> +#include <ddb/db_command.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> char db_line[120]; char * db_lp, *db_endlp; @@ -131,7 +137,7 @@ db_lex() if (c >= '0' && c <= '9') { /* number */ - int r, digit; + int r, digit = 0; if (c > '0') r = db_radix; diff --git a/sys/ddb/db_lex.h b/sys/ddb/db_lex.h index c49294d0332..611c35949f8 100644 --- a/sys/ddb/db_lex.h +++ b/sys/ddb/db_lex.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_lex.h,v 1.6 1994/10/09 08:30:06 mycroft Exp $ */ +/* $OpenBSD: db_lex.h,v 1.2 1996/02/20 13:35:39 mickey Exp $ */ /* * Mach Operating System @@ -36,9 +36,10 @@ int db_read_line __P((void)); void db_flush_line __P((void)); int db_read_char __P((void)); void db_unread_char __P((int)); -int db_read_token __P((void)); void db_unread_token __P((int)); +int db_read_token __P((void)); void db_flush_lex __P((void)); +int db_lex __P((void)); int db_tok_number; #define TOK_STRING_SIZE 120 diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index a7e02583cd9..0bc996c4f9e 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_output.c,v 1.9 1995/10/16 05:28:16 mycroft Exp $ */ +/* $OpenBSD: db_output.c,v 1.3 1996/02/20 13:35:39 mickey Exp $ */ /* * Mach Operating System @@ -33,6 +33,16 @@ #include <machine/stdarg.h> +#include <dev/cons.h> + +#include <machine/db_machdep.h> + +#include <ddb/db_command.h> +#include <ddb/db_output.h> +#include <ddb/db_interface.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> + /* * Character output - tracks position in line. * To do this correctly, we should know how wide @@ -64,7 +74,9 @@ int db_tab_stop_width = 8; /* how wide are tab stops? */ int db_max_line = DB_MAX_LINE; /* output max lines */ int db_max_width = DB_MAX_WIDTH; /* output line width */ -extern void db_check_interrupt(); +static void db_more __P((void)); +static char *db_ksprintn __P((u_long, int, int *)); +static void db_printf_guts __P((const char *, va_list)); /* * Force pending whitespace. @@ -124,6 +136,7 @@ db_more() /* * Output character. Buffer whitespace. */ +void db_putchar(c) int c; /* character to output */ { @@ -187,11 +200,14 @@ extern int db_radix; /*VARARGS1*/ void -#ifdef __STDC__ -db_printf(char *fmt, ...) +#if __STDC__ +db_printf(const char *fmt, ...) #else db_printf(fmt, va_alist) - char *fmt; +/*###207 [cc] warning: type of `va_alist' defaults to `int'%%%*/ + const char *fmt; +/*###208 [cc] parse error before `va_dcl'%%%*/ + va_dcl #endif { va_list listp; @@ -204,11 +220,12 @@ db_printf(fmt, va_alist) /*VARARGS1*/ void -#ifdef __STDC__ -kdbprintf(char *fmt, ...) +#if __STDC__ +kdbprintf(const char *fmt, ...) #else kdbprintf(fmt, va_alist) char *fmt; + va_dcl #endif { va_list listp; @@ -249,6 +266,7 @@ db_ksprintn(ul, base, lenp) return (p); } +static void db_printf_guts(fmt, ap) register const char *fmt; va_list ap; @@ -299,13 +317,14 @@ reswitch: switch (ch = *(u_char *)fmt++) { case 'b': ul = va_arg(ap, int); p = va_arg(ap, char *); - for (p = db_ksprintn(ul, *p++, NULL); ch = *p--;) + for (p = db_ksprintn(ul, *p++, NULL); + (ch = *p--) !='\0';) db_putchar(ch); if (!ul) break; - for (tmp = 0; n = *p++;) { + for (tmp = 0; (n = *p++) != '\0';) { if (ul & (1 << (n - 1))) { db_putchar(tmp ? ',' : '<'); for (; (n = *p) > ' '; ++p) @@ -333,7 +352,7 @@ reswitch: switch (ch = *(u_char *)fmt++) { if (!ladjust && width > 0) while (width--) db_putchar (padc); - while (ch = *p++) + while ((ch = *p++) != '\0') db_putchar(ch); if (ladjust && width > 0) while (width--) @@ -409,7 +428,7 @@ number: p = (char *)db_ksprintn(ul, base, &tmp); while (width--) db_putchar(padc); - while (ch = *p--) + while ((ch = *p--) != '\0') db_putchar(ch); break; default: diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index 7c313d6018b..3ae835735dd 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_output.h,v 1.6 1995/10/16 05:28:17 mycroft Exp $ */ +/* $OpenBSD: db_output.h,v 1.3 1996/02/20 13:35:40 mickey Exp $ */ /* * Mach Operating System @@ -33,6 +33,8 @@ * Printing routines for kernel debugger. */ void db_force_whitespace __P((void)); +void db_putchar __P((int)); int db_print_position __P((void)); -void db_end_line __P((void)); void db_printf __P((const char *, ...)); +void kdbprintf __P((const char *, ...)); +void db_end_line __P((void)); diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c index a584216c310..bb9c579d4d0 100644 --- a/sys/ddb/db_print.c +++ b/sys/ddb/db_print.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_print.c,v 1.4 1994/06/29 06:31:15 cgd Exp $ */ +/* $OpenBSD: db_print.c,v 1.2 1996/02/20 13:35:40 mickey Exp $ */ /* * Mach Operating System @@ -40,13 +40,19 @@ #include <ddb/db_lex.h> #include <ddb/db_variables.h> #include <ddb/db_sym.h> +#include <ddb/db_output.h> +#include <ddb/db_extern.h> extern unsigned int db_maxoff; +/*ARGSUSED*/ void -db_show_regs() +db_show_regs(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { - int (*func)(); register struct db_variable *regp; db_expr_t value, offset; char * name; diff --git a/sys/ddb/db_run.c b/sys/ddb/db_run.c index 102cc3a4c63..31450884afc 100644 --- a/sys/ddb/db_run.c +++ b/sys/ddb/db_run.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_run.c,v 1.7 1994/10/09 08:30:08 mycroft Exp $ */ +/* $OpenBSD: db_run.c,v 1.2 1996/02/20 13:35:41 mickey Exp $ */ /* * Mach Operating System @@ -41,6 +41,10 @@ #include <ddb/db_lex.h> #include <ddb/db_break.h> #include <ddb/db_access.h> +#include <ddb/db_watch.h> +#include <ddb/db_output.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> int db_run_mode; #define STEP_NONE 0 @@ -255,7 +259,6 @@ db_set_single_step(regs) */ inst = db_get_value(pc, sizeof(int), FALSE); if (inst_branch(inst) || inst_call(inst)) { - extern unsigned getreg_val(); brpc = branch_taken(inst, pc, getreg_val, regs); if (brpc != pc) { /* self-branches are hopeless */ diff --git a/sys/ddb/db_run.h b/sys/ddb/db_run.h index 14a4dc96dd6..8c4d8fae1e8 100644 --- a/sys/ddb/db_run.h +++ b/sys/ddb/db_run.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_run.h,v 1.2 1994/10/09 08:30:12 mycroft Exp $ */ +/* $OpenBSD: db_run.h,v 1.2 1996/02/20 13:35:42 mickey Exp $ */ /* * Mach Operating System @@ -39,13 +39,18 @@ int db_inst_count; int db_load_count; int db_store_count; +boolean_t db_stop_at_pc __P((db_regs_t *, boolean_t *)); +void db_restart_at_pc __P((db_regs_t *, boolean_t)); +void db_single_step __P((db_regs_t *)); #ifndef db_set_single_step void db_set_single_step __P((db_regs_t *)); #endif #ifndef db_clear_single_step void db_clear_single_step __P((db_regs_t *)); #endif -void db_restart_at_pc __P((db_regs_t *, boolean_t)); -boolean_t db_stop_at_pc __P((db_regs_t *, boolean_t *)); +void db_single_step_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_trace_until_call_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_trace_until_matching_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_continue_cmd __P((db_expr_t, int, db_expr_t, char *)); #endif _DDB_DB_RUN_ diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index 52f7f4622c9..ef2d473cec2 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.c,v 1.11 1995/11/24 22:13:08 cgd Exp $ */ +/* $OpenBSD: db_sym.c,v 1.4 1996/02/20 13:35:42 mickey Exp $ */ /* * Mach Operating System @@ -32,14 +32,9 @@ #include <machine/db_machdep.h> #include <ddb/db_sym.h> - -/* - * 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(); +#include <ddb/db_output.h> +#include <ddb/db_extern.h> +#include <ddb/db_command.h> /* * Multiple symbol tables @@ -56,7 +51,7 @@ db_symtab_t db_symtabs[MAXNOSYMTABS] = {{0,},}; db_symtab_t *db_last_symtab; -db_sym_t db_lookup(); /* forward */ +static char *db_qualify __P((db_sym_t, char *)); /* * Add symbol table, with given name, to list of symbol tables. @@ -75,7 +70,7 @@ db_add_symbol_table(start, end, name, ref) break; } if (slot >= MAXNOSYMTABS) { - printf ("No slots left for %s symbol table", name); + db_printf("No slots left for %s symbol table", name); return(-1); } @@ -102,7 +97,7 @@ db_del_symbol_table(name) break; } if (slot >= MAXNOSYMTABS) { - printf ("Unable to find symbol table slot for %s.", name); + db_printf("Unable to find symbol table slot for %s.", name); return; } @@ -113,7 +108,7 @@ db_del_symbol_table(name) } /* - * db_qualify("vm_map", "bsd") returns "bsd:vm_map". + * db_qualify("vm_map", "netbsd") returns "netbsd:vm_map". * * Note: return value points to static data whose content is * overwritten by each call... but in practice this seems okay. @@ -129,11 +124,11 @@ db_qualify(sym, symtabname) db_symbol_values(sym, &symname, 0); s = tmp; - while (*s++ = *symtabname++) { - } + while ((*s++ = *symtabname++) != '\0') + ; s[-1] = ':'; - while (*s++ = *symname++) { - } + while ((*s++ = *symname++) != '\0') + ; return tmp; } @@ -142,7 +137,7 @@ boolean_t db_eqname(src, dst, c) char *src; char *dst; - char c; + int c; { if (!strcmp(src, dst)) return (TRUE); @@ -324,10 +319,9 @@ db_symbol_values(sym, namep, valuep) * The variable db_lastsym is used instead of "end" in case we * add support for symbols in loadable driver modules. */ - extern char end[]; -unsigned long db_lastsym = (long)end; -db_expr_t db_maxoff = 0x10000000; +unsigned int db_lastsym = (unsigned long)end; +db_expr_t db_maxoff = 0x10000000; void diff --git a/sys/ddb/db_sym.h b/sys/ddb/db_sym.h index 2bbe44a8764..41dd4f51ba8 100644 --- a/sys/ddb/db_sym.h +++ b/sys/ddb/db_sym.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.h,v 1.6 1994/10/09 08:19:41 mycroft Exp $ */ +/* $OpenBSD: db_sym.h,v 1.2 1996/02/20 13:35:43 mickey Exp $ */ /* * Mach Operating System @@ -75,9 +75,16 @@ int db_add_symbol_table __P((char *, char *, char *, char *)); void db_del_symbol_table __P((char *)); /* remove a symbol table from list */ +boolean_t db_eqname __P((char *, char *, int)); + /* strcmp, modulo leading char */ + int db_value_of_name __P((char *, db_expr_t *)); /* find symbol value given name */ +db_sym_t db_lookup __P((char *)); + +boolean_t db_symbol_is_ambiguous __P((db_sym_t)); + db_sym_t db_search_symbol __P((db_addr_t, db_strategy_t, db_expr_t *)); /* find symbol given value */ @@ -92,8 +99,9 @@ void db_symbol_values __P((db_sym_t, char **, db_expr_t *)); db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0) /* ditto, but no locals */ -int db_eqname __P((char *, char *, char)); - /* strcmp, modulo leading char */ - void db_printsym __P((db_expr_t, db_strategy_t)); /* print closest symbol to a value */ + +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 **)); diff --git a/sys/ddb/db_trap.c b/sys/ddb/db_trap.c index 8838986d91e..7cfca6eb20f 100644 --- a/sys/ddb/db_trap.c +++ b/sys/ddb/db_trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_trap.c,v 1.8 1994/12/02 06:07:37 gwr Exp $ */ +/* $OpenBSD: db_trap.c,v 1.2 1996/02/20 13:35:44 mickey Exp $ */ /* * Mach Operating System @@ -40,7 +40,11 @@ #include <ddb/db_run.h> #include <ddb/db_command.h> #include <ddb/db_break.h> +#include <ddb/db_output.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> +void db_trap(type, code) int type, code; { diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c index 21e6bcbf812..24a077a9145 100644 --- a/sys/ddb/db_variables.c +++ b/sys/ddb/db_variables.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_variables.c,v 1.7 1994/10/09 08:56:28 mycroft Exp $ */ +/* $OpenBSD: db_variables.c,v 1.2 1996/02/20 13:35:45 mickey Exp $ */ /* * Mach Operating System @@ -33,6 +33,9 @@ #include <ddb/db_lex.h> #include <ddb/db_variables.h> +#include <ddb/db_command.h> +#include <ddb/db_sym.h> +#include <ddb/db_extern.h> extern unsigned int db_maxoff; @@ -74,6 +77,7 @@ db_find_variable(varp) } db_error("Unknown variable\n"); /*NOTREACHED*/ + return 0; } int @@ -105,11 +109,12 @@ db_set_variable(value) } +void db_read_variable(vp, valuep) struct db_variable *vp; db_expr_t *valuep; { - int (*func)() = vp->fcn; + int (*func) __P((struct db_variable *, db_expr_t *, int)) = vp->fcn; if (func == FCN_NULL) *valuep = *(vp->valuep); @@ -117,11 +122,12 @@ db_read_variable(vp, valuep) (*func)(vp, valuep, DB_VAR_GET); } +void db_write_variable(vp, valuep) struct db_variable *vp; db_expr_t *valuep; { - int (*func)() = vp->fcn; + int (*func) __P((struct db_variable *, db_expr_t *, int)) = vp->fcn; if (func == FCN_NULL) *(vp->valuep) = *valuep; @@ -129,11 +135,15 @@ db_write_variable(vp, valuep) (*func)(vp, valuep, DB_VAR_SET); } +/*ARGSUSED*/ void -db_set_cmd() +db_set_cmd(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { db_expr_t value; - int (*func)(); struct db_variable *vp; int t; diff --git a/sys/ddb/db_variables.h b/sys/ddb/db_variables.h index 8bdb6dea5d4..984882ed836 100644 --- a/sys/ddb/db_variables.h +++ b/sys/ddb/db_variables.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_variables.h,v 1.4 1994/06/29 06:31:24 cgd Exp $ */ +/* $OpenBSD: db_variables.h,v 1.2 1996/02/20 13:35:46 mickey Exp $ */ /* * Mach Operating System @@ -39,15 +39,22 @@ 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 */); + int (*fcn) __P((struct db_variable *, db_expr_t *, int)); #define DB_VAR_GET 0 #define DB_VAR_SET 1 }; -#define FCN_NULL ((int (*)())0) +#define FCN_NULL ((int (*) __P((struct db_variable *, db_expr_t *, int)))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; +int db_find_variable __P((struct db_variable **)); +int db_get_variable __P((db_expr_t *)); +int db_set_variable __P((db_expr_t)); +void db_read_variable __P((struct db_variable *, db_expr_t *)); +void db_write_variable __P((struct db_variable *, db_expr_t *)); +void db_set_cmd __P((db_expr_t, int, db_expr_t, char *)); + #endif /* _DB_VARIABLES_H_ */ diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c index ff3a5bbe32c..d7e5fd76a14 100644 --- a/sys/ddb/db_watch.c +++ b/sys/ddb/db_watch.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_watch.c,v 1.7 1994/10/09 08:30:15 mycroft Exp $ */ +/* $OpenBSD: db_watch.c,v 1.2 1996/02/20 13:35:46 mickey Exp $ */ /* * Mach Operating System @@ -38,7 +38,11 @@ #include <ddb/db_watch.h> #include <ddb/db_lex.h> #include <ddb/db_access.h> +#include <ddb/db_run.h> #include <ddb/db_sym.h> +#include <ddb/db_output.h> +#include <ddb/db_command.h> +#include <ddb/db_extern.h> /* * Watchpoints. @@ -198,8 +202,13 @@ db_watchpoint_cmd(addr, have_addr, count, modif) } /* list watchpoints */ +/*ARGSUSED*/ void -db_listwatch_cmd() +db_listwatch_cmd(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char * modif; { db_list_watchpoints(); } diff --git a/sys/ddb/db_watch.h b/sys/ddb/db_watch.h index 9a3a8817600..088ea2f5215 100644 --- a/sys/ddb/db_watch.h +++ b/sys/ddb/db_watch.h @@ -1,4 +1,4 @@ -/* $NetBSD: db_watch.h,v 1.8 1994/10/09 08:41:20 mycroft Exp $ */ +/* $OpenBSD: db_watch.h,v 1.2 1996/02/20 13:35:47 mickey Exp $ */ /* * Mach Operating System @@ -42,12 +42,16 @@ typedef struct db_watchpoint { struct db_watchpoint *link; /* link in in-use or free chain */ } *db_watchpoint_t; -boolean_t db_find_watchpoint __P((vm_map_t, db_addr_t, db_regs_t *)); -void db_set_watchpoints __P((void)); -void db_clear_watchpoints __P((void)); - +db_watchpoint_t db_watchpoint_alloc __P((void)); +void db_watchpoint_free __P((db_watchpoint_t)); void db_set_watchpoint __P((vm_map_t, db_addr_t, vm_size_t)); void db_delete_watchpoint __P((vm_map_t, db_addr_t)); void db_list_watchpoints __P((void)); +void db_deletewatch_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_watchpoint_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_listwatch_cmd __P((db_expr_t, int, db_expr_t, char *)); +void db_set_watchpoints __P((void)); +void db_clear_watchpoints __P((void)); +boolean_t db_find_watchpoint __P((vm_map_t, db_addr_t, db_regs_t *)); #endif _DDB_DB_WATCH_ diff --git a/sys/ddb/db_write_cmd.c b/sys/ddb/db_write_cmd.c index 8c324a33c98..ed103f3006a 100644 --- a/sys/ddb/db_write_cmd.c +++ b/sys/ddb/db_write_cmd.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_write_cmd.c,v 1.5 1994/10/09 08:56:30 mycroft Exp $ */ +/* $OpenBSD: db_write_cmd.c,v 1.2 1996/02/20 13:35:48 mickey Exp $ */ /* * Mach Operating System @@ -38,6 +38,8 @@ #include <ddb/db_access.h> #include <ddb/db_command.h> #include <ddb/db_sym.h> +#include <ddb/db_extern.h> +#include <ddb/db_output.h> /* * Write to file. @@ -72,6 +74,7 @@ db_write_cmd(address, have_addr, count, modif) size = 4; break; default: + size = -1; db_error("Unknown size\n"); /*NOTREACHED*/ } |