Pobjname
,
Pobjname_resolved
—
turn a virtual address into its mapped object
Process Control Library (libproc, -lproc)
#include
<libproc.h>
char *
Pobjname
(
struct
ps_prochandle *P,
uintptr_t addr,
char *buffer,
size_t bufsize);
char *
Pobjname_resolved
(
struct
ps_prochandle *P,
uintptr_t addr,
char *buffer,
size_t bufsize);
The
Pobjname
() and
Pobjname_resolved
() functions attempt to
determine the underlying mapped object that contains the virtual address
addr in the process handle
P.
A program consists of multiple memory mappings. Some are provided by the system,
such as the stack and the heap. While others are created through explicit
calls to
mmap(2) or brought in by the run-time
link-editor due to dependencies specified in binaries and libraries.
If
addr is contained in a mapping, then up to
bufsize characters, including the null
terminator, of the name of the corresponding object will be written into
buffer. The
Pobjname_resolved
() function attempts to
resolve the object to a full file system path. If the full file-system path
cannot be determined, then it will fall back to the name that the run-time
link-editor has for that mapping, which is the behavior of
Pobjname
().
Upon successful completion, the
Pobjname
()
and
Pobjname_resolved
() functions return
buffer. Otherwise,
NULL
is returned to indicate the object
name could not be found.
Uncommitted
See
LOCKING in
libproc(3LIB).
mmap(2),
libproc(3LIB),
Pobject_iter(3PROC),
proc(4)