如何在LLVM项目中使用interception.h中的INTERCEPTOR?

问题描述

我想截取一些函数并为其添加一些特性。

我发现llvm-project中有拦截器。 https://github.com/llvm/llvm-project/blob/1a2eaebc09c6a200f93b8beb37130c8b8aab3934/compiler-rt/lib/interception/interception.h

在文档中他们说 我们可以通过定义 INTERCEPTOR(return type,function name,args ...){} 来拦截函数调用 INTERCEPT_FUNCTION(函数名)。

所以我定义了 INTERCEPTOR(void,free,void* p){ //print message} 并在compiler-rt文件中执行了INTERCEPT_FUNCION(free)。

但是我遇到了以下错误

undefined reference to `__interception::InterceptFunction(char const*,unsigned long*,unsigned long,unsigned long)'

我认为它需要更多信息或实施。

有没有人知道如何解决这个错误

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)