NetBSD-Users archive

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

Re: Mapping function address to name



On Fri, 27 Apr 2012 15:37:52 +0000 (UTC)
christos%astron.com@localhost (Christos Zoulas) wrote:

> 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
> 

OK thanks, I've taken your symtab functions, which obtain symbol names.
I'm trying to instrument libfuse and quite a lot of symbol names show
up as '_fini' eg:

tusec ncalls func file
---------------------------------------------------
126.50 1 _fini() /lib64/libfuse.so.2
1.88 2 fuse_register_module() /lib64/libfuse.so.2
11.13 808 _fini() /lib64/libfuse.so.2
1.38 2 _fini() /lib64/libfuse.so.2
231.85 5 _fini() /lib64/libfuse.so.2
1.16 811 fuse_req_userdata() /lib64/libfuse.so.2

.. and so on

Any idea why that might be?

Cheers.


Home | Main Index | Thread Index | Old Index