JonathanSalwan / Triton

Triton is a dynamic binary analysis library. Build your own program analysis tools, automate your reverse engineering, perform software verification or just emulate code.
https://triton-library.github.io
Apache License 2.0
3.4k stars 524 forks source link

Simplify and Lifting expressions via LLVM #1225

Closed Nitr0-G closed 1 year ago

Nitr0-G commented 1 year ago

Hello everyone

How can I simplify and Lifting expressions via LLVM in c++? It doesn't work:

ast::SharedAbstractNode al = ctx.getRegisterAst(ctx.registers.x86_al);
ast::SharedAstContext ast = ctx.getAstContext();
cout << "\nIn: " << ast::unroll(al);
auto RES = ctx.simplifyAstViaLLVM(al);   <-here  I don't get anything in RES => ERROR
cout << "\nOut: " << RES;

Also does not work

typedef basic_seqbuf<char> seqbuf;
....
engines::synthesis::SynthesisResult RES = ctx.synthesize(al, true,false, false);
    seqbuf s;
    std::ostream os(&s);
    os << "OUT::: " << RES.getOutput();
    ast::SharedAbstractNode av = RES.getOutput();
    auto OutPut = engines::lifters::LiftingToLLVM::liftToLLVM(os, av, (const char)"__triton", false);