简体   繁体   English

帮助在visual studio中调试C ++

[英]help debugging C++ in visual studio

This is a vague question so I am expecting vague (but hopefully helpful) answers. 这是一个模糊的问题,所以我期待模糊(但希望有帮助)的答案。

I am new at C++ and debugging in visual studio and what frustrates me the most is how to interpret the call stack... 我是C ++的新手,在visual studio中进行调试,最让我失望的是如何解释调用堆栈...

So my question is specifically about what I'm seeing on an error at the top of the stack. 所以我的问题是关于我在堆栈顶部的错误上看到的内容。 What should this be indicating? 这应该表明什么? Someone suggested that there are exceptions being thrown in the code that is causing stack corruption. 有人建议在代码中抛出异常导致堆栈损坏。 That may be indicated by the __FrameUnwindFilter(_EXCEPTION_POINTERS*...) line in the call stack. 这可以通过调用堆栈中的__FrameUnwindFilter(_EXCEPTION_POINTERS * ...)行来指示。 How do I interpret what's going on here? 我如何解释这里发生了什么? There's just so much stuff I possibly don't care about. 我可能不关心的东西太多了。 And then on top of that there's that warning that "Frames below may be incorrect and/or missing" what does that mean? 然后最重要的是警告“下面的框架可能不正确和/或缺失”是什么意思? That I can't trust those lines at all? 我完全不相信那些台词? Why show it in the first place? 为什么要首先展示它? Also, why is dddddddd() at the bottom of the stack frame? 另外,为什么dddddddd()位于堆栈框架的底部?

Please help me - I'm looking for general advice and tips on how to interpret the stack. 请帮助我 - 我正在寻找有关如何解释堆栈的一般建议和提示。

Thanks, 谢谢,

jbu JBU

On one particular error, what I see is: 在一个特定错误上,我看到的是:

mscvcr90d.dll!_NMSG_WRITE(...) Line ###

mscvcr90d.dll!abort() Line ## + 0x7 bytes

mscvcr90d.dll!terminate() Line ###

mscvcr90d.dll!__FrameUnwindFilter(_EXCEPTION_POINTERS* ...) Line ####

mscvcr90d.dll!__FrameUnwindToState(EHRegistrationNode * ...) Line ###

mscvcr90d.dll!@_EH4_CallFilterFunc@8() + 0x12 bytes

ntdll.dll!7c9032a8() 

[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 

ntdll.dll!7c90327a() 

ntdll.dll 

ntdll.dll 

kernel32.dll 

kernel32.dll 

kernel32.dll 

Other Library 

Other Library

FINALLY MY LIBRARY CODE HERE

END OF MY LIBRARY CODE 

a whole bunch of other libraries here that I haven't heard of 

dddddddd()

Are you running in Release when seeing this kind of thing? 当你看到这种东西时,你在Release中运行吗? Debug builds offer much more helpful information about the call-stack. 调试版本提供了有关调用堆栈的更多有用信息。 You can enable this information in the project properties for Release builds too if you like/need (Debugging Information Format, I think). 如果您愿意/需要,您也可以在Release版本的项目属性中启用此信息(我认为是调试信息格式)。 Without that information (including dlls you haven't built like ntdll) it can only tell you the library name and virtual address. 如果没有这些信息(包括你没有像ntdll那样构建的dll),它只能告诉你库名和虚拟地址。

The unwind tells you that an exception caused the error. 展开会告诉您异常导致错误。 As a starting point you may want to consider your exception handling is adequate and informative enough and hopefully then you can collect more valuable information about your errors. 作为起点,您可能需要考虑您的异常处理是否足够且信息量足够,希望您可以收集有关错误的更多有价值的信息。

Unfortunately if you do corrupt the stack it can get it all wrong and "point to an error" in your code that just makes no sense. 不幸的是,如果你确实损坏了堆栈,它可能会把它弄错,并且在你的代码中“指向一个错误”是没有意义的。 That's often where you see the callstack has no decent origin (whereas your example does). 这通常是你看到callstack没有合适起源的地方(而你的例子确实如此)。

There are a couple of things that are going on here. 这里有几件事情正在发生。

The first is that there does appear to be an SEH exception thrown. 首先是看起来确实出现了SEH异常。 That is indicated by the FrameUnwindToFilter calls. 这由FrameUnwindToFilter调用指示。 It's hard to say simply from the call stack exactly what exception is occurring. 很难简单地从调用堆栈中说出正在发生的异常。 If you move down to that frame though and look at the parameters one of them should have the exception code. 如果你向下移动到那个框架并查看参数,其中一个应该有异常代码。

The second item si the "frames below may be incorrect ..." The Debugger displays this message when you are debugging a native DLL for which symbols are not present. 第二项是“下面的帧可能不正确...”调试器在您调试不存在符号的本机DLL时显示此消息。 The absence of symbols makes it hard, and sometimes impossible, for the native debugger to accurately determine the call stack. 缺少符号使本机调试器难以准确地确定调用堆栈,有时甚至是不可能的。 It forces it to guess and hence the warning "may be wrong" 它迫使它猜测,因此警告“可能是错的”

This can be fixed by loading the symbols for the DLL in question. 这可以通过加载有问题的DLL的符号来解决。 In this case it's nt.dll and kernel32.dll. 在这种情况下,它是nt.dll和kernel32.dll。 These are Microsoft owned DLLs for which symbols are publicly available. 这些是Microsoft拥有的DLL,其符号可公开获得。 The following MDN page has more information about how to get the public symbols setup on your machine 以下MDN页面提供了有关如何在计算机上设置公共符号的详细信息

好吧,如果你需要调试这里的提示我会帮你解决你的问题,但我不会说我太确定我自己没有问题,我不能从错误日志中说出来

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

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