我想要的是一个能够告诉我哪些函数调用特定函数 A()(在 C 项目中)以及哪些函数调用这些函数等的工具,以便我可以拥有一个我知道什么时候的函数列表它们被调用时,函数 A() 可能会被调用。
例如我们在一个项目中分散了以下函数:
void A()
{ /*does something*/ }
void B()
{
A();
/*and more stuff*/
}
void C()
{
if(unlikely_to_be_false)
A()
/* moar stoff */
}
void D()
{
/* code that does not refer to A() at all */
}
void E()
{
C()
}
当使用参数 A 运行很棒的工具时,它将以某种方式返回函数 BC 和 E。
接近于此但不完全是我想完成的:给定项目中某处的变量,找到对其的所有读/写操作(直接或间接)。
例如:
void A()
{
char* c; // this is our little variable
B(c); // this is in the resulting list
}
void B(char* x)
{
printf("%c", x); // this is definately in the list
*x='d' // this is also in the list
C(x); // also in the list
}
void C(void* ptr)
{
ptr = something; // also in the list
}
如果上述内容可以与 emacs 很好地配合,我将非常高兴!