SunOS man pages : dladdr (3)
Dynamic Linking Library Functions dladdr(3DL)
NAME
dladdr, dladdr1 - translate address to symbolic information
SYNOPSIS
cc [ flag ... ] file... -ldl [ library ... ]
#include <dlfcn.h>
int dladdr(void *address, Dl_info *dlip);
int dladdr1(void *address, Dl_info *dlip, void **info, int
flags);
DESCRIPTION
The dladdr() and dladdr1() functions determine if the speci-
fied address is located within one of the mapped objects
that make up the current applications address space. An
address is deemed to fall within a mapped object when it is
between the base address, and the _end address of that
object. If a mapped object fits this criteria, the symbol
table made available to the runtime linker is searched to
locate the nearest symbol to the specified address. The
nearest symbol is one that has a value less than or equal to
the required address.
The Dl_info structure must be preallocated by the user. The
structure members are filled in by dladdr() based on the
specified address. The Dl_info structure includes the fol-
lowing members:
const char * dli_fname;
void * dli_fbase;
const char * dli_sname;
void * dli_saddr;
Descriptions of these members appear below.
dli_fname
Contains a pointer to the filename of the containing
object.
dli_fbase
Contains the base address of the containing object.
dli_sname
Contains a pointer to the symbol name nearest to the
specified address. This symbol either has the same
address, or is the nearest symbol with a lower
address.
dli_saddr
Contains the actual address of the above symbol.
SunOS 5.8 Last change: 12 July 2000 1
Dynamic Linking Library Functions dladdr(3DL)
The dladdr1() function provides for addition information to
be returned as specified by the flags argument:
RTLD_DL_SYMENT
Obtain the ELF symbol table entry for the matched sym-
bol. The info argument points to a Sym pointer as
defined in <sys/machelf.h> (Sym **info).
RTLD_DL_LINKMAP
Obtain the Link_map for the matched file. The info
argument points to a Link_map pointer as defined in
<sys/link.h> (Link_map **info).
RETURN VALUES
If the specified address cannot be matched to a mapped
object, a 0 is returned. Otherwise, a non-zero return is
made and the associated Dl_info elements are filled.
USAGE
The dladdr() and dladdr1() functions are one of a family of
functions that give the user direct access to the dynamic
linking facilities (see Linker and Libraries Guide) and are
available to dynamically-linked processes only.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| MT-Level | MT-Safe |
|_____________________________|_____________________________|
SEE ALSO
ld(1), dlclose(3DL), dldump(3DL), dlerror(3DL), dlopen(3DL),
dlsym(3DL), attributes(5)
Linker and Libraries Guide
NOTES
The Dl_info pointer elements point to addresses within the
mapped objects. These may become invalid if objects are
removed prior to these elements being used (see dlclose()).
If no symbol is found to describe the specified address,
both the dli_sname and dli_saddr members are set to 0.
SunOS 5.8 Last change: 12 July 2000 2
|
 |
|
|