Static Analysis Defect Detection Using Virtual Function Knowledge Base
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Static analysis tools struggle to accurately detect errors in computer program code, particularly with virtual functions, as they do not consider the dynamic effects of program execution, leading to incomplete analysis and potential missed defects.
Innovation Solution
A computer-implemented method using a Function Behaviour Knowledge Base (FBKB) to identify and analyze the possible runtime types of virtual functions, reducing the set of object runtime types that may cause defects, and reporting errors based on expected events.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Speed
If static analysis tools analyze virtual function calls without considering runtime behavior, then analysis speed is improved, but measurement precision deteriorates
Solution Approach 1:
The patent pre-computes and stores function behavior information in a knowledge base before static analysis. This includes pre-analyzing virtual function implementations and their potential runtime behaviors, so that during actual static analysis, the tool can quickly retrieve pre-computed information without performing complex runtime simulations, thus maintaining both speed and precision
Solution Approach 2:
The patent introduces a function behavior knowledge base as an intermediary between the static analysis tool and the virtual function implementations. This knowledge base stores pre-analyzed behavior patterns and acts as a mediator that provides precise runtime behavior information without requiring the static analysis tool to directly simulate execution, resolving the contradiction between analysis speed and precision
2Measurement precision
If static analysis tools consider all possible runtime types of virtual functions, then measurement precision is improved, but device complexity deteriorates
Solution Approach 1:
The patent extracts and stores function behavior information into a separate knowledge base, removing the complexity of analyzing all possible runtime types directly from the static analysis tool. The knowledge base contains pre-computed information about virtual function behaviors, allowing the analysis tool to query specific behaviors without managing the complexity of all possible runtime type combinations
Solution Approach 2:
The system performs preliminary analysis of virtual function implementations and stores the results in a knowledge base before actual static analysis. This pre-computation phase handles the complex exploration of runtime types, so that during subsequent analysis, the tool can work with simplified, pre-processed information, reducing overall system complexity while maintaining precision
3Measurement precision
If static analysis tools perform comprehensive inter-procedural dataflow analysis, then measurement precision is improved, but loss of time deteriorates
Solution Approach 1:
The patent performs preliminary analysis of function behaviors and stores results in a knowledge base before comprehensive static analysis. This includes pre-computing dataflow information for virtual functions, so that during actual error detection, the tool can retrieve pre-analyzed information without performing time-consuming inter-procedural analysis from scratch, maintaining accuracy while reducing analysis time
Solution Approach 2:
The function behavior knowledge base serves as an intermediary that provides pre-computed dataflow information. Instead of performing comprehensive inter-procedural analysis during each static analysis run, the tool queries the knowledge base for pre-analyzed behavior patterns, significantly reducing analysis time while maintaining detection accuracy through the use of pre-verified behavior information
Data Source
AI summary
A computer-implemented error detection mechanism for detecting programming errors in a computer program. The computer-implemented error detection method described herein can make use of a Function Behavior Knowledge Base (FBKB) to approximate how a virtual function changes state of the program execution for all methods that can be called at each specific invocation point. The FBKB is used to select what implementation of a virtual function should be called in order to give rise to a programming defect. By dropping implementations that do not lead to a programming defect, the set of possible object runtime types is reduced. If this set is empty by the end of the analysis, then a defect is not possible, otherwise the set of object runtime types will contain types that may cause a defect.


