Relocatable instrumentation tags for testing and debugging a computer program
First Claim
1. A method in a computer system for instrumenting a computer program having a plurality of source code modules, the method comprising:
- for each source code module,generating a base variable having a name that is unique to the source code module;
for each instrumentation point in the source code module,generating an offset value that is unique within the source code module to the instrumentation point; and
inserting a tagging assignment statement at the instrumentation point, the tagging assignment statement for setting a tagging variable to a combination of the generated offset value and a value of the base variable; and
compiling the instrumented source code module;
for each generated base variable, generating a source code statement that sets the base variable to a unique value such that combination of a generated offset value and of a value of base variable uniquely identifies each instrumentation point and the unique value of the tagging variable at each instrumentation point avoids a predetermined range of values;
compiling the generated source code statements; and
linking the compiled instrumented source code modules with the compiled generated source code statements to form a linked program so that during execution of the linked program the tagging variable is set to a unique value at each instrumentation point.
8 Assignments
0 Petitions
Accused Products
Abstract
A method and apparatus for producing a plurality of unique instrumentation tags for testing and debugging a computer program. The tags have a value equal to the combination of an offset and a base. The value for a tag offset is first determined. The tag is then inserted into an area of interest within the source code being instrumented. The base value is set when the object code for the computer program is linked to form executable code. The base value is resolved such that each tag has a unique value in comparison with any other tag. The source code being instrumented with tagging statements can reside on more than one computer. Moreover, the instrumented source code can be compiled on more than one computer. The unique value associated with each tagging statement is recorded in an instrumentation database, which facilitates observation of the instrumented program during its execution.
-
Citations
17 Claims
-
1. A method in a computer system for instrumenting a computer program having a plurality of source code modules, the method comprising:
-
for each source code module, generating a base variable having a name that is unique to the source code module; for each instrumentation point in the source code module, generating an offset value that is unique within the source code module to the instrumentation point; and inserting a tagging assignment statement at the instrumentation point, the tagging assignment statement for setting a tagging variable to a combination of the generated offset value and a value of the base variable; and compiling the instrumented source code module; for each generated base variable, generating a source code statement that sets the base variable to a unique value such that combination of a generated offset value and of a value of base variable uniquely identifies each instrumentation point and the unique value of the tagging variable at each instrumentation point avoids a predetermined range of values; compiling the generated source code statements; and linking the compiled instrumented source code modules with the compiled generated source code statements to form a linked program so that during execution of the linked program the tagging variable is set to a unique value at each instrumentation point. - View Dependent Claims (2, 3, 4)
-
-
5. A system for instrumenting a computer program having a plurality of source code modules with a plurality of tagging assignment statements, each tagging assignment statement for specifying a unique value for a tagging variable by combining an offset value with a base value, the system comprising:
-
an offset tagging instrumenter which inserts tagging assignment statements into source code modules of the computer program and which generated the offset value for each tagging assignment statement; and a base value resolver which generates the base value for each source code module of the plurality of source code modules such that the value of the tagging variable is unique at each tagging assignment statement, wherein the base value resolver retrieves a range of previously assigned values for the tagging variable and determines the base value such that the value of the tagging variable at each tagging variable assignment statement avoids the range of previously assigned values for the tagging variable. - View Dependent Claims (6, 7)
-
-
8. A method for producing a plurality of unique values for a tagging variable used for instrumenting a computer program, the method comprising:
-
for each instrumentation point in the computer program, inserting a tagging assignment statement that sets the tagging variable to a value; generating object code for the computer program with the inserted tagging assignment statements; when object code of the computer program is linked to form executable code, adjusting the computer program so that each tagging assignment statement sets the tagging variable to a unique value, wherein the computer program includes a plurality of modules and the tagging assignment statement combines a tagging offset value with a tagging base value to generate the value such that the combination uniquely identifies each instrumentation point, and wherein a base value for each module is established when the computer program is adjusted. - View Dependent Claims (9, 10, 11)
-
-
12. A method for instrumenting with tagging assignment statements a plurality of source code modules for a computer program to support testing of the computer program, the method comprising:
-
setting an offset value for a tagging assignment statement; inserting the tagging assignment statement into a source code module that assigns a combination of the set offset values and a base value to a tagging variable; and setting the base value for the tagging assignment statement when object code representing the computer program is linked to form executable code, wherein the base value is resolved such that the value of the tagging variable in a tagging variable assignment statement is unique, wherein a highest value for the offset value in each source code module is set sufficiently large to provide for later insertion of a predetermined number of new tagging assignment statements such that the value of the tagging variable in all tagging assignment statements in the computer program will still be unique. - View Dependent Claims (13)
-
-
14. A computer-readable medium containing instructions for causing a computer system to produce a plurality of unique values for a tagging variable used for instrumenting a computer program, by:
-
for each instrumentation point in the computer program, inserting a tagging assignment statement that sets the tagging variable to a value; generating object code for the computer program with the inserted tagging assignment statements; when object code of the computer program is linked to form executable code, adjusting the computer program so that each tagging assignment statement sets the tagging variable to a unique value, wherein the computer program includes a plurality of modules the tagging assignment statement combines a tagging offset value with a tagging base value to generate the value such that the combination uniquely identifies each instrumentation point and wherein a base value for each module is established when the computer program is adjusted. - View Dependent Claims (15, 16, 17)
-
Specification