Windows10 64位下Mingw32开发OpenGL程序gdb调试报错问题
OpenGL程序GDB调试异常问题记录与临时处理
问题背景
我在Windows 10 64位系统下用Mingw32开发OpenGL程序,程序本身能正常运行,但使用GDB调试时遇到了异常:
- 我在
glGenVertexArrays(1, &VAO);这行设置断点,执行n(下一步)命令后,会直接跳转到atioglxx.dll的未知内存地址 - 再次执行
n命令,GDB会提示Cannot find bounds of current function
待调试代码片段
int main() { GLFWwindow * window = initGLContext(); initImGui(window); int points[8] = { 0 }; GLuint VAO, VBO; glGenVertexArrays(1, &VAO); // 我在这里设置了断点 glGenBuffers(1, &VBO); GLShader curveShader("", "", ""); while (!glfwWindowShouldClose(window)) { glfwPollEvents(); useGUI(points); render(); glfwSwapBuffers(window); } ImGui_ImplGlfwGL3_Shutdown(); ImGui::DestroyContext(); glfwTerminate(); return 0; }
问题排查与临时解决方案
经过排查,确定问题根源是glGenVertexArrays()调用的atioglxx.dll没有提供对应的调试信息,导致GDB无法正确识别函数边界,进而出现调试异常。目前我暂时改用printf()输出关键变量的方式来替代GDB调试,满足基本的调试需求。
内容的提问来源于stack exchange,提问作者Rayman
相关产品推荐
相关产品推荐

