Beta 4 - Debugging with Arduino Zero - some questions

First of all - I'm sorry if I have missed already available info on this. Searched through the forum, googled and checked YouTube for some tutorials. All with negative outcome.

I got an Arduino (Genuino) Zero to see if I can use the debugger in IDE 2.0 beta without the hassle of setting up custom environment, dealing with configurations etc.

Got my board, connected it via Programming Port. Device was installed properly. Uploaded Blink example with an additional global variable and hit Start Debugging button. I added some breakpoints and at this point everything seemed to work well. The only difference that I see compared to brief video published some time ago is that Variables window contains a lot of additional stuff not present in the code. I guess this comes from external components being added by the IDE/compiler. Is there any chance to filter/limit what is being displayed there? I know there's the Watch window and with first run it does a well job showing what I'm interested in. But in almost all cases the functionality of this window breaks with second run of Debugger - the value is not being updated any more. A manual update is possible, but I need to click it and press enter in the variable edit window every time I want to read current value. Is this a bug or am I missing something?

Also, do I understand correctly that timer (millis()) in debug mode is stopped when a breakpoint is reached?

Another question - my IDE seems not to have any debugger configuration pre-set. I'm referring to the drop down menu at the top of the debug console. What I have is "No Configurations" and "Add Configuration". Some videos indicate that there should be an "Arduino" profile selected, but in my case it seems to work without it. Although occasionally it does appear there... :-/

I guess a lot will become clear once documentation is released. Any ETA?

baspacc:
Is there any chance to filter/limit what is being displayed there?

Not that I'm aware of. The Arduino IDE 2.x's integrated debugger is this VS Code extension:

So any information you find in the documentation of that project should apply to the Arduino IDE 2.x. Please let us know if you learn anything. I'm sure I'm not the only one interested in this subject.

baspacc:
But in almost all cases the functionality of this window breaks with second run of Debugger - the value is not being updated any more. A manual update is possible, but I need to click it and press enter in the variable edit window every time I want to read current value. Is this a bug or am I missing something?

I'm not super knowledgeable on this subject, but I also ran into the exact thing you describe during the beta testing phase and it surely seemed like a bug to me, so I filed a report with the developers.

baspacc:
Also, do I understand correctly that timer (millis()) in debug mode is stopped when a breakpoint is reached?

Correct. Execution halts completely.

baspacc:
Another question - my IDE seems not to have any debugger configuration pre-set. I'm referring to the drop down menu at the top of the debug console. What I have is "No Configurations" and "Add Configuration". Some videos indicate that there should be an "Arduino" profile selected, but in my case it seems to work without it. Although occasionally it does appear there... :-/

I think it's partially related to whether you open the debugger via the button on the top bar or the one on the side bar. In addition, it's related to the state of the sketch. You can learn about that here:

I have also not been happy with this user experience (see my review of that pull request for details). I think there are plans to investigate improving on this situation at some point, but for now we'll have to be resigned to the rough edges on the debugger.

baspacc:
I guess a lot will become clear once documentation is released. Any ETA?

All I know is what Ubi shared here:
https://forum.arduino.cc/index.php?topic=731809.msg4924623#msg4924623

Thanks for the reply!

Not that I'm aware of. The Arduino IDE 2.x's integrated debugger is this VS Code extension:
GitHub - Marus/cortex-debug: Visual Studio Code extension for enhancing debug capabilities for Cortex-M Microcontrollers
So any information you find in the documentation of that project should apply to the Arduino IDE 2.x. Please let us know if you learn anything. I'm sure I'm not the only one interested in this subject.

Yes, I noticed the similarities in UI. Maybe it's a good way forward, untill official documentation appears. One thing I hope to find there is how to approach debuging code that relays on timers - right now manual cycling trhough breakpoints unitl the timer reaches a threshold is... a bit time-consuming. :wink: I'm sure there's a smart way to deal with that. :slight_smile:

But in almost all cases the functionality of this window breaks with second run of Debugger - the value is not being updated any more. A manual update is possible, but I need to click it and press enter in the variable edit window every time I want to read current value. Is this a bug or am I missing something?

It's a bit annoying. I learnt that restaring the whole IDE helps, which is not a great solution. Hope this is fixed soon.

I think it's partially related to whether you open the debugger via the button on the top bar or the one on the side bar. In addition, it's related to the state of the sketch. You can learn about that here:
ATL-972: Moved the `./theia/launch.json` config into a temp folder. by kittaakos · Pull Request #168 · arduino/arduino-ide · GitHub
I have also not been happy with this user experience (see my review of that pull request for details). I think there are plans to investigate improving on this situation at some point, but for now we'll have to be resigned to the rough edges on the debugger.

That introduced a lot of confusion at the begining. I do understand that debugging is not a simple thing and typically requires a lot of things to be set up. On the other hand, Arduino is a platform that does a great job in hiding all of the underlying complexities. I was expecting similar experience here, but as ubidefeo stated:

This feature is still in its infancy and we're working out how to make it more accessible but it not being a simple tool in itself we'll need quite some time to polish the whole debug approach.

So it just needs time, I guess...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.