在我的 OpenGL 渲染引擎中,当我按下开始发出一些新的 OpenGL 调用的键后,我当前崩溃了 1 帧。
以下是崩溃的调用堆栈,它是一个 CVDisplayLink 线程。
0 libsystem_kernel.dylib 0x00007fff94d89f06 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff88d3e4ec pthread_kill + 90
2 libsystem_c.dylib 0x00007fff980246e7 abort + 129
3 libGPUSupportMercury.dylib 0x00007fff983a3e5c gpusGenerateCrashLog + 158
4 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x000000010f750d4b gpusKillClientExt + 9
5 libGPUSupportMercury.dylib 0x00007fff983a5204 gpusSubmitDataBuffers + 162
6 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x000000010f2ac3f2 IntelCommandBuffer::getNew(GLDContextRec*) + 48
7 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x000000010f399849 intelSubmitCommands + 171
8 com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x000000010f3996c2 gldPresentFramebufferData + 142
9 GLEngine 0x000000010f0ddc81 glSwap_Exec + 97
10 com.apple.GLEngineProfiler 0x000000010d759265 0x10d60b000 + 1368677
11 com.apple.opengl 0x00007fff8ed15ffe CGLFlushDrawable + 66
12 com.apple.AppKit 0x00007fff8846509f -[NSOpenGLContext flushBuffer] + 27
13 StarchipStudios.Marble 0x000000010a72c69c -[MarbleOpenGLView getFrameForTime:] + 172 (MarbleOpenGLView.mm:139)
14 StarchipStudios.Marble 0x000000010a72c337 displayLinkCallback(__CVDisplayLink*, CVTimeStamp const*, CVTimeStamp const*, unsigned long long, unsigned long long*, void*) + 55 (MarbleOpenGLView.mm:15)
15 com.apple.CoreVideo 0x00007fff92e183ba CVDisplayLink::performIO(CVTimeStamp*) + 258
16 com.apple.CoreVideo 0x00007fff92e17f45 CVDisplayLink::runIOThread() + 627
17 com.apple.CoreVideo 0x00007fff92e179a9 startIOThread(void*) + 147
18 libsystem_pthread.dylib 0x00007fff88d3b99d _pthread_body + 131
19 libsystem_pthread.dylib 0x00007fff88d3b91a _pthread_start + 168
20 libsystem_pthread.dylib 0x00007fff88d39351 thread_start + 13
在系统日志中我还发现:
Jun 7 12:13:35 jamess-laptop kernel[0] <Notice>: The graphics driver has encountered internal error 0x0, 0xfffffffe.
看起来 GPU 驱动程序本身由于一些不正确的 OpenGL 调用而崩溃,但事实证明很难找到我错误地调用 OpenGL 的地方。我尝试使用 OpenGL Profiler 图形调试工具进行附加,但这无法在应用程序崩溃之前中断任何错误。
有谁知道显卡驱动调用gpusGenerateCrashLog
生成的日志在哪里? (在上面的调用堆栈中)被存储?也许这可以给我一些关于哪里出了问题的线索?
最佳答案
崩溃报告(您在问题中引用的部分)是 gpuGenerateCrashLog
创建的崩溃报告。它的作用是为崩溃报告的应用程序特定签名:
部分提供文本。
使用Hopper反汇编器伪代码生成器我们可以具体看到:
int _gpusGenerateCrashLog(int arg0, int arg1, int arg2) {
rdi = arg0;
r14 = arg2;
rbx = arg1;
if (*0xc678 != 0x0) {
rax = *___stack_chk_guard;
if (rax != *___stack_chk_guard) {
rax = __stack_chk_fail();
}
}
else {
if (rdi != 0x0) {
IOAccelDeviceGetName(*(rdi + 0x230), 0x0, 0x14);
}
if ((rbx & 0x20000000) == 0x0) {
rdx = "Graphics kernel error: 0x%08x\n";
}
else {
rdx = "Graphics hardware encountered an error and was reset: 0x%08x\n";
}
sprintf_l(var_A0, 0x0, rdx);
*0xc680 = var_A0;
rax = abort();
}
return rax;
}
因此生成的信息 (rdx
= "string") 只是一行,而不是大型单独的日志转储或报告。
Apple 有一个网页,解释了如何获取各种场景的日志。对于桌面图形,他们建议: https://download.developer.apple.com/OS_X/OS_X_Logs/Graphics_Diagnostic_Logging_Instructions.pdf
(假设您有苹果开发者帐户登录)
这将为您提供 TimingSnoop 程序。它获取系统的系统配置,而不是最近在其上运行的 OpenGL 命令。因此,除非您向 Apple 提出错误,否则它可能对您的特定问题没有多大帮助。
Apple 确实提供了 OpenGL 分析器。我会首先查看这个,看看它是否提供了引发问题的线索。它被提到于: https://developer.apple.com/library/archive/technotes/tn2178/_index.html 并从 Apple 的下载页面下载(Xcode 的附加工具)。 我尝试让这个工具工作,但在 macOS 10.13.6 上无法工作,因为它不会生成 OpenGL 配置文件跟踪(已在附加到进程的首选项中设置密码)。所以我希望其他人可以在这里提供额外的帮助。
关于macos - 在哪里可以找到从 gpusGenerateCrashLog 调用堆栈创建的日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37678014/