Elektrine lite

← Feed

@evmar@inuh.net

Post #2158442

2026-04-29 18:42 UTC

From there, I could see that phase2 was intended as a loop and that the loop was exiting. Again, because I have translated source code I could use my system debugger to step through it, though the control flow is harder than normal code. From there, I could see that edi was some sort of counter that started at 0, but after a single pass through the loop it had a garbage value. The system debugger's watch points tracked it down further, possibly the first time I've used those.

Replies (1)

  • @evmar@inuh.net 2026-04-29 18:47

    The culprit was a function that was using edi for its own purposes. It was correctly using push/pop edi to preserve the caller's value, but that was going wrong. The stdcall ABI used on Windows means the callee pops arguments off the stack. This means when the culprit function calls one of my functions and I had the arguments wrong, the stack pointer gets off by an entry or two. I've written this bug so many times! This meant the restored edi was instead some other garbage on the stack.

    Open ##2158443