pathrider
pathrider

Reputation: 1005

vscode debug configuration for Azure Edge Module running in edge simulator?

On my dev box (Windows), I have a Visual Studio Code IoT Edge workspace that contains a C++ IoT Edge Module I am developing. My dev box is running Windows, with Docker Desktop.

I'm having problems debugging this module in the local IoT Edge Simulator (edgeHubDev).

I can build, deploy, and debug against a physical Edge Device with no problems, so my the container containing my module is properly set up for debugging. I can set and get breakpoints to hit.

But, when I 'Build and Run the Solution in Simulator', I can't get breakpoints to hit. Starting debugging does allow me to select the module process, so VSCode is actually talking to the module container, it appears.

This is the debug config that I am using (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 does see that the module is running, because I get the Debug Output window, which goes away when I terminate edgeHubDev.

While the container is running I am able to run docker commands (ps -ef, ls) against the image, so I know the module process is running.

Any ideas why breakpoints will not hit, when they work fine in a 'real' Edge Device?

Upvotes: 0

Views: 314

Answers (1)

SLdragon
SLdragon

Reputation: 1627

First make sure you're using the debug version of the module, so that it will install material which will be used for debugging.

If you still cannot debug, you can share your full sample project, so that we can take a look.

Also take a look about vscode cpptools repo, maybe there are some related issue for debugging C++ project.

Upvotes: 1

Related Questions