Avoid printing values as "end+0x...."

This commit is contained in:
gwr 1995-05-24 20:21:00 +00:00
parent 2b3cba51fb
commit e7f3fdcd35

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_sym.c,v 1.8 1994/10/09 08:56:27 mycroft Exp $ */
/* $NetBSD: db_sym.c,v 1.9 1995/05/24 20:21:00 gwr Exp $ */
/*
* Mach Operating System
@ -320,10 +320,16 @@ db_symbol_values(sym, namep, valuep)
* 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 int db_lastsym = (int)end;
unsigned int db_maxoff = 0x10000000;
void
db_printsym(off, strategy)
db_expr_t off;
@ -336,19 +342,22 @@ db_printsym(off, strategy)
int linenum;
db_sym_t cursym;
cursym = db_search_symbol(off, strategy, &d);
db_symbol_values(cursym, &name, &value);
if (name == 0 || d >= db_maxoff || value == 0) {
db_printf("%#n", off);
return;
}
db_printf("%s", name);
if (d)
db_printf("+%#r", d);
if (strategy == DB_STGY_PROC) {
if (db_line_at_pc(cursym, &filename, &linenum, off))
db_printf(" [%s:%d]", filename, linenum);
if (off <= db_lastsym) {
cursym = db_search_symbol(off, strategy, &d);
db_symbol_values(cursym, &name, &value);
if (name && (d < db_maxoff) && value) {
db_printf("%s", name);
if (d)
db_printf("+%#r", d);
if (strategy == DB_STGY_PROC) {
if (db_line_at_pc(cursym, &filename, &linenum, off))
db_printf(" [%s:%d]", filename, linenum);
}
return;
}
}
db_printf("%#n", off);
return;
}