简体   繁体   English

我可以相信在发生在C ++ / STL / MFC应用程序启动初期的致命异常中的堆栈回溯符号名称吗?

[英]Can I trust the stack traceback symbol names in a fatal exception that occurs early in the startup in my C++/STL/MFC application?

I am getting access violations in mfc90d.dll in CObject:IsKindOf , the deepest item on the call stack, which is actually apparently run long before WinMainCRTStartup is, and which probably is in my app because I wrote a standard container of some of my application's model objects; 我在调用堆栈中最深的项目CObject:IsKindOf mfc90d.dll中遇到访问冲突,实际上它显然在WinMainCRTStartup之前运行了很长时间,并且可能在我的应用程序中运行了很长时间,因为我编写了一些应用程序的标准容器模型对象; std::map<int, CDevice*> somewhere, leading to the following templated container C++ type existing, and then showing up in my call stack: std::map<int, CDevice*>某个地方,导致以下模板容器C ++类型存在,然后显示在我的调用堆栈中:

myapp.exe!std::_Tree<std::_Tmap_traits<int,CDevice   
         *,std::less<int>,std::allocator<std::pair<int const ,CDevice *> >,0> 
          >::_Copy(const std::_Tree<std::_Tmap_traits<int,CDevice 
         *,std::less<int>,std::allocator<std::pair<int const ,CDevice *> >,0> > &                     
         _Right={...})  Line 1067 + 0x1d bytes  C++

I am not 100% sure that the std::map<int, CDevice*> is the reason, but it's the only templates reference involving "CDevice*" that I could find. 我不是100%确定std::map<int, CDevice*>是原因,但它是我所能找到的唯一涉及“ CDevice *”的模板参考。

The whole call stack, given slightly simplified (ellipsis ... indicates omission of some details of the function signature). 整个调用堆栈略有简化(省略号...表示省略了函数签名的某些细节)。

mfc90d.dll!CObject::IsKindOf(const CRuntimeClass * pClass=0x691a09ec)  
mfc90d.dll!CDocManager::OpenDocumentFile(const char * lpszFileName=0x007783e8)  
mfc90d.dll!CWinApp::OpenDocumentFile(const char * lpszFileName=0x007783e8)  
myapp.exe!CServerApp::InitInstance()  
mfc90d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * ...            
    myapp.exe!__tmainCRTStartup()  Line 574 + 0x35 bytes    C
myapp.exe!WinMainCRTStartup()  Line 399 C
kernel32.dll!762033aa()     
ntdll.dll!77369ef2()    
ntdll.dll!77369ec5()    
myapp.exe!std::_Tree<std::_Tmap_traits<int,CDevice ..........

Questions: 问题:

  1. I'm a bit mystified about how something like std::_Tree<...>::_Copy can be executing so many layers of stuff FOUR entire call layers layers above myapp.exe!WinMainCRTStartup . 我对std::_Tree<...>::_Copy之类的东西如何执行这么多层的东西感到有些困惑,这些东西层位于myapp.exe!WinMainCRTStartup上方的四个整个调用层。 Should I suspect the callstack above of being incorrect? 我应该怀疑上面的调用堆栈不正确吗?

  2. What's an std::_Tree<...> mess like the above there for and why is it invoking CObject:IsKindOf ? 什么是std :: _ Tree <...>像上面那样混乱,为什么调用CObject:IsKindOf My code uses the STL like this: std::map<int, CDevice*> . 我的代码使用如下STL: std::map<int, CDevice*>
    My guess is that if I removed all references to std::map<int, CDevice*> then the above std::_Tree internal implementation code would go away. 我的猜测是,如果删除所有对std::map<int, CDevice*>引用,那么上面的std::_Tree内部实现代码就会消失。

  3. Running this far before WinMainCRTStartup suggests to me that this code is actually run when the mfc90d.dll loads. WinMainCRTStartup之前运行了mfc90d.dll ,这向我暗示,当mfc90d.dll加载时,此代码实际上已运行。 Is that probably so? 大概是这样吗? Is there anything I can do in VC++2008 debugger to get a clearer view of "when is this code running?" 我可以在VC ++ 2008调试器中进行任何操作来获得“何时运行此代码”的清晰视图吗?

  4. It's unreasonable to ask for someone to guess for me how on earth crashes can occur this early in my application's lifetime. 要求某人为我猜测在我的应用程序生命周期的早期发生崩溃是不合理的。 I am interested in how you debug such problems though, so if any of this rings a bell for you, I'd appreciate your thoughts and ideas, but it's too much to ask anybody to guess what's really going on. 我对您如何调试此类问题感兴趣,因此,如果其中任何一个对您有所帮助,我将不胜感激您的想法和构想,但是要让任何人去猜测到底发生了什么实在是太多了。 Let's just say it's random heap corruption, somehow. 让我们以某种方式说这是随机堆损坏。 But if you have tips on the order of "switch from using MFC in a dll to statically linking MFC", I'd like to hear those. 但是,如果您对“从在dll中使用MFC切换为静态链接MFC”的顺序有一些建议,我想听听。

Anything below ntdll.DLL is a red herring, in my experience. 根据我的经验,ntdll.DLL下面的任何内容都是红色的鲱鱼。 Your std map did not call code in ntdll which called win main. 您的std映射未调用名为win main的ntdll中的代码。 The debugger is interpreting nonsense and trying to makes sense of it, and some semi random binary data had an address that lined up with one of your functions. 调试器正在解释废话,并试图弄明白这一点,并且一些半随机二进制数据的地址与您的函数之一对齐。 Pretend it is not there. 假装它不在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM