Function Pointers

update: Function pointer support added with Understand 5.0

Function pointers will befuddle pretty much any static analysis tool. With Understand, we associate dependence between the function and where its address is taken. This can work pretty well in some types of code, but not so well in others (for instance table/array driven setups where the taking of the address is well away from where it is actually used).

As an alternative, you can modify your code to display function calls in Understand, but actually compile with function pointers. To do this use the __UNDC__ macro which is automatically defined in Understand, but not in the compiler

So in your top level include file add something like:

//Enable tracking pointers with Understand_C
#ifdef __UNDC__
#define func_pointer(x) x()
#define func_pointer(x)

Then change your function pointer calls from:




You can use the same concept to trace a function call in Understand that is not being directly made in the code, e.g. made with tables etc.

#ifdef __UNDC__
#define undcforcecall(x) x();

then simply add the following wherever you want to track a call to foo();