Paddr_to_map
,
Paddr_to_text_map
,
Plmid_to_map
,
Pname_to_map
—
lookup memory map information
Process Control Library (libproc, -lproc)
#include
<libproc.h>
const prmap_t *
Paddr_to_map
(
struct
ps_prochandle *P,
uintptr_t addr);
const prmap_t *
Paddr_to_text_map
(
struct
ps_prochandle *P,
uintptr_t addr);
const prmap_t *
Plmid_to_map
(
struct
ps_prochandle *P,
Lmid_t lmid,
const char *name);
const prmap_t *
Pname_to_map
(
struct
ps_prochandle *P,
const char *name);
The
Paddr_to_map
(),
Paddr_to_text_map
(),
Plmid_to_map
(), and
Pname_to_map
() functions lookup memory map
information in the process handle
P. The
prmap_t structure provides information such as
the size, offset, and object of the mapping and is defined in
proc(4).
The pointer to the data returned by the library will only be valid for as long
as the handle
P is valid. Any calls to
Prelease(3PROC) will invalidate the data.
The
Paddr_to_map
() function attempts to find
the mapping information corresponding to the address
addr.
The
Paddr_to_text_map
() function is similar
to the
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.
The
Pname_to_map
() function looks up the
object named
name and returns the
corresponding mapping information. Two special values may be used for name.
The macro
PR_OBJ_EXEC
refers to the
executable object itself and the macro
PR_OBJ_LDSO
refers to the object ld.so.1
.
The
Plmid_to_map
() function is similar to
Pname_to_map
(). It allows passing a
link-map identifier,
lmid, which constricts
the search of the object named with
name to
that link-map. The special value of
PR_LMID_EVERY
may be passed to indicate
that every link-map should be searched, which is equivalent in behavior to the
Pname_to_map
() function.
Upon successful completion, the
Paddr_to_map
(),
Paddr_to_text_map
(),
Plmid_to_map
(), and
Pname_to_map
() functions return a pointer
to the corresponding mapping information. If none exists then
NULL
is returned.
Uncommitted
See
LOCKING in
libproc(3LIB).
libproc(3LIB),
Prelease(3PROC),
proc(4)