Please can we have a debugger!!!

When will Arduino get a proper debugger. I haven't needed to resort to littering code with print statements in order to debug it since I was writing compiled BASIC on an HP200 desktop back in the mid 80's. Productivity would go up 10 fold and my blood pressure down by 20 points!!!

Seriously, Arduino is now being used for serious applications and some effective debugging tools are really needed. Surely it must be possible to port gdb if nothing else.

When you outgrow the regular IDE meant for new people then maybe it is time to move up to another application that has more bells and whistles ?

Just saying.

Arduino does already have a proper debugger. It's in the Arduino Pro IDE:

and Arduino CLI:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_debug/

As far as I know, the only boards platform that have taken advantage of this capability are Arduino SAMD Boards (Zero, MKR, Nano 33 IoT) and the new Arduino Mbed OS Boards (nRF52840 / STM32H747) platform for the Portenta, but there's no reason the authors of other platforms can't do this as well.

You should note that Arduino Pro IDE is still in alpha development phase. It's a great time to try it out and assist the development process by reporting bugs and making feature requests, but it's probably not quite ready for use as your everyday IDE. Even though Arduino CLI is still in beta, I find it to be very stable and usable. If you're using the Arduino IDE or Arduino Web Editor, you're already using Arduino CLI, since this tool now provides most of the functionality of the Arduino software other than the GUI aspects.

The Arduino AVR hardware (the auto-reset capacitor) prevents the operation of the normal AVR protocols. Also, the AVR debug protocol is proprietary.

So I wouldn't hold your breath.

Uno WiFi 2 and Arduino Zero are more likely candidates.

Debugging the Zero is already working fine with Arduino CLI and Arduino Pro IDE. That board is especially convenient for debugging, since there is a debugger built right into the board. Connect the Zero to the computer via the Programming Port USB socket and a couple clicks in the Pro IDE or an arduino-cli command has you up and debugging.

Right. The Uno WiFi 2 also has a debug chip already on the board.

I was really hoping that someone at Arduino would figure out some sort of debugging support that is simpler than usual "pro-style" debugging. Unfortunately, I've been using pro debuggers for so long that I can't imagine what that might look like :frowning:

Lots of really good feedback and Pro IDE will probably be the way once it's ready but looking at the comments in order;

Ballscrewbob: I don't quite understand why the ability to stop execution and interrogate variables is beyond a beginner. I would have given my right arm for that capability when I started out. Moreover, the inability to work out why that 'perfectly good code' isn't working could easily deter the novice. And with regards to "Moving up", I'm open to suggestions bearing in mind I am no longer doing this professionally so don't have 1000's to spend on real tools such as VxWorks or Integrity.

Pert: As I've said, Pro IDE looks like the way to go when it's ready but for the time being I want to concentrate on developing applications not spending most of my time faffing around with the development tools. I've tried Eclipse several times for different platforms and never managed to get to a point where I was spending more time developing than I was trying to make Eclipse behave itself. Again, that's what puts newcomers off; it put me off and I've been writing real time software for 35 years.

westfw: WiFi 2 is my current target. This is soooo frustrating.

I don't quite understand why the ability to stop execution and interrogate variables is beyond a beginner.

Well, for instance, people well beyond "beginner" stage are often confused by variables that only end up existing very briefly (in registers) due to optimization. And that's well before the more advanced optimizations that the Arduino compiler (gcc) does that eliminate and/or generate multiple "constprop" versions of functions...

There's a simple solution to that; turn off optimisation for debugging either for the whole application or, as is done with many modern tool sets, for selected parts. And if all else fails, the beginner can still stick with print() but it leaves the rest of us with a usable development utility.

Arduino provides for this. Compiler flags are defined to be used specifically when compiling the sketch for debugging:

These are used with the Arduino Pro IDE's Sketch > Optimize for debugging option or Arduino CLI's --optimize-for-debug option.