00001 #ifndef _SYM_C_
00002 #define _SYM_C_
00003
00004 #include "scbuf.c"
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 static const char * (*_stp_kallsyms_lookup)(unsigned long addr,
00018 unsigned long *symbolsize,
00019 unsigned long *offset,
00020 char **modname, char *namebuf)=(void *)KALLSYMS_LOOKUP;
00021
00022 static void __stp_symbol_print (unsigned long address, void (*prtfunc)(const char *fmt, ...))
00023 {
00024 char *modname;
00025 const char *name;
00026 unsigned long offset, size;
00027 char namebuf[KSYM_NAME_LEN+1];
00028
00029 name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
00030
00031 (*prtfunc)("0x%lx : ", address);
00032 if (modname)
00033 (*prtfunc)("%s+%#lx/%#lx [%s]", name, offset, size, modname);
00034 else
00035 (*prtfunc)("%s+%#lx/%#lx", name, offset, size);
00036 }
00037
00038
00039
00040
00041
00042
00043
00044
00045 char * _stp_symbol_sprint (unsigned long address)
00046 {
00047 char *ptr = _stp_scbuf_cur();
00048 __stp_symbol_print (address, _stp_sprint);
00049 return ptr;
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059 void _stp_symbol_print (unsigned long address)
00060 {
00061 __stp_symbol_print (address, _stp_print);
00062 }
00063
00064
00065 #endif