State Machine Detection Variables for Program Bug Location
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing debugging methods for program code are inefficient and ineffective when they fail to disclose location information of potential bugs in core files.
Innovation Solution
A method and apparatus that assign unique values to detection variables of state machines for each program code segment, determine current values during abnormal program exits, and compare these values to identify suspicious code segments, outputting debug information including location details.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If GNU project debugger (GDB) tools are used to check core files, then debugging can be performed, but location information of potential bugs may not be disclosed
Solution Approach 1:
The patent applies preliminary action by assigning unique values to detection variables of state machines before abnormal program exits occur. This pre-positioning of tracking mechanisms ensures that when bugs occur, the location information is already captured and can be retrieved from core files, thus resolving the information loss problem while maintaining debugging effectiveness
Solution Approach 2:
The patent introduces detection variables as intermediary elements between program code segments and debugging tools. These detection variables act as mediators that capture and preserve location information, allowing GDB tools to effectively retrieve bug location data that would otherwise be lost, thereby improving both debugging effectiveness and information retention
2Measurement precision
If detection variables are assigned for each program code segment, then bug location can be identified, but system complexity increases
Solution Approach 1:
The patent applies universality by using a unified state machine structure with detection variables that can serve multiple program code segments. Rather than creating separate tracking mechanisms for each segment, a single state machine framework handles multiple segments, reducing overall system complexity while maintaining precise bug location identification
Solution Approach 2:
The patent uses parameter changes by modifying the detection variable values based on program counter values to identify different program code segments. This approach allows the same detection variable structure to differentiate between segments through value changes rather than structural complexity, achieving precise location identification with minimal system complexity
Data Source
AI summary
A method for debugging program code is performed at an apparatus having one or more processors and memory for storing programs to be executed by the one or more processors. The method includes the following steps: for each program code segment from a set of program code segments, assigning a unique value to a detection variable of a state machine when the respective program code segment operates the state machine. The unique value is based on a value of an identification variable associated with the respective program code segment. The method also includes determining a current value of the detection variable corresponding to an abnormal program exit, and determining a suspicious program code segment based on a comparison of the current value of the detection variable with the unique values of the respective identification variables. The method further includes outputting debug information based on the suspicious program code segment.


