PLOOKUP_BY_ADDR(3PROC) Process Control Library Functions PLOOKUP_BY_ADDR(3PROC)

Plookup_by_addr, Pxlookup_by_addr, Pxlookup_by_addr_resolved, Plookup_by_name, Pxlookup_by_namelookup symbols in a process

Process Control Library (libproc, -lproc)

#include <libproc.h>

int
Plookup_by_addr(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size, Gelf_Sym *symp);

int
Pxlookup_by_addr(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size, Gelf_Sym *symp, prsyminfo_t *sip);

int
Pxlookup_by_addr_resolved(struct ps_prochandle *P, uintptr_t addr, char *buf, size_t size, Gelf_Sym *symp, prsyminfo_t *sip);

int
Plookup_by_name(struct ps_prochandle *P, const char *object, const char *symbol, GElf_Sym *symp);

int
Pxlookup_by_name(struct ps_prochandle *P, Lmid_t lmid, const char *object, const char *symbol, GElf_Sym *symp, prsyminfo_t *sip);

The (), Pxlookup_by_addr(), Pxlookup_by_addr_resolved(), Plookup_by_name(), and Pxlookup_by_name() functions look up symbol information in the process handle P and fill in the ELF symbol information in symp with the found symbol. Symbols may be looked up both by address and name.

The () function looks up symbol information corresponding to the address addr. If found, up to size bytes of the symbol's name, including the null terminator will be filled in to the buffer buf.

The () function is identical to the Plookup_by_addr() function, except that it also fills in the structure sip with additional information. The definition of the prsyminfo_t is found in libproc(3LIB).

The () function is similar to the Pxlookup_by_addr() function; however, it attempts to resolve the paths present in the prsyminfo_t to an absolute path on the file system.

The () function attempts to look up a symbol based on its name. The object argument allows the caller to specify a specific object that was mapped in by the run-time link-editor to search for symbol in. The system provides three special values which may be passed in for object. The value PR_OBJ_EXEC refers to the executable's object (a.out). The value PR_OBJ_LDSO refers to the object . The value PR_OBJ_EVERY indicates that every object should be searched.

The () function is similar to the Plookup_by_name() function; however, it allows a link-map identifier, lmid, to be specified and also provides additional information about the symbol in the form of the prsyminfo_t sip. The specification of lmid restricts the search for the object named object and symbol named symbol to the specified link-map.

There are three special link-map identifiers that may be passed in. The symbol PR_LMID_EVERY indicates that every link-map should be searched. The symbol LM_ID_BASE indicates that the base link-map, the one that is used for the executable should be searched. Finally, the symbol LM_ID_LDSO refers to the link-map that is used by the run-time link editor, ld.so.1. The () function behaves like Pxlookup_by_name() when the PR_LMID_EVERY argument is passed to lmid, indicating that every link-map should be searched.

Upon successful completion, the Plookup_by_addr(), Pxlookup_by_addr(), Pxlookup_by_addr_resolved(), Plookup_by_name(), and Pxlookup_by_name() functions return and fill in the symbol information. Otherwise, is returned to indicate that the symbol could not be found.

See in libproc(3LIB).

elf(3ELF), gelf(3ELF), libproc(3LIB), proc(5)

May 11, 2016 OmniOS