Tracking a Method

Use the startMethodTracking method of the Process class to initiate method tracking for the receiving process. If tracking is not enabled, an attempt to use the startMethodTracking method results in an exception being raised.

The receiving Process instance can be any current process, including the current process. The parameters of the startMethodTracking method are listed in the following table.

Parameter Description
targetMethod Method to be tracked.
preambleMethod Method to be invoked just before calling the target method.
postambleMethod Method to be invoked just after returning from executing the target method (that is, after any epilog code in the target method has been executed).
receiver Receiver for the preamble and postamble methods. The receiver object must be accessible by the target process.

The following methods cannot be tracked.

Method tracking is not currently supported for serverExecution methods.

To avoid repeated calls and kernel stack overflow exceptions, the tracking method should not track itself or any of the methods that it calls.

The stopMethodTracking method of the Process class turns off method tracking of the target method by the receiving process.