在 Vis.Code 中设置调试配置以附加到 gdbserver 时出现问题

Problem setting up debug configuration to attach to a gdbserver in Vis.Code

我正在尝试设置 调试配置以附加到 运行 gdbserver

(参考文献:https://code.visualstudio.com/docs/cpp/launch-json-reference

[注。我可以将特定于 arch 的 gdb 实例附加到 gdbserver]

并进行调试

那是有逻辑检查死锁的模板

{
    "name": "(gdb) Attach to gdbserver in QEMU",
    "type": "cppdbg",
    "request": "attach",
    "MIMode": "gdb",
    "miDebuggerPath": "/path/to/gdb/../../bin/mips-mti-linux-gnu-gdb",
    "miDebuggerServerAddress": "localhost: 1234",
    "program": "${workspaceFolder}/__out--MIPS64r6_MTI/vmlinux",
    // "processId": "${command:none}",
    // "processId": "${command:pickProcess}",
    // "processId": "23739",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
},

no "processId" 给出时,它会抱怨: unable to parse process id

给出一些有效的"processId"时(然后一些进程也从列表中选择,如果UI),它抱怨说: 'processId' cannot be used with miDebuggerServerAddress

有谁知道如何解决 VC 调试配置解析逻辑中的这个死锁,或者这是一个错误?

谢谢。

好的。经过几次尝试,它成功了;)

使用 "request": "launch"尽管听起来有点不合逻辑,因为我们已经附加到 运行 进程,gdbserver i-face ) 没有 "processId" #577 bug discussion 中的建议,数据库会话最初因抱怨而中断: remote replied unexpectedly to 'vMustReplyEmpty': timeout,但经过多次尝试后终于成功了 ;)

注意。对于 "lanuch" 的情况,VC 还要求添加: "cwd": "${workspaceRoot}"

VC+CPP 插件支持需要更新说明 (https://code.visualstudio.com/docs/cpp/launch-json-reference)。 使用 "request": "launch" 实际执行 attach 操作听起来真的不合逻辑:)。