xref: /illumos-gate/usr/src/man/man3proc/Paddr_to_ctf.3proc (revision ea4c6b78cebe2a3687fa43deeedf6212a124d817)
1.\"
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
5.\" 1.0 of the CDDL.
6.\"
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.
10.\"
11.\"
12.\" Copyright 2015 Joyent, Inc.
13.\"
14.Dd May 11, 2016
15.Dt PADDR_TO_CTF 3PROC
16.Os
17.Sh NAME
18.Nm Paddr_to_ctf ,
19.Nm Plmid_to_ctf ,
20.Nm Pname_to_ctf
21.Nd lookup CTF data
22.Sh SYNOPSIS
23.Lb libproc
24.In libproc.h
25.Ft "ctf_file_t *"
26.Fo Paddr_to_ctf
27.Fa "struct ps_prochandle *P"
28.Fa "uintptr_t addr"
29.Fc
30.Ft "ctf_file_t *"
31.Fo Plmid_to_ctf
32.Fa "struct ps_prochandle *P"
33.Fa "Lmid_t lmid"
34.Fa "const char *name"
35.Fc
36.Ft "ctf_file_t *"
37.Fo Pname_to_ctf
38.Fa "struct ps_prochandle *P"
39.Fa "const char *name"
40.Fc
41.Sh DESCRIPTION
42The
43.Fn Paddr_to_ctf ,
44.Fn Plmid_to_ctf ,
45and
46.Fn Pname_to_ctf
47functions lookup CTF (Compact C Type Format) data, for use with
48.Sy libctf ,
49from the process represented by the handle
50.Fa P .
51In all cases, the CTF sections of both the running executable and its
52shared libraries are searched.
53.Pp
54The CTF container returned is valid as long as the process handle
55.Fa P
56is valid. That is, until a call to
57.Xr Prelease 3PROC
58is made. Further, consumers must not close the CTF container.
59.Pp
60The
61.Fn Paddr_to_ctf
62function attempts to find the CTF section, if any, that exists for the
63address
64.Fa addr .
65Note, not all addresses correspond to memory regions that have CTF
66data. For example, if a user creates a region of anonymous memory
67through the
68.Xr mmap 2
69function, then it will not have any corresponding CTF information.
70.Pp
71The
72.Fn Pname_to_ctf
73function looks up the object named
74.Fa name
75and returns the corresponding CTF section, if any exists. Two special
76values may be used for name. The macro
77.Dv PR_OBJ_EXEC
78refers to the executable object itself and the macro
79.Dv PR_OBJ_LDSO refers to the object ld.so.1 .
80.Pp
81The
82.Fn Plmid_to_ctf
83function is similar to
84.Fn Pname_to_ctf .
85It allows the passing of a link-map identifier,
86.Fa lmid ,
87which constricts the search of the object named with
88.Fa name
89to that link-map. The special value of
90.Dv PR_LMID_EVERY
91indicates that every link-map should be searched, which is equivalent
92in behavior to the
93.Fn Pname_to_ctf
94function.
95.Sh RETURN VALUES
96Upon successful completion, the
97.Fn Paddr_to_ctf ,
98.Fn Plmid_to_ctf ,
99and
100.Fn Pname_to_ctf
101functions return a pointer to the corresponding CTF container.
102Otherwise, if none exists then
103.Dv NULL
104is returned.
105.Sh INTERFACE STABILITY
106.Sy Uncommitted
107.Sh MT-LEVEL
108See
109.Sy LOCKING
110in
111.Xr libproc 3LIB .
112.Sh SEE ALSO
113.Xr libproc 3LIB ,
114.Xr ctf 4
115