Patent ID: 7930684

Claim:
A method comprising: using a computer to perform: logging one or more asynchronous events occurring during execution of a first instance of a computer program, comprising, for each of the one or more asynchronous events: determining a respective location in the execution of the first instance at which the asynchronous event occurs; and determining a respective synchronous event preceding the asynchronous event, wherein the respective synchronous event preceding the asynchronous event comprises a nearest synchronous event preceding the location at which the asynchronous event occurs in the execution of the first instance; and replaying the one or more asynchronous events during execution of a second instance of the computer program, comprising, for each of the one or more asynchronous events: detecting the respective synchronous event preceding the asynchronous event in the execution of the second instance; and instrumenting the second instance at the respective location during the execution of the second instance after detecting the respective synchronous event, wherein instrumenting the second instance comprises: determining an interval between the nearest synchronous event and the asynchronous event in the execution of the first instance; if the interval is smaller than a threshold, inserting a breakpoint in the second instance; and if the interval is not smaller than the threshold, entering a pre-breakpoint state to delay insertion of the breakpoint in the second instance.