azureiotazure-iot-hubazure-sphere

Invisible and locked Breakpoint in Sphere SDK for vs code


I'm trying to get started with microsoft's azure sphere development.

When I try to debug any of the starter projects within vs code, it tells me that I have a breakpoint set on the first line of the app. However, vs code doesn't show any breakpoints in the "Breakpoints" tab.

I am running the latest VS code version (1.44) with the Azure Sphere Extension 20.1 on windows 10. The same problem appears on Linux.

To reproduce the bug:

  1. Download the starter projects from github
  2. Install the Azure sphere extension for visual studio code.
  3. open HelloWorld_HighLevelApp folder in azure-sphere-samples\Samples\HelloWorld\HelloWorld_HighLevelApp in visual studio code.
  4. Go to the Debug tab and hit the green play button on top left corner. Next to the button it should say Launch for Azure Sphere High-Level Applications (gdb)

For me it doesn't an error but the output console shows:

Deploying image...
Starting debugger....

Process /mnt/apps/1689d8b2-c835-2e27-27ad-e894d6d15fa9/bin/app created; pid = 2233
Listening on port 2345

Remote debugging from host 192.168.35.1, port 54911

Starting CMake Hello World application...

The Debug Console shows:

...
Breakpoint 1, main () at ../../main.c:45
45  {
Loaded 'target:/usr/lib/libapplibs.so.0'. Symbols loaded.
Loaded 'target:/lib/libgcc_s.so.1'. Symbols loaded.
Loaded 'target:/usr/lib/libc++runtime.so.1'. Symbols loaded.

Is there a work around / a plan to fix the issue?

Addition 1: To provide extra clarification here is a screenshot, showing the miss match of console output (breakpoint set) and ui (no breakpoint set) enter image description here


Solution

  • Solution:

    Finally I found the root cause of the issue. Visual studio code acts just slightly different when debugging the sphere device compared to just plain c code.

    When you start the debugging mode and you haven't set a breakpoint initially, it won't start running your program till you have set a breakpoint. In plain c debugging the program just runs through and printed values are shown in the debug console.