Patent ID: 7484205

Claim:
A computer-implemented method for instrumenting software, the method comprising: receiving a source code file containing source code to be instrumented; performing first lexical and syntactic analyses on the source code to build a syntax tree representing the source code; using one or more defect modules: analyzing the syntax tree representing the source code to identify a location in the source code file of at least one code segment in the source code to instrument to detect one or more types of defects potentially occurring at runtime, the one or more types of defects including runtime errors which potentially occur when executing compiled code based on the at least one code segment; and determining, as a result of analyzing the syntax tree, at least one source code modification to perform to the at least one code segment in the source code file to instrument the at least one code segment in the source code according to the one or more types of defects to potentially be detected; recording XML directives describing the at least one determined modification in an instrumentation directive file, the directives specifying changes to be made to the source code at one or more lines in the source code file and at one or more offsets within the one or more lines to describe how to instrument the at least one code segment by performing the determined source code modification; after the directives are recorded in the instrumentation directive file by the defect modules, instrumenting the source code by applying the changes to the source code file at the one or more lines and the one or more offsets as indicated by the directives in the instrumentation directive file to create instrumented source code comprising instrumented versions of the at least one identified code segment; compiling the instrumented source code to create an instrumented compiled version of the source code.