Example #1
0
    def clear_function(self, object_version, address):

        for ((xref_offset, operand),
             xref_list) in object_version.get_xrefed_id_map().iteritems():
            for (xref_value, xref_attributes) in xref_list:
                size = None
                try:
                    size = self.yatools.hex_string_to_address(
                        xref_attributes["size"])
                except:
                    pass
                if size is not None:
                    ea = address + xref_offset
                    # sometime, another function might have taken that piece of code for her
                    func_at_ea = idaapi.get_func(ea)
                    if func_at_ea is not None:
                        logger.debug(
                            "type(address) = %s, type(func) = %s, type(startEA) = %s"
                            % (type(address), type(func_at_ea),
                               type(func_at_ea.startEA)))
                        logger.debug(
                            "looking for tail : %s %r, address=0x%08X" %
                            (func_at_ea, func_at_ea.startEA, address))
                        if func_at_ea.startEA != address:
                            logger.warning(
                                "Removing func tail 0x%08X from func 0x%08X" %
                                (address, func_at_ea.startEA))
                            idaapi.remove_func_tail(func_at_ea, address)
Example #2
0
def removeChunk(fn, ea):
    if type(fn) is idaapi.func_t:
        return idaapi.remove_func_tail(fn, ea)
    return removeChunk(by(fn), ea)
Example #3
0
def removeChunk(fn, ea):
    if type(fn) is idaapi.func_t:
        return idaapi.remove_func_tail(fn, ea)
    return removeChunk(by(fn), ea)
import idaapi

for i in range(idaapi.get_fchunk_qty()):
    chunk = idaapi.getn_fchunk(i)
    if not idaapi.is_func_tail(chunk):
        continue

    ea = chunk.start_ea
    print("removing tail 0x%016x" % ea)
    parent = idaapi.get_func(ea)
    idaapi.remove_func_tail(parent, ea)
    idaapi.add_func(ea)