Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Analyzing crash - translate disassembly instructions to C++ equivalent

I'm attempting to debug 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;
    }
}
like image 296
Daniel Walker Avatar asked Feb 23 '23 02:02

Daniel Walker


1 Answers

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).

like image 146
bdonlan Avatar answered Mar 15 '23 22:03

bdonlan