I have different pieces of code which are going to be inserted at the end of each basic block in CFG (Control Flow Graph). We don't have the source code. An executable file is available. I have readed a lot about code injection. Basically, I have readed about binary instrumentation, there are two types of instrumentations: Static and Dynamic binary instrumentation. Static binary instrumentation is what I need in my work. I have checked seveal tools and api. Finally I found Dyninst api. I installed it but at this time, I failed to inject my code. Is there any full example describes how to use the Dyninst api.
Thanks a lot.
What I have tried:
T have tried to use Dyninst api but I couldn't. After that, I tried to write my own program based on Ptrace system call. It is very complex. I have check PIN inter tool for instrumentation. I think, Pin is not suitable for ststic instrumentation.