A method instruments a function in an executable file so that the
instrumented function calls a generic preprocessor prior to execution of
the body of the function. After the preprocessor modifies the original
function's incoming parameters, the body of the function itself is
executed. Finally, execution is directed to a generic postprocessor prior
to returning from the function. The postprocessor modifies the outgoing
parameters and return value. In one implementation, the parameters of an
instrumented function are described and packaged into a descriptor data
structure. The descriptor data structure is passed to the generic
preprocessor and postprocessor. A generic processor uses the descriptor
to select changed behaviors based on the calling context.