def remove(segment, remove=False):
"""Remove the segment identified by ``segment``.
If the bool ``remove`` is specified, then remove the content of the segment from the database.
"""
if not isinstance(segment, idaapi.segment_t):
raise TypeError("{:s}.remove({!r}) : segment is not of an idaapi.segment_t. : {!r}".format(__name__, segment, type(segment)))
res = idaapi.del_selector(segment.sel)
if res == 0:
logging.warn("{:s}.remove({!r}):Unable to delete selector {:x}".format(__name__, segment, segment.sel))
res = idaapi.del_segm(segment.startEA, idaapi.SEGMOD_KILL if remove else idaapi.SEGMOD_KEEP)
if res == 0:
logging.warn("{:s}.remove({!r}):Unable to delete segment {:s} : {:s}".format(__name__, segment, segment.name, segment.sel))
return res
评论列表
文章目录