I'm trying to debug the corruption of a linked list structure inside of a Win32 DLL with IDA Pro and Hexrays. The offending assembly traverses a doubly-linked list forwards checking a condition, and breaks if the next node of the list is null. When the application using the library is run fast enough, the address holding the pointer location being iterated becomes corrupted with a value far outside the bounds of addressable memory, crashing the program. I want to see if the previous linked list node contained the corrupted pointer as its next node or the bug is elsewhere, but there are no references to the parent at the time of the crash, since the node is overwritten inside the loop.
The bug is only triggered when the application is running at full speed, likely because it's a race condition. Because of this, I can't trace or conditionally break on the the execution of the assembly block because it slows the program down so much that the bug doesn't trigger.
Is there some way of injecting a global variable somewhere in memory holding the address of the previously iterated linked list node, or otherwise patching the code structure so the values the program checked are inspectable somehow?