Inspection of binary file's mapping

336 Views Asked by At

If I run some program under Linux I can see in /proc/pid/smaps that part of its binary is mapped to physical memory. For example:

08047000-0804d000 r-xp 00000000 b4:04 2845       /usr/bin/test_prog
Size:                 24 kB
Rss:                  20 kB
Pss:                  20 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:        20 kB
Private_Dirty:         0 kB
Referenced:           20 kB
...

(mapped 20 out of 24 kB)

How can I see exactly which parts of binary is mapped? If I understand right, according to this answer field address in /proc/pid/maps shows starting and ending addresses of whole file in virtual memory. Which tool can I use to investigate which part of virtual memory, where binary is loaded, mapped to RAM?

1

There are 1 best solutions below

0
On BEST ANSWER

/proc/pid/pagemap can give such information. Documentation is here.