2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2015 Joyent, Inc.
15 .Dt PSYMBOL_ITER 3PROC
19 .Nm Psymbol_iter_by_addr ,
20 .Nm Psymbol_iter_by_lmid ,
21 .Nm Psymbol_iter_by_name ,
23 .Nd iterate symbols in a process
30 .Fa "struct ps_prochandle *P"
31 .Fa "const char *object_name"
34 .Fa "proc_sym_f *func"
38 .Fo Psymbol_iter_by_addr
39 .Fa "struct ps_prochandle *P"
40 .Fa "const char *object_name"
43 .Fa "proc_sym_f *func"
47 .Fo Psymbol_iter_by_lmid
48 .Fa "struct ps_prochandle *P"
50 .Fa "const char *object_name"
53 .Fa "proc_sym_f *func"
57 .Fo Psymbol_iter_by_name
58 .Fa "struct ps_prochandle *P"
59 .Fa "const char *object_name"
62 .Fa "proc_sym_f *func"
67 .Fa "struct ps_prochandle *P"
69 .Fa "const char *object_name"
72 .Fa "proc_xsym_f *func"
78 .Fn Psymbol_iter_by_addr ,
79 .Fn Psymbol_iter_by_lmid ,
80 .Fn Psymbol_iter_by_name ,
83 functions are used to iterate over the symbols present in the process
84 referred to by the handle
86 For each symbol found, the callback function
88 will be called once and the argument
90 will be passed to it along with an ELF symbol entry in the form of the
92 along with the name of the symbol, if known.
95 function an additional
97 argument will be provided to the callback.
108 argument names the object that is a part of the controlled process which
109 will be searched for symbols.
110 Only one object may be searched at any given time.
111 Valid object names may be obtained through the
114 .Xr Pobject_iter 3PROC
115 functions, among others.
116 The system also has two special object names that may be passed in to refer to
117 the objects of the executable file and for ld.so.1.
120 refers to the executables object and the symbol
122 refers to the object ld.so.1.
126 argument controls which of two possible symbol tables will be searched.
129 then the ELF symbol table will be searched.
132 then the symbol table associated with the dynamic section will be
134 If any other value is specified for
136 then an error will be returned.
140 argument controls which symbols will be included.
143 argument allows for control over both the symbol's binding and the
145 These flags logically correspond to the various ELF symbol bindings and types.
146 The following values may be passed as a bitwise-inclusive-OR into the
149 .Bl -tag -width Dv -offset indent
151 The symbol is a local symbol.
152 Local symbols are not visible outside of their object file.
154 The symbol is a global symbol.
155 Global symbols are visible outside of their object file and may be referred to
156 by other ELF objects.
158 The symbol is a weak symbol.
159 Weak symbols are visible outside of their object file, but another definition of
160 the symbol may be used instead.
162 This is a combination of
167 Every symbol's binding will match this value.
169 The symbol's type is not specified.
171 The symbol refers to a data object.
172 For example, variables.
174 The symbol refers to a function.
176 The symbol refers to an ELF section.
178 The symbol refers to the name of a source file associated with an object
181 This is a combination of
188 Every symbol's type will match this value.
191 To obtain all of the symbols in an object, the caller would pass the
199 .Fn Psymbol_iter_by_lmid
202 functions allow for a link-map identifier to be specified in the
205 This will restrict the search for the object specified in
207 to the specified link-map.
208 There are three special link-map identifiers that may be passed in.
211 indicates that every link-map should be searched.
214 indicates that the base link-map, the one that is used for the
215 executable should be searched.
218 refers to the link-map that is used by the run-time link editor, ld.so.1.
219 The functions which do not allow a link-map identifier to be specified always
220 search every link-map.
222 By default, symbols are iterated based on the order of the symbol
223 table being searched.
224 However, it is also possible to iterate based on the name of the symbol and
225 based on the address of the symbol.
226 To iterate by name use the
227 .Fn Psymbol_iter_by_name
229 To iterate by address use the
230 .Fn Psymbol_iter_by_addr
234 .Fn Psymbol_iter_by_lmid ,
237 functions all sort based on the order of the symbol table.
239 The return value of the callback function
241 determines whether or not iteration continues.
246 then iteration will continue.
249 returns non-zero, then iteration will halt and that value will be used
250 as the return value of the
252 .Fn Psymbol_iter_by_addr ,
253 .Fn Psymbol_iter_by_lmid ,
254 .Fn Psymbol_iter_by_name ,
258 Because these functions return
260 on internal failure, it is recommended that the callback function not return
262 to indicate an error so that the caller may distinguish between the
263 failure of the callback function and the failure of these functions.
265 Upon successful completion, the
267 .Fn Psymbol_iter_by_addr ,
268 .Fn Psymbol_iter_by_lmid ,
269 .Fn Psymbol_iter_by_name ,
274 If there was an internal error then
277 Otherwise, if the callback function
279 returns non-zero, then its return value will be returned instead.
280 .Sh INTERFACE STABILITY