Understood Due to option toolchain option `-Og' is the optimization for debugging[1] how about rename debug-build to debug-optimize? Drop DEBUG_BUILD, use DEBUG_OPTIMIZE to instead, add debug-optimize.bbclass and debug-optimize.inc. Use variable DEBUG_OPTIMIZE to defer inherit debug-optimize.bbclass conditionally.(Similar did in v5) Make a config fragment core/yocto/debug-optimize to set DEBUG_OPTIMIZE ?= 1 to enable debug friendly optimize. For the recipe (such as qemu) which doesn't work with debug optimization, set DEBUG_OPTIMIZE = "0" to disable it for a given recipe even though config fragment core/yocto/debug-optimize is enabled Do not encourage user to enable debug friendly optimization by setting DEBUG_OPTIMIZE = '1' directly, because the variable override is not certainty, which is affected by the order of configuration parsing V7 incoming [1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Og //Hongxu