Plookup_by_addr, Plookup_by_name - search the symbol tables of the victim process
#include <gelf.h> #include <libproc.h>
int Plookup_by_addr(ps_prochandle_t *Pr, uintptr_t addr, char *buf, size_t bufsize, GElf_Sym *symp, prsyminfo_t *sip)
int Plookup_by_name(ps_prochandle_t *Pr, const char *object, const char *symbol, GElf_Sym *symp, prsyminfo_t *sip)
The Pr argument identifies a victim process or core file attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.
The Plookup_by_addr() function searches the symbol tables of the victim for a symbol whose address space range, [st_value .. st_value + st_size), includes the address passed in the addr argument. On successful lookup, the name of the symbol is copied to the buffer of the caller and the symbol table entry is copied to the symp argument of the caller. If the sip argument is not NULL, extended symbol table information is copied into it, including the pointer to the buffer of the caller. So, it then becomes sip->prs_name.
The Plookup_by_name() function searches the symbol tables of the victim for a symbol named by the symbol argument, such as "atoi", in the loaded object file named by the object argument, such as libc.so. If object equals PR_OBJ_EVERY, all symbol tables in every loaded object file is searched and the first one found is the one that is returned. On successful lookup, the symbol table entry is copied to the symp argument of the caller. If the sip argument is not NULL, extended symbol table information is copied into it, including the object and symbol arguments of the caller which become sip->prs_object and sip->prs_name.
On successful completion, the Plookup_by_addr() and Plookup_by_name() functions return 0. On failure, they return -1. This normally means that the symbol was not found.
On failure, errno is not set.
See attributes(7) for descriptions of the following attributes:
|
libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)