Module Name: src Committed By: christos Date: Thu Feb 9 00:21:23 UTC 2012
Modified Files: src/sys/ddb: db_sym.c Log Message: Remove bogus code in the non kernel case involving end[]. In this case end[] is the end of the crash program symbols, so using that as the end of the kernel symbol table is just wrong. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/ddb/db_sym.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ddb/db_sym.c diff -u src/sys/ddb/db_sym.c:1.61 src/sys/ddb/db_sym.c:1.62 --- src/sys/ddb/db_sym.c:1.61 Mon Apr 11 00:26:18 2011 +++ src/sys/ddb/db_sym.c Wed Feb 8 19:21:23 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.c,v 1.61 2011/04/11 04:26:18 mrg Exp $ */ +/* $NetBSD: db_sym.c,v 1.62 2012/02/09 00:21:23 christos Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.61 2011/04/11 04:26:18 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.62 2012/02/09 00:21:23 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ddbparam.h" @@ -300,12 +300,7 @@ db_symbol_values(db_sym_t sym, const cha * bogus symbol associations, e.g. 3 might get some absolute * value like _INCLUDE_VERSION or something, therefore we do * not accept symbols whose value is zero (and use plain hex). - * Also, avoid printing as "end+0x????" which is useless. - * 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 = (unsigned long)end; unsigned int db_maxoff = 0x100000; void @@ -325,29 +320,27 @@ db_symstr(char *buf, size_t buflen, db_e 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); - if (name != NULL && - ((unsigned int) d < db_maxoff) && - value != 0) { - strlcpy(buf, name, buflen); - if (d) { - strlcat(buf, "+", buflen); - db_format_radix(buf+strlen(buf), - 24, d, true); - } - if (strategy == DB_STGY_PROC) { - if ((*db_symformat->sym_line_at_pc) - (NULL, cursym, &filename, - &linenum, off)) - snprintf(buf + strlen(buf), - buflen - strlen(buf), - " [%s:%d]", - filename, linenum); - } - return; + cursym = db_search_symbol(off, strategy, &d); + db_symbol_values(cursym, &name, &value); + if (name != NULL && + ((unsigned int) d < db_maxoff) && + value != 0) { + strlcpy(buf, name, buflen); + if (d) { + strlcat(buf, "+", buflen); + db_format_radix(buf+strlen(buf), + 24, d, true); + } + if (strategy == DB_STGY_PROC) { + if ((*db_symformat->sym_line_at_pc) + (NULL, cursym, &filename, + &linenum, off)) + snprintf(buf + strlen(buf), + buflen - strlen(buf), + " [%s:%d]", + filename, linenum); } + return; } strlcpy(buf, db_num_to_str(off), buflen); return; @@ -402,28 +395,26 @@ db_printsym(db_expr_t off, db_strategy_t 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); - if (name != NULL && - ((unsigned int) d < db_maxoff) && - value != 0) { - (*pr)("%s", name); - if (d) { - char tbuf[24]; - - db_format_radix(tbuf, 24, d, true); - (*pr)("+%s", tbuf); - } - if (strategy == DB_STGY_PROC) { - if ((*db_symformat->sym_line_at_pc) - (NULL, cursym, &filename, - &linenum, off)) - (*pr)(" [%s:%d]", - filename, linenum); - } - return; + cursym = db_search_symbol(off, strategy, &d); + db_symbol_values(cursym, &name, &value); + if (name != NULL && + ((unsigned int) d < db_maxoff) && + value != 0) { + (*pr)("%s", name); + if (d) { + char tbuf[24]; + + db_format_radix(tbuf, 24, d, true); + (*pr)("+%s", tbuf); } + if (strategy == DB_STGY_PROC) { + if ((*db_symformat->sym_line_at_pc) + (NULL, cursym, &filename, + &linenum, off)) + (*pr)(" [%s:%d]", + filename, linenum); + } + return; } (*pr)(db_num_to_str(off)); return;