Backwards Debugging Multithreaded Programs Shared Memory
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional debuggers are unable to perform backwards debugging, especially in cases of non-deterministic events, and struggle with multithreaded programs and shared memory access, leading to difficulties in tracing errors and debugging programs without access to source code or when compiler issues are involved.
Innovation Solution
A method that involves instrumenting machine code to handle non-deterministic events, recording states, and replaying execution to return to arbitrary points in a program's history, using techniques like thread multiplexing, snapshotting, and shared memory management to handle thread switches, asynchronous events, and shared memory access.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If forward debugging with breakpoints is used, then the program can be examined at specific points, but the cause of errors occurring long before manifestation cannot be identified
Solution Approach 1:
The patent applies preliminary action by recording program states and execution information before errors occur. The system continuously captures snapshots of program state, register values, and instruction execution sequences during normal forward execution, so that when an error is detected, the pre-recorded information is already available for immediate analysis without requiring time-consuming backward reconstruction.
2Quantity of substance
If backwards debugging is implemented without recording intermediate results, then memory usage is reduced, but it becomes impossible to return to previous program states
Solution Approach 1:
The patent applies local quality by selectively recording only the essential program state information needed for backward debugging, rather than recording all possible data. Specifically, it records snapshots of program state at instruction boundaries, register values, and execution sequences, while omitting redundant information. This localized recording strategy enables backward execution capability while keeping memory consumption manageable.
3Ease of operation
If conventional debugging methods are used on multithreaded programs with shared memory, then debugging is simpler, but non-deterministic events like thread switches and shared memory reads cannot be properly handled
Solution Approach 1:
The patent applies the intermediary principle by introducing a recording mechanism that acts as a mediator between the non-deterministic multithreaded program execution and the debugging process. The system records thread switch events, shared memory access patterns, and execution sequences during forward execution, creating a deterministic replay trace. This intermediary recording layer allows conventional simple debugging operations to work reliably on complex multithreaded programs by providing a controlled replay of the original execution.
4Loss of information
If source code instrumentation is used for debugging, then debugging information can be obtained, but it becomes impossible to debug programs without source code access or when compiler issues are involved
Solution Approach 1:
The patent applies mechanics substitution by replacing source code-level instrumentation with machine code-level recording. Instead of inserting debug statements into source code, the system directly records execution information from the compiled machine code, including instruction sequences, register states, and memory accesses. This substitution allows the debugging system to work with compiled programs without requiring source code access, while still obtaining comprehensive debugging information at the binary level.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
We describe techniques which relate to bi-directional, in particular backwards, debugging of computer programs. Thus we describe identifying processes with shared memory access, such as threads or multicore processes, by arranging process (thread) memory ownership to deliberate provoke memory page faults to identify and handle concurrent memory access by multiple threads in such a manner as to enable deterministic replay, and hence backwards debugging.