Stepover problem debuging ESP32 on PIO

Last time I used PIO to debug an ESP32 project I’m sure that the stepover button always moved on to the next line of code, but now it often jumps into some RTOS code and I can’t find any way back, in effect stepover seems to work like stepin, but then stepout does not return to main.cpp. Using PIO on Linux and ESP-Prog interface board.

Hm I think that’s OpenOCD’s job to be RTOS-aware and break correctly to the next line. Of course that’s what happens in reality on the CPU, the thread / task might get interrupted at any point and the scheduler might switch it out, so it’s not entirely wrong.

Can you post the content of the “Debug Console” / Output during the debug session? OpenOCD should say something.

Hello all,
I also experienced the same problem.
Here you can see what happens:
Stepover-Problem

If I want to process a method call via step-over, the debugger still jumps into the method.
Workaround: Using Step-Out you can go one step higher in the stack, and then you are back at the right place.
But it is irritating.

Thanks in advance
Arne

Here is my platformio.ini

[env]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
lib_deps =
	adafruit/Adafruit SSD1306
	adafruit/Adafruit GFX Library
	x385832/EasyLogger
monitor_speed = 115200
upload_speed = 921600
board_build.partitions = custom_part.csv
board_upload.maximum_size = 3145728

[env:myrelease]
build_type = release

[env:mydebug]
build_type = debug
debug_tool = esp-prog
upload_protocol = esp-prog
; debug_init_break = tbreak setup

Doesn’t anyone have an idea?
One inspiration might be enough … :nerd_face:

Theoretically you don’t need a special debug environment. The build_type will already be release by default, and will be set to debug when you hit debug.

  1. Delete the .pio folder of the project to make sure a clean build is made
  2. Add debug_build_flags = -O0 -g3 -ggdb3 (docs) to the (debug) environment to make sure compiler optimizations are fully disabled. The default is -Og for debug.