A system for modifying a compiled executable code file by adding patches that
add
functionality when the modified executable code file is executed. The modifying
is performed without recompiling, relinking or rewriting the code file. Adding
a patch involves creating a patch handler which when executed causes the patch
statements to be executed, and may involve replacing one or more existing compiled
instructions in the file with patching instructions to transfer flow of execution
to the appropriate patch handler. The instructions replaced by the patching instructions
can also be added to the patch handler. Patches can also include code statements
which form a complete module, such as an invokable routine, which can be referenced
by other patch statements to cause the module to be executed. Specialized trace
requests can also be added as patch statements. The trace requests will make specified
information about the current execution of the executable code file available to
a software developer. Patch statements can include variables and expressions that
will be evaluated in the context of the appropriate current variable scope, regardless
of whether the scope is defined within the patch or by existing compiled instructions.
After patches have been added, they can be disabled so as to prevent their execution
without removing the patching instructions from the compiled executable file. Patches
can also be qualified with conditions such that the patch will be executed only
when the conditions are true at the time of execution.