def rvaToOffset(self, rva):
        '''
        Convert an RVA for this ELF binary to a file offset.
        '''
        baseaddr = 0
        #if self.isPreLinked() or not self.isSharedObject():
        #if not self.isSharedObject():
            #print 'SUBTRACTING CALCULATED BASE'
            #baseaddr = self.getBaseAddress()

        for pgm in self.pheaders:
            if pgm.p_type != PT_LOAD:
                continue
            phrva = baseaddr - pgm.p_vaddr
            if rva < phrva:
                continue
            if rva >= phrva+pgm.p_memsz:
                continue
            print 'pgm',hex(pgm.p_vaddr),hex(phrva),hex(rva)
            # We are inside this pgrm header!
            rvaoff = rva - phrva
            return pgm.p_offset + rvaoff

        raise 'omg',hex(rva)
        return None
dataset/ETHPy150Open columbia/libtrack/libtrack/elfmod/Elf/__init__.py/Elf.rvaToOffset/swapped operands of `-`