如何将多段代码注入代码中的不同位置? [英] How to inject multiple pieces of code into different places in code?

查看:110
本文介绍了如何将多段代码注入代码中的不同位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有不同的代码片段,将在CFG(控制流图)中的每个基本块的末尾插入。我们没有源代码。可执行文件可用。我已经对代码注入做了很多考虑。基本上,我已经了解了二进制检测,有两种类型的仪器:静态和动态二进制检测。静态二进制检测是我工作中需要的。我检查了seveal工具和api。最后我找到了Dyninst api。我安装了它但是在这个时候,我没有注入我的代码。有没有完整的例子描述如何使用Dyninst api。

非常感谢。



我尝试了什么:



T试图使用Dyninst api,但我不能。之后,我尝试根据Ptrace系统调用编写自己的程序。这非常复杂。我检查了PIN inter工具进行检测。我认为,Pin不适用于ststic instrumentation。

解决方案

请参阅 Dyninst API |将性能用于高性能计算 [ ^ ]

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.

解决方案

See Dyninst API | Putting the Performance in High Performance Computing[^]


这篇关于如何将多段代码注入代码中的不同位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆