"""
end = start + size
for seg in self.iter_segments():
+ # consider LOAD only to prevent same address being yielded twice
+ if seg['p_type'] != 'PT_LOAD':
+ continue
if (start >= seg['p_vaddr'] and
end <= seg['p_vaddr'] + seg['p_filesz']):
yield start - seg['p_vaddr'] + seg['p_offset']
__init__ = object.__init__
def iter_segments(self):
return iter((
- dict(p_vaddr=0x10200, p_filesz=0x200, p_offset=0x100),
- dict(p_vaddr=0x10100, p_filesz=0x100, p_offset=0x400),
+ dict(p_type='PT_PHDR', p_vaddr=0x10100, p_filesz=0x100, p_offset=0x400),
+ dict(p_type='PT_LOAD', p_vaddr=0x10200, p_filesz=0x200, p_offset=0x100),
+ dict(p_type='PT_LOAD', p_vaddr=0x10100, p_filesz=0x100, p_offset=0x400),
))
elf = MockELF()