def tag_write(func, key, none):
'''Removes the tag identified by ``key`` from the function ``func``.'''
#fn = by(func)
# Check to see if function tag is being applied to an import
try:
rt,ea = __addressOfRtOrSt(func)
except LookupError:
# If we're not even in a function, then use a database tag.
logging.warn('{:s}.tag_write : Attempted to clear tag for a non-function. Falling back to a database tag. : {:x}'.format(__name__, func))
return database.tag_write(func, key, none)
# If so, then write the tag to the import
if rt:
logging.warn('{:s}.tag_write : Attempted to set tag for a runtime-linked symbol. Falling back to a database tag. : {:x}'.format(__name__, ea))
return database.tag_write(ea, key, none)
# Otherwise, it's a function.
fn = by_address(ea)
# if the user wants to remove the '__name__' tag then remove the name from the function.
if key == '__name__':
return set_name(fn, None)
state = internal.comment.decode(comment(fn, repeatable=1))
res = state.pop(key)
comment(fn, internal.comment.encode(state), repeatable=1)
internal.comment.globals.dec(fn.startEA, key)
return res
#FIXME: define tag_erase
评论列表
文章目录