获取 CallInst 的指针?
我正在研究 LLVM pass,我对函数指针的调用感兴趣。除了知道指针实际指向什么(或实际将调用什么)之外,我还想拥有函数指针本身。
因此,从 CallInst::getCalledValue() 中,我可以获得将被调用的函数,我想要实际使用的函数指针。
在此示例中,我想获取 ptr1 (地址、变量对象本身、名称等):
int main() {
int (*ptr1)(int) = &f1;
ptr1(42);
return 0;
}
I'm working on a LLVM pass where I'm interested in calls on function pointers. Besides from knowing what the pointer actually points too (or what will actually be called) I would like to have the function pointer itself.
So from CallInst::getCalledValue()
I can get the function that will be called, I want the function pointer that was actually used.
In this example, I would like to get ptr1
(address, variable object itself, name, something):
int main() {
int (*ptr1)(int) = &f1;
ptr1(42);
return 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么你就不需要处理pass,而应该修改clang以通过函数指针进行调用并将信息放在某处。
Then you aren't working on a pass and should just modify clang to get you calls through function pointers and put out the information somewhere.