【问题标题】:How to configure json file in VScode to remote debugging?如何在VScode中配置json文件进行远程调试?
【发布时间】:2021-06-29 05:47:41
【问题描述】:

我想要一个远程选项来调试应用程序。为此,我从以下配置创建了“launch.json”文件:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "gdb",
            "request": "attach",
            "name": "Attach to gdbserver",
            "executable": "/home/jakub/repo/app/build/app",
            "target": "193.168.100.1:2345",
            "remote": true,
            "cwd": "/home/jakub/repo/app", 
            "gdbpath": "/home/jakub/repo/ext-toolchain/bin/arm-linux-gnueabihf-gdb",
            "autorun": [
                    "info break"
                ]
        }
    ]
}

首先我在 arm board 上启动 GDB Server:

# gdbserver :2345 app
Process app created; pid = 173
Listening on port 2345

然后调试器在 vscode 中触发,但没有任何反应,没有错误或反应。我只有暂停、重新启动和断开连接按钮。该程序绝对正确地构建为 Debug,因为我能够通过 GDB 控制台进行连接

【问题讨论】:

    标签: linux visual-studio-code gdb gdbserver


    【解决方案1】:

    它应该适用于这个启动配置:

    {
        "name": "Attach to gdbserver",
        "type": "cppdbg",
        "request": "launch",
        "program": "/home/jakub/repo/app/build/app",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceRoot}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "miDebuggerServerAddress": "193.168.100.1:2345",
        "miDebuggerPath": "/home/jakub/repo/ext-toolchain/bin/arm-linux-gnueabihf-gdb"
    }
    

    运行后: gdbserver localhost:2345 app

    连接所有设备可能需要几秒钟。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-13
      • 1970-01-01
      • 2017-07-27
      • 2016-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-28
      相关资源
      最近更新 更多