【问题标题】:How to debug in VS Code using lldb?如何使用 lldb 在 VS Code 中进行调试?
【发布时间】:2022-01-11 16:24:08
【问题描述】:

我正在尝试调试一个简单的 C++ 程序,但没有任何反应,而且断点也不起作用。构建任务运行良好,我可以运行应用程序。

tasks.json

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++.exe build active file",
            "command": "F:\\Programs\\LLVM\\bin\\clang++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "clang++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "miDebuggerPath": "F:\\Programs\\LLVM\\bin\\lldb-vscode.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: clang++.exe build active file"
        }
    ]
}

当我按 F5 时,我在终端中有这个:

PS F:\Projects\Console Apps\testbuild>  & 'c:\Users\daniil\.vscode\extensions\ms-vscode.cpptools-1.7.1\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-4pf1un21.l04' '--stdout=Microsoft-MIEngine-Out-tpjfi4ip.jse' '--stderr=Microsoft-MIEngine-Error-2nkku53m.1iw' '--pid=Microsoft-MIEngine-Pid-xscepzdp.k00' '--dbgExe=F:\Programs\LLVM\bin\lldb-vscode.exe' '--interpreter=mi'

但是我的程序没有任何输出,单步执行/进入/退出按钮显示为灰色并且断点不起作用。

【问题讨论】:

    标签: c++ debugging visual-studio-code llvm lldb


    【解决方案1】:

    在launch.json 中我必须写“lldb”,而不是“cppdbg”。 现在可以了。

    【讨论】:

      猜你喜欢
      • 2019-05-30
      • 1970-01-01
      • 2019-06-26
      • 2019-05-21
      • 1970-01-01
      • 2022-06-12
      • 2021-07-12
      • 1970-01-01
      • 2017-08-09
      相关资源
      最近更新 更多