Source-Level Debugging of Intermediate Code via Line Mapping
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing debugging systems make it difficult for human programmers to understand and debug intermediate code, as it often differs significantly from the initial source code, and changes made to fix bugs in intermediate code are temporary and frequently overwritten, requiring time-consuming identification of corresponding source code lines.
Innovation Solution
A debugging system that generates and stores a mapping between lines of intermediate code and initial source code, allowing the debugger tool to present the initial source code corresponding to each line of intermediate code, enabling easier identification and modification of the source code that generated the intermediate code.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If programmers debug intermediate code directly, then debugging can be performed on the executed code, but it becomes difficult to understand and changes are temporary and frequently overwritten
Solution Approach 1:
The patent introduces a mapping data structure as an intermediary between intermediate code and source code. This mapping contains line number associations that link each intermediate code line to its corresponding source code line, allowing the debugger to present source code to the programmer while maintaining the ability to debug the executed intermediate code. The mapping acts as a mediator that translates debugger operations between the two code representations.
Solution Approach 2:
The patent creates a copy of source code line information stored in the mapping data structure during compilation. This copy includes line number associations that preserve the relationship between source and intermediate code without requiring the programmer to access the original source files. The copied information enables source-level debugging presentation while debugging the intermediate code execution.
2Productivity
If intermediate code is generated from source code, then the program can be executed, but the intermediate code differs significantly from source code making it hard to identify corresponding lines
Solution Approach 1:
The patent performs preliminary action by generating and storing the mapping data structure during the compilation process, before debugging occurs. The compiler creates line number associations between source code and intermediate code and stores them in the mapping. This preliminary preparation ensures that when debugging occurs, the correspondence information is already available, eliminating the need for programmers to manually identify corresponding lines.
Solution Approach 2:
The mapping data structure provides feedback about the relationship between source code and intermediate code lines. When the debugger needs to present source code corresponding to a particular intermediate code line, it queries the mapping which returns the associated source line numbers. This feedback mechanism maintains the connection between transformed code and original code throughout the debugging process.
3Productivity
If source code is compiled to intermediate code, then the program can be executed, but debugging requires time-consuming identification of corresponding source code lines
Solution Approach 1:
The mapping data structure is generated during compilation as a preliminary action before debugging occurs. This pre-computed mapping stores line number associations that enable immediate lookup of corresponding source code lines during debugging, eliminating the time-consuming manual identification process that would otherwise be required.
Solution Approach 2:
The patent creates a copied representation of source code line information in the mapping data structure during compilation. This copy contains the necessary line number associations that enable the debugger to quickly retrieve and present corresponding source code lines without requiring programmers to search through original source files during the debugging process.
Data Source
AI summary
An example method may include identifying one or more source code lines from which an intermediate code line of an intermediate code module is generated, wherein each respective source code line is associated with a respective source code module name and further associated with a respective line number in the respective source code module, generating one or more source mappings, where each source mapping corresponds to a respective source code line and associates a line number of the intermediate code line with a respective source code module name of the respective source code line and further with a respective line number of the respective source code line, and storing, in a data store, the one or more source mappings in association with a name of the intermediate code module. The intermediate code module can be a file generated by a compiler or translator.


