使用Visual Studio Code High Sierra进行C ++调试

时间:2018-06-30 03:25:03

标签: c++ debugging visual-studio-code macos-high-sierra

我正在尝试在Mac OS High Sierra上进行c ++调试。这是我的launch.json文件。我不太确定如何运行它。

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/Users/user/Desktop/VSCodeProjects/test",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb"
        }
    ]
}

当我确实点击调试按钮时,Visual Studio Code只会向我显示调试按钮,然后会显示以下错误消息。

Loaded '/usr/lib/system/libsystem_networkextension.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_notify.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_sandbox.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_secinit.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_kernel.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_platform.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_pthread.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_symptoms.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libsystem_trace.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libunwind.dylib'. Symbols loaded.
Loaded '/usr/lib/system/libxpc.dylib'. Symbols loaded.
Loaded '/usr/lib/closure/libclosured.dylib'. Symbols loaded.
Loaded '/usr/lib/libobjc.A.dylib'. Symbols loaded.
Loaded '/Users/jeffomidvaran/Desktop/VSCodeProjects/test'. Symbols loaded.
The program '/Users/user/Desktop/VSCodeProjects/test' has exited with code 0 (0x00000000).

1 个答案:

答案 0 :(得分:1)

大多数情况下,人们遇到此问题是因为他们没有在启用调试符号的情况下进行编译。对于clang,您可以指定-g标志,这将使程序可调试。如果没有调试符号,调试器将不知道执行行信息中的代码,因此它将无法设置断点。

您可以在我们的Extension's GitHub site上发布以获取更多帮助。