I had to define a new set of wrappers for existing methods. These new wrappers intend to help in debugging by including certain tracing information.
Original Source Code:
Sample.c ::
Caller{
void functionA(){
funcB();
}
}
Callee{
void funcB(){
}
}
Modified Code with Traditional Wrapper Functionality:
Sample.h ::
#define funcB wrapperFuncB //not visible to Callee
Caller{
void functionA(){ //this gets redirected to wrapperFuncB cos of #define
funcB();
}
}
Callee{
void wrapperFuncB(){
if(DEBUG){ //value of DEBUG is set at runtime
//COLLECT Trace data
}else{
funcB();
}
}
void funcB(){
}
}
This mechanism has the additional overhead of : 1] All calls to funcB is routed to wrapperFuncB, irrespecitve of DEBUG enabled or not 2] An additional method frame [wrapperFuncB] has to be created, irrespecitve of DEBUG enabled or not 3] An overhead of a conditional check