def offset_from_vma(vma, size = 0)
      segments_by_type(:load) do |seg|
        return seg.vma_to_offset(vma) if seg.vma_in?(vma, size)
      end
    end
def offset_from_vma(vma, size = 0)
      segments_by_type(:load) do |seg|
        return seg.vma_to_offset(vma) if seg.vma_in?(vma, size)
      end
    end
Get the offset related to file, given virtual memory address.

 This method should work no matter ELF is a PIE or not.
 This method refers from (actually equals to) binutils/readelf.c#offset_from_vma.
 @param [Integer] vma The virtual address to be queried.
 @return [Integer] Related file offset.
 @example
   elf = ELFTools::ELFFile.new(File.open('/bin/cat'))
   elf.offset_from_vma(0x401337)
   #=> 4919 # 0x1337