Search code examples
c++visual-studio-codevscode-debugger

setup lldb debugging with cpp extension in vscode linux


I mostly use gdb for debugging c++ single files in vscode but now want to try lldb but i am facing issues while setting it up for vscode.

I first create default launch.json form debug tab selecting cpp gdb/lldb then clang++ for configuration.

When the debugging starts.. it shows following error:

When the debugging starts.. it shows following error:

then in launch.json I changed miDebuggerPath path form /usr/bin/lldb-mi to /usr/bin/lldb.

Then when I launch the debugger it does NOTHING just debug controls up top and following lines in terminal:

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

anything I am missing here?

My whole launch.json is:

{
    // 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"
        }
    ]
}

Solution

  • lldb-mi is not part of the LLDB project. see lists.llvm.org

    you can still build it yourself from the project's github repo. you will need to build LLDB/Clang/LLVM first, since lldb-micompilation requires headers and compiled libraries for the build to work as per information stated in the README.