Call Graph Generation via Shadow Stack and Trace Integration
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing debugging techniques face challenges in generating accurate call graphs for computer programs, especially when system functions or library functions are not available for inserting event instructions, leading to incomplete or inaccurate debugging information.
Innovation Solution
A system and method that generate a call graph based on a stream of logged events, including call trace events and sample trace events, by adding and modifying nodes to represent function invocations and exits, and creating a shadow stack to approximate the call stack, even in indeterminate states, using a state machine to manage transitions and heuristics for accuracy.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If call trace events are used to generate call graph, then accuracy of function call tracking is improved, but completeness deteriorates when system functions or library functions are not available for inserting event instructions
Solution Approach 1:
The patent combines call trace events (which provide accurate function call tracking when available) with sample trace events (which provide incomplete but supplementary information) to generate a more complete call graph. The merging process integrates data from both sources, using call trace events for precise tracking and sample trace events to fill in gaps for system functions and library functions where call trace instructions cannot be inserted.
Solution Approach 2:
The patent introduces a shadow stack as an intermediary data structure to bridge the information gap between available call trace events and the complete call graph. The shadow stack stores function invocation information from sample traces and uses heuristics to infer missing call relationships, acting as a mediator that connects partial information from both trace sources into a coherent complete call graph.
2Loss of information
If sample trace events are used to generate call graph, then completeness of function information is improved, but accuracy deteriorates due to incomplete snapshot nature
Solution Approach 1:
The patent implements a feedback mechanism where the system continuously compares information from sample trace events against the existing call graph constructed from call trace events. When discrepancies or gaps are detected, the system uses heuristics to infer missing information and updates the call graph accordingly, refining the accuracy through iterative feedback between the two data sources.
Solution Approach 2:
The patent applies partial action by selectively using sample trace events only for functions where call trace instructions are unavailable (system functions and library functions), rather than attempting to use sample traces for all functions. This targeted approach maintains accuracy for instrumented functions while gaining completeness for non-instrumented functions.
3Loss of information
If both call trace events and sample trace events are integrated, then completeness of call graph is improved, but device complexity increases due to need to manage multiple event sources and synchronization
Solution Approach 1:
The patent segments the call graph construction process into distinct phases: processing call trace events to build the initial accurate framework, then processing sample trace events to fill gaps. The shadow stack is also segmented into different regions for storing different types of information from different sources, making the complex integration process more manageable and organized.
Data Source
AI summary
A system and method for generating a computer program call graph. A profiler may insert probes into a debuggee computer program, the probes generating call trace events. Checkpoints may be performed during execution of the debuggee program, so that a snapshot of the call stack is performed. Call trace events and checkpoint snapshots are logged and serialized. Logged call trace events and checkpoints may be retrieved and used in combination to generate a call graph and a shadow stack. Mechanisms facilitate combining the different sources of debuggee program information and determining whether the call graph and shadow stack are determinate or indeterminate at any time. The mechanisms may provide for improved accuracy of generated call graphs.


