c++debuggingllvmvisual-studio-codedebuggervisualizer

LLVM C++ Debugging in Visual Studio Code


I am having a lot of trouble getting the Visual Studio Code debugger to work for my C++ project. I know it isn't a popular IDE for C++ but XCode and Emacs are both equally unsuitable for me. I couldn't even get them to run my code.

I was wondering if anyone could share their .vscode configs that allowed them to use the VCS debugging menu. I would really appreciate it.

P.S. I tried following the tutorial here, but largely it has been unhelpful.


Solution

  • If you use lldb as the debugger and programming in macOS platform, the answer is quite simple.

    C/C++ extension dose not work well in macOS, so I suggest you use LLDB Debugger.

    If you have installed python through homebrew, you need do little additional settings following this issue (also there is a PR will fix this but now is waiting to be merged). Maybe you also need run pip install six if there is a warning in lldb output.

    Here is a simple config what i use:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "lldb",
                "request": "launch",
                "name": "Debug",
                "program": "${workspaceRoot}/format",
                "args": [],
                "cwd": "${workspaceRoot}"
            }
        ]
    }
    

    Hope I can help you.