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: https://github.com/nargetdev/platformio-core

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

Thanks

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

[env:debug]
platform = ...
build_flags = -D DEBUG=1

[env:release]
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?