首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VS代码启动gdbserver

VS代码启动gdbserver
EN

Stack Overflow用户
提问于 2021-06-28 20:54:05
回答 1查看 1.4K关注 0票数 2

我正在尝试为VS代码编写一个启动配置,它可以将gdbserver作为一个preLaunchTask启动。

当我开始调试时,当gdbserver说“侦听XXXX端口”时,一切都停止了。

我在网上找到了许多用于其他调试器的方法示例,但没有针对gdbserver的特定示例。

我尝试将isBackground设置为true,但没有效果,同时尝试设置一个problemMatcher

我也找不到任何文档来解释如何编写您自己的problemMatcher

那么,如何编写可以作为调试器preLaunchTask的一部分启动gdbserver的任务呢?

下面是我启动gdbserver的任务

代码语言:javascript
复制
{
    "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'"
    ]     
}

这是我的发射配置

代码语言:javascript
复制
{
    "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"
}
]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-26 09:18:33

我和你有同样的问题。我让它使用模式匹配器运行,并在后台运行。该任务仅启动远程目标上的gdbserver。它不编译文件或将文件发送到远程目标。

代码语言:javascript
复制
{
        "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*"
            }
        }
    },
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68169916

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档