Tweak the previous change to ensure symbol addresses are correctly

sign-extended on cpus with 64-bit registers.
This commit is contained in:
scw 2003-10-05 11:17:47 +00:00
parent 14658b124b
commit 5efdd1f9f3
1 changed files with 12 additions and 7 deletions

View File

@ -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 * Mach Operating System
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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" #include "opt_ddbparam.h"
@ -90,7 +90,8 @@ boolean_t
db_value_of_name(char *name, db_expr_t *valuep) db_value_of_name(char *name, db_expr_t *valuep)
{ {
char *mod, *sym; char *mod, *sym;
unsigned long val; unsigned long uval;
long val;
#ifdef DB_AOUT_SYMBOLS #ifdef DB_AOUT_SYMBOLS
db_sym_t ssym; db_sym_t ssym;
@ -108,11 +109,13 @@ db_value_of_name(char *name, db_expr_t *valuep)
} }
#endif #endif
db_symsplit(name, &mod, &sym); 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; *valuep = (db_expr_t)val;
return TRUE; 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; *valuep = (db_expr_t)val;
return TRUE; return TRUE;
} }
@ -358,7 +361,8 @@ db_printsym(db_expr_t off, db_strategy_t strategy,
{ {
char *name; char *name;
const char *mod; const char *mod;
unsigned long val; unsigned long uval;
long val;
#ifdef notyet #ifdef notyet
char *filename; char *filename;
int linenum; int linenum;
@ -401,7 +405,8 @@ db_printsym(db_expr_t off, db_strategy_t strategy,
#endif #endif
if (ksyms_getname(&mod, &name, (vaddr_t)off, if (ksyms_getname(&mod, &name, (vaddr_t)off,
strategy|KSYMS_CLOSEST) == 0) { 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) { if (((off - val) < db_maxoff) && val) {
(*pr)("%s:%s", mod, name); (*pr)("%s:%s", mod, name);
if (off - val) { if (off - val) {