Method and system for modifying executable code to add additional functionality
First Claim
1. A method for modifying an executable file including a plurality of compiled instructions, the compiled instructions natively executable on a target computer but not on a source computer, the modifying performed under control of the source computer without recompiling or relinking or rewriting the executable file, the method comprising:
- under control of the source computer, (a) loading the executable file onto the target computer;
(b) receiving a plurality of indications to modify the loaded executable file, each indication specifying one of the compiled instructions in the loaded executable file and at least one non-compiled executable instruction to be added to the loaded executable file;
(c) modifying the loaded executable file by, for each indication, creating an instruction group including the specified at least one non-compiled executable instruction;
converting the instruction group into an executable non-compiled format not specific to the target computer; and
replacing the specified compiled instruction in the loaded executable file with an executable patch instruction associated with the converted instruction group, the patch instruction when executed to transfer flow of execution to the converted instruction group with which the patch instruction is associated; and
(d) loading the converted instruction groups into at least one memory area on the target computer, the at least one memory area distinct from a memory area on the target computer containing the loaded executable file; and
under control of the target computer, executing the modified loaded executable file by, as the flow of execution sequentially reaches each executable instruction, (e) when the executable instruction is a non-compiled executable instruction from an instruction group, interpretively evaluating the executable instruction;
(f) when the executable instruction is a patch instruction, transferring flow of execution to the loaded associated converted instruction group; and
(g) when the executable instruction is a compiled instruction, natively executing the compiled executable instruction, so that additional functionality is exhibited when the modified loaded executable file is executed on the target computer.
15 Assignments
0 Petitions
Accused Products
Abstract
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.
83 Citations
75 Claims
-
1. A method for modifying an executable file including a plurality of compiled instructions, the compiled instructions natively executable on a target computer but not on a source computer, the modifying performed under control of the source computer without recompiling or relinking or rewriting the executable file, the method comprising:
-
under control of the source computer, (a) loading the executable file onto the target computer;
(b) receiving a plurality of indications to modify the loaded executable file, each indication specifying one of the compiled instructions in the loaded executable file and at least one non-compiled executable instruction to be added to the loaded executable file;
(c) modifying the loaded executable file by, for each indication, creating an instruction group including the specified at least one non-compiled executable instruction;
converting the instruction group into an executable non-compiled format not specific to the target computer; and
replacing the specified compiled instruction in the loaded executable file with an executable patch instruction associated with the converted instruction group, the patch instruction when executed to transfer flow of execution to the converted instruction group with which the patch instruction is associated; and
(d) loading the converted instruction groups into at least one memory area on the target computer, the at least one memory area distinct from a memory area on the target computer containing the loaded executable file; and
under control of the target computer, executing the modified loaded executable file by, as the flow of execution sequentially reaches each executable instruction,(e) when the executable instruction is a non-compiled executable instruction from an instruction group, interpretively evaluating the executable instruction;
(f) when the executable instruction is a patch instruction, transferring flow of execution to the loaded associated converted instruction group; and
(g) when the executable instruction is a compiled instruction, natively executing the compiled executable instruction, so that additional functionality is exhibited when the modified loaded executable file is executed on the target computer. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. 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. - View Dependent Claims (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)
-
-
22. A computer-implemented method for adding instructions to be executed to an executable compiled file without recompiling or rewriting the file, the method comprising:
-
receiving an indication to modify the compiled file, the indication specifying a compiled instruction in the compiled file and at least one executable instruction to be added;
modifying the compiled file by, creating a patch group including the specified at least one executable instruction; and
replacing the specified compiled instruction in the compiled file with a patch instruction such that flow of execution will transfer to the created patch group upon execution of the patch instruction; and
storing separate from the patch group the modified compiled file including the patch instruction, so that instructions in the patch group will be executed when the modified compiled file is later executed. - View Dependent Claims (23, 24, 25, 26, 27, 28, 29, 30, 31)
-
-
32. A computer-implemented method for executing a modified compiled file including a plurality of original compiled instructions and at least one patch instruction in place of an original compiled instruction, each patch instruction when executed to transfer flow of execution to an associated patch group including a plurality of instructions, the method comprising:
-
loading the modified compiled file and the associated patch groups into memory; and
executing the modified compiled file by, as the flow of execution reaches each executable instruction, when the executable instruction is an original compiled instruction, natively executing the executable instruction;
when the executable instruction is one of the patch instructions, transferring flow of execution to the associated patch group for the patch instruction; and
when the executable instruction is one of the plurality of instructions from a patch group, interpretively evaluating the executable instruction. - View Dependent Claims (33, 34, 35, 36, 37, 38, 39)
-
-
40. An embedded systems development application for adding instructions to be executed to an executable compiled file without recompiling or rewriting the file, the application comprising:
-
a command subsystem on a source computer for receiving indications to modify the compiled file, the compiled file being on an embedded computer, each indication specifying a compiled instruction in the compiled file and at least one executable instruction to be added; and
a patching subsystem on the source computer for modifying the compiled file by creating for each received indication an associated patch group including the specified at least one executable instruction, and by replacing the specified compiled instruction in the compiled file with a patch instruction such that flow of execution will transfer to the associated patch group upon execution of the patch instruction. - View Dependent Claims (41, 42, 43, 44)
-
-
45. A computer-readable medium containing instructions for controlling a computer system to add instructions to be executed to an executable compiled file without recompiling the file, by:
-
receiving an indication to modify the compiled file, the indication specifying a compiled instruction in the compiled file and at least one executable instruction to be added; and
modifying the compiled file by, creating a patch group including the specified at least one executable instruction; and
replacing the specified compiled instruction in the compiled file with a patch instruction such that flow of execution will transfer to the created patch group upon execution of the patch instruction. - View Dependent Claims (46, 47, 48, 49, 50, 51, 52)
-
-
53. A method for modifying an executable image in a computer system after the executable image is loaded and relocated, the executable image including a plurality of instructions executable on a target computer within the computer system and having a source code representation of at least part of the executable image, the source code representation including a plurality of source code locations associated with sets of instructions in the executable image, the method comprising:
-
(a) receiving an indication to modify a behavior associated with a specified source code location in the source code representation;
(b) creating a patch instruction in response to the indication to modify a behavior associated with the specified source code location;
(c) mapping the specified source code location to the associated set of instructions in the loaded, relocated executable image; and
(d) replacing at least one of the associated set of instructions in the loaded, relocated executable image with the patch instruction. - View Dependent Claims (54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74)
-
-
75. A computer system including a target computer and a source computer, the system for modifying compiled files on an embedded computer, the system comprising:
-
a command subsystem on the source computer, the command subsystem for receiving commands to patch a compiled executable file on the target computer by replacing an executable instruction in the compiled executable file with a patching instruction pointing to a patch handler stored in a memory location distinct from the compiled executable file, the command subsystem further for receiving commands to execute one or more patch handlers in a patch group, the command subsystem further for receiving commands to add trace requests to the compiled executable file on the target computer;
a patch interpreter subsystem on the target computer, the patch interpreter subsystem for interpretively evaluating patch statements stored in a non-natively-executable format on the target computer.
-
Specification