Our Windows application keeps crashing for an access violation. Our system is set up to capture a full dump of the application state when the crash happens. I'm not here to get explanation of the crash... I want to understand an oddness I see with the RAX register in the full dumps.
Here's the snippet of assembly:
000000007B0D306A mov rax,qword ptr [rsp+68h]
000000007B0D306F movzx eax,byte ptr [rax+rcx]
000000007B0D3073 test eax,eax
000000007B0D3075 je 000000007B0D3117
000000007B0D307B mov ecx,dword ptr [rsp]
000000007B0D307E mov rax,qword ptr [rsp+58h] <<< CRASH
Notice that we write to RAX in the first and last line of the snippet. The last line of the assembly is the access violation. Because the crash happened, I would expect RAX to still hold the value it got previously from "rsp+68h", but it doesn't. rsp+68h is a valid memory address, but in the crash dump, RAX has a value of 1.
I've ruled out any sort of re-write of memory, and every other register appears to have the values I would expect it to have at this point in the code.
So my question is: when the exception is thrown, is there something that overwrites the RAX register as part of the exception? Or is there some other explanation for why RAX no longer has its previous value?