// Replace all instance of calling of egl_*() function with the following
block:
{
// local static that control and if the special diag code will be call.
static struct { int control; int value; char* file=__FILE__; int
line=__LINE__; } oCtrl;
if (oCtrl->control==NOT_REGISTER) my_diag_register(oCtrl);
else if (oCtrl->control==LOG_DIAG) my_diag_call(oCtrl);
egl_*(....) // call the same function usb_*() function
}
With this, I like to dynamically turn on/off the call to my_diag_call()
at run time.
If it is possible, is there any similar "code transformation" .py script I
can follow to figure out how to do this myself?
Thanks
-Tony
p.s. On a related note, I love to see a sample gcc-plugin .py script that
wrap C function() call with profiling code that collect call count and call
duration with rdtsc, etc.