简体   繁体   English

C ++程序在ntdll.dll执行时挂起

[英]C++ Program hangs on ntdll.dll execution

When I try to run my program it never enters the main() function, but just hangs. 当我尝试运行我的程序时,它从不进入main()函数,但只是挂起。 Some how though, my program is throwing an exception in one of my classes as the first call in the stack after numerous calls to ntdll.dll. 但是有些怎么样,我的程序在我的一个类中抛出异常,作为多次调用ntdll.dll后堆栈中的第一个调用。 The exception seems to be the factor that is causing my program to hang with a "< bad ptr >". 异常似乎是导致我的程序挂起“<bad ptr>”的因素。 I am unable to trigger any breakpoints I set though, making it harder to find where the problem originates. 我无法触发我设置的任何断点,因此很难找到问题所在的位置。

You need to figure out which system call you made that caused the crash. 您需要确定导致崩溃的系统调用。 Normally this kind of thing is the result of passing garbage into some windows API. 通常这种事情是将垃圾传递到某些Windows API的结果。

Use a debugger and look at the call stack. 使用调试器并查看调用堆栈。 The last entry that is inside your code is likely to be the cause of the problem. 代码中的最后一个条目可能是问题的原因。 It probably has some bad data that is it not handling correctly. 它可能有一些不正确处理的错误数据。

This sounds like you are using global objects/singletons. 这听起来像是在使用全局对象/单例。 If any of these depend on each other you are in trouble. 如果其中任何一个相互依赖,你就会遇到麻烦。 I would look for all your globals and put a break point in the contructor of each. 我会寻找你所有的全局变量并在每个变换器的构造函数中加入一个断点。 It sounds like the contructor for one global is using another global but the second has not been contructed yet. 听起来像一个全球的构造者正在使用另一个全球,但第二个尚未构建。

Finally if this is not the cause, and your application is loading 3rd party dlls they might be clashing. 最后,如果这不是原因,并且您的应用程序正在加载第三方dll,那么它们可能会发生冲突。 I remember once orbix and ms message queue dlls classing in one was loaded before the other, everything worked if they were loaded the other way around. 我记得曾经orbix和ms消息队列dll分类在一个之前被加载,如果它们被反过来加载,一切都有效。 In the end to find this I removed every thing till I was just left with an empty main and then started adding things one by one until I found the problem. 最后发现这个我删除了所有的东西,直到我刚刚离开一个空的主要,然后开始逐个添加东西,直到我发现问题。

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

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