Dr. Dobb's Journal February 1997
Instrumentation Techniques
Instrumentation, in the context of this article, is the process of adding extra code to monitor a program's behavior. Sometimes object code in the executable image itself is changed; at other times, program flow is diverted by patching entry points to external functions.
Source-code instrumentation adds extra instructions at the source-code level. NuMega's BoundsChecker (with technology licensed from ParaSoft) uses this approach and calls it CTI ("compile time instrumentation," a slight misnomer in my view).
Compile-time instrumentation modifies the actual translation process and adds extra object code that never had a source code representation. This is what Borland's C++ compiler does for the benefit of CodeGuard.
Link-time instrumentation uses the properties of the (static) link process to intercept calls to selected library functions and replace them with calls to equivalent, but instrumented versions of them. CodeGuard uses this technique.
Object-code instrumentation takes a ready-to-run executable module and inserts additional code into it, based on an object-code-level analysis of the program flow. Pure Software's Purify is the prime example of this instrumentation technique.
Run-time instrumentation, finally, defers instrumentation to the time when the executable program image is loaded into memory, and only then modifies entry points or uses notifications (including processor exceptions) to get control at critical points. BoundsChecker uses this mode of instrumentation.
-- R.v.d.W.
Copyright © 1997, Dr. Dobb's Journal