def __rebase_function(old, new, size, iterable):
key = internal.comment.tagging.__address__
failure, total = [], list(iterable)
for i, fn in enumerate(total):
# grab the contents dictionary
try:
state = internal.comment.contents._read(None, fn)
except LookupError:
logging.fatal("{:s}.rebase : Address {:x} -> {:x} is not a function : {:x} -> {:x}".format(__name__, fn - new + old, fn, old, new))
state = None
if state is None: continue
# now we can erase the old one
res = fn - new + old
internal.comment.contents._write(res, None, None)
# update the addresses
res, state[key] = state[key], {ea - old + new : ref for ea,ref in state[key].iteritems()}
# and put the new addresses back
ok = internal.comment.contents._write(None, fn, state)
if not ok:
logging.fatal("{:s}.rebase : Failure trying to write refcount for {:x} : {!r} : {!r}".format(__name__, fn, res, state[key]))
failure.append((fn, res, state[key]))
yield i, fn
return
评论列表
文章目录