Debug build (-g3) should be separate from Release

I noticed that when I use the unified debugger and the “standard” build back and forth then Pio is deleting the build in the .pioenvs and compiling all sources over again (with debug symbols . -g3 or without). The ‘proper’ behavior would be to have separate build dirs for compiler vs debugger optimization.

I would like to start working on this and contribute to the project.
I have a clone here:

If anybody has worked in this domain or has any advice would be much appreciated!!


You need to have 2 different build environments in platformio.ini:

platform = ...
build_flags = -D DEBUG=1

platform = ...
build_flags = -D RELEASE=1

Is it possible to share configurations between the two envs?

For example with ESP32 projects, sdkconfig.debug and skdconfig.release are two independent files.

Do you mean Common env section?