Method: MemoryIO::Process#bases
- Defined in:
- lib/memory_io/process.rb
#bases ⇒ {Symbol => Integer}
Parse /proc/[pid]/maps to get all bases.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/memory_io/process.rb', line 59 def bases file = "/proc/#{@pid}/maps" stat = MemoryIO::Util.(file) return {} unless stat && stat.readable? maps = ::IO.binread(file).split("\n").map do |line| # 7f76515cf000-7f76515da000 r-xp 00000000 fd:01 29360257 /lib/x86_64-linux-gnu/libnss_files-2.24.so addr, _perm, _offset, _dev, _inode, pathname = line.strip.split(' ', 6) next nil if pathname.nil? addr = addr.to_i(16) pathname = pathname[1..-2] if pathname =~ /^\[.+\]$/ pathname = ::File.basename(pathname) [MemoryIO::Util.trim_libname(pathname).to_sym, addr] end maps.compact.reverse.to_h end |