Check out the new USENIX Web site. next up previous
Next: Interposition on top of Up: DITOOLS Previous: Loading of new functionality

Rebinding and redefinition

We exploit the dynamic-linking data structures for interposition purposes. DITOOLS supports explicit manipulation of bindings between dynamically-linked references and definitions exported by modules. It currently implements two mechanisms: the first one allows changing the target for a given reference (we call it rebinding), and the second one allows `wrapping' (i.e. mediate all the uses of) a given definition (we call it redefinition). While the effects of the first mechanism are selective and leave the original definition untouched, the second one affects all the uses of a definition, effectively hiding it to the outside. Using rebinding we can achieve selective overriding of definitions, while using redefinition we are doing global overriding of definitions.

References and definitions are identified by a pair (module, name). So, a single rebinding can be specified as follows:

(program,read) -> (mymodule,myread)

Meaning that references to `read' done by the module `program' should point to the definition `myread' in the module `mymodule'.

As can be observed, this mechanism is independent of conventional resolution policies based on name matching. This makes possible the coexistence of definitions with the same name in different loaded modules.

Acting over references and definitions individually also proves to have its advantages. On the one hand, we can avoid affecting all the uses of a definition when inserting new functionality. On the other hand, we do not require to subclass the entire library in order to interpose on its interface.

   figure827
Figure 2: Scenarios after rebinding references



Albert Serra, DITools, 2000 USENIX Annual Technical Conference
Tue Apr 25 13:07:07 MET DST 2000