Skip to content

adapter vscode cppdbg doesn't work on Windows #512

@liuyangzys

Description

@liuyangzys

Debug adapter definition and debug configuration

The cppdbg config is as shown bellow

dap.adapters.cppdbg = {
	id = "cppdbg",
	type = "executable",
	command = "C:/Users/liuya/.vscode/extensions/ms-vscode.cpptools-1.9.7/debugAdapters/bin/OpenDebugAD7",
}
dap.configurations.c = {}
dap.configurations.cpp = {}

-- load from json file
require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp" }, python = { "python" } })

The "./vscode/launch.json" file is as shown bellow

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/a.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "setupCommands": [
                {
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

Debug adapter version

vscode-cpptools 1.9.7

Steps to Reproduce

  1. write a a.c and build it by "gcc -g -o a.exe"
  2. debug a.exe with "nvim-dap", "vscode", "vimspector"
  3. both "vscode" and "vimspector" can work correctly, but "nvim-dap" failed
    image

Expected Result

The debug can work correctly.

Actual Result

[ ERROR ] 2022-04-12T15:47:42Z+0800 ] ...m-data\site\pack\packer\opt\nvim-dap/lua/dap/session.lua:827 ] "stderr"       {  command = "C:/Users/liuya/.vscode/extensions/ms-vscode.cpptools-1.9.7/debugAdapters/bin/OpenDebugAD7",
  id = "cppdbg",
  type = "executable"
}       "waiting for v8 protocol on stdin/stdout\r\n"
[ INFO ] 2022-04-12T15:47:42Z+0800 ] ...m-data\site\pack\packer\opt\nvim-dap/lua/dap/session.lua:795 ]  "Closed all handles"
[ INFO ] 2022-04-12T15:47:42Z+0800 ] ...m-data\site\pack\packer\opt\nvim-dap/lua/dap/session.lua:798 ]  "Process closed40852    false
[ INFO ] 2022-04-12T15:47:43Z+0800 ] ...m-data\site\pack\packer\opt\nvim-dap/lua/dap/session.lua:1058 ] "Session closed due to disconnect"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions