debugging 如何使用lldb调试VS代码?

wswtfjt7  于 2023-03-03  发布在  其他
关注(0)|答案(1)|浏览(187)

我尝试调试一个简单的C++程序,但是没有任何React,断点也不起作用。构建任务运行良好,我可以运行应用程序。
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'

但是我的程序没有任何输出,单步执行/进入/退出按钮变灰,断点不工作。

jutyujz0

jutyujz01#

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

相关问题