dladdr(3C)
dladdr - Translates address to symbolic information
As shipped in IRIX 6.5.7. Added in IRIX 6.5.5.
NAME dladdr - Translates address to symbolic information SYNOPSIS cc [flags ...] [file ...] #include <dlfcn.h> int dladdr(void *address, Dl_info *dlip); IMPLEMENTATION IRIX systems DESCRIPTION dladdr() determines if the specified address is located within one of the mapped objects (either the executable or a DSO) that make up the current application address space. If the address is within an object, the symbol table available to the run-time linker (rld(1)) 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 contains at least the following members: const char * dli_fname; void * dli_fbase; const char * dli_sname; void * dli_saddr; The members are defined as follows: dli_fname Contains a pointer to the file name of the containing object. dli_fbase Contains the base address (in memory) of the containing object. dli_sname Contains a pointer to the nearest symbol name. 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. The following nonstandard field is in Dl_info: dli_version This is filled in with zero by dladdr(). NOTES If no symbol is found to describe the specified address, but the address is within a mapped-in object, the dli_sname and dli_saddr members are set to 0 by dladdr(). The memory pointed to by dli_fname and dli_sname is within the mapped object. If the object is closed with dlclose(), the pointers become invalid. If the call is attempted on a system that does not have the supporting functionality, the following message will be emitted to /dev/tty by default, and the application will be terminated with a non-zero exit code: Fatal Error: _rld_new_interface: bad operation: 14 Applications that might be executed on IRIX releases without the latest rld should first attempt the call in a separate small process. Define the environment variable _RLD_ARGS as the following to direct the rld message to disk, if its appearance on /dev/tty might be an annoyance: -log /tmp/rldmessage On a development system with dlfcn.h missing Dl_info and libc missing dladdr(), but with rld implementing _RLD_DLADDR, the following is a sample implementation that you might want to try. This sample implementation is not guaranteed to work, because user applications and DSOs should not call _rld_new_interface, but it is provided with the hope that it will be useful. #include <rld_interface.h> #ifndef _RLD_INTERFACE_DLFCN_H_DLADDR #define _RLD_INTERFACE_DLFCN_H_DLADDR struct Dl_info { const char * dli_fname; void * dli_fbase; const char * dli_sname; void * dli_saddr; int dli_version; int dli_reserved1; long dli_reserved[4]; }; #endif #define _RLD_DLADDR 14 int dladdr(void *address, struct Dl_info *dl); int dladdr(void *address, struct Dl_info *dl) { void *v; v = _rld_new_interface(_RLD_DLADDR,address,dl); return (int)v; } DIAGNOSTICS The function returns zero if the address cannot be associated with a mapped-in object. In such a case, the Dl_info fields are not touched. The function returns non-zero if it can be associated with a mapped-in object, and the Dl_info fields are updated. SEE ALSO dlopen(3C), dlclose(3C), dlsym(3C), sgidlopen_version(3C), sgidlopen_verison(3C) rld(1) dso(5) This man page is available only online.