Understanding how PIO debugging treats interrupts in single-step under VSCode

I’m debugging using PIO with VSCode, an STM32L432 board and FreeRTOS. “Usually” it all actually works fine… except when it doesn’t :-). To help me understand what goes wrong, I’m trying to understand how PIO treats single-stepping in a FreeRTOS system that has periodic interrupts.

Getting this to work with single stepping in a debugger seems kind of miraculous. FreeRTOS sets up a periodic interrupt using the STM32 SysTick interrupt, to trigger its scheduler. Clearly the debugger cannot be “stopped” in single-step mode if we are bouncing back to the FreeRTOS scheduler every 1ms or so. So somehow this periodic interrupt is turned off when we hit a breakpoint. But FreeRTOS knows nothing about breakpoints; and PIO probably doesn’t even know that we’re using FreeRTOS at all. So how does the miracle work?

Does PIO actually turns off all interrupts when the code hits a breakpoint? If so, then what HW mechanism does it use?

I’m guessing that PIO does not also turn off clocks on breakpoints. So, e.g., DMA transfers are still running, and if they finish while the debugger is still paused then the interrupt will just be lost. Correct? And, e.g., any free-running counters will keep running while the code is “paused.”

If my code hits an infinite loop and I stop it with the “Pause” button, then how does PIO pause the chip? I.e., what HW mechanism does it use?

I hunted a bit to see if this was all documented somewhere, but didn’t succeed.
Thanks!
Joel