NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Mapping function address to name



In article <20120426213152.5b67c73f.cryintothebluesky%googlemail.com@localhost>,
Sad Clouds  <cryintothebluesky%googlemail.com@localhost> wrote:
>On Thu, 26 Apr 2012 13:11:19 -0700
>Chuck Swiger <cswiger%mac.com@localhost> wrote:
>
>> On Apr 26, 2012, at 12:48 PM, Sad Clouds wrote:
>> > Hi, I am trying to find a way to map function addresses to names,
>> > during runtime for the following:
>> > 
>> > - Shared library functions
>> > - Any Functions mapped with dlopen/dlsym
>> > 
>> > Any suggestions? Thanks.
>> 
>> You're looking for dladdr().
>> 
>> Regards,
>> -- 
>> -Chuck
>> 
>
>Yes, but dladdr() only works for symbols obtained with dlsym(), for all
>other function addresses it gives dli_sname as "_init"

Yes, because dladdr only knows dynamic symbols; look at:

http://www.zoulas.com/NetBSD/libexecinfo.tar.gz

christos



Home | Main Index | Thread Index | Old Index