You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:52:41