00001 #ifndef _SYM_C_
00002 #define _SYM_C_
00003
00004 #include "string.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
00023
00024
00025
00026
00027
00028
00029
00030 String _stp_symbol_sprint (String str, unsigned long address)
00031 {
00032 char *modname;
00033 const char *name;
00034 unsigned long offset, size;
00035 char namebuf[KSYM_NAME_LEN+1];
00036
00037 name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
00038
00039 _stp_sprintf (str, "0x%lx : ", address);
00040 if (modname)
00041 _stp_sprintf (str, "%s+%#lx/%#lx [%s]", name, offset, size, modname);
00042 else
00043 _stp_sprintf (str, "%s+%#lx/%#lx", name, offset, size);
00044 return str;
00045 }
00046
00047
00048
00049
00050
00051
00052
00053
00054 void _stp_symbol_print (unsigned long address)
00055 {
00056 char *modname;
00057 const char *name;
00058 unsigned long offset, size;
00059 char namebuf[KSYM_NAME_LEN+1];
00060
00061 name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
00062
00063 _stp_printf ("0x%lx : ", address);
00064 if (modname)
00065 _stp_printf ("%s+%#lx/%#lx [%s]", name, offset, size, modname);
00066 else
00067 _stp_printf ("%s+%#lx/%#lx", name, offset, size);
00068 }
00069
00070
00071 #endif