Changeset View
Changeset View
Standalone View
Standalone View
lib/libproc/proc_sym.c
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
struct symsort_thunk { | struct symsort_thunk { | ||||
Elf *e; | Elf *e; | ||||
struct symtab *symtab; | struct symtab *symtab; | ||||
}; | }; | ||||
static int | static int | ||||
symvalcmp(void *_thunk, const void *a1, const void *a2) | symvalcmp(const void *a1, const void *a2, void *_thunk) | ||||
{ | { | ||||
GElf_Sym sym1, sym2; | GElf_Sym sym1, sym2; | ||||
struct symsort_thunk *thunk; | struct symsort_thunk *thunk; | ||||
const char *s1, *s2; | const char *s1, *s2; | ||||
u_int i1, i2; | u_int i1, i2; | ||||
int bind1, bind2; | int bind1, bind2; | ||||
i1 = *(const u_int *)a1; | i1 = *(const u_int *)a1; | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (symtab->index == NULL) | ||||
return (-1); | return (-1); | ||||
for (u_int i = 0; i < nsyms; i++) | for (u_int i = 0; i < nsyms; i++) | ||||
symtab->index[i] = i; | symtab->index[i] = i; | ||||
symtab->nsyms = nsyms; | symtab->nsyms = nsyms; | ||||
symtab->stridx = shdr.sh_link; | symtab->stridx = shdr.sh_link; | ||||
thunk.e = e; | thunk.e = e; | ||||
thunk.symtab = symtab; | thunk.symtab = symtab; | ||||
qsort_r(symtab->index, nsyms, sizeof(u_int), &thunk, symvalcmp); | qsort_r(symtab->index, nsyms, sizeof(u_int), symvalcmp, &thunk); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
load_symtabs(struct file_info *file) | load_symtabs(struct file_info *file) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 513 Lines • Show Last 20 Lines |