0

我想截取一些功能并为它们添加一些功能。

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

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

所以我定义了 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)'

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

有谁知道如何解决这个错误?

谢谢你。

4

0 回答 0