This invention discloses a method for accurately reproducing multi-threaded race conditions for historical debugging. By defining three types of causal relationships—release acquisition, wake-up execution, and memory
visibility—a
semantic equivalence mapping table of synchronization instructions between different target architectures is constructed. Then, when the target program is executed on the first target architecture, user-mode and kernel-mode synchronization events are recorded. Combined with causal conditions, a bidirectional causal chain with confidence is constructed. During replay, a replay engine is started on the second target architecture. First, the synchronization operation is identified and matched with the original synchronization events in the
semantic equivalence mapping table and the causal chain. The semantic
reproduction status of core dependent events is verified. Ignoring actual hardware execution, memory, status flags, memory barriers, and thread states are forcibly reproduced according to the records. Finally, subsequent events are added to the
queue according to the confidence level, and the semantic
reproduction of subsequent events is completed in the order of the recorded information. This achieves accurate
reproduction of the target program execution process under multi-threaded race conditions.