diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
| commit | a16f65c7d117419bd266c28a1901ef129a337569 (patch) | |
| tree | 2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /sys/ddb | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Diffstat (limited to 'sys/ddb')
| -rw-r--r-- | sys/ddb/db_access.c | 13 | ||||
| -rw-r--r-- | sys/ddb/db_access.h | 6 | ||||
| -rw-r--r-- | sys/ddb/db_aout.c | 125 | ||||
| -rw-r--r-- | sys/ddb/db_break.c | 7 | ||||
| -rw-r--r-- | sys/ddb/db_command.c | 12 | ||||
| -rw-r--r-- | sys/ddb/db_command.h | 6 | ||||
| -rw-r--r-- | sys/ddb/db_examine.c | 35 | ||||
| -rw-r--r-- | sys/ddb/db_expr.c | 5 | ||||
| -rw-r--r-- | sys/ddb/db_input.c | 12 | ||||
| -rw-r--r-- | sys/ddb/db_lex.c | 8 | ||||
| -rw-r--r-- | sys/ddb/db_lex.h | 6 | ||||
| -rw-r--r-- | sys/ddb/db_output.c | 18 | ||||
| -rw-r--r-- | sys/ddb/db_output.h | 7 | ||||
| -rw-r--r-- | sys/ddb/db_print.c | 7 | ||||
| -rw-r--r-- | sys/ddb/db_run.c | 5 | ||||
| -rw-r--r-- | sys/ddb/db_sym.c | 21 | ||||
| -rw-r--r-- | sys/ddb/db_sym.h | 6 | ||||
| -rw-r--r-- | sys/ddb/db_trap.c | 5 | ||||
| -rw-r--r-- | sys/ddb/db_variables.c | 16 | ||||
| -rw-r--r-- | sys/ddb/db_variables.h | 4 | ||||
| -rw-r--r-- | sys/ddb/db_watch.c | 8 | ||||
| -rw-r--r-- | sys/ddb/db_write_cmd.c | 5 | ||||
| -rw-r--r-- | sys/ddb/ddb.h | 109 |
23 files changed, 363 insertions, 83 deletions
diff --git a/sys/ddb/db_access.c b/sys/ddb/db_access.c index 85af9ef6d819..4bd89fd0c90f 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.2 1993/10/16 16:47:04 rgrimes Exp $ + * $Id: db_access.c,v 1.4 1993/12/19 00:49:42 wollman Exp $ */ /* @@ -31,8 +31,9 @@ * Date: 7/90 */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> /* type definitions */ +#include "ddb/ddb.h" /* * Access unaligned data items on aligned (longword) @@ -42,11 +43,11 @@ extern void db_read_bytes(); /* machine-dependent */ extern void db_write_bytes(); /* machine-dependent */ -int db_extend[] = { /* table for sign-extending */ +unsigned db_extend[] = { /* table for sign-extending */ 0, - 0xFFFFFF80, - 0xFFFF8000, - 0xFF800000 + 0xFFFFFF80U, + 0xFFFF8000U, + 0xFF800000U }; db_expr_t diff --git a/sys/ddb/db_access.h b/sys/ddb/db_access.h index d8a237c4b0db..291e571301e0 100644 --- a/sys/ddb/db_access.h +++ b/sys/ddb/db_access.h @@ -23,9 +23,12 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_access.h,v 1.2 1993/10/16 16:47:05 rgrimes Exp $ + * $Id: db_access.h,v 1.3 1993/11/07 17:39:20 wollman Exp $ */ +#ifndef _DDB_DB_ACCESS_H_ +#define _DDB_DB_ACCESS_H_ 1 + /* * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 @@ -41,3 +44,4 @@ extern db_expr_t db_get_value(/* db_addr_t addr, extern void db_put_value(/* db_addr_t addr, int size, db_expr_t value */); +#endif /* _DDB_DB_ACCESS_H_ */ diff --git a/sys/ddb/db_aout.c b/sys/ddb/db_aout.c index b7ff5da6f4cd..f3db425ab031 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.3 1993/10/16 16:47:06 rgrimes Exp $ + * $Id: db_aout.c,v 1.6 1994/01/14 16:23:00 davidg Exp $ */ /* @@ -35,14 +35,16 @@ */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> /* data types */ +#include "ddb/ddb.h" #include <ddb/db_sym.h> #ifndef DB_NO_AOUT #define _AOUT_INCLUDE_ #include "nlist.h" +#include "stab.h" /* * An a.out symbol table as loaded into the kernel debugger: @@ -66,12 +68,13 @@ ep = (struct nlist *)((char *)sp + *(symtab))) #ifndef SYMTAB_SPACE -#define SYMTAB_SPACE 63000 +#define SYMTAB_SPACE 73000 #endif /*SYMTAB_SPACE*/ int db_symtabsize = SYMTAB_SPACE; char db_symtab[SYMTAB_SPACE] = { 1 }; +void X_db_sym_init(symtab, esymtab, name) int * symtab; /* pointer to start of symbol table */ char * esymtab; /* pointer to end of string table, @@ -163,13 +166,17 @@ X_db_search_symbol(symtab, off, strategy, diffp) for (; sp < ep; sp++) { if (sp->n_un.n_name == 0) continue; - if ((sp->n_type & N_STAB) != 0) + if ((sp->n_type & N_STAB) != 0 || (sp->n_type & N_TYPE) == N_FN) continue; if (off >= sp->n_value) { if (off - sp->n_value < diff) { diff = off - sp->n_value; symp = sp; - if (diff == 0) + if (diff == 0 && + (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) { @@ -208,27 +215,127 @@ X_db_symbol_values(sym, namep, valuep) *valuep = sp->n_value; } + boolean_t -X_db_line_at_pc() +X_db_line_at_pc(symtab, cursym, filename, linenum, off) + db_symtab_t * symtab; + db_sym_t cursym; + char **filename; + int *linenum; + 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; + + sp = (struct nlist *)symtab->start; + ep = (struct nlist *)symtab->end; + +/* XXX - gcc specific */ +#define NEWSRC(str) ((str) != NULL && \ + (str)[0] == 'g' && strcmp((str), "gcc_compiled.") == 0) + + for (; sp < ep; sp++) { + + /* + * Prevent bogus linenumbers in case module not compiled + * with debugging options + */ +#if 0 + if (sp->n_value <= off && (off - sp->n_value) <= sodiff && + NEWSRC(sp->n_un.n_name)) { +#endif + if ((sp->n_type & N_TYPE) == N_FN || NEWSRC(sp->n_un.n_name)) { + sodiff = lndiff = -1UL; + ln = 0; + fname = NULL; + } + + if (sp->n_type == N_SO) { + if (sp->n_value <= off && (off - sp->n_value) < sodiff) { + sodiff = off - sp->n_value; + fname = sp->n_un.n_name; + } + continue; + } + + if (sp->n_type != N_SLINE) + continue; + + if (sp->n_value > off) + break; + + if (off - sp->n_value < lndiff) { + lndiff = off - sp->n_value; + ln = sp->n_desc; + } + } + + if (fname != NULL && ln != 0) { + *filename = fname; + *linenum = ln; + return TRUE; + } + return (FALSE); } +boolean_t +X_db_sym_numargs(symtab, cursym, nargp, argnamep) + db_symtab_t * symtab; + db_sym_t cursym; + int *nargp; + char **argnamep; +{ + register struct nlist *sp, *ep; + u_long addr; + int maxnarg = *nargp, nargs = 0; + + if (cursym == NULL) + return FALSE; + + addr = ((struct nlist *)cursym)->n_value; + sp = (struct nlist *)symtab->start; + ep = (struct nlist *)symtab->end; + + for (; sp < ep; sp++) { + if (sp->n_type == N_FUN && sp->n_value == addr) { + while (++sp < ep && sp->n_type == N_PSYM) { + if (nargs >= maxnarg) + break; + nargs++; + *argnamep++ = sp->n_un.n_name?sp->n_un.n_name:"???"; + { + /* XXX - remove trailers */ + char *cp = *(argnamep-1); + while (*cp != '\0' && *cp != ':') cp++; + if (*cp == ':') *cp = '\0'; + } + } + *nargp = nargs; + return TRUE; + } + } + return FALSE; +} + /* * Initialization routine for a.out files. */ -kdb_init() +void +kdb_init(void) { #if 0 extern char *esym; extern int end; if (esym > (char *)&end) { - X_db_sym_init((int *)&end, esym, "mach"); + X_db_sym_init((int *)&end, esym, "386bsd"); } #endif - X_db_sym_init (db_symtab, 0, "mach"); + X_db_sym_init (db_symtab, 0, "386bsd"); } #if 0 diff --git a/sys/ddb/db_break.c b/sys/ddb/db_break.c index a321867267c5..7b5660958ac3 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.2 1993/10/16 16:47:07 rgrimes Exp $ + * $Id: db_break.c,v 1.3 1993/11/25 01:30:03 wollman Exp $ */ /* @@ -34,8 +34,9 @@ * Breakpoints. */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> /* type definitions */ +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_break.h> @@ -291,7 +292,7 @@ db_breakpoint_cmd(addr, have_addr, count, modif) /* list breakpoints */ void -db_listbreak_cmd() +db_listbreak_cmd(db_expr_t dummy1, int 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 7c422e641731..588e069dbbc8 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.2 1993/10/16 16:47:10 rgrimes Exp $ + * $Id: db_command.c,v 1.4 1994/02/11 21:14:52 guido Exp $ */ /* @@ -35,8 +35,9 @@ * Command dispatcher. */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> /* type definitions */ +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_output.h> @@ -168,7 +169,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(); @@ -306,13 +307,15 @@ extern void db_listbreak_cmd(); extern void db_listwatch_cmd(); extern void db_show_regs(), db_show_one_thread(), db_show_all_threads(); extern void vm_map_print(), vm_object_print(), vm_page_print(); +extern void db_ps(); extern void ipc_port_print(); void db_show_help(); struct command db_show_all_cmds[] = { #if 0 - { "threads", db_show_all_threads,0, 0 }, + { "threads", db_show_all_threads, 0, 0 }, #endif + { "procs", db_ps, 0, 0 }, { (char *)0 } }; @@ -369,6 +372,7 @@ struct command db_command_table[] = { { "trace", db_stack_trace_cmd, 0, 0 }, { "call", db_fncall, CS_OWN, 0 }, { "show", 0, 0, db_show_cmds }, + { "ps", db_ps, 0, 0 }, { (char *)0, } }; diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h index b0bd66631d00..cd86e34c6d69 100644 --- a/sys/ddb/db_command.h +++ b/sys/ddb/db_command.h @@ -23,9 +23,12 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_command.h,v 1.2 1993/10/16 16:47:12 rgrimes Exp $ + * $Id: db_command.h,v 1.3 1993/11/07 17:39:22 wollman Exp $ */ +#ifndef _DDB_DB_COMMAND_H_ +#define _DDB_DB_COMMAND_H_ 1 + /* * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 @@ -51,3 +54,4 @@ extern db_addr_t db_next; /* next address to be examined or written */ +#endif /* _DDB_DB_COMMAND_H_ */ diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c index 79bb1662bbe6..5073e9dfd76d 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.2 1993/10/16 16:47:13 rgrimes Exp $ + * $Id: db_examine.c,v 1.4 1993/12/19 00:49:43 wollman Exp $ */ /* @@ -31,19 +31,25 @@ * Date: 7/90 */ #include "param.h" +#include "systm.h" #include "proc.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_sym.h> +#include "ddb/ddb.h" + +#include "ddb/db_lex.h" +#include "ddb/db_output.h" +#include "ddb/db_command.h" +#include "ddb/db_sym.h" +#include "ddb/db_access.h" char db_examine_format[TOK_STRING_SIZE] = "x"; extern db_addr_t db_disasm(/* db_addr_t, boolean_t */); /* instruction disassembler */ +static void db_examine(db_addr_t, char *, int); +static void db_search(db_addr_t, int, db_expr_t, db_expr_t, u_int); + /* * Examine (print) data. */ @@ -64,6 +70,7 @@ db_examine_cmd(addr, have_addr, count, modif) db_examine((db_addr_t) addr, db_examine_format, count); } +static void db_examine(addr, fmt, count) register db_addr_t addr; @@ -237,6 +244,7 @@ db_print_cmd(addr, have_addr, count, modif) db_printf("\n"); } +void db_print_loc_and_inst(loc) db_addr_t loc; { @@ -245,20 +253,12 @@ db_print_loc_and_inst(loc) (void) db_disasm(loc, TRUE); } -db_strcpy(dst, src) - register char *dst; - register char *src; -{ - while (*dst++ = *src++) - ; -} - /* * Search for a value in memory. * Syntax: search [/bhl] addr value [mask] [,count] */ void -db_search_cmd() +db_search_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) { int t; db_addr_t addr; @@ -290,7 +290,7 @@ db_search_cmd() size = 4; } - if (!db_expression(&addr)) { + if (!db_expression((db_expr_t *)&addr)) { db_printf("Address missing\n"); db_flush_lex(); return; @@ -303,7 +303,7 @@ db_search_cmd() } if (!db_expression(&mask)) - mask = 0xffffffff; + mask = 0xffffffffUL; t = db_read_token(); if (t == tCOMMA) { @@ -321,6 +321,7 @@ db_search_cmd() db_search(addr, size, value, mask, count); } +static 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 382af7da9bbf..610d3f6a2f37 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.2 1993/10/16 16:47:14 rgrimes Exp $ + * $Id: db_expr.c,v 1.3 1993/11/25 01:30:06 wollman Exp $ */ /* @@ -31,8 +31,9 @@ * Date: 7/90 */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_access.h> #include <ddb/db_command.h> diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index 718c08dbc35d..4d557becbf8c 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.2 1993/10/16 16:47:16 rgrimes Exp $ + * $Id: db_input.c,v 1.4 1993/12/19 00:49:44 wollman Exp $ */ /* @@ -32,8 +32,11 @@ */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <ddb/db_output.h> +#include "ddb/ddb.h" +#include "ddb/db_output.h" +#include "machine/cons.h" /* * Character input and editing. @@ -239,12 +242,15 @@ db_check_interrupt() } } -cnmaygetc () +int +cnmaygetc (void) { return (-1); } /* called from kdb_trap in db_interface.c */ +void cnpollc (flag) + int flag; { } diff --git a/sys/ddb/db_lex.c b/sys/ddb/db_lex.c index 8db18d2e59ce..6455927d5bf1 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.2 1993/10/16 16:47:17 rgrimes Exp $ + * $Id: db_lex.c,v 1.3 1993/11/25 01:30:07 wollman Exp $ */ /* @@ -33,6 +33,9 @@ /* * Lexical analyzer. */ +#include "param.h" +#include "systm.h" +#include "ddb/ddb.h" #include <ddb/db_lex.h> char db_line[120]; @@ -78,6 +81,7 @@ db_read_char() void db_unread_char(c) + int c; { db_look_char = c; } @@ -132,7 +136,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 b6e1be9e42ee..76027ccc246c 100644 --- a/sys/ddb/db_lex.h +++ b/sys/ddb/db_lex.h @@ -23,9 +23,12 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_lex.h,v 1.2 1993/10/16 16:47:19 rgrimes Exp $ + * $Id: db_lex.h,v 1.3 1993/11/07 17:39:23 wollman Exp $ */ +#ifndef _DDB_DB_LEX_H_ +#define _DDB_DB_LEX_H_ 1 + /* * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 @@ -71,3 +74,4 @@ extern int db_radix; +#endif /* _DDB_DB_LEX_H_ */ diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index 3e509e66dfc4..d0b041294ad4 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.4 1993/10/16 16:47:20 rgrimes Exp $ + * $Id: db_output.c,v 1.6 1993/12/19 00:49:45 wollman Exp $ */ /* @@ -37,7 +37,9 @@ #include "param.h" #include "systm.h" -#include <machine/stdarg.h> +#include "machine/stdarg.h" +#include "ddb/ddb.h" +#include "machine/cons.h" /* * Character output - tracks position in line. @@ -58,7 +60,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 */ -extern void db_check_interrupt(); + +static void db_printf_guts(const char *, va_list); /* * Force pending whitespace. @@ -88,6 +91,7 @@ db_force_whitespace() /* * Output character. Buffer whitespace. */ +void db_putchar(c) int c; /* character to output */ { @@ -136,10 +140,8 @@ db_print_position() /* * Printing */ -extern int db_radix; - -/*VARARGS1*/ -db_printf(char *fmt, ...) +void +db_printf(const char *fmt, ...) { va_list listp; va_start(listp, fmt); @@ -150,6 +152,7 @@ db_printf(char *fmt, ...) /* alternate name */ /*VARARGS1*/ +void kdbprintf(char *fmt, ...) { va_list listp; @@ -190,6 +193,7 @@ db_ksprintn(ul, base, lenp) return (p); } +static void db_printf_guts(fmt, ap) register const char *fmt; va_list ap; diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h index e53b603568dd..2b68c5e142d9 100644 --- a/sys/ddb/db_output.h +++ b/sys/ddb/db_output.h @@ -23,9 +23,12 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_output.h,v 1.2 1993/10/16 16:47:21 rgrimes Exp $ + * $Id: db_output.h,v 1.4 1993/11/25 01:30:09 wollman Exp $ */ +#ifndef _DDB_DB_OUTPUT_H_ +#define _DDB_DB_OUTPUT_H_ 1 + /* * Author: David B. Golub, Carnegie Mellon University * Date: 8/90 @@ -38,4 +41,4 @@ extern void db_force_whitespace(); extern int db_print_position(); extern void db_end_line(); -extern int db_printf(); +#endif /* _DDB_DB_OUTPUT_H_ */ diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c index 6b8a82abfbce..de2c6dc0af64 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.2 1993/10/16 16:47:22 rgrimes Exp $ + * $Id: db_print.c,v 1.3 1993/11/25 01:30:09 wollman Exp $ */ /* @@ -35,9 +35,10 @@ * Miscellaneous printing. */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_variables.h> @@ -46,7 +47,7 @@ extern unsigned int db_maxoff; void -db_show_regs() +db_show_regs(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) { int (*func)(); register struct db_variable *regp; diff --git a/sys/ddb/db_run.c b/sys/ddb/db_run.c index f8f805e85392..3a31d5b544f2 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.2 1993/10/16 16:47:24 rgrimes Exp $ + * $Id: db_run.c,v 1.3 1993/11/25 01:30:10 wollman Exp $ */ /* @@ -35,8 +35,9 @@ * Commands to run process. */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_break.h> diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index 1b3ef9cc1fda..4f3fa7d7711b 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.2 1993/10/16 16:47:25 rgrimes Exp $ + * $Id: db_sym.c,v 1.4 1994/01/03 07:54:10 davidg Exp $ */ /* @@ -31,8 +31,9 @@ * Date: 7/90 */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <ddb/db_sym.h> /* @@ -46,7 +47,9 @@ extern void X_db_symbol_values(); /* * Multiple symbol tables */ +#ifndef MAXNOSYMTABS #define MAXNOSYMTABS 3 /* mach, ux, emulator */ +#endif db_symtab_t db_symtabs[MAXNOSYMTABS] = {{0,},}; int db_nsymtab = 0; @@ -310,9 +313,21 @@ db_printsym(off, strategy) } } - boolean_t db_line_at_pc( sym, filename, linenum, pc) + int sym; + int filename; + int linenum; + int pc; { return X_db_line_at_pc( db_last_symtab, sym, filename, linenum, pc); } + +int +db_sym_numargs(sym, nargp, argnames) + db_sym_t sym; + int *nargp; + char **argnames; +{ + return X_db_sym_numargs(db_last_symtab, sym, nargp, argnames); +} diff --git a/sys/ddb/db_sym.h b/sys/ddb/db_sym.h index dca4ef217571..13560b5d34f4 100644 --- a/sys/ddb/db_sym.h +++ b/sys/ddb/db_sym.h @@ -23,9 +23,12 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_sym.h,v 1.2 1993/10/16 16:47:27 rgrimes Exp $ + * $Id: db_sym.h,v 1.3 1993/11/07 17:39:25 wollman Exp $ */ +#ifndef _DDB_DB_SYM_H_ +#define _DDB_DB_SYM_H_ 1 + /* * Author: Alessandro Forin, Carnegie Mellon University * Date: 8/90 @@ -96,3 +99,4 @@ extern int db_eqname(/* char*, char*, char */); extern void db_printsym(/* db_expr_t, db_strategy_t */); /* print closest symbol to a value */ +#endif /* _DDB_DB_SYM_H_ */ diff --git a/sys/ddb/db_trap.c b/sys/ddb/db_trap.c index aa62d49a572e..1229eaed4432 100644 --- a/sys/ddb/db_trap.c +++ b/sys/ddb/db_trap.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_trap.c,v 1.2 1993/10/16 16:47:28 rgrimes Exp $ + * $Id: db_trap.c,v 1.3 1993/11/25 01:30:12 wollman Exp $ */ /* @@ -35,7 +35,9 @@ * Trap entry point to kernel debugger. */ #include "param.h" +#include "systm.h" #include "proc.h" +#include "ddb/ddb.h" #include <ddb/db_command.h> #include <ddb/db_break.h> @@ -46,6 +48,7 @@ extern int db_inst_count; extern int db_load_count; extern int db_store_count; +void db_trap(type, code) int type, code; { diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c index 39c2e8ca3fca..92cbcc1b7250 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.2 1993/10/16 16:47:29 rgrimes Exp $ + * $Id: db_variables.c,v 1.3 1993/11/25 01:30:13 wollman Exp $ */ /* @@ -32,17 +32,15 @@ */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_variables.h> -extern unsigned int db_maxoff; - -extern int db_radix; -extern int db_max_width; -extern int db_tab_stop_width; +void db_read_variable(struct db_variable *, db_expr_t *); +static void db_write_variable(struct db_variable *, db_expr_t *); struct db_variable db_vars[] = { { "radix", &db_radix, FCN_NULL }, @@ -107,6 +105,7 @@ db_set_variable(value) } +void db_read_variable(vp, valuep) struct db_variable *vp; db_expr_t *valuep; @@ -119,6 +118,7 @@ db_read_variable(vp, valuep) (*func)(vp, valuep, DB_VAR_GET); } +static void db_write_variable(vp, valuep) struct db_variable *vp; db_expr_t *valuep; @@ -132,7 +132,7 @@ db_write_variable(vp, valuep) } void -db_set_cmd() +db_set_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummy4) { db_expr_t value; int (*func)(); diff --git a/sys/ddb/db_variables.h b/sys/ddb/db_variables.h index ff8dbc4ca7d3..80b24e4b0293 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.2 1993/10/16 16:47:31 rgrimes Exp $ + * $Id: db_variables.h,v 1.3 1993/11/25 01:30:14 wollman Exp $ */ /* @@ -52,4 +52,6 @@ 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 *); + #endif /* _DB_VARIABLES_H_ */ diff --git a/sys/ddb/db_watch.c b/sys/ddb/db_watch.c index 7d3e89a257f1..16e4ab6974a0 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.2 1993/10/16 16:47:32 rgrimes Exp $ + * $Id: db_watch.c,v 1.3 1993/11/25 01:30:15 wollman Exp $ */ /* @@ -32,15 +32,15 @@ */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <vm/vm_map.h> #include <ddb/db_lex.h> #include <ddb/db_watch.h> #include <ddb/db_access.h> #include <ddb/db_sym.h> -#include <machine/db_machdep.h> /* * Watchpoints. @@ -205,7 +205,7 @@ db_watchpoint_cmd(addr, have_addr, count, modif) /* list watchpoints */ void -db_listwatch_cmd() +db_listwatch_cmd(db_expr_t dummy1, int dummy2, db_expr_t dummy3, char *dummmy4) { db_list_watchpoints(); } diff --git a/sys/ddb/db_write_cmd.c b/sys/ddb/db_write_cmd.c index 456fa7a11ebc..ad5ad5e3c9c5 100644 --- a/sys/ddb/db_write_cmd.c +++ b/sys/ddb/db_write_cmd.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_write_cmd.c,v 1.2 1993/10/16 16:47:35 rgrimes Exp $ + * $Id: db_write_cmd.c,v 1.3 1993/11/25 01:30:16 wollman Exp $ */ /* @@ -32,8 +32,9 @@ */ #include "param.h" +#include "systm.h" #include "proc.h" -#include <machine/db_machdep.h> +#include "ddb/ddb.h" #include <ddb/db_lex.h> #include <ddb/db_access.h> diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h new file mode 100644 index 000000000000..e596ce750c2c --- /dev/null +++ b/sys/ddb/ddb.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 1993, Garrett A. Wollman. + * Copyright (c) 1993, University of Vermont and State Agricultural College. + * 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. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $Id: ddb.h,v 1.1 1993/11/25 01:30:16 wollman Exp $ + */ + +/* + * Necessary declarations for the `ddb' kernel debugger. + */ + +#ifndef __h_ddb_ddb +#define __h_ddb_ddb 1 + +#include "machine/db_machdep.h" /* type definitions */ + +/* + * Global variables... + */ +extern char *esym; +extern unsigned int db_maxoff; +extern int db_inst_count; +extern int db_load_count; +extern int db_store_count; +extern int db_radix; +extern int db_max_width; +extern int db_tab_stop_width; + +/* + * Functions... + */ +extern void +db_read_bytes(vm_offset_t addr, register int size, register char *data); + /* machine-dependent */ + +extern void +db_write_bytes(vm_offset_t addr, register int size, register char *data); + /* machine-dependent */ + +struct vm_map; /* forward declaration */ + +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); + +#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 kdbprinttrap(int, int); + +#endif /* __h_ddb_ddb */ |
