开发者

Analyzing crash - translate disassembly instructions to C++ equivalent

开发者 https://www.devze.com 2023-04-02 07:48 出处:网络
I\'m attempting to debug开发者_C百科 a crash. (ACCESS_VIOLATION) Below is a disassembly snippet. I marked the line that the exception occurs on.

I'm attempting to debug开发者_C百科 a crash. (ACCESS_VIOLATION)

Below is a disassembly snippet. I marked the line that the exception occurs on. What instruction does it correspond to in the actual C++ code shown below it?

Disassembly:

420: for( Uint32 i = 0; i < m_children.size(); ++i){
    06A923D3 8B 46 0C             mov         eax,dword ptr [esi+0Ch]  
    06A923D6 57                   push        edi  
    06A923D7 33 FF                xor         edi,edi  
--> 06A923D9 39 38                cmp         dword ptr [eax],edi  
    06A923DB 76 59                jbe         ICategoryNode::iterate+66h (6A92436h)  
    06A923DD 53                   push        ebx  
    06A923DE 55                   push        ebp  
    06A923DF 8B 2D 04 60 B0 06    mov         ebp,dword ptr [__imp_::AssertionFailure::logAssert (6B06004h)]  
    06A923E5 33 DB                xor         ebx,ebx  
421: bool keepGoing = CategoryImp::recursiveIterator(handler, *m_children[i]);

Actual C++ code:

void ICategoryNode::iterate(ICategoryHandler& handler) const {
    for(Uint32 i = 0; i < m_children.size(); ++i) {
        bool keepGoing = CategoryImp::recursiveIterator(handler, *m_children[i]);
        if(!keepGoing)
            return;
    }
}


Looks like cmp dword ptr [eax],edi corresponds to the < size() check - note that the dereference of the size member of m_children is inlined into the less-than check.

Most likely, your this pointer is invalid. You may have called ICategoryNode::iterate on a null pointer, or a deleted object or something (if eax has a very low value, it's probably a null pointer - but in any case, check the stack frame above this, you should be able to get the bad address of the object being called).

0

精彩评论

暂无评论...
验证码 换一张
取 消