Ready to debug- How?

I’m adding this to the .ini file:
build_flags = -D SERIAL_DEBUG
monitor_filters = ESP32_exception_decoder

Now what?
PIO Debug Console says" please start a debug session to evaluate expressions?"

I can’t debug it, because it isn’t uploading. But then I want to try this debug thing.

You need to know how to debug with gdb first. This is a good book to start with as it explains how the program ypu are debugging is structured, something else that’s good to know. Plenty of examples. It’s quite old, 2008, but I have it and still use it when I have to.

If ypu are in the Untied States :wink:, then change the ‘’ part of the link to ‘.com’ – should work.

So far I’ve only had to debug code on an Uno board, so it might be wise to start with that? That way, I can assist better when you need it?

Bear in mind that Uno debugging is simulated whereas thungs like Bluepills have actual hardware debugging via the ST-Link device.

Start simple and work up, don’t try to run before you get out of the pram as my late mother never said.


When it isn’t working, I try it on the Uno.
I have a CatBot script that only moves one of two Servo motors.

Two of these CatBot scripts made the Nano go blinky after X cycles.

So I have something to work with.
I think I’m too laxy for it today.

Yes, I’m in Sunny Silicon Valley.
A lizard lives in my parsley.

Things don’t work that way. Debugging an ESP32 involves having a debug probe, e.g. in the form of an esp-prog with a chip that can speak JTAG while having a USB connection, connected to the ESP32 via its respective JTAG lines. See article at Low-cost ESP32 In-circuit Debugging | by Manuel Bl. | Medium as an example. I agree with @normandunbar here, a book on that might clear up these fundamental misconceptions and give you a strong background in that area.

The only known issue I have is on a Nano.

There are a bunch of randoms in a quick set of commands.

Goes haywire after a few cycles.
I figure that’s a good first debug.

I’ll read something.
Thank you.

For debugging AVRs, PlatformIO has documentation here. This debugging method is quite special as it uses something called a GDB stub that communicates over serial – hence you program is also not allowed to use Serial when debugging this way. Debugging via ISP / debugWire, which would be the equivalent of JTAG debugging for other chips, is not implemented in PlatformIO natively.

For debugging ESP32s, JTAG is the way to go, and PlatformIO has documentation, along with addtional tutorials on the net.

1 Like

must be 20 cha

In case you can’t order the book, or wait for its arrival, there’s an online tutorial covering just abpout everything you might need to knwo about GDB for debugging. It’s obvioulsy not Arduino/ESP32 based, but the commands are the same – looks useful.

You can also download the tutorial as a OPDF file for a nominal fee, $9.99 in your part of the world.