Operating System - HP-UX
1833876 Members
1911 Online
110063 Solutions
New Discussion

ldd like tool for in-memory process

 
Banibrata Dutta
Frequent Advisor

ldd like tool for in-memory process

Hi,

Is there a tool like "ldd" which can accept the PID of a process in execution, and display the pathnames of the various libraries loaded dynamically and linked-to ? I'm just hoping against the odds...

cheers,
bd
4 REPLIES 4
CAS_2
Valued Contributor

Re: ldd like tool for in-memory process

I suggest use lsof command.

# lsof -p 11086 | awk '$4=="mem"'
telnetd 11086 root mem REG 64,0x7 36864 10488 /usr/lib/libnss_dns.1
telnetd 11086 root mem REG 64,0x7 53248 29984 /usr/lib/libnss_files.1
telnetd 11086 root mem REG 64,0x7 135168 116 /usr/lib/libxti.2
telnetd 11086 root mem REG 64,0x7 741376 30172 /usr/lib/libnsl.1
telnetd 11086 root mem REG 64,0x7 45056 30173 /usr/lib/libnss_nis.1
telnetd 11086 root mem REG 64,0x7 1044480 118 /usr (/dev/vg00/lvol7)
telnetd 11086 root mem REG 64,0x7 24576 29836 /usr/lib/libdld.2
telnetd 11086 root mem REG 64,0x7 1814528 27903 /usr/lib/libc.2
telnetd 11086 root mem REG 64,0x7 241664 28460 /usr/lib/dld.sl
telnetd 11086 root mem REG 64,0x8 532 2449 /var/spool/pwgr/status
Banibrata Dutta
Frequent Advisor

Re: ldd like tool for in-memory process

Thanks CAS, but "lsof" is something I've already tried and found that due to the "snapshot" nature of info. it provides, you cannot really tell what all ".sl"'s it is linked against and what all ".sl"'s have been demand-loaded (dynamically, using dlopen() for instance).

I believe that when demand load is done, dld.so opens the file, reads it, loads the text segments into memory after relocation, update the link tables, and finally close the file... (just a hunch). Because I am not seeing so monay .sl files (via "lsof), that ldd -v shows, and I know that they are loaded because I am able to use the functionality delivered by those shared libs!!

thanks for the info anyway.

regards,
bd
Banibrata Dutta
Frequent Advisor

Re: ldd like tool for in-memory process

Well, i found the way, albeit quite crude.
I knew which all .sl's I was suspecting to be used, but couldn't get "ldd" to report them (since they were loaded on demand). I simply started the process in question, and did an "fuser" on the suspected .sl file, and that's it. It confirmed it's use.

thanks,
bdutta
Banibrata Dutta
Frequent Advisor

Re: ldd like tool for in-memory process

see my last post.