All STM32 feature a set of power-saving modes. In these, clocks to various portions of the mcu are stopped, and in the lower-consumption modes, internal power regulators are switched off.
Switching off clock to the processor core would disable debugging, as the debugger modules are part of the processor core. Therefore, STM32 offer an option to keep part of the processor core running during debugging, by setting one of the related bits in DBGMCU_CR register (DBG_SLEEP, DBG_STOP, DBG_STANDBY). These are documented in the DBG chapter of RM to given STM32. Depending on particular low-power mode employed, clock to processor core may be supplied from the normal system clock, or an internal RC oscillator may be switched on for this purpose.
Using any of these options of course partially defeats the working of the low-power modes, and STM32 with these bits set have higher power consumption in the low-power modes than expected. In the lowerst-power modes, the difference is significant, milliamperes instead of microamperes may be drawn.
Sometimes users are not aware of this feature, as the sleep-related bits in DBGMCU_CR may be manipulated directly by the debugger. Usually, there are switches in the debugging environment to disable this behaviour, but they may not be displayed conspiciously.