static char sccsid
[] = "@(#)sym.c 4.1 %G%";
* adb - symbol table routines
* Lookup a symbol by name.
register struct nlist
*sp
;
for (sp
= symtab
; sp
< esymtab
; sp
++)
/* SHOULD DO SOME OF EQSYM INLINE TO SAVE TIME */
if ((sp
->n_type
&N_STAB
)==0 && eqsym(sp
->n_un
.n_name
, symstr
, '_'))
* Find the closest symbol to val, and return
* the difference between val and the symbol found.
* Leave a pointer to the symbol found as cursym.
register struct nlist
*sp
;
if (type
== NSYM
|| symtab
== 0)
for (sp
= symtab
; sp
< esymtab
; sp
++) {
if (sp
->n_type
&N_STAB
|| (sp
->n_type
&N_EXT
)==0)
if (val
- sp
->n_value
< diff
&& val
>= sp
->n_value
) {
diff
= val
- sp
->n_value
;
* Advance cursym to the next local variable.
* Leave its value in localval as a side effect.
* Return 0 at end of file.
register struct nlist
*sp
;
for (sp
= cursym
; ++sp
< esymtab
; ) {
if (sp
->n_un
.n_name
[0] =='_' || sp
->n_type
== N_FN
)
localval
= cframe
- sp
->n_value
;
/* code below works since n_value > 0 */
localval
= cframe
+ sp
->n_value
;
localval
= cargp
+ sp
->n_value
;
* Print value v and then the string s.
* If v is not zero, then we look for a nearby symbol
* and print name+offset if we find a symbol for which
* offset is small enough.
* For values which are just into kernel address space
* that they match exactly or that they be more than maxoff
* bytes into kernel space.
if (v
==0 || w
>= maxoff
|| (KVTOPH(v
) < maxoff
&& w
))
printf("%s", cursym
->n_un
.n_name
);
* Print value v symbolically if it has a reasonable
* interpretation as name+offset. If not, print nothing.
* Used in printing out registers $r.
printf("%s", cursym
->n_un
.n_name
);