其他分享
首页 > 其他分享> > VS Code + clang + lldb

VS Code + clang + lldb

作者:互联网

 

 

https://github.com/microsoft/vscode-cpptools/issues/5415

 

1. Install the following packages via apt

sudo apt install clang-10 llvm-10-dev liblldb-10-dev

 

2. Create soft links for executable files so things can work as expected

sudo ln -s /usr/bin/clang-10 /usr/bin/clang
sudo ln -s /usr/bin/clang++-10 /usr/bin/clang++
sudo ln -s /usr/bin/lldb-10 /usr/bin/lldb
# This one is a bit strange but VSCode only looks for the name `lldb-server-10.0.0` but not `lldb-server-10`
sudo ln -s /usr/bin/lldb-server-10 /usr/bin/lldb-server-10.0.0

 

3. Build the lldb-mi executable from source

git clone https://github.com/lldb-tools/lldb-mi.git
cd lldb-mi
cmake .
cmake --build .
sudo cp src/lldb-mi /usr/bin/

 

These should be it. And here's my launch.json. Basically just the default one from clang++ preset and changed nothing if I remember it correctly.

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

 

 

标签:bin,10,Code,sudo,clang,lldb,VS,usr
来源: https://www.cnblogs.com/sinferwu/p/15353427.html