Shadow Debugging of Optimized Binaries Using Guard Breakpoints
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Debugging optimized code is inefficient due to missing context information and the need for frequent recompilation, while non-optimized code is too slow for practical use, leading to suboptimal debugging experiences.
Innovation Solution
A method and system that maps an optimized binary to a non-optimized binary by generating a dependency graph, adding guard breakpoints, and redirecting execution between the two during debugging, allowing seamless navigation and context retrieval.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If non-optimized code is used for debugging, then context information is available and debugging is easy, but execution speed is too slow for practical use
Solution Approach 1:
The system segments the binary into optimized and non-optimized portions, allowing the optimized binary to execute at high speed while the non-optimized binary provides debugging context. The dependency graph divides the codebase into functions that need optimization versus those that need debugging support.
Solution Approach 2:
The dependency graph acts as an intermediary between the optimized binary and non-optimized binary, mapping functions and variables across both versions. This mediator enables the debugger to navigate between the performance-optimized code and the context-rich unoptimized code without requiring the entire system to run in one mode.
2Speed
If optimized code is used for debugging, then execution speed is sufficient for practical use, but context information is missing and debugging becomes difficult
Solution Approach 1:
The system maintains copies of both optimized and non-optimized binaries side by side. The non-optimized binary serves as a reference copy that preserves original context information, variable names, and debugging metadata, while the optimized binary provides performance execution. The dependency graph links corresponding functions between the two copies.
3Loss of information
If optimizations are disabled for specific functions to improve debugging, then context information is available, but rebuild time increases and productivity decreases
Solution Approach 1:
The system performs preliminary action by pre-generating and maintaining both optimized and non-optimized binaries with a pre-computed dependency graph before debugging begins. This allows the debugger to immediately access both versions without requiring on-demand recompilation when context information is needed.
Solution Approach 2:
The system changes the parameter of binary optimization status by maintaining multiple versions with different optimization levels. Instead of recompiling with different flags, the system switches between pre-built optimized and non-optimized binaries based on the debugging needs, avoiding the time cost of recompilation.
4Loss of information
If the entire codebase is recompiled when optimizations need to be adjusted, then debugging context is improved, but time required for rebuild and restart increases
Solution Approach 1:
The system applies local quality by selectively applying different optimization levels to different parts of the codebase. The dependency graph identifies which functions require debugging context versus which can remain optimized, allowing localized adjustments without recompiling the entire codebase.
Data Source
AI summary
Systems, methods, and devices are provided for shadow debugging an optimized binary with a corresponding non-optimized binary. Embodiments compile a binary into an optimized binary and generate a dependency graph. The dependency graph associates functions within the binary. Embodiments further identify a breakpoint within the optimized binary and add a set of guard breakpoints in the optimized binary based on the breakpoint and the dependency graph. The guard breakpoints reference a portion of a non-optimized binary. Embodiments redirect to the portion of the non-optimized binary from the optimized binary.


