def map(ea, size, newea, **kwds):
"""Map ``size`` bytes of data from ``ea`` into a new segment at ``newea``.
``name`` can be used to name the segment.
"""
fpos,data = idaapi.get_fileregion_offset(ea),database.read(ea, size)
if len(data) != size:
raise ValueError("{:s}.map({:x}, {:#x}, {:x}) : Unable to read {:#x} bytes from {:#x}".format(__name__, ea, size, newea, size, ea))
res = idaapi.mem2base(data, newea, fpos)
if not res:
raise ValueError("{:s}.map({:x}, {:#x}, {:x}) : Unable to remap {:#x}:{:+#x} to {:#x}".format(__name__, ea, size, newea, ea, size, newea))
return create(newea, size, kwds.get("name', 'map_{:x}".format(ea)))
#return create(newea, size, kwds.get("name', 'map_{:s}".format(newea>>4)))
# creation/destruction
评论列表
文章目录