在vscode linux中使用cpp扩展名设置lldb调试

时间:2020-09-20 10:37:43

标签: c++ visual-studio-code vscode-debugger

我主要使用gdb在vscode中调试c ++单个文件,但现在想尝试lldb,但是在为vscode设置它时遇到了问题。

我首先创建默认的launch.json表单调试标签,依次选择cpp gdb/lldbclang++进行配置。

调试开始时..它显示以下错误:

When the debugging starts.. it shows following error:

然后在launch.json中,我将miDebuggerPath的路径形式从/usr/bin/lldb-mi更改为/usr/bin/lldb

然后,当我启动调试器时,它只是在终端的顶部和下面几行调试控件而已:

warning: ignoring unknown option: --interpreter=mi
warning: ignoring unknown option: --tty=/dev/pts/1

我在这里缺少什么?

我的整个launch.json是:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "clang++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: clang++ build active file",
            "miDebuggerPath": "/usr/bin/lldb"
        }
    ]
}

1 个答案:

答案 0 :(得分:1)

lldb-mi不属于LLDB项目。参见lists.llvm.org

您仍然可以从项目的github repo自己构建它。您将需要首先构建LLDB / Clang / LLVM,因为lldb-mi编译需要头文件和已编译的库才能使构建按照README中所述的信息进行工作。