MSVS 2013以不一致的方式“迈入”步骤

时间:2015-04-03 22:49:27

标签: c++ debugging opengl breakpoints

我正在开发一个没有.NET或其他特定库的纯C ++ / OpenGL项目,只有纯C ++语法和纯OpenGL代码。我使用Windows 8.1和MSVS 2013社区进行更新4.
我设置了一个断点,并在调试时按预期暂停,然后我继续使用F10 / F11从一行到另一行,跳过不是我的代码。
它显示了即将执行的线的线标记,直到我处于某个函数中时才很好,因为我按F10它只是跳过了3行,没有任何理由,有条件或其他。在另一个F10之后,它返回到它应该首先进入的线并继续正确。

今天在添加了一些文件和一些代码后,MSVS 2013调试器根本不会在任何断点处中断。经过6个小时的修复,卸载和安装MSVS 2013 Express(BTW与项目不兼容(?!))和MSVS Community 2013后,调试器在断点处再次暂停,但仍然F11随机跳转。以下是代码的一部分:

void loop()
    {
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // BREAKPOINT!, press F10
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // marker here, I press again F10

    RenderActionObjects(); // the marker is now at this line
          // before this is executed, I press F11 and it gets me inside ifstream.h!
          // I input a char; from there I step out with shift+F11 which
          // places the marker back at the function call above!
          // I press F11 again and it gives an _expected_ unhandled exception related
          // to some OpenGL (in nvoglv64.dll) and places the marker...
    glfwSwapBuffers(window0); // ... at this line
    glfwPollEvents();
    }
loop()中反复调用

main()

static void RenderActionObjects() // looped
    {
    int test;
    test = userAcknowledge; // userAcknowledge is int defined globally
    cin >> userAcknowledge;

    glUseProgram(programsI[0]);
    glBindVertexArray(VAOaction);
    OutputDebugString("testing string"); // HERE is the added line! <<<<<<<<<<<<<<<<<
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, testTex);
    // set uniforms
    glUniform1i(testTex, 0); // 0 as in GL_TEXTURE0 (texture unit 0)

    glDrawArrays(GL_TRIANGLES, 0, 3);
    glBindVertexArray(0);
    }

如果可以,请帮我一把,告诉我该怎么做。

Whitesmiths有什么问题?如果您因此而烦恼,至少要将它们全部设为相同而不是部分C-style,部分Whitesmiths

修改 问题已减少为: 使用MSVS 2013调试器,如果你有多个嵌套函数,并且每个函数在调用堆栈内函数之前都使用赋值/ OpenGL函数启动,那么按F11标记会从第一个函数调用行直接跳转到最深函数,从而没有逐行显示执行路径。

那么如何沿着执行路径实现从一行到下一行的步骤?

0 个答案:

没有答案