Fix hopper-exported length for procedures

This commit is contained in:
Jack Andersen 2018-05-15 15:12:55 -10:00
parent cfeafb1296
commit 3cf7c2665e
3 changed files with 32728 additions and 32725 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -35,8 +35,11 @@ if save_loc is not None:
elif type == Segment.TYPE_UNICODE: elif type == Segment.TYPE_UNICODE:
objects.append(CodeObject('WSTR', label_name, addr, length)) objects.append(CodeObject('WSTR', label_name, addr, length))
elif type == Segment.TYPE_PROCEDURE: elif type == Segment.TYPE_PROCEDURE:
objects.append(CodeObject('FUNC', label_name, addr, length))
proc = seg.getProcedureAtAddress(addr) proc = seg.getProcedureAtAddress(addr)
maxAddr = addr
for bb in proc.basicBlockIterator():
maxAddr = max(maxAddr, bb.getEndingAddress())
objects.append(CodeObject('FUNC', label_name, addr, maxAddr - addr + length))
for lvar in proc.getLocalVariableList(): for lvar in proc.getLocalVariableList():
if not lvar.name().startswith('var_') and not lvar.name().startswith('arg_'): if not lvar.name().startswith('var_') and not lvar.name().startswith('arg_'):
objects.append(CodeObject('LVAR', lvar.name(), addr, lvar.displacement())) objects.append(CodeObject('LVAR', lvar.name(), addr, lvar.displacement()))