【问题标题】:vscode debug configuration for Azure Edge Module running in edge simulator?在边缘模拟器中运行的 Azure Edge 模块的 vscode 调试配置?
【发布时间】:2020-05-24 15:32:22
【问题描述】:

在我的开发盒 (Windows) 上,我有一个 Visual Studio Code IoT Edge 工作区,其中包含我正在开发的 C++ IoT Edge 模块。我的开发盒运行 Windows,带有 Docker Desktop。

我在本地 IoT Edge 模拟器 (edgeHubDev) 中调试此模块时遇到问题。

我可以毫无问题地构建、部署和调试物理边缘设备,因此包含我的模块的容器已正确设置以进行调试。我可以设置和获取要命中的断点。

但是,当我“在模拟器中构建并运行解决方案”时,我无法设置断点。开始调试确实允许我选择模块进程,所以 VSCode 实际上是在与模块容器对话。

这是我正在使用的调试配置(launch.json):

{
  "name": "edge simulator module",
  "type": "cppdbg",
  "request": "attach",
  "program": "module",
  "processId": "${command:pickRemoteProcess}",
  "pipeTransport": {
    "pipeCwd": "${workspaceFolder}",
    "pipeProgram": "docker",
    "pipeArgs": [
      "exec",
      "-i",
      "module",
      "sh",
      "-c"
    ],
    "debuggerPath": "/usr/bin/gdb"
  },
  "sourceFileMap": {
    "/app": "${workspaceFolder}/modules/module"
  },
  "linux": {
    "MIMode": "gdb",
    "setupCommands": [
      {
        "description": "Enable pretty-printing for gdb",
        "text": "-enable-pretty-printing",
        "ignoreFailures": true
      }
    ]
  },
  "osx": {
    "MIMode": "lldb"
  },
  "windows": {
    "MIMode": "gdb",
    "setupCommands": [
      {
        "description": "Enable pretty-printing for gdb",
        "text": "-enable-pretty-printing",
        "ignoreFailures": true
      }
    ]
  }
},

VSCode 确实看到模块正在运行,因为我得到了调试输出窗口,当我终止 edgeHubDev 时该窗口消失了。

在容器运行时,我可以对映像运行 docker 命令(ps -ef、ls),因此我知道模块进程正在运行。

有什么想法为什么断点在“真正的”边缘设备中工作正常时不会命中?

【问题讨论】:

标签: visual-studio-code azure-iot-edge


【解决方案1】:

首先确保您使用的是模块的调试版本,以便它安装将用于调试的材料。

如果还是不能调试,可以分享你的完整样例项目,让我们看看。

另外看看vscode cpptools repo,可能有一些调试C++项目的相关问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-10
    • 1970-01-01
    相关资源
    最近更新 更多