分析崩溃 - 将反汇编指令转换为C++等价物

Dan*_*ker 4 c++ crash debugging assembly

我正在尝试调试崩溃. (ACCESS_VIOLATION)

下面是一个反汇编代码段.我标记了发生异常的行. 它在下面显示的实际C++代码中对应了什么指令?

拆卸:

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]);
Run Code Online (Sandbox Code Playgroud)

实际的C++代码:

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;
    }
}
Run Code Online (Sandbox Code Playgroud)

bdo*_*lan 8

看起来cmp dword ptr [eax],edi对应于<size()检查 - 请注意,size成员的取消引用m_children内联到less-than check中.

很可能,你的this指针无效.您可能已经调用ICategoryNode::iterate了空指针,或者已删除的对象或其他东西(如果eax值非常低,它可能是空指针 - 但无论如何,检查上面的堆栈帧,您应该能够得到错误的地址被调用的对象).