CA2292123C

Method and system for modifying executable code to add additional functionality

Abstract

A system for modifying a compiled executable code file by addingpatches that add functionality when the modified executable code file is executed. Themodifying is performed without recompiling, relinking or rewriting the code file.Adding a patch involves creating a patch handler which when executed causes thepatch statements to be executed, and may involve replacing one or more existingcompiled instructions in the file with patching instructions to transfer flow ofexecution to the appropriate patch handler. The instructions replaced by the patchinginstructions can also be added to the patch handler. Patches can also include codestatements which form a complete module, such as an invokable routine, which can bereferenced by other patch statements to cause the module to be executed. Specializedtrace requests can also be added as patch statements. The trace requests will makespecified information about the current execution of the executable code file availableto a software developer. Patch statements can include variables and expressions thatwill be evaluated in the context of the appropriate current variable scope, regardless ofwhether 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 executionwithout removing the patching instructions from the compiled executable file. Patchescan also be qualified with conditions such that the patch will be executed only whenthe conditions are true at the time of execution.

CA2292123C, drawing sheet 1
Sheet 1 of 10

Term

Term ended

Expired 8 December 2019, 6.8 years ago.

  1. Priority
  2. Filed
  3. Granted
  4. Expired
  5. Today

13 claims: 1 independent, 12 dependent

  1. 1
    CA 02292123 2003-06-02 CLAIMS 1. A method for modifying a compiled file loaded on a target computer, the loaded compiled file including a plurality of instructions executable on the target computer, the method comprising:modifying the loaded compiled file by, under control of a source computer, receiving an indication to modify the loaded compiled file by adding at least one instruction to be executed upon execution of the loaded compiled file;creating a patch group including a plurality of instructions, the plurality of instructions including the indicated at least one instruction;and replacing an instruction in the loaded compiled file with a patch instruction;and loading the patch group into a first portion of memory on the target computer distinct from a second portion of memory on the target computer containing the loaded compiled file;and on the target computer, executing the instructions in the modified loaded compiled file by, when an instruction to be executed is the patch instruction, indicating one of the plurality of instructions in the loaded patch group as a next instruction to be executed.