Skip to content

[ INFO ] Debug functionality: an update #87

Closed
@ubidefeo

Description

@ubidefeo

We have received a lot of confusing requests from users who had issues with the Debug feature of this new IDE,
From hard to decipher errors to unsupported hardware.

We are aware of the fact that such functionality can create confusion in both novice and advanced users, so the team and I decided to put together this update.

As we move towards a Beta release (it will be announced when we feel comfortable with giving it the monicker), we have been investigating the behaviour of the included debugger and plan to offer a much better working solution in the near future.
Please try not to ask "are we there yet" every week, just know that we're at work and we're not a big team.

A better debugger is coming, we look forward to releasing it into your hands, but we want it to be good :)

For the current debugger functionality you have to know the following:

  • not every board is supported, in fact only ARM Cortex based boards can work
  • our current lineup (MKR, Nano 33, Portenta H7) has support, somewhere it's flaky
  • support for debug (a debug recipe) must be provided by the platform developer, so please don't ask us to enable debug for boards which we have no control over
  • You CANNOT debug an Arduino UNO or a classic Nano
  • in the current version of the debugger Global variables are not working and setting booleans fails miseraby: the solution is on its way
  • you cannot step into library code, and also this is going to work when we release an update for the debug functionality
  • such update will not necessarily come at the next minor Alpha release

Last but not lease: we know that the debug button in the UI is active no matter which board you select, and we're working on this because we don't like it either 😬

Please feel free to ask more questions below, we're more than happy to update this issue and help you get more clarity.

Thank you for reading us
Arduino Tooling Team

Activity

pinned this issue on Oct 8, 2020
DeqingSun

DeqingSun commented on Oct 10, 2020

@DeqingSun

It seems arduino-pro-ide shares a lot of code with VScode.
And VScode actually can debug a uno after this merged PR microsoft/vscode-arduino#685
If there is info for making a debug recipe, I can help to get it added.

ubidefeo

ubidefeo commented on Oct 13, 2020

@ubidefeo
Author

hey @DeqingSun
I'll look into that one, introducing DebugWire support would be interested for a lot of reasons.

@kittaakos can you also take a look on the Theia side?

kittaakos

kittaakos commented on Oct 13, 2020

@kittaakos
Contributor

can you also take a look on the Theia side?

What exactly, @ubidefeo?

DeqingSun

DeqingSun commented on Oct 14, 2020

@DeqingSun

@ubidefeo I got the CLI work nicely with debugger package on

https://raw.githubusercontent.com/DeqingSun/unoDebugTestPackage/main/package_uno_debug_index.json

Screen Shot 2020-10-14 at 2 14 34 PM

The set up is the same to https://github.com/DeqingSun/Debugging-Arduino-Uno without the VScode part.

However the pro-ide gave me -break-insert: Unknown option ``-function'' . No matter I connect debugger or not.

Screen Shot 2020-10-14 at 2 17 09 PM

ubidefeo

ubidefeo commented on Oct 15, 2020

@ubidefeo
Author

@DeqingSun
nice progress on this 👍
as we are changing the Debug part of the new IDE we'll investigate this further.
Right now please consider the current debugger as broken, we're working to fix it nicely before next release

DeqingSun

DeqingSun commented on Oct 15, 2020

@DeqingSun

@ubidefeo Is there a timeline for the next release? If it can be released in 2 week I will try to use the pro IDE for my class, otherwise I'll keep using VScode for teaching this semester.

ubidefeo

ubidefeo commented on Oct 15, 2020

@ubidefeo
Author

@DeqingSun
we have a few rough edges to polish, so cannot guarantee it'll be done in 2 weeks.
Also as we continue working on the language server and code assist I think we'll try to squeeze both feature in a single release.
Our release cycle could be faster, but I'd rather make sure things are exciting for users 🚀

DeqingSun

DeqingSun commented on Dec 17, 2020

@DeqingSun

@ubidefeo I tried again with alpha 0.1.3 and it returns error "The debug session type "arduino" is not supported."

Is this something I can fix with editing launch.json or edit board.txt?

rsora

rsora commented on Dec 17, 2020

@rsora
Contributor

Hi @DeqingSun, thanks for reaching out again and helping us in making the new IDE better!

@ubidefeo I tried again with alpha 0.1.3 and it returns error "The debug session type "arduino" is not supported."

Can you please help me in understanding how to reproduce your problem providing:

  • the board that you are trying to debug
  • OS/Platform you are using
  • (if possible) the sketch that you are trying to debug
  • the HW debugger/tool that you are using

Thanks!

DeqingSun

DeqingSun commented on Dec 17, 2020

@DeqingSun

@rsora
I tried multiple board and they throw the same error. "The debug session type "arduino" is not supported."

I tried "Arduino Zero programming port", "Arduino Zero USB port", "Arduino M0 pro programming port", and the avr board I defined. They have the same error.
I'm using the launch.json from https://github.com/arduino/arduino-pro-ide/issues/219 and arduino samd version 1.8.6
Mac 10.14.6
I was trying to debug the Blink example.
And I don't think the HW debugger/tool was even scanned so no hardware is connected to computer.

Deqing

rsora

rsora commented on Dec 17, 2020

@rsora
Contributor

@DeqingSun Can you please upgrade the samd core and try again?
We should have the 1.8.10 available.

Thanks!

DeqingSun

DeqingSun commented on Dec 17, 2020

@DeqingSun

@rsora Thanks, seems the Arduino IDE can start openOCD at least. I'll take a look to see how to get it working for Uno.

DeqingSun

DeqingSun commented on Dec 17, 2020

@DeqingSun

@rsora
It seems pressing the "Start debugging" button on the top will overwrite the launch.json with a working content. Mine is

{
  "version": "0.2.0",
  "configurations": [
    {
      "cwd": "${workspaceRoot}",
      "name": "Arduino",
      "request": "launch",
      "type": "cortex-debug",
      "executable": "/var/folders/l6/28chlnbn66b1nflyprjgv26h0000gn/T/arduino-sketch-A95360DDCF796B5109E9A069DBF3E5C9/Blink_copy_20201217101132.ino.elf",
      "servertype": "openocd",
      "serverpath": "/Users/sundeqing/Library/Arduino15/packages/arduino/tools/openocd/0.10.0-arduino7/bin/openocd",
      "armToolchainPath": "/Users/sundeqing/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/",
      "configFiles": [
        "/Users/sundeqing/Library/Arduino15/packages/arduino/hardware/samd/1.8.10/variants/arduino_mzero/openocd_scripts/arduino_zero.cfg"
      ]
    }
  ]
}

But using the debug panel on the left will not create such a template. Just mentioning.

DeqingSun

DeqingSun commented on Dec 17, 2020

@DeqingSun

Hi @rsora, it seems I got some progress.
The new Pro IDE 0.1.3 changes the Debugger configuration in platform.txt.

So far I got 2 issues. First the IDE is always looking for arm-none-eabi-gdb for toolchain. Is it possible to override the file's name?

Also the server is called with argument "-c" "gdb_port 50000" "-s" "/Users/sundeqing/Documents/Arduino/testDebug" "-f" . Is it possible to customize the arguments?

I used this setting

# Debugger configuration (general options)
# ----------------------------------------
# EXPERIMENTAL feature:
#  - this is alpha and may be subject to change without notice
debug.executable={build.path}/{build.project_name}.elf
debug.toolchain=gcc
debug.toolchain.path={runtime.tools.DWDebugTools.path}/linux
debug.toolchain.path.windows={runtime.tools.DWDebugTools.path}/win
debug.toolchain.path.macosx={runtime.tools.DWDebugTools.path}/macosx

debug.server=openocd
debug.server.openocd.path={debug.toolchain.path}/dwdebug
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/
debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/{build.openocdscript}

Update, refering to the code on https://github.com/Marus/cortex-debug/blob/a5a07dbbfa6acf53b157a62f4215b36c1ff854ca/src/openocd.ts , the serverArguments are hard coded.

41 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @tigoe@ronnyek@DeqingSun@kittaakos@ubidefeo

      Issue actions

        [ INFO ] Debug functionality: an update · Issue #87 · arduino/arduino-ide