Exemple #1
0
def mark(ea, message):
    # FIXME: give a warning if we're replacing a mark at the given ea
    res = set((n for n, _ in marks()))
    if ea in res:
        idx, comm = (comm for i, (n, comm) in enumerate(marks()) if n == ea)
        logging.warn("Replacing mark %d at %x : %r", idx, ea, comm)
    idc.MarkPosition(ea, 0, 0, 0, len(res) + 1, message)
Exemple #2
0
 def yatest_bookmarks(self):
     logger.info("yatest_bookmarks")
     addrs = []
     for i in range(0, 3):
         addr = yaunit.get_next_function()
         logger.info("yatest_bookmarks:0x%08X : %d", addr, i)
         idc.MarkPosition(addr, 1, 1, 1, i+1, 'bookmark_%d' % i)
         addrs.append(addr)
     yaunit.save('bookmarks', addrs)
Exemple #3
0
def delete_comment_at_ea(ea, comment_type):
    logger.debug("Deleting comment at 0x%08X / %d" % (ea, comment_type))
    if comment_type == ya.COMMENT_REPEATABLE:
        idc.MakeRptCmt(ea, "")
        # TODO: remove the test with "comment" (temporary fix because of cache incoherency)
    elif comment_type == ya.COMMENT_NON_REPEATABLE or comment_type == "comment":
        idc.MakeComm(ea, "")
    elif comment_type == ya.COMMENT_ANTERIOR:
        for i in xrange(0, idaapi.get_first_free_extra_cmtidx(ea, idaapi.E_PREV)):
            idaapi.del_extra_cmt(ea, idaapi.E_PREV + i)
    elif comment_type == ya.COMMENT_POSTERIOR:
        for i in xrange(0, idaapi.get_first_free_extra_cmtidx(ea, idaapi.E_NEXT)):
            idaapi.del_extra_cmt(ea, idaapi.E_NEXT + i)
    elif comment_type == ya.COMMENT_BOOKMARK:
        # parse marked position
        for i in xrange(1, 1024):
            if idc.GetMarkedPos(i) == idc.BADADDR:
                break
            elif idc.GetMarkedPos(i) == ea:
                idc.MarkPosition(ea, 0, 0, 0, i, "")
Exemple #4
0
def mark(ea, message):
    # TODO: give a warning if we're replacing a mark at the given ea
    nextmark = len(list(marks())) + 1
    idc.MarkPosition(ea, 0, 0, 0, nextmark, message)