Dual Code Generation for Debugging Optimized Software
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Debugging software applications is challenging due to the conflict between compiler optimizations for speed and the need for debugging information, which can alter program behavior and timing, making it difficult to accurately analyze logical errors.
Innovation Solution
A system that generates both optimized and debuggable object code versions of subroutines, allowing the debugger to switch between them based on user needs, with the compiler producing distinct names for each version to prevent name conflicts and enable seamless debugging without disrupting program execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If compiler optimizations are enabled to increase program execution speed, then productivity is improved, but debugging efficacy deteriorates because debugging information is lost and program behavior changes
Solution Approach 1:
The patent segments the compilation process to generate two distinct versions of the same program: an optimized version for production use and a debuggable version for analysis. This segmentation allows each version to be tailored for its specific purpose without compromising the other, resolving the contradiction between execution speed and debugging efficacy.
Solution Approach 2:
The patent changes compilation parameters to produce different code versions. By adjusting compiler flags and optimization levels, the system generates an optimized binary for speed and a debuggable binary with preserved source code mapping for analysis, allowing both requirements to be met simultaneously through parameter variation.
2Measurement precision
If debugging options are enabled during compilation to preserve program behavior, then debugging efficacy is improved, but productivity deteriorates because all optimizations are disabled
Solution Approach 1:
The patent divides the compilation output into separate optimized and debuggable versions, allowing the debuggable version to maintain slower but accurate execution while the optimized version provides fast production performance. This eliminates the need to choose one over the other.
Solution Approach 2:
The patent creates a copy of the source code and compiles it with debugging options enabled, generating a debuggable version that preserves program behavior. This copying approach allows the original source to be optimized while the copy maintains debugging fidelity.
3Speed
If compiler optimizations are applied, then program execution speed is improved, but program behavior changes making it different from the original program
Solution Approach 1:
The patent segments program usage into production mode and debugging mode, with each mode using the appropriate version. This ensures that optimized code with potentially altered behavior is only used when performance is critical, while the original behavior is preserved in the debuggable version for analysis.
Solution Approach 2:
The patent introduces an intermediary mechanism (the dual-version compilation system) that mediates between the need for optimized behavior and the need for original behavior preservation. The system automatically selects which version to use based on the execution context.
Data Source
AI summary
Systems and methods provide a debugger that debugs code using two versions of code, an optimized and a debuggable version of object code for subroutines, methods or functions. The debugger causes the appropriate version of the code to be executed depending on whether debug commands have been applied with respect to particular subroutines, methods or functions.


