Inconsistency-based bug detection
AssigneeAmazon Technologies, Inc.
InventorsHangqi Zhao, Qiang Zhou, Sengamedu Hanumantha Rao Srinivasan
Life of this patent
Estimating the term…
Abstract
A system identifies a pattern in source code. The pattern is identified based, at least in part, on correlation between units of code, or on the derivation of a rule from a recurring sequence in the source code. The system identifies a portion of the source code that at least partially matches the pattern, and determines that this portion includes at least one deviation from the pattern. The system then generates an error message to describe the deviation.
Claims20
A computer-implemented method, comprising:
- generating a plurality of code units corresponding to a plurality of portions of source code by at least one of a lexical analyzer and a semantic analyzer;
- identifying one or more patterns in source code, wherein patterns of two code units are identified based, at least in part, on correlation between two units of code, and patterns of two or more code units are identified based, at least in part, on a rule derived from a recurring sequence in the source code;
- determining that a portion of source code matches a part of a pattern and also contains at least one deviation from the pattern;
- and
- generating a message to indicate the portion of the source code contains an error based on the deviation.
A system, comprising:
- one or more processors;
- and
- memory storing instructions that, in response to execution by the one or more processors, cause the system to at least:
- generate a plurality of code units corresponding to a plurality of portions of source code by at least one of a lexical analyzer and a semantic analyzer;
- identify one or more patterns in source code, wherein patterns of two code units are identified based at least in part on recurrence of a bigram in the source code, and patterns of two or more code units are identified based at least in part on a rule derived from a recurring sequence in the source code;
- determine that a portion of the source code at least partially matches a pattern, and that the portion of the source code comprises a deviation from the pattern;
- and
- generate, based at least in part on the deviation, an error message indicating the portion of the source code contains an error.
A non-transitory computer-readable storage medium comprising executable instructions that, as a result of being executed by one or more processors of a computer system, cause the computer system to:
- generate a plurality of code units corresponding to a plurality of portions of source code by at least one of a lexical analyzer and a semantic analyzer;
- identify one or more patterns in source code, wherein patterns of two code units are identified based, at least in part, on recurrence of a bigram in the source code of the two code units, and patterns of two or more code units are identified based, at least in part, on a rule obtained from a sequence in the source code determined to be recurring;
- identify a portion of source code matches at least part of a pattern but comprises at least one deviation from the pattern;
- and generate, based at least in part on the at least one deviation, a message to indicate that the portion of the source code contains an error.
Dependencies are inferred from the claim text.