18

有没有办法从未处理的异常中查看解释性字符串?我正在使用 Visual Studio 2012 Express,但似乎找不到查看它的方法。

当我运行以下代码时:

#include <stdexcept>

int main(int argc, char* argv[])
{
    throw std::runtime_error("warp core breach");
    return 0;
}

我在输出窗口中得到的只是:

First-chance exception at 0x7652C41F in vstest.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0015F6A4.
Unhandled exception at at 0x7652C41F in vstest.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0015F6A4.

我本来希望在那里打印“经线核心破坏”消息。我将 Debugging->Output Window->General Output Settings 下的所有选项都设置为 On。

4

1 回答 1

24

当抛出异常时,您将获得一个窗口,其中包含中断/继续/忽略选项。复制并粘贴此对话框报告的十六进制地址,然后单击break按钮。现在在监视窗口中,输入如下内容:(std::runtime_error*)(0x002cfbc8)到第一列的单元格中。

观察窗口

于 2012-11-21T17:43:45.777 回答