ttd-bindings icon indicating copy to clipboard operation
ttd-bindings copied to clipboard

Callback not triggered when using RepayForward with a step of -1

Open dolphinau opened this issue 2 years ago • 1 comments

Hi! Recently, I tried to use the Callback feature of TTD with the bindings of this repo, and I experienced an issue. It appears that when using a number of steps of -1 in ReplayForward (which is supposed to replay the whole trace), the callbacks aren't triggered.

ttdcursor.SetCallReturnCallback((TTD::PROC_CallCallback)callCallback_tree, 0);
ttdcursor.ReplayForward(&replayrez, last, -1);
// Callback never triggered here

Hence, the only way to scan the whole process and trigger the callbacks at the same time is to ReplayForward with a step of 1 in a loop. This alternative works, but is rather slow.

// Callback triggered here
do {
    ttdcursor.ReplayForward(&replayrez, last, 1);
} while (replayrez.stepCount);

I don't really know if the bug comes from TTD itself or from the bindings. But in the first case, it could be nice to document this behavior in the bindings.

I tried to build an example to understand better the issue, you can find it here, on my fork, in the issue-callback branch. I hardcoded the value of the trace file and the dlls in the example, you may need to change them to make it work on your machine

I just simplified the example-calltree main file to showcase the bug. I works on windows, and should also work on any other supported platform (but I didn't test).

Thank you for your work on these bindings! Regards

dolphinau avatar May 02 '23 09:05 dolphinau

Try it without an index file. Delete the ".idx" file that WinDbgX makes. Assuming you have loaded the trace in WinDbgX in the first place. I had a similar problem but only when a companion ".idx" file is present. The Windows playback will load the index file along with the ".run" trace file and there is no option to disable it.

kweatherman avatar Nov 05 '23 02:11 kweatherman