From 5efdd1f9f356bb78d35ea537bdb1bd6f877d0b9b Mon Sep 17 00:00:00 2001 From: scw Date: Sun, 5 Oct 2003 11:17:47 +0000 Subject: [PATCH] Tweak the previous change to ensure symbol addresses are correctly sign-extended on cpus with 64-bit registers. --- sys/ddb/db_sym.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index 9ac994fd3d73..f071bddd6995 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_sym.c,v 1.42 2003/09/03 10:45:10 ragge Exp $ */ +/* $NetBSD: db_sym.c,v 1.43 2003/10/05 11:17:47 scw Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.42 2003/09/03 10:45:10 ragge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.43 2003/10/05 11:17:47 scw Exp $"); #include "opt_ddbparam.h" @@ -90,7 +90,8 @@ boolean_t db_value_of_name(char *name, db_expr_t *valuep) { char *mod, *sym; - unsigned long val; + unsigned long uval; + long val; #ifdef DB_AOUT_SYMBOLS db_sym_t ssym; @@ -108,11 +109,13 @@ db_value_of_name(char *name, db_expr_t *valuep) } #endif db_symsplit(name, &mod, &sym); - if (ksyms_getval(mod, sym, &val, KSYMS_EXTERN) == 0) { + if (ksyms_getval(mod, sym, &uval, KSYMS_EXTERN) == 0) { + val = (long) uval; *valuep = (db_expr_t)val; return TRUE; } - if (ksyms_getval(mod, sym, &val, KSYMS_ANY) == 0) { + if (ksyms_getval(mod, sym, &uval, KSYMS_ANY) == 0) { + val = (long) uval; *valuep = (db_expr_t)val; return TRUE; } @@ -358,7 +361,8 @@ db_printsym(db_expr_t off, db_strategy_t strategy, { char *name; const char *mod; - unsigned long val; + unsigned long uval; + long val; #ifdef notyet char *filename; int linenum; @@ -401,7 +405,8 @@ db_printsym(db_expr_t off, db_strategy_t strategy, #endif if (ksyms_getname(&mod, &name, (vaddr_t)off, strategy|KSYMS_CLOSEST) == 0) { - (void)ksyms_getval(mod, name, &val, KSYMS_ANY); + (void)ksyms_getval(mod, name, &uval, KSYMS_ANY); + val = (long) uval; if (((off - val) < db_maxoff) && val) { (*pr)("%s:%s", mod, name); if (off - val) {