2

Is there an utility that gives me specific line from /proc/id/maps when given specific address from this process?

For example when given 0x7fb4a84f6008 it returns:

7fb4a84f6000-7fb4a84fd000 r-xp 00000000 00:48 20132    /lib64/libnss_compat-2.21.so
2

Maybe pmap does what you want:

$ sudo pmap -Ab75bf022 26746
26746:   dhclient -1 -v -pf /run/dhclient.eth5.pid -lf /var/lib/dhcp/dhclient.eth5.leases eth5
b75bf000      4K rw--- ld-2.19.so
 total        4K

Or with a address range and full path:

$ sudo pmap -p -Ab75bf022,b77bf022 26746
26746:   dhclient -1 -v -pf /run/dhclient.eth5.pid -lf /var/lib/dhcp/dhclient.eth5.leases eth5
b75bf000      4K rw--- /lib/i386-linux-gnu/ld-2.19.so
b75c0000   1732K r-x-- /sbin/dhclient
b7771000      4K r---- /sbin/dhclient
b7772000     12K rw--- /sbin/dhclient
b7775000     44K rw---   [ anon ]
 total     1796K
0
1

You can use awk do do this:

awk -F'[ -]' -v s=7fb4a84f6008 '$1<=s&&s<$2' /proc/id/maps

assuming you can give the searched address (after s=) in the same format as it appears in maps (without 0x and having the same length).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.