summaryrefslogtreecommitdiff
path: root/usr/src/man/man3proc/Plookup_by_addr.3proc
blob: d1b1593326d6db577d824f3047206319eb96eb95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2015 Joyent, Inc.
.\"
.Dd May 11, 2016
.Dt PLOOKUP_BY_ADDR 3PROC
.Os
.Sh NAME
.Nm Plookup_by_addr ,
.Nm Pxlookup_by_addr ,
.Nm Pxlookup_by_addr_resolved ,
.Nm Plookup_by_name ,
.Nm Pxlookup_by_name
.Nd lookup symbols in a process
.Sh LIBRARY
.Lb libproc
.Sh SYNOPSIS
.In libproc.h
.Ft int
.Fo Plookup_by_addr
.Fa "struct ps_prochandle *P"
.Fa "uintptr_t addr"
.Fa "char *buf"
.Fa "size_t size"
.Fa "Gelf_Sym *symp"
.Fc
.Ft int
.Fo Pxlookup_by_addr
.Fa "struct ps_prochandle *P"
.Fa "uintptr_t addr"
.Fa "char *buf"
.Fa "size_t size"
.Fa "Gelf_Sym *symp"
.Fa "prsyminfo_t *sip"
.Fc
.Ft int
.Fo Pxlookup_by_addr_resolved
.Fa "struct ps_prochandle *P"
.Fa "uintptr_t addr"
.Fa "char *buf"
.Fa "size_t size"
.Fa "Gelf_Sym *symp"
.Fa "prsyminfo_t *sip"
.Fc
.Ft int
.Fo Plookup_by_name
.Fa "struct ps_prochandle *P"
.Fa "const char *object"
.Fa "const char *symbol"
.Fa "GElf_Sym *symp"
.Fc
.Ft int
.Fo Pxlookup_by_name
.Fa "struct ps_prochandle *P"
.Fa "Lmid_t lmid"
.Fa "const char *object"
.Fa "const char *symbol"
.Fa "GElf_Sym *symp"
.Fa "prsyminfo_t *sip"
.Fc
.Sh DESCRIPTION
The
.Fn Plookup_by_addr ,
.Fn Pxlookup_by_addr ,
.Fn Pxlookup_by_addr_resolved ,
.Fn Plookup_by_name ,
and
.Fn Pxlookup_by_name
functions look up symbol information in the process handle
.Fa P
and fill in the ELF symbol information in
.Fa symp
with the found symbol.
Symbols may be looked up both by address and name.
.Pp
The
.Fn Plookup_by_addr
function looks up symbol information corresponding to the address
.Fa addr .
If found, up to
.Fa size
bytes of the symbol's name, including the null terminator will be filled
in to the buffer
.Fa buf .
.Pp
The
.Fn Pxlookup_by_addr
function is identical to the
.Fn Plookup_by_addr
function, except that it also fills in the structure
.Fa sip
with additional information.
The definition of the
.Sy prsyminfo_t
is found in
.Xr libproc 3LIB .
.Pp
The
.Fn Pxlookup_by_addr_resolved
function is similar to the
.Fn Pxlookup_by_addr
function; however, it attempts to resolve the paths present in the
.Sy prsyminfo_t
to an absolute path on the file system.
.Pp
The
.Fn Plookup_by_name
function attempts to look up a symbol based on its name.
The
.Fa object
argument allows the caller to specify a specific object that was mapped
in by the run-time link-editor to search for
.Fa symbol
in.
The system provides three special values which may be passed in for
.Fa object .
The value
.Dv PR_OBJ_EXEC
refers to the executable's object (a.out).
The value
.Dv PR_OBJ_LDSO
refers to the object
.Sy ld.so.1 .
The value
.Dv PR_OBJ_EVERY
indicates that every object should be searched.
.Pp
The
.Fn Pxlookup_by_name
function is similar to the
.Fn Plookup_by_name
function; however, it allows a link-map identifier,
.Fa lmid ,
to be specified and also provides additional information about the
symbol in the form of the
.Sy prsyminfo_t
.Fa sip .
The specification of
.Fa lmid
restricts the search for the object named
.Fa object
and symbol named
.Fa symbol
to the specified link-map.
.Pp
There are three special link-map identifiers that may be passed in.
The symbol
.Dv PR_LMID_EVERY
indicates that every link-map should be searched.
The symbol
.Dv LM_ID_BASE
indicates that the base link-map, the one that is used for the
executable should be searched.
Finally, the symbol
.Dv LM_ID_LDSO
refers to the link-map that is used by the run-time link editor, ld.so.1.
The
.Fn Plookup_by_name
function behaves like
.Fn Pxlookup_by_name
when the
.Dv PR_LMID_EVERY
argument is passed to
.Fa lmid ,
indicating that every link-map should be searched.
.Sh RETURN VALUES
Upon successful completion, the
.Fn Plookup_by_addr ,
.Fn Pxlookup_by_addr ,
.Fn Pxlookup_by_addr_resolved ,
.Fn Plookup_by_name ,
and
.Fn Pxlookup_by_name
functions return
.Sy 0
and fill in the symbol information.
Otherwise,
.Sy -1
is returned to indicate that the symbol could not be found.
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
See
.Sy LOCKING
in
.Xr libproc 3LIB .
.Sh SEE ALSO
.Xr elf 3ELF ,
.Xr gelf 3ELF ,
.Xr libproc 3LIB ,
.Xr proc 4