1 PLOOKUP_BY_ADDR(3PROC) Process Control Library Functions 2 3 NAME 4 Plookup_by_addr, Pxlookup_by_addr, Pxlookup_by_addr_resolved, 5 Plookup_by_name, Pxlookup_by_name - lookup symbols in a process 6 7 LIBRARY 8 Process Control Library (libproc, -lproc) 9 10 SYNOPSIS 11 #include <libproc.h> 12 13 int 14 Plookup_by_addr(struct ps_prochandle *P, uintptr_t addr, char *buf, 15 size_t size, Gelf_Sym *symp); 16 17 int 18 Pxlookup_by_addr(struct ps_prochandle *P, uintptr_t addr, char *buf, 19 size_t size, Gelf_Sym *symp, prsyminfo_t *sip); 20 21 int 22 Pxlookup_by_addr_resolved(struct ps_prochandle *P, uintptr_t addr, 23 char *buf, size_t size, Gelf_Sym *symp, prsyminfo_t *sip); 24 25 int 26 Plookup_by_name(struct ps_prochandle *P, const char *object, 27 const char *symbol, GElf_Sym *symp); 28 29 int 30 Pxlookup_by_name(struct ps_prochandle *P, Lmid_t lmid, 31 const char *object, const char *symbol, GElf_Sym *symp, 32 prsyminfo_t *sip); 33 34 DESCRIPTION 35 The Plookup_by_addr(), Pxlookup_by_addr(), Pxlookup_by_addr_resolved(), 36 Plookup_by_name(), and Pxlookup_by_name() functions look up symbol 37 information in the process handle P and fill in the ELF symbol 38 information in symp with the found symbol. Symbols may be looked up both 39 by address and name. 40 41 The Plookup_by_addr() function looks up symbol information corresponding 42 to the address addr. If found, up to size bytes of the symbol's name, 43 including the null terminator will be filled in to the buffer buf. 44 45 The Pxlookup_by_addr() function is identical to the Plookup_by_addr() 46 function, except that it also fills in the structure sip with additional 47 information. The definition of the prsyminfo_t is found in 48 libproc(3LIB). 49 50 The Pxlookup_by_addr_resolved() function is similar to the 51 Pxlookup_by_addr() function; however, it attempts to resolve the paths 52 present in the prsyminfo_t to an absolute path on the file system. 53 54 The Plookup_by_name() function attempts to look up a symbol based on its 55 name. The object argument allows the caller to specify a specific object 56 that was mapped in by the run-time link-editor to search for symbol in. 57 The system provides three special values which may be passed in for 58 object. The value PR_OBJ_EXEC refers to the executable's object (a.out). 59 The value PR_OBJ_LDSO refers to the object ld.so.1. The value 60 PR_OBJ_EVERY indicates that every object should be searched. 61 62 The Pxlookup_by_name() function is similar to the Plookup_by_name() 63 function; however, it allows a link-map identifier, lmid, to be specified 64 and also provides additional information about the symbol in the form of 65 the prsyminfo_t sip. The specification of lmid restricts the search for 66 the object named object and symbol named symbol to the specified link- 67 map. 68 69 There are three special link-map identifiers that may be passed in. The 70 symbol PR_LMID_EVERY indicates that every link-map should be searched. 71 The symbol LM_ID_BASE indicates that the base link-map, the one that is 72 used for the executable should be searched. Finally, the symbol 73 LM_ID_LDSO refers to the link-map that is used by the run-time link 74 editor, ld.so.1. The Plookup_by_name() function behaves like 75 Pxlookup_by_name() when the PR_LMID_EVERY argument is passed to lmid, 76 indicating that every link-map should be searched. 77 78 RETURN VALUES 79 Upon successful completion, the Plookup_by_addr(), Pxlookup_by_addr(), 80 Pxlookup_by_addr_resolved(), Plookup_by_name(), and Pxlookup_by_name() 81 functions return 0 and fill in the symbol information. Otherwise, -1 is 82 returned to indicate that the symbol could not be found. 83 84 INTERFACE STABILITY 85 Uncommitted 86 87 MT-LEVEL 88 See LOCKING in libproc(3LIB). 89 90 SEE ALSO 91 elf(3ELF), gelf(3ELF), libproc(3LIB), proc(4) 92 93 illumos May 11, 2016 illumos