Debug with LLDB

integrated in VSCode - CodeLLDB

Debug Action

F5 - Continue / Pause
F10 - Step Over F11 - Step Into

see also

VSCode

Troubleshooting

Extension can conflict with other, and make debugging unavailable: disabling all extension & reloading selectively can solve the issue.

So far compatible extension are

Issue remains

LLDB launch config

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug",
            "program": "build/cg",
            "preLaunchTask": "cg-build",		// build task to invoke before launching debugger, see below for definition
            //"program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stdio": ["test_21.txt"],
            "cwd": "${workspaceFolder}",
            "stopOnEntry": false,

            "initCommands": [ // in debug script fonctionnality
                "command script import ${workspaceRoot}/debug/debugvis.py" // <<<<< This is the important bit
            ]
        }
    ]
}

Example of lldb plugin, invoking python script on conditional break, to have a custom visualisation of program state.

caption

How run build task automatically before debugging in Visual Studio Code?

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "cg-build",
        "command": "ninja",
        "args": [],
        "options": {
          "cwd": "${workspaceFolder}/"
        }
      }
    ]
}
Written on September 26, 2022, Last update on January 6, 2024
debug-c++ vscode gdb