def ext_repr(x): if is_addr(x): return x.addr if is_value(x): return hex(x.val) if is_expr(x): if x.op == "+" and len(x.args) == 2: if is_value(x.args[1]): x = EXPR("+", [x.args[1], x.args[0]]) return str(x) return str(x)
def trace(bblock, mapping): for inst in bblock.items: args = inst.args if len(args) == 1 and is_expr(args[0]): args = args[0].args for r in inst.uses(cfg): if r in mapping: mapping[r].comments["uses"].append(inst.addr) for dest in inst.defs(regs_only=False): mapping[dest] = inst inst.comments["uses"] = []