简体   繁体   English

在Win7 64bit上崩溃未处理的第一次机会异常(在XP 32bit,Linux 64bit上没有问题)

[英]Crash over unhandled first chance exception on Win7 64bit (no issue on XP 32bit, Linux 64bit)

I encountered a strange problem while coding a OpenGl program with C++ under Visual Studio Express 2010. 在Visual Studio Express 2010下使用C ++编写OpenGl程序时遇到了一个奇怪的问题。
I use: Windows 7 64bit, OpenGl 4.x 我使用:Windows 7 64位,OpenGl 4.x.
My partner uses: Windows XP 32bit, Visual Studio Express 2010, OpenGl 2.x 我的合作伙伴使用:Windows XP 32位,Visual Studio Express 2010,OpenGl 2.x.

Until now we just drawed vertexes for our models and it works fine at both systems (I know, I know: deprecated but we're still beginners). 到目前为止,我们只为我们的模型绘制了顶点,并且它在两个系统中都能正常工作(我知道,我知道:已弃用,但我们仍然是初学者)。 Now he included a lib to import 3d-meshes and make an animation. 现在他包含一个lib来导入3d网格并制作动画。 For him everything works fine but I get 对他来说一切正常,但我明白了

First-chance exception at 0x0055f838 in Ant Simulation.exe: 0xC0000005: Access violation reading location 0x00bb0000. Ant Simulation.exe中0x0055f838处的第一次机会异常:0xC0000005:访问冲突读取位置0x00bb0000。
Unhandled exception at 0x0055f838 in Ant Simulation.exe: 0xC0000005: Access violation reading location 0x00bb0000. Ant Simulation.exe中0x0055f838处的未处理异常:0xC0000005:访问冲突读取位置0x00bb0000。

With the debugger I traced the problem to the line 使用调试器,我将问题追溯到该行

glDrawArrays(GL_QUADS,0,n_data); (4,8 GL_QUADS,0,N_DATA);

I tried to catch the code, but nothing is triggered. 我试图抓住代码,但没有触发任何内容。 Strange enough, yesterday I could go over this line 2-3 times with the debugger until it crashed, today it crashes directly. 奇怪的是,昨天我可以用调试器重复这一行2-3次直到它崩溃,今天它直接崩溃了。 I checked yesterday that n_data is the same every time. 我昨天检查过n_data每次都是一样的。 If I execute the *.exe in Windows, it crashes (error code below). 如果我在Windows中执行* .exe,它会崩溃(下面的错误代码)。 When my partner sends me his *.exe, it usually doesn't work, but 1 time I could start it. 当我的伴侣发给我他的* .exe时,它通常不起作用,但有一次我可以启动它。 I reproduced the error on an other windows. 我在其他窗口上重现了错误。 We tried on Linux 64bit and there is no problem. 我们试过Linux 64bit并没有问题。 I tried running it in compatibility mode, but the problem keeps the same (still crashes). 我尝试在兼容模式下运行它,但问题保持不变(仍然崩溃)。

I searched around and found this: 我四处搜寻,发现了这个:
https://blogs.msdn.com/b/debugger/archive/2010/05/12/visual-studio-debugger-fails-to-catch-unhandled-exception-for-a-windows-form-or-wpf-application.aspx?Redirected=true https://blogs.msdn.com/b/debugger/archive/2010/05/12/visual-studio-debugger-fails-to-catch-unhandled-exception-for-a-windows-form-or-wpf- application.aspx?重定向=真

Not sure if I understood this correctly. 不确定我是否理解正确。 There is an exception I cannot catch but which will kill the application - but why haven't other system a problem with this exception? 有一个例外我无法捕获,但会杀死应用程序 - 但为什么其他系统没有这个例外的问题?

I tried to solve it the way described in the link but it seems in VS Express I have not the menu to throw the first-chance exceptions. 我尝试按照链接中描述的方式解决它,但似乎在VS Express中我没有菜单抛出第一次机会异常。 I'll try to get VS 2012 but nevertheless I'd like to know: Is this an enirely Windows thing or could there by a problem with my code which causes the crash (as suggested in one of the comments in the link)? 我会尝试获取VS 2012,但我仍然想知道:这是一个非常好的Windows事物还是我的代码出现问题会导致崩溃(如链接中的一条评论所示)? I would also highly appreciate an explication for what is actually going on... 我也非常感谢对实际情况的解释......

The error I get when I run the *.exe: 运行* .exe时出现的错误:

Problem Event Name: APPCRASH 问题事件名称:APPCRASH

Application Name: Ant Simulation.exe 应用程序名称:Ant Simulation.exe
Application Version: 0.0.0.0 应用版本:0.0.0.0

Application Timestamp: 511d99a3 应用程序时间戳:511d99a3

Fault Module Name: StackHash_0a9e 故障模块名称:StackHash_0a9e

Fault Module Version: 0.0.0.0 故障模块版本:0.0.0.0
Fault Module Timestamp: 00000000 故障模块时间戳:00000000

Exception Code: c0000005 例外代码:c0000005

Exception Offset: 0037f278 异常抵消:0037f278

OS Version: 6.1.7601.2.1.0.256.48 操作系统版本:6.1.7601.2.1.0.256.48

Locale ID: 1031 区域设置ID:1031

Additional Information 1: 0a9e 附加信息1:0a9e

Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 附加信息2:0a9e372d3b4ad19135b953a78882e789

Additional Information 3: 0a9e 附加信息3:0a9e

Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 附加信息4:0a9e372d3b4ad19135b953a78882e789

A "first chance exception" in Windows isn't a C++ exception, it means the runtime system has detected illegal behaviour of your program, such as dereferencing an invalid pointer. Windows中的“第一次机会异常”不是C ++异常,它意味着运行时系统检测到程序的非法行为,例如取消引用无效指针。 In fact, "Access violation reading location 0x00bb0000" suggests very much that this is what's happening. 实际上,“访问冲突读取位置0x00bb0000”非常表明这就是正在发生的事情。

Dereferencing an invalid pointer doesn't necessarily cause the same behaviour on different systems or even on different runs on the same machine: see questions like C code crashes in Windows, but not in Linux for more information on that. 取消引用无效指针不一定会在不同系统上甚至在同一台机器上的不同运行中导致相同的行为:请参阅Windows中的C代码崩溃等问题,但有关此问题的更多信息请参阅Linux中的问题。 In this case, the fault seems to be occurring inside the GL implementation, but this is probably caused by earlier application code giving it bad information. 在这种情况下,故障似乎发生在GL实现中,但这可能是由早期的应用程序代码引起的,它给出了错误的信息。

Check that all the enabled vertex arrays have at least n_data elements. 检查所有已启用的顶点数组是否至少具有n_data元素。 (Be particularly careful to make sure they don't have only n_data - 1 elements, and that n_data holds the value you expected.) You should also check that any pointers you have previously passed to GL functions were valid. (要特别小心,确保它们没有n_data - 1元素,并且n_data保存您期望的值。)您还应检查先前传递给GL函数的任何指针是否有效。 There's a lot more GL state to check too, but that would be my first guess. 还有更多的GL状态可以检查,但这将是我的第一个猜测。

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

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