VS Code 启动 gdbserver
VS Code start gdbserver
我正在尝试为 VS Code 编写启动配置,它可以 gdbserver
作为 preLaunchTask 启动。
当我开始调试时,当 gdbserver 说“侦听端口 XXXX”时一切都停止了
我在网上找到了很多其他调试器方法的示例,但没有针对 gdbserver 的方法。
我试过将 isBackground
设置为 true
无济于事,同时尝试设置 problemMatcher
我也找不到任何似乎可以解释如何编写您自己的 problemMatcher
的文档。
那么,如何为我的调试器编写一个可以启动 gdbserver 作为 preLaunchTask 的一部分的任务?
这是我启动 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"
}
]
我遇到了和你一样的问题。我使用模式匹配器 运行 并在后台 运行 获得了它。
该任务仅在远程目标上启动 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*"
}
}
},
我正在尝试为 VS Code 编写启动配置,它可以 gdbserver
作为 preLaunchTask 启动。
当我开始调试时,当 gdbserver 说“侦听端口 XXXX”时一切都停止了
我在网上找到了很多其他调试器方法的示例,但没有针对 gdbserver 的方法。
我试过将 isBackground
设置为 true
无济于事,同时尝试设置 problemMatcher
我也找不到任何似乎可以解释如何编写您自己的 problemMatcher
的文档。
那么,如何为我的调试器编写一个可以启动 gdbserver 作为 preLaunchTask 的一部分的任务?
这是我启动 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"
}
]
我遇到了和你一样的问题。我使用模式匹配器 运行 并在后台 运行 获得了它。 该任务仅在远程目标上启动 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*"
}
}
},