Пример #1
0
def call_targets_of(addr):
    targets = []
    code, data = flatland.explore(tp, addr)
    for block in code.values():
        for inst in block.opcodes:
            if inst[0] == "BL":
                targets.append(inst[1])
    return tuple(targets)
Пример #2
0
    #bkk = 0x080003a4
    cg = callgraph(kk)
    print("----------------- <<")
    for uen, wev in cg.items():
        print(".-", names.get(uen, hex(uen)))
        for ten in wev:
            print("    +- "+names.get(ten, hex(ten)))
    print("----------------- >>")
    #pprint(cg)
    flatselect(cg, kk, names)
    print()

entrypoint = 0x0806CFF4
entrypoint = 0x080003a4

code, data = flatland.explore(tp, entrypoint)

print(type(code), type(data))
print(code, data)

if 0:
    c, r = flow.strong(code[entrypoint])
    pprint(r)
    code[entrypoint].pred.add(None) # mark the entrypoint
    c_e, mm = i = flow.loops(code[entrypoint], c, r)

if 0:
    gen = codegen.CCodeGen(names)
    flow.noncyclic(gen, c_e)
    print(gen.join())