A trick that I use, which typically works quite quickly, is to temporarily add a global counter to the piece of code where the problem is.Fguy64 wrote:OK one thing my program does not have yet is proper diagnostics output, PV or perftt or whatever you want to call it. But I do know what level1 node is being searched when something weird happens. So, if my alpha-beta is working properly, the following should work (I think)
As I see it, If I know what level1 move is being searched when the program craps out, then I should be able to make that move manually, reduce the ply by 1, restart the engine, and the engine should crap out in the exact same position.
Agreed?
The first run I use to determine the counter value when the problem occurs (e.g. an assert that fails).
I then add an if (counter == ...) statement with a value slightly lower than the target counter value, and break there in the debugger.
That way you can go "backward in time" and step through the code just before the problem occurs.
Btw, an intriguing concept is "reversible debugging" where after hitting a break-point, the debugger is able to step backwards in time.
I have never had the opportunity to try it, but it sounds promising.