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
|
.\"
.\" 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 PADDR_TO_MAP 3PROC
.Os
.Sh NAME
.Nm Paddr_to_map ,
.Nm Paddr_to_text_map ,
.Nm Plmid_to_map ,
.Nm Pname_to_map
.Nd lookup memory map information
.Sh LIBRARY
.Lb libproc
.Sh SYNOPSIS
.In libproc.h
.Ft "const prmap_t *"
.Fo Paddr_to_map
.Fa "struct ps_prochandle *P"
.Fa "uintptr_t addr"
.Fc
.Ft "const prmap_t *"
.Fo Paddr_to_text_map
.Fa "struct ps_prochandle *P"
.Fa "uintptr_t addr"
.Fc
.Ft "const prmap_t *"
.Fo Plmid_to_map
.Fa "struct ps_prochandle *P"
.Fa "Lmid_t lmid"
.Fa "const char *name"
.Fc
.Ft "const prmap_t *"
.Fo Pname_to_map
.Fa "struct ps_prochandle *P"
.Fa "const char *name"
.Fc
.Sh DESCRIPTION
The
.Fn Paddr_to_map ,
.Fn Paddr_to_text_map ,
.Fn Plmid_to_map ,
and
.Fn Pname_to_map
functions lookup memory map information in the process handle
.Fa P .
The
.Sy prmap_t
structure provides information such as the size, offset, and object of
the mapping and is defined in
.Xr proc 5 .
.Pp
The pointer to the data returned by the library will only be valid for
as long as the handle
.Fa P
is valid.
Any calls to
.Xr Prelease 3PROC
will invalidate the data.
.Pp
The
.Fn Paddr_to_map
function attempts to find the mapping information corresponding to the
address
.Fa addr .
.Pp
The
.Fn Paddr_to_text_map
function is similar to the
.Fn Paddr_to_map
function; however, it only returns successfully if the specified address
corresponds to a text mapping as identified by the run-time link-editor.
One use of this is to ensure that a mapping is actually a text-mapping
before inserting a breakpoint in it.
.Pp
The
.Fn Pname_to_map
function looks up the object named
.Fa name
and returns the corresponding mapping information.
Two special values may be used for name.
The macro
.Dv PR_OBJ_EXEC
refers to the executable object itself and the macro
.Dv PR_OBJ_LDSO refers to the object ld.so.1 .
.Pp
The
.Fn Plmid_to_map
function is similar to
.Fn Pname_to_map .
It allows passing a link-map identifier,
.Fa lmid ,
which constricts the search of the object named with
.Fa name
to that link-map.
The special value of
.Dv PR_LMID_EVERY
may be passed to indicate that every link-map should be searched, which
is equivalent in behavior to the
.Fn Pname_to_map
function.
.Sh RETURN VALUES
Upon successful completion, the
.Fn Paddr_to_map ,
.Fn Paddr_to_text_map ,
.Fn Plmid_to_map ,
and
.Fn Pname_to_map
functions return a pointer to the corresponding mapping information.
If none exists then
.Dv NULL
is returned.
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
See
.Sy LOCKING
in
.Xr libproc 3LIB .
.Sh SEE ALSO
.Xr libproc 3LIB ,
.Xr Prelease 3PROC ,
.Xr proc 5
|