Try and set a breakpoint after the USB conenction has been established. (debug_init_break = break setup in the platformio.ini).
From developing stuff with USB-enabled microcontrollered I got the experience that you shouldn’t try and interrupt the USB setup phase, but after that, you can halt the microcontroller for quite some lengthy time before it loses its USB connection.
A different issue could be that certain code does not work when compiled with debug optimization. Add debug_build_flags = -Os -g -ggdb3 to the platformio.ini to do a Release+DebugInfo build and check if that survives the USB setup.