开发者

get pointer for CallInst?

开发者 https://www.devze.com 2023-03-31 21:25 出处:网络
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 fu

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, varia开发者_StackOverflow社区ble object itself, name, something):

int main() {
    int (*ptr1)(int) = &f1;
    ptr1(42);
    return 0;
}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消