I need to get the filenames of all memory mapped libraries of the current application. Currently I'm going through all mapped libraries via vm_region. Sadly it doesn't provide information about the filename of the current region. Is there a way to get this information in c without doing popen on vmmap ?
Asked
Active
Viewed 1,059 times
4
-
1Does this post help? http://stackoverflow.com/questions/1627998/retrieving-the-memory-map-of-its-own-process-in-os-x-10-5-10-6 – askmish Oct 19 '12 at 11:05
1 Answers
1
- For regular
mmap-ed files you can useproc_regionfilename() - For libraries from dyld_shared_cache you get "/private/var/db/dyld/dyld_shared_cache_x86_64" as the path and need to find the actual library name.
- https://code.google.com/p/psutil/issues/detail?id=260 speculates you can parse dyld_shared_cache_*.map file to get this info.
- https://stackoverflow.com/a/15714052/1026 points to another implementation, http://newosxbook.com/src.jl?tree=listings&file=12-1-vmmap.c