Module Name: src Committed By: mrg Date: Mon Apr 11 04:22:32 UTC 2011
Modified Files: src/sys/arch/acorn26/include: db_machdep.h src/sys/arch/hp300/include: db_machdep.h src/sys/arch/i386/i386: db_machdep.c src/sys/arch/i386/include: db_machdep.h src/sys/arch/luna68k/include: db_machdep.h src/sys/arch/m68k/include: db_machdep.h src/sys/arch/mvme68k/include: db_machdep.h src/sys/arch/pmax/include: db_machdep.h src/sys/arch/sparc/include: db_machdep.h src/sys/arch/x86/x86: db_trace.c src/sys/ddb: db_sym.c db_sym.h files.ddb src/usr.sbin/crash: Makefile Removed Files: src/sys/ddb: db_aout.c db_aout.h Log Message: obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code in db_sym.[ch] as it is used by the elf version of crash(8). i will be cleaning up the db_sym.c code in a follow up commit to avoid having dead code compiled. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/acorn26/include/db_machdep.h cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hp300/include/db_machdep.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/i386/db_machdep.c cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/include/db_machdep.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/include/db_machdep.h cvs rdiff -u -r1.28 -r1.29 src/sys/arch/m68k/include/db_machdep.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mvme68k/include/db_machdep.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/pmax/include/db_machdep.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/include/db_machdep.h cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/db_trace.c cvs rdiff -u -r1.41 -r0 src/sys/ddb/db_aout.c cvs rdiff -u -r1.3 -r0 src/sys/ddb/db_aout.h cvs rdiff -u -r1.59 -r1.60 src/sys/ddb/db_sym.c cvs rdiff -u -r1.23 -r1.24 src/sys/ddb/db_sym.h cvs rdiff -u -r1.5 -r1.6 src/sys/ddb/files.ddb cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/crash/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/acorn26/include/db_machdep.h diff -u src/sys/arch/acorn26/include/db_machdep.h:1.7 src/sys/arch/acorn26/include/db_machdep.h:1.8 --- src/sys/arch/acorn26/include/db_machdep.h:1.7 Wed Jan 14 23:14:48 2009 +++ src/sys/arch/acorn26/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,9 +1,8 @@ -/* $NetBSD: db_machdep.h,v 1.7 2009/01/14 23:14:48 bjh21 Exp $ */ +/* $NetBSD: db_machdep.h,v 1.8 2011/04/11 04:22:30 mrg Exp $ */ #include <arm/db_machdep.h> /* acorn26 uses ELF */ -#undef DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/hp300/include/db_machdep.h diff -u src/sys/arch/hp300/include/db_machdep.h:1.4 src/sys/arch/hp300/include/db_machdep.h:1.5 --- src/sys/arch/hp300/include/db_machdep.h:1.4 Tue Dec 6 17:05:02 2005 +++ src/sys/arch/hp300/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,6 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.4 2005/12/06 17:05:02 tsutsui Exp $ */ +/* $NetBSD: db_machdep.h,v 1.5 2011/04/11 04:22:30 mrg Exp $ */ /* Just use the common m68k definition */ #include <m68k/db_machdep.h> - -#undef DB_AOUT_SYMBOLS Index: src/sys/arch/i386/i386/db_machdep.c diff -u src/sys/arch/i386/i386/db_machdep.c:1.1 src/sys/arch/i386/i386/db_machdep.c:1.2 --- src/sys/arch/i386/i386/db_machdep.c:1.1 Sun Apr 10 20:36:48 2011 +++ src/sys/arch/i386/i386/db_machdep.c Mon Apr 11 04:22:31 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:48 christos Exp $ */ +/* $NetBSD: db_machdep.c,v 1.2 2011/04/11 04:22:31 mrg Exp $ */ /* * Mach Operating System @@ -27,15 +27,25 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.2 2011/04/11 04:22:31 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> +#ifndef _KERNEL +#include <stdbool.h> +#endif + #include <machine/frame.h> #include <machine/trap.h> #include <machine/intrdefs.h> +#include <machine/cpu.h> + +#include <uvm/uvm_prot.h> +/* We need to include both for ddb and crash(8). */ +#include <uvm/uvm_pmap.h> +#include <machine/pmap.h> #include <machine/db_machdep.h> #include <ddb/db_sym.h> Index: src/sys/arch/i386/include/db_machdep.h diff -u src/sys/arch/i386/include/db_machdep.h:1.28 src/sys/arch/i386/include/db_machdep.h:1.29 --- src/sys/arch/i386/include/db_machdep.h:1.28 Sun Apr 10 20:36:48 2011 +++ src/sys/arch/i386/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.28 2011/04/10 20:36:48 christos Exp $ */ +/* $NetBSD: db_machdep.h,v 1.29 2011/04/11 04:22:30 mrg Exp $ */ /* * Mach Operating System @@ -139,9 +139,8 @@ #endif /* - * We use either a.out or Elf32 symbols in DDB. + * We use Elf32 symbols in DDB. */ -#define DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/luna68k/include/db_machdep.h diff -u src/sys/arch/luna68k/include/db_machdep.h:1.2 src/sys/arch/luna68k/include/db_machdep.h:1.3 --- src/sys/arch/luna68k/include/db_machdep.h:1.2 Mon Dec 24 17:57:19 2001 +++ src/sys/arch/luna68k/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,8 +1,7 @@ -/* $NetBSD: db_machdep.h,v 1.2 2001/12/24 17:57:19 chs Exp $ */ +/* $NetBSD: db_machdep.h,v 1.3 2011/04/11 04:22:30 mrg Exp $ */ /* Just use the common m68k definition */ #include <m68k/db_machdep.h> -#undef DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/m68k/include/db_machdep.h diff -u src/sys/arch/m68k/include/db_machdep.h:1.28 src/sys/arch/m68k/include/db_machdep.h:1.29 --- src/sys/arch/m68k/include/db_machdep.h:1.28 Fri Jan 14 02:06:27 2011 +++ src/sys/arch/m68k/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.28 2011/01/14 02:06:27 rmind Exp $ */ +/* $NetBSD: db_machdep.h,v 1.29 2011/04/11 04:22:30 mrg Exp $ */ /* * Mach Operating System @@ -104,9 +104,8 @@ #endif /* _KERNEL */ /* - * We use either a.out or Elf32 symbols in DDB. + * We use Elf32 symbols in DDB. */ -#define DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/mvme68k/include/db_machdep.h diff -u src/sys/arch/mvme68k/include/db_machdep.h:1.2 src/sys/arch/mvme68k/include/db_machdep.h:1.3 --- src/sys/arch/mvme68k/include/db_machdep.h:1.2 Sat Dec 2 13:57:05 2000 +++ src/sys/arch/mvme68k/include/db_machdep.h Mon Apr 11 04:22:30 2011 @@ -1,8 +1,7 @@ -/* $NetBSD: db_machdep.h,v 1.2 2000/12/02 13:57:05 scw Exp $ */ +/* $NetBSD: db_machdep.h,v 1.3 2011/04/11 04:22:30 mrg Exp $ */ /* Just use the common m68k definition */ #include <m68k/db_machdep.h> -#undef DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/pmax/include/db_machdep.h diff -u src/sys/arch/pmax/include/db_machdep.h:1.3 src/sys/arch/pmax/include/db_machdep.h:1.4 --- src/sys/arch/pmax/include/db_machdep.h:1.3 Sun Jan 9 15:34:42 2000 +++ src/sys/arch/pmax/include/db_machdep.h Mon Apr 11 04:22:31 2011 @@ -1,11 +1,10 @@ -/* $NetBSD: db_machdep.h,v 1.3 2000/01/09 15:34:42 ad Exp $ */ +/* $NetBSD: db_machdep.h,v 1.4 2011/04/11 04:22:31 mrg Exp $ */ #ifndef _PMAX_DB_MACHDEP_H_ #define _PMAX_DB_MACHDEP_H_ #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 -#define DB_AOUT_SYMBOLS #include <mips/db_machdep.h> Index: src/sys/arch/sparc/include/db_machdep.h diff -u src/sys/arch/sparc/include/db_machdep.h:1.24 src/sys/arch/sparc/include/db_machdep.h:1.25 --- src/sys/arch/sparc/include/db_machdep.h:1.24 Fri Jan 14 02:06:31 2011 +++ src/sys/arch/sparc/include/db_machdep.h Mon Apr 11 04:22:31 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.24 2011/01/14 02:06:31 rmind Exp $ */ +/* $NetBSD: db_machdep.h,v 1.25 2011/04/11 04:22:31 mrg Exp $ */ /* * Mach Operating System @@ -111,9 +111,8 @@ int kdb_trap(int, struct trapframe *); /* - * We use both a.out and elf symbols in DDB. + * We use elf symbols in DDB. */ -#define DB_AOUT_SYMBOLS #define DB_ELF_SYMBOLS #define DB_ELFSIZE 32 Index: src/sys/arch/x86/x86/db_trace.c diff -u src/sys/arch/x86/x86/db_trace.c:1.1 src/sys/arch/x86/x86/db_trace.c:1.2 --- src/sys/arch/x86/x86/db_trace.c:1.1 Sun Apr 10 20:36:49 2011 +++ src/sys/arch/x86/x86/db_trace.c Mon Apr 11 04:22:31 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.1 2011/04/10 20:36:49 christos Exp $ */ +/* $NetBSD: db_trace.c,v 1.2 2011/04/11 04:22:31 mrg Exp $ */ /* * Mach Operating System @@ -27,15 +27,19 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.1 2011/04/10 20:36:49 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.2 2011/04/11 04:22:31 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> +#include <uvm/uvm_prot.h> +#include <uvm/uvm_pmap.h> + #include <machine/frame.h> #include <machine/trap.h> #include <machine/intrdefs.h> +#include <machine/pmap.h> #include <machine/db_machdep.h> #include <ddb/db_sym.h> Index: src/sys/ddb/db_sym.c diff -u src/sys/ddb/db_sym.c:1.59 src/sys/ddb/db_sym.c:1.60 --- src/sys/ddb/db_sym.c:1.59 Sat Mar 7 22:02:17 2009 +++ src/sys/ddb/db_sym.c Mon Apr 11 04:22:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.c,v 1.59 2009/03/07 22:02:17 ad Exp $ */ +/* $NetBSD: db_sym.c,v 1.60 2011/04/11 04:22:32 mrg Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.59 2009/03/07 22:02:17 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.60 2011/04/11 04:22:32 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_ddbparam.h" @@ -43,10 +43,10 @@ static void db_symsplit(char *, char **, char **); -#ifdef DB_AOUT_SYMBOLS +#ifndef _KERNEL #define TBLNAME "netbsd" -static int using_aout_symtab; +static int use_ksyms = true; const db_symformat_t *db_symformat; static db_forall_func_t db_sift; extern db_symformat_t db_symformat_aout; @@ -63,18 +63,11 @@ ddb_init(int symsize, void *vss, void *vse) { #ifdef _KERNEL -# ifdef DB_AOUT_SYMBOLS - db_symformat = &db_symformat_aout; - if ((*db_symformat->sym_init)(symsize, vss, vse, TBLNAME) == true) { - using_aout_symtab = true; - return; - } -# endif ksyms_addsyms_elf(symsize, vss, vse); /* Will complain if necessary */ #else /* _KERNEL */ db_symformat = &db_symformat_elf; if ((*db_symformat->sym_init)(symsize, vss, vse, TBLNAME) == true) { - using_aout_symtab = true; + use_ksyms = false; return; } #endif /* _KERNEL */ @@ -101,10 +94,10 @@ long val; #endif -#ifdef DB_AOUT_SYMBOLS - db_sym_t ssym; +#ifndef _KERNEL + if (!use_ksyms) { + db_sym_t ssym; - if (using_aout_symtab) { /* * Cannot load symtabs in a.out kernels, so the ':' * style of selecting modules is irrelevant. @@ -116,6 +109,7 @@ return (true); } #endif + (void)strlcpy(symbol, name, sizeof(symbol)); db_symsplit(symbol, &mod, &sym); #ifdef _KERNEL @@ -133,7 +127,7 @@ return false; } -#ifdef DB_AOUT_SYMBOLS +#ifndef _KERNEL /* Private structure for passing args to db_sift() from db_sifting(). */ struct db_sift_args { char *symstr; @@ -193,10 +187,10 @@ char *mod, *sym; #endif -#ifdef DB_AOUT_SYMBOLS +#ifndef _KERNEL struct db_sift_args dsa; - if (using_aout_symtab) { + if (!use_ksyms) { dsa.symstr = symstr; dsa.mode = mode; (*db_symformat->sym_forall)(NULL, db_sift, &dsa); @@ -227,11 +221,11 @@ const char *sym; #endif -#ifdef DB_AOUT_SYMBOLS - db_expr_t newdiff; - db_sym_t ssym; +#ifndef _KERNEL + if (!use_ksyms) { + db_expr_t newdiff; + db_sym_t ssym; - if (using_aout_symtab) { newdiff = diff = ~0; ssym = (*db_symformat->sym_search) (NULL, val, strategy, &newdiff); @@ -271,9 +265,10 @@ return; } -#ifdef DB_AOUT_SYMBOLS - if (using_aout_symtab) { +#ifndef _KERNEL + if (!use_ksyms) { db_expr_t value; + (*db_symformat->sym_value)(NULL, sym, namep, &value); if (valuep) *valuep = value; @@ -323,8 +318,8 @@ unsigned long val; #endif -#ifdef DB_AOUT_SYMBOLS - if (using_aout_symtab) { +#ifndef _KERNEL + if (!use_ksyms) { db_expr_t d; char *filename; db_expr_t value; @@ -400,13 +395,14 @@ int linenum; #endif -#ifdef DB_AOUT_SYMBOLS - if (using_aout_symtab) { +#ifndef _KERNEL + if (!use_ksyms) { db_expr_t d; char *filename; db_expr_t value; int linenum; db_sym_t cursym; + if ((unsigned long) off <= db_lastsym) { cursym = db_search_symbol(off, strategy, &d); db_symbol_values(cursym, &name, &value); @@ -482,8 +478,8 @@ bool db_sym_numargs(db_sym_t cursym, int *nargp, char **argnamep) { -#ifdef DB_AOUT_SYMBOLS - if (using_aout_symtab) +#ifndef _KERNEL + if (!use_ksyms) return ((*db_symformat->sym_numargs)(NULL, cursym, nargp, argnamep)); #endif Index: src/sys/ddb/db_sym.h diff -u src/sys/ddb/db_sym.h:1.23 src/sys/ddb/db_sym.h:1.24 --- src/sys/ddb/db_sym.h:1.23 Thu Feb 22 04:38:06 2007 +++ src/sys/ddb/db_sym.h Mon Apr 11 04:22:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.h,v 1.23 2007/02/22 04:38:06 matt Exp $ */ +/* $NetBSD: db_sym.h,v 1.24 2011/04/11 04:22:32 mrg Exp $ */ /* * Mach Operating System @@ -38,9 +38,10 @@ #define DB_STGY_XTRN (KSYMS_EXTERN|KSYMS_CLOSEST) /* only external symbols */ #define DB_STGY_PROC (KSYMS_PROC|KSYMS_CLOSEST) /* only procedures */ -#ifdef DB_AOUT_SYMBOLS +#ifndef _KERNEL /* - * This struct is unused. + * These structures and functions are not used in the kernel, but only + * in crash(8). */ typedef struct { const char *name; /* symtab name */ @@ -80,7 +81,6 @@ void (*sym_forall)(db_symtab_t *, db_forall_func_t *db_forall_func, void *); } db_symformat_t; - #endif extern unsigned int db_maxoff; /* like gdb's "max-symbolic-offset" */ Index: src/sys/ddb/files.ddb diff -u src/sys/ddb/files.ddb:1.5 src/sys/ddb/files.ddb:1.6 --- src/sys/ddb/files.ddb:1.5 Sun Sep 27 18:24:23 2009 +++ src/sys/ddb/files.ddb Mon Apr 11 04:22:32 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.ddb,v 1.5 2009/09/27 18:24:23 bsh Exp $ +# $NetBSD: files.ddb,v 1.6 2011/04/11 04:22:32 mrg Exp $ # # DDB options @@ -9,7 +9,6 @@ DDB_COMMANDONENTER file ddb/db_access.c ddb | kgdb -file ddb/db_aout.c ddb file ddb/db_break.c ddb file ddb/db_command.c ddb file ddb/db_cpu.c ddb Index: src/usr.sbin/crash/Makefile diff -u src/usr.sbin/crash/Makefile:1.7 src/usr.sbin/crash/Makefile:1.8 --- src/usr.sbin/crash/Makefile:1.7 Sun Apr 10 20:39:42 2011 +++ src/usr.sbin/crash/Makefile Mon Apr 11 04:22:32 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.7 2011/04/10 20:39:42 christos Exp $ +# $NetBSD: Makefile,v 1.8 2011/04/11 04:22:32 mrg Exp $ PROG= crash MAN= crash.8 @@ -17,7 +17,7 @@ CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing CPPFLAGS+= -DDDB_VERBOSE_HELP -DDB_MAX_LINE=10000000 -D_KMEMUSER -CPPFLAGS+= -DDB_AOUT_SYMBOLS -UDB_MACHINE_COMMANDS +CPPFLAGS+= -UDB_MACHINE_COMMANDS # ddb files from kernel .PATH: $S/ddb