Source-Level Debugging of Intermediate Code via Line Mapping

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvedebugging effectivenessVSAvoidprogrammer understanding
Core Design Contradiction:
ReliabilityVSEase of operation

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.

Inventive Principle:
Principle #24Intermediary (Mediator)

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.

Inventive Principle:
Principle #26Copying

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

Engineering Contradiction:
Improveprogram execution capabilityVSAvoidsource code correspondence
Core Design Contradiction:
ProductivityVSLoss of information

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.

Inventive Principle:
Principle #10Preliminary action

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.

Inventive Principle:
Principle #23Feedback

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

Engineering Contradiction:
Improveprogram executionVSAvoiddebugging time
Core Design Contradiction:
ProductivityVSLoss of time

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.

Inventive Principle:
Principle #10Preliminary action

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.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS12135633B2Source-level debugging of intermediate code
Publication Date: 2024.11.05 RED HAT LLC
  • US12135633B2 patent drawing
  • US12135633B2 patent drawing
  • US12135633B2 patent drawing

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.