Error Tracing via Context Swapping in Software Debugging
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for tracing errors in computer software face challenges in obtaining accurate information due to function calls altering hardware registers and stack information, making it difficult to debug errors and turning leaf functions into non-leaf functions.
Innovation Solution
The method involves using system calls to maintain and swap context information, allowing error tracing without altering the target process's context, thereby preventing leaf functions from becoming non-leaf functions and ensuring accurate error information storage and retrieval.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a function call is used to save error state information, then error tracing capability is provided, but the function call alters hardware registers and stack information making accurate debugging difficult
Solution Approach 1:
The patent introduces a dedicated error-tracing process as an intermediary between the target process and the error handling mechanism. Instead of using a function call that modifies the target process context, the system swaps contexts to a separate error-tracing process that reads error information from preserved context data structures, thereby avoiding contamination of the original error state.
Solution Approach 2:
The patent creates a copy of the target process context before error tracing begins. This context copy is preserved in memory while the actual process context is swapped to the error-tracing process. The error-tracing process then reads from this preserved copy, ensuring that no modifications to the original context affect the accuracy of error information.
2Reliability
If a function call is used to trace errors, then error handling is enabled, but leaf functions become non-leaf functions increasing complexity
Solution Approach 1:
The error-tracing process acts as an intermediary that eliminates the need for leaf functions to make function calls. Instead, the system uses process context switching to transfer control to a dedicated error handling process, thereby maintaining leaf functions as true leaf functions and reducing overall system complexity.
3Measurement precision
If context information is maintained during error tracing, then accurate error information is preserved, but the target process context must be swapped altering execution flow
Solution Approach 1:
The patent performs preliminary action by preserving the target process context in memory before initiating error tracing. This preserved context is made available to the error-tracing process, allowing accurate error information to be read without disrupting the target process execution flow during normal operation.
Solution Approach 2:
The error-tracing process serves as an intermediary that reads error information from the preserved context without modifying the target process. The context swap mechanism allows the error-tracing process to access accurate error state information while maintaining the ability to restore the target process to its original state, thus balancing accuracy with operational ease.
Data Source
AI summary
Methods and systems consistent with the present invention may facilitate error tracing in computer software. Such methods and systems may maintain context information of a target process, swap from a context of the target process to a context of an error-tracing process, and trace an error from the target process using the error-tracing process and the context information of the target process.


