I am debugging a crash, and I noticed how a step through the debugger, the this pointer changed its value, and after 3 steps it finally got the value 0x00000001 and the application crashed.
Now the value 0x00000001 is obviously wrong, but should I expect this change when passing through the debugger?
Below the constructor I debug where it crashes. I added the value of this pointer in the comments with each step, and as you can see, it jumps quite a bit.
CADOCommand::CADOCommand(CADODatabase* pAdoDatabase, CString strCommandText, int nCommandType) { m_pCommand = NULL; m_pCommand.CreateInstance(__uuidof(Command));
Are there any circumstances where the value of this can or should change when passing code in this member function?
Update
I have to add for recording and in response to a few comments, I debugged the release build, but when I debug the same function in the debug build, this value did not change in the end.
So what does this mean if there is a problem only in the release build?
The comment from @drescherjm is saved, which says in release mode the this pointer is not correct because of optimization , but what exactly does this mean "wrong"? That we cannot trust this pointer in the release assembly (is fictitious) or that the pointer value is correct, but the release collection is broken due to optimization?
source share