Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Thursday, June 13, 2019
 
 

Plookup_by_addr (3PROC)

Name

Plookup_by_addr, Plookup_by_name - search the symbol tables of the victim process

Synopsis

#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)

Description

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.

Return Values

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.

Errors

On failure, errno is not set.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)