I have function: foo()
I want to write a #define
to put 'infront' of foo()
(a shim I guess) to add debug to the front of foo()
.
So the #define
should look this this:
#define foo(dev) { \
printk("%s: get %lx\n", (dev)->name); \
foo_orig(dev); \
}
And then I rename foo()
to foo_orig()
.
This works OK if foo()
function is called in 'isolation' like this:
foo(dev);
BUT, if its called within an if()
then it is a compile problem...
if (something() && foo(dev)) {
..
Have I explained the issue? and Is there a solution for this?
The problem is that I really need the shim as define because I need the code to live in the calling function rather than foo()
.
[The reason for this is because I need to dump out the EIP the the calling function for debug reasons (i.e. I need to know who is calling foo()
].