This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: operation and limitations of dladdr()?


On 03/29/2016 10:27 PM, Britton Kerin wrote:
> I'm trying to learn as much as possible about dladdr() before
> unleashing a small lib that uses it on the world.  Two questions:
> 
> Does the fact that dladdr() reports the symbol with the nearest
> address lower than the given
> one mean that that might be the correct function?  In other words why this:
> 
>        const char *dli_sname;  /* Name of nearest symbol with address
> lower than addr */
>        void      *dli_saddr;  /* Exact address of symbol name in dli_sname */
> 
> I would have thought that the address of the function about to be
> executed would have to match the library address exactly, but maybe
> not.  What does it mean if they don't match?

dladdr cannot always determine the function symbol from an address.
Often, it is still useful to obtain the base address of the shared
object, so that you can figure out the exact location by other means
(such as DWARF debugging information).

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]