我正在尝试为VS代码编写一个启动配置,它可以将gdbserver作为一个preLaunchTask启动。
当我开始调试时,当gdbserver说“侦听XXXX端口”时,一切都停止了。
我在网上找到了许多用于其他调试器的方法示例,但没有针对gdbserver的特定示例。
我尝试将isBackground设置为true,但没有效果,同时尝试设置一个problemMatcher
我也找不到任何文档来解释如何编写您自己的problemMatcher。
那么,如何编写可以作为调试器preLaunchTask的一部分启动gdbserver的任务呢?
下面是我启动gdbserver的任务
{
"label": "run",
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
},
"options": {
"cwd": "${workspaceRoot}/build"
},
"command": "ssh",
"args": [
"root@remote",
"'gdbserver localhost:9091 program'"
]
}这是我的发射配置
{
"name": "Remote Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/program",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "run",
"miDebuggerServerAddress": "remote:9091",
"miDebuggerPath": "aarch64-sbs-linux-gdb"
}
]发布于 2021-10-26 09:18:33
我和你有同样的问题。我让它使用模式匹配器运行,并在后台运行。该任务仅启动远程目标上的gdbserver。它不编译文件或将文件发送到远程目标。
{
"type": "shell",
"label": "Start gdbserver",
"command": "ssh",
"args": [
"root@remote",
"gdbserver localhost:3000 ${fileBasenameNoExtension}"
],
// "dependsOn": [
// "optional build task"
// ],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"group": "build",
"detail": "Starts the gdbserver and waits for success",
"isBackground": true,
"problemMatcher": {
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "^.*Process*",
"endsPattern": "^.*Listening*"
}
}
},https://stackoverflow.com/questions/68169916
复制相似问题